LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert IMAQ Detect Rectangles rectangle to ROI descriptor

I am having trouble converting the "Rectangles" cluster output from "IMAQ Detect Shapes VI" ("IMAQ Detect Rectangles") to ROI Descriptor. The "IMAQ Convert Rectangle to ROI (Polygon) VI" accepts a different type of rectangle cluster.
I have tried using "2D Cartesian Coordinate Rotation VI" to rotate the coordinates and create the rectangle cluster as an input to "IMAQ Convert Rectangle to ROI (Polygon) VI" but the final ROI does not match the coordinates I started with.

0 Kudos
Message 1 of 3
(2,089 Views)

Detect Rectangles gives you the corners of the Rectangle (which I presume is in its current, possibly rotated, position) as well as the angle of rotation.  What I suspect you need to do is to "untwist" the Rectangle (getting it horizontal or vertical), transform this to an ROI (pretty simple, almost a component-for-component mapping), then "retwist" the ROI to put it back to the same angle as the original Rectangle.

 

One needs to be very careful when dealing with IMAQ -- a Rectangle has one "name", but multiple differing representations depending on what it represents.  This is one of the reasons that IMAQ requires a fair amount of experience in LabVIEW, and a willingness to "experiment" by writing simple VIs that take a known quantity and examine the effect of simple transformations.

 

Good luck.

 

Bob Schor

0 Kudos
Message 2 of 3
(2,068 Views)

Hi Bob,

 

I used the "2D Cartesian Coordinate Rotation VI" to untwist the coordinates and then feed it into "IMAQ Convert Rectangle to ROI (Polygon) VI" the untwisted cluster. However, the final ROI does not overlap onto the rectangle.

Is it possible to provide an example as to how to untwist the rectangle cluster output from "IMAQ Detect Rectangles"?

 

Thanks

0 Kudos
Message 3 of 3
(2,057 Views)