Finding the peak value of a 2D wave
Sandbo
Hi,
I am wondering if there is an fast way (then going through all entries) to find the peak of a 2D wave, returning:
1. The peak value
2. The location as x and y values (2D wave center is (x=0,y=0)
It seems FindPeak function is 1D only.
If you want the maximum value in the wave, use WaveStats. If you are truly trying to do something like what FindPeak does, it is difficult. If your 2D wave has just one reasonably obvious peak you could do a curve fit to Gauss2D, but that's not fast.
October 4, 2018 at 04:47 pm - Permalink
In reply to If you want the maximum… by johnweeks
I see, thanks for the ideas.
In fact the 2D waves I am considering are rather small, it may not worth it to do much more than a for-loop and just compare.
A better way maybe to just transform it to 1D wave, find the peak there, and note down the coordinate by counting the row and column. Not sure if this is faster.
October 4, 2018 at 05:08 pm - Permalink
In reply to I see, thanks for the ideas… by Sandbo
It seems to me that the simplest solution for you is ImageStats, giving the peak value and location.
DisplayHelpTopic "ImageStats"
V_maxColLoc Specifies the location of the column in which the maximum pixel value was found or the first eligible column if no single column was found.
V_maxRowLoc Specifies the location of the row in which the maximum pixel value was found or the first eligible row if no single maximum was found.
October 5, 2018 at 04:05 am - Permalink