Ask Your Question

compiling errors with opencv GOLD

asked 2015-07-14 07:04:26 -0500

franken gravatar image

Hi all , i'm under ubuntu 14.04 and opencv 3 gold .... i have found an example here for eye detection

when compiling in raspberry pi i got a lot of errors /home/pi/opencv-3.0.0/samples/cpp/test/eyeLike-master/src/main.cpp: In function 'int main(int, const char)': /home/pi/opencv-3.0.0/samples/cpp/test/eyeLike-master/src/main.cpp:82:37: error: no match for 'operator=' in 'frame = cvQueryFrame(capture)' /home/pi/opencv-3.0.0/samples/cpp/test/eyeLike-master/src/main.cpp:82:37: note: candidates are: /usr/local/include/opencv2/core/mat.inl.hpp:560:6: note: cv::Mat& cv::Mat::operator=(const cv::Mat&) /usr/local/include/opencv2/core/mat.inl.hpp:560:6: note: no known conversion for argument 1 from 'IplImage* {aka _IplImage}' to 'const cv::Mat&' /usr/local/include/opencv2/core/mat.inl.hpp:2878:6: note: cv::Mat& cv::Mat::operator=(const cv::MatExpr&) /usr/local/include/opencv2/core/mat.inl.hpp:2878:6: note: no known conversion for argument 1 from 'IplImage {aka _IplImage}' to 'const cv::MatExpr&' /usr/local/include/opencv2/core/mat.hpp:1102:10: note: cv::Mat& cv::Mat::operator=(const Scalar&) /usr/local/include/opencv2/core/mat.hpp:1102:10: note: no known conversion for argument 1 from 'IplImage {aka _IplImage}' to 'const Scalar& {aka const cv::Scalar_<double>&}' src/CMakeFiles/eyeLike.dir/build.make:54: recipe for target 'src/CMakeFiles/eyeLike.dir/main.cpp.o' failed make[2]: * [src/CMakeFiles/eyeLike.dir/main.cpp.o] Error 1 CMakeFiles/Makefile2:75: recipe for target 'src/CMakeFiles/eyeLike.dir/all' failed make[1]: [src/CMakeFiles/eyeLike.dir/all] Error 2 Makefile:72: recipe for target 'all' failed make: * [all] Error 2

NB : i have tested the program with opencv 2.4.10 and it worked very well :)

thanks for your help

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-14 07:22:56 -0500

berak gravatar image

updated 2015-07-14 07:39:01 -0500

yes, the assignment from IplImage* to cv::Mat was removed in 3.0. again, please try to avoid any code, that is using old c-api functionality .

in this case , it should be quite easy to fix, use VideoCapture instead of the outdated cvCaptureFromCAM

main.cpp ~58:

 // Read the video stream
cv::VideoCapture capture( -1 ); // please delete the old  CvCapture* capture; in line 35 !
if( capture.isOpened() ) {
    while( frame ) ) {

(just saying, .. there should have been a cvReleaseCapture() at the end of main(), but there isn't. manual resource management is cumbersome, and bug-prone...) ...

edit flag offensive delete link more



btw, if you like the code from that repo, it might be a good idea to make an issue there ;)

beat me ;)

berak gravatar imageberak ( 2015-07-14 07:25:20 -0500 )edit

thanks you ... errors are now gone , for cvReleaseCapture() it's called automatically by destructor using c++ :) , i have made an issue there too =D

franken gravatar imagefranken ( 2015-07-14 10:28:00 -0500 )edit

you're wrong about cvReleaseCapture(). there is no automatic destructor for a CvCapture * pointer !

yes, i've seen your issue, you were faster than my comment there. what about making a pull-request there to fix it for those coming after you ?

;) ;)

berak gravatar imageberak ( 2015-07-14 10:32:44 -0500 )edit

I'm sorry i want to say cv::Mat.release() ... i'm new at github when i click pull requests i get a message : There aren't any open pull requests.?? can you tell me how to do this thanks :)

franken gravatar imagefranken ( 2015-07-14 12:20:53 -0500 )edit

here is what i've done !!! is it right :p

franken gravatar imagefranken ( 2015-07-14 12:37:07 -0500 )edit

almost ;) <-- kill it (else you got 2 vars with same name)

obviously, you did not try to compile & run your patch. you always have to try your own dogfood !

(there aren't any pull requests so far ;)

berak gravatar imageberak ( 2015-07-14 12:49:37 -0500 )edit

@berak sorry i didn't understand , i have compiled and run the code in my laptop !!

franken gravatar imagefranken ( 2015-07-16 21:39:22 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-07-14 07:04:26 -0500

Seen: 793 times

Last updated: Jul 14 '15