Comments (4)
you are getting an array of rectangles with some properties that allow you to decide if face is good enough to further processing.
you can also look at the demo here:
https://github.com/inspirit/jsfeat/blob/gh-pages/sample_haar_face.html
from jsfeat.
@inspirit Hi, thank you for the support, i am actually in trouble cause the code seems ok but rects.length is always 0 i debugged but it seems i am missing something, any clue please?
var canvas = $window.document.getElementById('canvas')
, canvasWidth = canvas.width
, canvasHeight = canvas.height
, ctx = canvas.getContext('2d')
, work_canvas = $window.document.createElement('canvas')
, work_ctx = work_canvas.getContext('2d')
, ii_sum = new Int32Array((canvasWidth+1)*(canvasHeight+1))
, ii_sqsum = new Int32Array((canvasWidth+1)*(canvasHeight+1))
, ii_tilted = new Int32Array((canvasWidth+1)*(canvasHeight+1))
, img_u8 = new jsfeat.matrix_t(canvasWidth, canvasHeight, jsfeat.U8_t | jsfeat.C1_t)
, classifier = jsfeat.haar.frontalface
, imageData
, rects;
work_canvas.width = canvasWidth;
work_canvas.height = canvasHeight;
jsfeat.haar.edges_density = 0.13;
work_ctx.drawImage(canvas, 0, 0);
imageData = work_ctx.getImageData(0, 0, work_canvas.width, work_canvas.height);
var anim = function () {
jsfeat.imgproc.grayscale(imageData.data, work_canvas.width, work_canvas.height, img_u8);
jsfeat.imgproc.equalize_histogram(img_u8, img_u8);
jsfeat.imgproc.compute_integral_image(img_u8, ii_sum, ii_sqsum, classifier.tilted ? ii_tilted : null);
rects = jsfeat.haar.detect_multi_scale(ii_sum,
ii_sqsum,
ii_tilted,
null,
img_u8.cols,
img_u8.rows,
classifier,
1.15,
2);
rects = jsfeat.haar.group_rectangles(rects, 1);
if (rects && rects.length === 0) {
$window.requestAnimationFrame(anim);
} else {
console.log(rects);
}
}
anim();
from jsfeat.
Sorry, it's my mistake, it works, i was using a wrong version of jsfeat i guess, sorry again :)
from jsfeat.
Congratulations!
from jsfeat.
Related Issues (20)
- Add requirements & limitations to the documentation
- Execution time static image processing vs webcam example
- An error in the docs HOT 1
- Simpler examples HOT 3
- Dose it support React Native HOT 1
- Can i use jsfeat with react-native? HOT 1
- Uncaught ReferenceError: module is not defined HOT 4
- Support for iOS 11 HOT 3
- Adding more functionalities
- Help needed!!, ORB matching - How train pattern using image from image folder instead of webcam. HOT 3
- background removal from face portrait
- Tracking a soccer ball in video HOT 1
- Demos stopped working HOT 3
- Hi Mate! There is a 404 Problem with Ur online demo. HOT 1
- demo's don't work "WebRTC not available" HOT 2
- How to transform canvas getImageData() to single channel matrix?
- Natural feature tracking/matching (NFT) in videostream
- Any details of yape06, such as paper or blog
- Pull request guidelines HOT 2
- Canny edges coordinates
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsfeat.