Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

rotated rectangle

hi,

 

i need to predfine a rotated rectangle ROI programably.  But i get the following information from vision help

 

/images/reference/en-XX/help/370281U-01/cdbl.gif

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

 

0 Kudos
Message 1 of 4
(5,210 Views)

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(5,201 Views)

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 

0 Kudos
Message 3 of 4
(5,193 Views)

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(5,175 Views)