Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Get width/height of current image / Get ROI information of user input

Solved!
Go to solution

Hello,

 

i have two problems:

First:

Is there an option to get the width and height of the current image to use it for calculations or set a ROI to the right parameters?

 

Second (more complicated):

I used Labview 8.5 to create a custom interface (see attachment interface.jpg).

I am trying to get the ROI from the Interface and use it in my Vision Builder Application, but i cant see the ROI or its size or position or anything...

Is it possible to get that information out of the Interface?

 

 

Information:

I am using Vision Builder 2009 SP1, LabVIEW 8.5

 

Thanks for your replies!

 

0 Kudos
Message 1 of 6
(5,132 Views)

Hi,

 

You can use property node Image Area Width and Height to get the size within the custom UI (a custom UI can only call primitives, properties and methods, but no VIs). You need to create 2 indicators if you want to access the size of the image from Vision Builder. (You can hide those indicators from the UI -  Right click on the indicator and select Hide Indicator).

 

To retrieve the ROI drawn in the image, right click on the image display control and create a property node ROI. You can then extract the coordinates from it, and create the corresponding indicators to access them in Vision Builder. To get the ROI in VBAI, you need to use the Create Region of Interest step and get the ROI coordinates from the custom step.

 

Hope this helps.

 

Best regards,

 

-Christophe

Message 2 of 6
(5,119 Views)

Here's a sample inspection that describes my previous post.

 

Hope this helps.

 

Christophe

0 Kudos
Message 3 of 6
(5,117 Views)

Hello Christophe,

that did it almost, thanks!

One small problem:

The image height and width attributes seem to be the height and width after zooming, so if i try to fit the picture into the imagearea, i get the new size of it, not the real size.

 

I am trying some things here, any solutions would be very helpfull!

0 Kudos
Message 4 of 6
(5,101 Views)
Solution
Accepted by topic author Rene_B

Hi,

 

I missed that when I tested it... the image display control must have been larger than the size of the image and the property node was returning the value I was expecting.

One restriction of the Custom Interface VI that you create in LabVIEW, is that it cannot have any dependencies (call any sub-VIs), other than methods and property nodes of the objects that you put on it. Therefore, I cannot just call IMAQ GetImageSize from it. So it does not seem possible at this point for the Custom Interface VI to return the image size.

The solution, at this point, to get the size of the image from within Vision Builder AI, is to use a Run LabVIEW step that call a simple VI that takes an image as an input, calls IMAQ GetImageSize and return X and Y res.

Note, that for distribution purposes, when you call a VI using a Run LabVIEW step, you have to save it, as a source distribution in a LLB and you need to redistribute that llb with your inspection. Refer to the Run LabVIEW step configuration help for more details.

Sorry there is no better way to do that at this time.

 

Best regards,

 

Christophe

Message 5 of 6
(5,087 Views)

That did it, thanks!

 

Maybe anyone needs the link for the howto:

http://digital.ni.com/public.nsf/allkb/231D87B9D8C3B71A862572D4007EAAF8?OpenDocument

0 Kudos
Message 6 of 6
(5,070 Views)