10-14-2014 11:12 AM
hi,
i need to predfine a rotated rectangle ROI programably. But i get the following information from vision help
Rotation specifies the rotation angle in degrees of the rectangle with its center as point of rotation. If the rotation angle does not equal zero, the Left, Top, Right, and Bottom coordinates are not the actual coordinates of the upper left and bottom right corner of the rectangle, but their position if the rotation angle equals zero. |
that means if rotation angle is zero, then the Left, Top,Right, Bottom coordinates are the actual coordinates of the upper left and bottom right corner of the rectangle in the picture. But my rotation angle is not zero, then how could i define the Left ,Top,Right , Bottom coordination? thanks for your great help.
Elvis
10-14-2014 02:17 PM
Use the coordinates where the rectangle would be before rotating it. Think of it as two steps: Define a rectangle, then rotate it.
You are essentially defining the center of the rectangle and its dimensions, then rotating it.
Bruce
10-15-2014 02:42 AM
thanks for your quick reply , Bruce.
as you see the attachment, if i predefine the coordination of top, left, bottom, right and then rotate the ROI , unwanted region will be included in the ROI.
how could i avoid this happen?
Elvis
10-15-2014 09:26 AM
You have to figure out where the rectangle needs to be and work backwards. Make sure the center is where you want it to be, since that won't change. Make sure the length and width are what you want, because that won't change. Your sides are center +/- length/2 or width/2.
If you are drawing the rectangle by hand, you might have to rotate the rectangle then grab the center and move it a little bit to avoid unwanted regions.
Bruce