Error undefined variable "cv" - Matlab

asked 2016-09-29 07:46:06 -0500

DNL gravatar image

System information (version)

OpenCV => 2.4.13 Operating System / Platform => Windows 10 64-Bit Compiler => Visual Studio 2012 Detailed description

I am trying to run a Matlab code using some OpenCV commands but I keep getting this error. What should I do? I already tried to install the OpenCV as in its guide following the 5 steps for Pre-built Libraries as follows but didn't work, I am probably missing or misunderstanding something. I would appreciate your help. Thank you guys in advance

http://docs.opencv.org/2.4/doc/tutori...

image description

image description

image description

Follows the Matlab error:

Undefined variable "cv" or class "cv.cvtColor".

Error in face_d_t_new (line 35) gr = cv.cvtColor(videoFrame, 'RGB2GRAY');

Error in HR (line 21) [pos, distance] = face_d_t_new(vid_name, fr, s);

edit retag flag offensive close merge delete

Comments

1

is that a prebuild opencv package ? (i doubt, that it contains the matlab wrapper)

afaik, you'd need opencv3.1 (not 2.4), and have to rebuild from src with https://github.com/Itseez/opencv_contrib (which contains the matlab module)

berak gravatar imageberak ( 2016-09-29 08:11:26 -0500 )edit

Thanks berak! So what I need to do is basically download opencv_contrib and CMake and build the Matlab module?

DNL gravatar imageDNL ( 2016-09-29 08:30:53 -0500 )edit

yes. and opencv3. you need matlab installed, and then pray, that cmake finds it.

(and rather update opencv via git, this will make it much easier to patch updates, buxfixes, etc. later)

may the force be with you.

berak gravatar imageberak ( 2016-09-29 08:42:40 -0500 )edit

I just realized my Visual Studio 2012 is 32-bit while my Matlab is 64-bit. I am gonna try to find a 64 one and see how things will go. Thank you very much, berak! hahah may the force be with you as well!

DNL gravatar imageDNL ( 2016-09-29 10:45:32 -0500 )edit