Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

ROI Descriptor details

Hi all,

 

I'm trying to make my image processing VI more efficient, but I'm having trouble figuring out which field is which.

 

I browsed through this forum, and found a few different definitions of the ROI fields, which don't agree.

 

I'm most interested in the 'Global Rectangle'.  I'd like to search for a pattern on the right half of the image.

The image I'm working with is 1400 pixels wide, and 500 pixels tall.

 

I asked LabVIEW to create a 'constant' ROI input to 'IMAQ Match Pattern4.VI' and it did.

I modified the ROI constant with the values that I thought would specify the right half of the image.

When I ran the VI, LabVIEW crashed (LabVIEW has to close now, would you like to send an error message to NI).

 

If I leave that input unwired, it runs, but according to the documenation, it'll search the entire image for my specified pattern, and that has to take longer.

 

I'm running LabVIEW 2013, SP1.

Windows 7, Professional, 64 bit.

FrameGrabber PCIe-1433.

 

Any information you could provide will be appreciated.

 

Thanks,

Jeff

 

0 Kudos
Message 1 of 5
(5,984 Views)

Hello,

 

the global rectangle (GR) has four coordinates representing the bounds of the ROI. It is a vector of size 4:

 

GR[0] = left U coordinate

GR[1] = top V coordinate

GR[2] = right U coordinate

GR[3] = bottom V coordinate

 

Could you post a simple example and explain on how to reproduct your error?

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 2 of 5
(5,978 Views)

The simplest solution is to use the VI that converts a rectangle to an ROI.  You specify the limits of the rectangle, and it does the rest.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 3 of 5
(5,968 Views)

Hi Klemen,

 

Thank you for the quick reply.

I just want to make sure I understand (I'm not sure I understand what the U and V letters represent).

 

The 4 coordinates are as follows:

left, top, right, bottom.

 

So if I want a box that starts at position x = 20, y = 25; and is 100 pixels wide by 150 pixels tall, the correct ROI will be:

20, 25, 120, 175.

 

The third and fourth parameters are specified based on the pixel location within the image, and are not 'height and width'.

 

Did I get that right?

 

Thanks,

Jeff

 

0 Kudos
Message 4 of 5
(5,958 Views)

Hello,

 

yes, that's correct. If you want to get the width and height, you need to subtract the coordinates. I tend to represent the image coordinates as u,v instead of x,y. Sorry for the confusion.

 

Like Mr.Ammons said, use "IMAQ Convert Rectangle to ROI", where you specify the global rectangle plus the additional rotation parameter (which is 0 for a unrotated rectangle).

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 5 of 5
(5,953 Views)