Compile .cpp calling opencv functions with Matlab on Mac OS X

2 views (last 30 days)
I am trying to compile an .cpp file on Matlab using mex. There are opencv functions in the c++ code, and I am using a 64-bit Mac.
I typed the following to compile:
mex(['-I' '/usr/local/include'],['-L' '/usr/local/lib'],'trackFeaturePoints.cpp')
I think this is the way to include the libraries and include files of opencv, but it might be wrong.
I got the following error:
Undefined symbols for architecture x86_64:
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::VideoCapture::get(int)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::VideoCapture::release()", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::VideoCapture::VideoCapture(std::string const&)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::VideoCapture::~VideoCapture()", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::VideoCapture::operator>>(cv::Mat&)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::calcOpticalFlowPyrLK(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::Size_<int>, int, cv::TermCriteria, int, double)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::Mat::deallocate()", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)", referenced from:
_mexFunction in trackFeaturePoints.o
"cv::fastFree(void*)", referenced from:
_mexFunction in trackFeaturePoints.o
"vtable for cv::_InputArray", referenced from:
_mexFunction in trackFeaturePoints.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"vtable for cv::_OutputArray", referenced from:
_mexFunction in trackFeaturePoints.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mex: link of ' "trackFeaturePoints.mexmaci64"' failed.
Unable to complete successfully.
Can someone help? Thank you so much!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!