Compile MATLAB bindings for OpenCV
I am trying to compile the MATLAB bindings for OpenCV 3.0, i.e. the current build from Github. I keep getting the following errors:
CMake Error at /opencv/modules/matlab/compile.cmake:47 (message):
Failed to compile createCalibrateDebevec:
/opencv/build/modules/matlab/src/createCalibrateDebevec.cpp:
In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
/opencv/build/modules/matlab/src/createCalibrateDebevec.cpp:46:3:
error: ‘Ptr_CalibrateDebevec’ was not declared in this scope
This occurs for multiple files. I found this thread, Issue 3445, which discusses a couple of remedies, viz. adding some typedef
s to the bridge.hpp
file, but that results in even more errors while compiling.
I also found this thread which suggested removing the problematic .cpp
files and compiling. This resulted in error-free compilation followed by the usual make install
. However, calling any OpenCV function from inside MATLAB now results in errors such as:
If = cv.dft(I, 'flags', cv.DFT_COMPLEX_OUTPUT);
Error using dft
cv::exception caught:
/home/xxx/opencv-master/modules/core/src/dxt.cpp:1760: error: (-215)
type == CV_32FC1 || type == CV_32FC2 || type == CV_64FC1 || type == CV_64FC2
in function dft
Another error example:
im_denoise = cv.fastNlMeansDenoising(im_noise, 18);
Error using fastNlMeansDenoising
cv::exception caught:
/home/xxx/opencv-master/modules/photo/src/fast_nlmeans_denoising_invoker.hpp:146:
error: (-215) almost_dist2weight_[0] == fixed_point_mult_ in function
FastNlMeansDenoisingInvoker
Any help on how to resolve these issues is much appreciated!
about the 1st error: please check, if your I variable is float type (i.e, if you loaded an image with imread, you'd have to convert it to CV_32F or similar before applying dft )
this seems to be a quite 'normal' or legit opencv error, you'd face the same situation in c++ or python.
How exactly would I convert a MATLAB image to CV_32F?
oh dear, if i only knew ;(
it's
src.convertTo(dst,typeflag)
in c++, so the matlab syntax might look like:dst = cv.convertTo(src, cv.CV_32F)
(again, can't test, so pure speculation )
It seems that data type is not the problem. All the generated .m files corresponding to the Matlab bindings are just comments. There is no actual code in them. Apparently the compilation did not go properly, and the problem remains. :(
hmm, ok. can't help then, sorry.
hallo! I have the very same problem here. Did you find any solution in the end?