Prev: How I can do the Coherence function using AR method
Next: Similarity between Goertzel filter and bandpass filter
From: Tim Wescott on 29 Mar 2010 13:02 Jerry Avins wrote: > Luna Moon wrote: >> On Mar 24, 8:12 pm, Vladimir Vassilevsky <nos...(a)nowhere.com> wrote: >>> Luna Moon wrote: >>>> Hi all, >>>> We have a task in Matlab that I don't know how to it: >>>> We would like to find the "robust" peak/max in an numeric array. >>>> The "robust" here means that if the peak or max is a singleton and all >>>> the surrounding regions around that peak/spike/max are deep valleys, >>>> then this peak/max is not a "robust" max, it's a spike, or random >>>> noise. >>>> We don't want to get such a max. >>>> Instead, we would like to see a slow varying top, or stable flat top. >>>> We would like to see that if the surrounding regions around the peak/ >>>> max are also high values, then that peak/max is a "robust" max, it's >>>> not a spike or random noise. >>>> How do I fulfill this task in Matlab? >>> Lowpass your data, find maximum, then refine the position of maximum >>> over the initial data. >>> >>> And remember: MATLAB is for STUPIDENTS and toy problems. >>> >>> VLV >> >> Do you think low-pass filter will work here? >> >> Let's say you have the following shape: >> >> >> 1 1 1 1 1 >> 1 0 0 0 1 >> 1 0 2 0 1 >> 1 0 0 0 1 >> 1 1 1 1 1 >> >> Let's say I don't want to identify the 2 in the middle as my peak. >> Because that's a spike which is not robust. >> >> I suspect a low pass filter will still pick that 2 up... > > Of course it will, because it's the closest thing to a peak that there > is. Never mind how to program it. If you, with all your intelligence, > can't provide an answer for a simple case, what hope do you have of > instructing a machine to do it for you? > > Jerry I think the OP's problem is that she has an image with popcorn noise or some such, and she wants to pick out a "true" peak without triggering on noise. If that's really the case, then ponder her example with the '2' turned to a '20', or all the '1's turned to 0.1. Although that does raise the question of why she doesn't want to just filter out the popcorn noise separately, then go looking for peaks. Hopefully we'll get some clarification... -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
From: ImageAnalyst on 29 Mar 2010 13:27 Luna: This is not an easy problem. It's harder in 2D than it is for 1D signals. You might want to look into H-domes. http://www.afscet.asso.fr/resSystemica/Crete02/Halkiotis.pdf http://www.leptonica.com/grayscale-morphology.html#TOPHAT-HDOME This is done in MATLAB by the function imhmax() function in the image processing toolbox. You might also take a look at imregionalmax() and imextendedmax(). Good luck, ImageAnalyst
From: Sebastian Doht on 29 Mar 2010 13:39 Luna Moon schrieb: > On Mar 24, 8:12 pm, Vladimir Vassilevsky<nos...(a)nowhere.com> wrote: >> Luna Moon wrote: >>> Hi all, >> >>> We have a task in Matlab that I don't know how to it: >> >>> We would like to find the "robust" peak/max in an numeric array. >> >>> The "robust" here means that if the peak or max is a singleton and all >>> the surrounding regions around that peak/spike/max are deep valleys, >>> then this peak/max is not a "robust" max, it's a spike, or random >>> noise. >> >>> We don't want to get such a max. >> >>> Instead, we would like to see a slow varying top, or stable flat top. >>> We would like to see that if the surrounding regions around the peak/ >>> max are also high values, then that peak/max is a "robust" max, it's >>> not a spike or random noise. >> >>> How do I fulfill this task in Matlab? >> >> Lowpass your data, find maximum, then refine the position of maximum >> over the initial data. >> >> And remember: MATLAB is for STUPIDENTS and toy problems. >> >> VLV > > Do you think low-pass filter will work here? > > Let's say you have the following shape: > > > 1 1 1 1 1 > 1 0 0 0 1 > 1 0 2 0 1 > 1 0 0 0 1 > 1 1 1 1 1 > > Let's say I don't want to identify the 2 in the middle as my peak. > Because that's a spike which is not robust. > > I suspect a low pass filter will still pick that 2 up... > > Any more thoughts? > > Thank you! Maybe you could apply some robust fitting method like RANSAC or anything else suitable for outlier detection if you can come up with a good model your input data is most likely to follow. But you need much bigger arrays than the example to distinguish between a spike/outlier and a real data point.
From: Michael Plante on 29 Mar 2010 15:47 Luna Moon wrote: >On Mar 24, 8:12=A0pm, Vladimir Vassilevsky <nos...(a)nowhere.com> wrote: >> Luna Moon wrote: >> > Hi all, >> >> > We have a task in Matlab that I don't know how to it: >> >> > We would like to find the "robust" peak/max in an numeric array. >> >> > The "robust" here means that if the peak or max is a singleton and all >> > the surrounding regions around that peak/spike/max are deep valleys, >> > then this peak/max is not a "robust" max, it's a spike, or random >> > noise. >> >> > We don't want to get such a max. >> >> > Instead, we would like to see a slow varying top, or stable flat top. >> > We would like to see that if the surrounding regions around the peak/ >> > max are also high values, then that peak/max is a "robust" max, it's >> > not a spike or random noise. >> >> > How do I fulfill this task in Matlab? >> >> Lowpass your data, find maximum, then refine the position of maximum >> over the initial data. >> >> And remember: MATLAB is for STUPIDENTS and toy problems. >> >> VLV > >Do you think low-pass filter will work here? > >Let's say you have the following shape: > > >1 1 1 1 1 >1 0 0 0 1 >1 0 2 0 1 >1 0 0 0 1 >1 1 1 1 1 > >Let's say I don't want to identify the 2 in the middle as my peak. >Because that's a spike which is not robust. > >I suspect a low pass filter will still pick that 2 up... Try a median filter first? For example, run a 3x3 block over the whole image and replace the center at each point with the median of the 9 values.
From: Vladimir Vassilevsky on 29 Mar 2010 15:54
Michael Plante wrote: > Luna Moon wrote: > >>On Mar 24, 8:12=A0pm, Vladimir Vassilevsky <nos...(a)nowhere.com> wrote: >> >>>Luna Moon wrote: >>> >>>>Hi all, >>> >>>>We have a task in Matlab that I don't know how to it: >>> >>>>We would like to find the "robust" peak/max in an numeric array. >>> >>>>The "robust" here means that if the peak or max is a singleton and > > all > >>>>the surrounding regions around that peak/spike/max are deep valleys, >>>>then this peak/max is not a "robust" max, it's a spike, or random >>>>noise. >>> >>>>We don't want to get such a max. >>> >>>>Instead, we would like to see a slow varying top, or stable flat top. >>>>We would like to see that if the surrounding regions around the peak/ >>>>max are also high values, then that peak/max is a "robust" max, it's >>>>not a spike or random noise. >>> >>>>How do I fulfill this task in Matlab? >>> >>>Lowpass your data, find maximum, then refine the position of maximum >>>over the initial data. >>> >>>And remember: MATLAB is for STUPIDENTS and toy problems. >>> >>>VLV >> >>Do you think low-pass filter will work here? >> >>Let's say you have the following shape: >> >> >>1 1 1 1 1 >>1 0 0 0 1 >>1 0 2 0 1 >>1 0 0 0 1 >>1 1 1 1 1 >> >>Let's say I don't want to identify the 2 in the middle as my peak. >>Because that's a spike which is not robust. >> >>I suspect a low pass filter will still pick that 2 up... > > > > Try a median filter first? For example, run a 3x3 block over the whole > image and replace the center at each point with the median of the 9 > values. 1. Highpass 2. Clip the peaks 3. Lowpass 4. Find peaks 5. Refine peak positions wrt original data Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com |