First time here? Check out the FAQ!

Ask Your Question
0

No matching function for call to 'rectangle'

asked Apr 24 '19

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
}
Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Apr 24 '19

supra56 gravatar image

updated Apr 24 '19

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);
Preview: (hide)

Comments

1

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

sturkmen gravatar imagesturkmen (Apr 24 '19)edit

@sturkmen. Thanks! I didn't know that

supra56 gravatar imagesupra56 (Apr 24 '19)edit

Question Tools

1 follower

Stats

Asked: Apr 24 '19

Seen: 1,983 times

Last updated: Apr 24 '19