Ask Your Question
0

No matching function for call to 'rectangle'

asked 2019-04-24 09:09:53 -0600

mor gravatar image

I am trying to draw an rectangle in video but I get this error :" No matching function for call to 'rectangle' " I searched for a solution online but with no success. here are my imports :

#import <opencv2/opencv.hpp>
#import <opencv2/videoio/cap_ios.h>
#import <opencv2/features2d.hpp>
#import <opencv2/objdetect.hpp>

and here is the code itself:

face_cascade.detectMultiScale(image, faces, 1.3, 5);
printf("%zd face(s) are found.\n", faces.size());
for(int i = 0; i< faces.size(); i++){
    cv::Rect r = faces[i];
    x = r.x;
    y = r.y;
    w = r.width;
    h = r.height;
    rectangle(image,(x,y),(x+w,y+h),(255,0,0),2); // my error is here
}
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-04-24 13:35:21 -0600

supra56 gravatar image

updated 2019-04-24 13:46:50 -0600

Change this:

 rectangle(image,(x,y),(x+w,y+h),(255,0,0),2);

to

 rectangle(image,Point(x,y),Point(x+w,y+h),Scalar(255,0,0),2);
edit flag offensive delete link more

Comments

1

@supra56 i updated your answer although i am still not sure if he use c++ code

sturkmen gravatar imagesturkmen ( 2019-04-24 13:52:54 -0600 )edit

@sturkmen. Thanks! I didn't know that

supra56 gravatar imagesupra56 ( 2019-04-24 14:00:41 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-04-24 09:09:53 -0600

Seen: 1,957 times

Last updated: Apr 24 '19