node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

"Error: VideoCapture::New - failed to open capture" on raspberry pi

Open JeremyKirkham opened this issue 7 years ago • 2 comments

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.

JeremyKirkham avatar Jun 07 '18 00:06 JeremyKirkham

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

riccardolardi avatar Aug 31 '18 07:08 riccardolardi

sudo modprobe bcm2835-v4l2 Worked to me

alcalawil avatar Jan 10 '19 17:01 alcalawil