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

TypeError: cv.VideoWriter is not a constructor

Open MathieuRS1 opened this issue 8 years ago • 3 comments
trafficstars

Hi,

I have this error,

TypeError: cv.VideoWriter is not a constructor

on trying the following example node-opencv/examples/write-video.js

And I don't understand why :(

Thank you, Mathieu

MathieuRS1 avatar Oct 17 '17 20:10 MathieuRS1

Ok you need to install the available-modules branch to use these functions.

npm install [...].git#available-modules

MathieuRS1 avatar Oct 18 '17 19:10 MathieuRS1

Can you elaborate what steps you took to resolve the issue? Thank you!!

acwang8880 avatar Nov 11 '17 10:11 acwang8880

available modules is now in the master branch; but you will need to install from github; npm is vanilla 6.0.0 which may not have the support.

npm install peterbraden/node-opencv

be aware that VideoWriter depends upon 'HAVE_OPENCV_VIDEOIO' - so this must have been set in the build of OpenCV itself, else it will be excluded when node-opencv builds.

using a relative std OpenCV 3.3.0 built with opencv-contrib, I successfully use:

    writer = new cv.VideoWriter(filename, 'MP42' /*'DIVX'*/, FPS, msg.camera.size(), true);    

which seems to produce mpeg4 in AVI relatively efficiently on an RPi3.

In terms of building opencv, I roughly documented what i did here node-opencv-with-node-red, in case it's any use

btsimonh avatar Nov 11 '17 10:11 btsimonh