Detecting contrib version with preprocessor

asked 2017-10-27 02:02:24 -0600

justadudewhohacks gravatar image

Hello everyone,

I am working on a project, which ports OpenCV and several contrib modules to node.js. Therefore I need to detect the OpenCV contrib version at compile time, but I have noticed, that there is no such macro as CV_MINOR_VERSION for contrib.

This is crucial for my package to ensure compatibility across different OpenCV versions. For example contrib 3.0 apparently does not implement MultiTracker, which caused users installing my package with contrib to run into compilation errors for the tracker module bindings.

edit retag flag offensive close merge delete

Comments

isn't it the other way round ? wouldn't you rather proactively request / checkout a certain release or branch ?

berak gravatar imageberak ( 2017-10-27 02:25:44 -0600 )edit

People that install the npm package have any minor version of OpenCV 3 and eventually any contrib version installed. Depending on which version they have set up I have to exclude some nodejs bindings from the compilation e.g. if a class is not implemented in that version. For OpenCV this works fine via CV_MINOR_VERSION, but not for contrib.

justadudewhohacks gravatar imagejustadudewhohacks ( 2017-10-27 02:42:32 -0600 )edit

note, that you would need exactly the same opencv_contrib version, as your main opencv has, else you run into subtle build problems. this is not an "option" (e.g. based on features) for your users to choose.

you will also need the src code for both repos, not some "preinstalled" nodejs bindings. (but maybe i misunderstand you here)

berak gravatar imageberak ( 2017-10-27 02:59:42 -0600 )edit

just curious, are you auto-generating the bindings ?

berak gravatar imageberak ( 2017-10-27 03:03:23 -0600 )edit
1

I am writing the bindings with the native nodejs API in C++. The bindings can then be installed via npm, which compiles and bundles them with node-gyp. If you are interested you can have a look at: opencv4nodejs.

But the info that main opencv and contrib version have to match is helping. Under that assumption checking the CV_MINOR_VERSION would be sufficient to exclude certain contrib bindings. I thought there would be scenarios, where people would use a contrib version that differs from main version for some reason (for example opencv3.3 with contrib3.2).

Thanks for your help.

justadudewhohacks gravatar imagejustadudewhohacks ( 2017-10-27 03:12:05 -0600 )edit

quite impressive, best of luck with it !

(from an node / npm / js hater...)

berak gravatar imageberak ( 2017-10-27 03:25:56 -0600 )edit

Thanks! :D

justadudewhohacks gravatar imagejustadudewhohacks ( 2017-10-27 03:34:39 -0600 )edit