hybridgroup/cylon-opencv

Face detection example fails on Mac OSX with built-in iSight

pasine opened this issue · 9 comments

The face detection example fails on Mac OSX, since the camera parameter must be set 0 instead of 1 like in the other examples.
I don't know if it is just me or it is a common issue, but I'm writing this here to support people that could face the same problem.

@zankich can you look at this please?

@pasine Did you ever figure this out?

@stewart, @zankich, @rafmagana, @solojavier could any of you guys with macs try this out?

I just tested and it's true that face example is not working, if I run as it is I get this error:

Warning, camera failed to properly initialize!
Cleaned up camera.

Error: Camera could not be opened
    at Adaptor.initCamera (/Users/solojavier/node_modules/cylon-opencv/lib/adaptor.js:35:24)
    at Connection.base.(anonymous function) [as initCamera] (/Users/solojavier/github/hybridgroup/cylon/lib/utils.js:124:31)
    at Camera.start (/Users/solojavier/node_modules/cylon-opencv/lib/camera.js:30:19)
    at Device.start (/Users/solojavier/github/hybridgroup/cylon/lib/device.js:68:22)
    at /Users/solojavier/github/hybridgroup/cylon/node_modules/async/lib/async.js:568:25
    at /Users/solojavier/github/hybridgroup/cylon/node_modules/async/lib/async.js:118:13
    at Array.forEach (native)
    at _each (/Users/solojavier/github/hybridgroup/cylon/node_modules/async/lib/async.js:39:24)
    at Object.async.each (/Users/solojavier/github/hybridgroup/cylon/node_modules/async/lib/async.js:117:9)
    at _parallel (/Users/solojavier/github/hybridgroup/cylon/node_modules/async/lib/async.js:567:20)

If I change to use camera = 0, then I get this:

The camera is ready!
/Users/solojavier/node_modules/cylon-opencv/node_modules/opencv/lib/opencv.js:674: Uncaught TypeError: Error loading file

I was missing a file.... Changing camera: 0, makes the example work... Fixed here: 95fe379

What file?

haarcascade_frontalface_alt.xml

But it is included in the example and referenced in the docs right? that it should be included...

if macOS set like this "cap = cv2.VideoCapture(0)"