Opencv4nodejs: Missing CV_FOURCC() function

Created on 13 Dec 2017  路  5Comments  路  Source: justadudewhohacks/opencv4nodejs

I'm trying to set the CV_CAP_PROP_FOURCC property on my VideoCapture object. However, I cannot find the CV_FOURCC() function usually used to convert from 4 chars to an int.

I tried the following:

this.opencv.vCap.set(cv.CV_CAP_PROP_FOURCC, cv.VideoWriter.fourcc("mjpg"));

But it gives me the following error:

VideoCapture::Set - expected arg 0 to be of type: INT

Ideas?

Most helpful comment

Yeah, CV_CAP_PROP_FOURCC is from the old C API, which I didn't export, thus it's undefined. In the C++ API it is simply CAP_PROP_FOURCC, so cv.CAP_PROP_FOURCC that should work.

You can have a look at the file, where I export all the CAP_PROPs: videoCaptureProps.cc .

All 5 comments

Yeah, CV_CAP_PROP_FOURCC is from the old C API, which I didn't export, thus it's undefined. In the C++ API it is simply CAP_PROP_FOURCC, so cv.CAP_PROP_FOURCC that should work.

You can have a look at the file, where I export all the CAP_PROPs: videoCaptureProps.cc .

Oh, right! I thought the problem was with this part: cv.VideoWriter.fourcc("mjpg"). In any case, when I'm looking for a function/property what should I use as a reference? The latest C++ API?

Thanks again for your help.

For future reference (it may help someone down the road), the character code should be in caps. This is the full line to get it working:

vCap.set(cv.CAP_PROP_FOURCC, cv.VideoWriter.fourcc("MJPG"));

P.S. MJPG provides much better throughput (resolution/frame rate) than the other ones. You have to consider that USB2's bandwidth is rather limited.

Oh, right! I thought the problem was with this part: cv.VideoWriter.fourcc("mjpg"). In any case, when I'm looking for a function/property what should I use as a reference? The latest C++ API?

Currently the entire API and usage is documented here: https://justadudewhohacks.github.io/opencv4nodejs/docs/

I agree it's a little inconvenient, but a webpage for this project will follow soon with hopefully a better overview of the documentation.

Ok, awesome. I'm really beginning to like OpenCV, thanks to your nice library!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlbernard2 picture karlbernard2  路  4Comments

YaronHershkovitz picture YaronHershkovitz  路  6Comments

ryandons picture ryandons  路  4Comments

developer239 picture developer239  路  5Comments

seanquijote picture seanquijote  路  6Comments