Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

since you move and scale your rectangle, I guess that parts of your new rectangle are outside the image border. The reason could be the cvRound function. This function "Rounds floating-point number to the nearest integer". In some rare cases it could be that the scaling and moving values are rounded to the next higher int value and so result in an rectangle which lies (partly) outside the image border. You should check if the new rectangle lies within the image border before taking the ROI.

Why do you want to scale and move the detected rectangle and why do you want to do that for all detected rectangles with the same values?