estherjk/face-detection-node-opencv

Cannot access camera

misotrnka opened this issue · 2 comments

Cannot access camera on Mac Pro running Mac OS Sierra. Here's the error output. Any clues?

node server.js
OpenCV: AVFoundation didn't find any attached Video Input Devices!
OpenCV: camera failed to properly initialize!
/private/var/www/face-detection-node-opencv/server/lib/routes/socket.js:14
var camera = new cv.VideoCapture(0);
             ^

Error: Camera could not be opened
    at Error (native)
    at Object.<anonymous> (/private/var/www/face-detection-node-opencv/server/lib/routes/socket.js:14:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/private/var/www/face-detection-node-opencv/server/server.js:26:21)
    at Module._compile (module.js:409:26)

Hmm, I just tried it on my MBP running Sierra, and it seems to be fine.... Which version of Node.js and OpenCV are you using? Also, did you notice any installation errors (warnings are fine) when running npm install? If the latter, can you remove the node_modules folder and run npm cache clean before trying npm install again?

It turned out to be some problem with my iSight camera. Some process was blocking it. I fixed it by running sudo killall VDCAssistant.