ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

VB using multiple regions

I have an app written in VB6 where I have placed multiple ROIs on the image. I wish to measure the brightness in each ROI.

 

I know I can do this using a light meter in a loop. However, is there a way to measure all of the ROIs at one time?

 

Thanks!

0 Kudos
Message 1 of 3
(3,255 Views)

Steverino -

 

If you look at the Machine Vision source code for LightMeterRectangle (found in <National Instruments>\Vision\Source\MSVB\MachineVision\) you can see that all it's doing is converting the rectangle to a mask and then calling CWIMAQVision.Histogram2.  If you want to measure the total brightness over a whole ROI, you can do a similar thing - simply call RegionsToMask to get a mask image and then call CWIMAQVision.Histogram2 with that mask image.

 

Alternatively, you can look at CWIMAQVision.RegionsProfile - this returns a report for each contour in the region.

 

Hope this helps!

 

Greg Stoll

Vision R&D
National Instruments

Greg Stoll
LabVIEW R&D
0 Kudos
Message 2 of 3
(3,249 Views)

What if I had multiple regions in an image and wanted to do more than measure light intensity?

 

For example, suppose I wanted to perform autothresholding such as clustering. I would need to restrict processing to each region else the results might be incorrect if the region were significantly different from the image as a whole.

 

How do I step through each region, do the image processing, and extract measurements for each region? Do you have code or pseudo-code that does this?

 

Thanks!

Message Edited by Steverino on 10-07-2008 05:19 PM
0 Kudos
Message 3 of 3
(3,244 Views)