-2

can you give me a basic c++ code that inclue opencv libraries , and can call the matlab engine ? the file should compile using matlab mex.

(my problem is when I use the engine and compile it with "mex -f optionfile file.cpp"I get error message "cannot include opencv\cv.h" , but using the opencv without the engine its work using the mex file.xpp)

1 Answers1

0

You need Matlab engine if you want to run .m files outside of Matlab command window (e.g. bash, c++ source file, etc.)

In your case, mex program (Matlab External Interface which acts like g++ or other c++ compilers) is required to compile a c++ source file. You must provide mex program a source file which is written according to what Matlab has introduced in its documentation.

If your source code (.cpp file) is including opencv/cv.h file and using one of its methods, you need to link the appropriate library (say libopencv.so, libopencv.dll or etc,) using -l flag. (I use mex foo.cpp -l opencv_core)

I hope it helps, you can provide your source

Mohammad
  • 464
  • 1
  • 3
  • 17