Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The issue above is entirely in the python <-> c++ cv::Rect conversion. In python, the list[4] is x, y, height, width, not x1, y1, x2, y2 (as I was led to believed by a bug in the code I was porting).

The code above works correctly if I change the following lines.

While printing:

out << '[' << rectangles[i].tl().x << ',' << rectangles[i].tl().y << ',' << rectangles[i].width << ',' << rectangles[i].height << ']';

While constructing the cv::Rect:

return cv::Rect((int)coord[0], (int)coord[1], (int)coord[2], (int)coord[3]);