01-31-2017 02:38 PM
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
Solved! Go to Solution.
01-31-2017 02:55 PM
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?
01-31-2017 02:57 PM
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
01-31-2017 03:10 PM
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.
01-31-2017 03:11 PM
No I have not converted the image, I do have an IMAQ call inside of the loop to the light meter.
01-31-2017 06:48 PM
You may want to see if IMAQ Centroid will give you the answer directly, otherwise thresholding first is likely to work well and fast.
01-31-2017 09:10 PM
I will try these, thank you for your help.