LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficiently Finding Max Intensity Coordinates of Image

Solved!
Go to solution

Hello,

 

I am currently attempting to find the (x,y) coordinates of a U8 Greyscale image. Currently I am using the Labview IMAQ Light Meter (Point) inside a double for loop which iterates through all of the image's pixels and find the maximum indices of the resulting array. This, however has proven to tak ~1 minute to calculate for one image, which is FAR too slow for the project we are working on (ideally it would take <0.1 seconds to compue this for one image)

 

Anyone know of a more efficient way to find the coordinates of the max intensity pixel?

 

Thanks,

 

-Steve

0 Kudos
Message 1 of 7
(4,428 Views)
Solution
Accepted by topic author notleysa

Using the Light Meter is certainly an inefficient way to do this.  There are a number of other ways to think about doing this, though it's difficult to know without knowing what your images look like.  Perhaps you could convert the image to an array, and use the Array Max & Min function to tell you the indices of the maximum.  But that will only return a single location, and it's possible that there will be a number of pixels with the same maximum intensity.  So another way would be to use IMAQ Quantify to tell you the value of the maximum, and then IMAQ Threshold to identify all the pixels with that value.  IMAQ Particle Analysis will let you get the coordinates of those pixels, though if they're connected you might need to think a bit more about what location you want - is it the centroid of a group of pixels with the same maximum value?

Message 2 of 7
(4,416 Views)

Post what you have done so far.  My guess is that inside your innermost loop, you are doing an IMAQ call and that it is the slowdown in the code.  If you have the image converted to a 2-D array of U8's.  it should be very fast to find the largest value

0 Kudos
Message 3 of 7
(4,413 Views)

This makes sense, I will look into doing something more along these lines. The images will be entirely black with a single gaussian, resulting in one bright spot. So yes, the centroid of this region would be what I am looking for.

 

I will test some of your suggestions, thank you.

0 Kudos
Message 4 of 7
(4,403 Views)

No I have not converted the image, I do have an IMAQ call inside of the loop to the light meter.

0 Kudos
Message 5 of 7
(4,402 Views)

You may want to see if IMAQ Centroid will give you the answer directly, otherwise thresholding first is likely to work well and fast.

Message 6 of 7
(4,377 Views)

I will try these, thank you for your help.

0 Kudos
Message 7 of 7
(4,361 Views)