Finding center of Rect
How can I find the center of Rect ?
Rect r(100,100,60,80);
Point center_of_rect = (r.br() + r.tl())*0.5;
gives center of rect
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
using namespace cv;
int main()
{
Mat image(400,400,CV_8UC3,Scalar(0,0,0));
Rect r(100,100,60,80);
rectangle(image,r,Scalar(0,255,255),2);
Point center_of_rect = (r.br() + r.tl())*0.5;
circle(image,center_of_rect,3,Scalar(0,0,255));
imshow("image",image);
waitKey();
return 0;
}
Asked: 2016-08-24 18:39:17 -0600
Seen: 20,503 times
Last updated: Aug 24 '16
How to remove detected human after DetectMultiScale?
Calc a bounding box with a binarized image?
How to cut an image in small images with opencv !!!
Estimation of 4-point Polygon in Contour
How pass Rect from Java code to Jni?
How to Shift a rect by a certain offset in openCV4Android
seriously ?
haha I guess he is ^_^