From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ ROI rotated rectangle ANGLE calculation

I am using IMAQ Construct ROI to construct a rotated Rectangle ROI. The resulting contours give coordinated of the top and bottom points of the rectangle before rotation and a fifth number indicate the angle. But can anyone tell me how can i calculate the angle in degree from this value, so that i can calculate the exact points of the rotated rectangle?
Is there any other method to find the actual coordinates of the 4 edges of the rotated rectangle? My intention is to find some points in between these edge points, which i can calculated with simple trigonometry by knowing the angle of rotation. 
 
Thank you in advance,
Mathew
0 Kudos
Message 1 of 4
(4,629 Views)

The angle of rotation is about the center of the rectangle.  I think the angle is already degrees.  If you calculate the center of the rectangle and subtract it from the corners, you have the coordinates to be rotated.  The easiest way I have found to rotate coordinates is to convert them to a complex number, multiply the complex number by the angle IN RADIANS, then convert back to x, y.  Add the center of the rectangle back to the rotated coordinates and you are done.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(4,619 Views)
The angle is give as a big number ..sometime 4 digit sometimes ( big angles) 5 digits...i dont know the relation ..Can you please give some more details?
 
thanx
mathew
0 Kudos
Message 3 of 4
(4,618 Views)
If you divide by 1000, you will get degrees.  The "convert ROI to rectangle" vi does this for you, and converts the array to a cluster.  This is a little easier to work with than the ROI itself.  You still need to convert the angle to radians (Deg*Pi/180).
 
Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(4,611 Views)