node-opencv
node-opencv copied to clipboard
"Error: VideoCapture::New - failed to open capture" on raspberry pi
I've added the opencv4nodejs library to my raspberry pi package, I'm trying to access the picam 2 video camera. The script I'm running is as following:
import * as cv from 'opencv4nodejs'
async function main() {
const wCap = new cv.VideoCapture(0);
const intvl = setInterval(() => {
let frame = wCap.read();
// loop back to start on end of stream reached
if (frame.empty) {
wCap.reset();
frame = wCap.read();
}
console.log(frame);
}, 0);
}
main()
FWIW, I'm running this inside docker on a raspberry pi 3b+, using resin.io to deploy the images.
Did you find any solution to this @JeremyKirkham ? I'm having the same issue on a Raspberry Pi 3 B. I think it has to do with missing dependencies, ffmpeg or v4l2... though not sure
sudo modprobe bcm2835-v4l2 Worked to me