I am trying to draw a Dot in Bounding Box that will represent the Center Point of that box. I have computed the center Point but it is only outputted in CMD and I wont this Point to be visible on a image.
I am working with OpenCV2.4.3 on Visual Studio 2010 C++
for(int i= 0; i < boundRect.size(); i++ )
{
//BoundingBox Area
boundingBoxArea.clear();
boundingBoxArea.push_back(Point2f(boundRect[i].x, boundRect[i].y));
boundingBoxArea.push_back(Point2f(boundRect[i].x + boundRect[i].width, boundRect[i].y));
boundingBoxArea.push_back(Point2f(boundRect[i].x + boundRect[i].width, boundRect[i].y + boundRect[i].height));
boundingBoxArea.push_back(Point2f(boundRect[i].x, boundRect[i].y + boundRect[i].height));
double area0 = contourArea(boundingBoxArea);
cout << "area of bounding box no." << i << " = " << area0 << endl;
//Bounding Box Centroid
area0 = (boundRect[i].x + boundRect[i].width)/2, (boundRect[i].y + boundRect[i].height)/2;
cout<<"Rectangle " <<i<< " Centroid possition is at: " "=" <<area0<<endl;
cout<<""<<endl;
cout<<""<<endl;
}
The above is the code that i use well only a small part but a part that is responsible for calculations on Bounding Boxes