Wrong arguments for CascadeClassifier detection

asked 2015-02-19 09:01:44 -0500

Fačko gravatar image

I work on CascadeClassifier MultiScale detection for WindowsPhone 8.1 C# using Windows Runtime Component. (Visual Studio 2013) Here is my code in WinRT:

cv::Mat mat(width, height, CV_8UC4);
cv::CascadeClassifier face_cascade;
face_cascade.load("haarcascade_frontalface_alt.xml");
std::vector<Rect> faces;
.
.
.
equalizeHist(mat, mat);
face_cascade.detectMultiScale(mat, faces, 1.1, 2, 0, Size(30, 30));

And I still get error: error C2664: 'void cv::CascadeClassifier::detectMultiScale(cv::InputArray,std::vector<_Ty> &,double,int,int,cv::Size,cv::Size)' : cannot convert parameter 2 from 'std::vector<_Ty>' to 'std::vector<_Ty> &'

I follow the tutorial on OpenCV website and I do not why my parameters should be wrong.

Thanks for reply.

edit retag flag offensive close merge delete

Comments

1

btw, you can't equalizeHist a 4 channel img, only a 1chan, grayscale one.

berak gravatar imageberak ( 2015-02-19 09:10:47 -0500 )edit

thanks, but this does not solve my problem

Fačko gravatar imageFačko ( 2015-02-19 09:20:40 -0500 )edit

sorry, ofc that was unrelated.

berak gravatar imageberak ( 2015-02-19 09:27:18 -0500 )edit

What version of OpenCV?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-02-19 09:29:02 -0500 )edit
1

can you try to specify cv::Rect and cv::Size explicitly ?

berak gravatar imageberak ( 2015-02-19 11:20:55 -0500 )edit

i can use only OpenCV version which supported Microsoft for Windows phone platform here

Fačko gravatar imageFačko ( 2015-02-19 14:45:29 -0500 )edit

berak thanks you were right , it should look like std::vector<cv::rect> faces; face_cascade.detectMultiScale(mat, faces, 1.1, 2, 0, cv::Size(30, 30));

Fačko gravatar imageFačko ( 2015-02-19 14:53:41 -0500 )edit

You can go to specific tag, like 2.4.10, that is the last release (3.0.0 is in beta version)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-02-20 02:04:44 -0500 )edit
1

You are missing a Size at the end. Should look like this:

face_cascade.detectMultiScale(mat, faces, 1.1, 2, 0, Size(30, 30), Size(500,500));

ArcadeBit gravatar imageArcadeBit ( 2015-02-20 16:23:00 -0500 )edit

@ArcadeBit , that should be handled by the default values to this argument, also i don't see, how this would trigger a compile time error.

@Fačko , if you could make an answer (or, even a comment, we'll progress that to an actual answer) about what was the actual solution to it, we could mark it as 'solved !

berak gravatar imageberak ( 2015-02-20 16:29:40 -0500 )edit