skimage.feature.peak_local_max behaviour

166 views
Skip to first unread message

Sigmund

unread,
Jan 15, 2015, 6:48:45 PM1/15/15
to scikit...@googlegroups.com
Hi,
My first post a few hours ago somehow didn't appear. It was with examples but I trink I can make my paint without.
If two peaks with the same value are within the min_distance range they are not detectes as too closer and reduced to one. Just use the provided examples in the doc and change the peaks to the same value.

Sigmund Neher

unread,
Jan 15, 2015, 6:52:38 PM1/15/15
to scikit...@googlegroups.com

Sorry! I realy suck at writing with my cellphone.

--
You received this message because you are subscribed to a topic in the Google Groups "scikit-image" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scikit-image/HksA6QBButU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scikit-image...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sigmund

unread,
Jan 16, 2015, 4:59:36 AM1/16/15
to scikit...@googlegroups.com
Since nothing has happened here and I'm back at my office some examples:

normal behavior:


>>> img1 = np.zeros((7, 7))
>>> img1[3, 4] = 1
>>> img1[3, 2] = 1.5
>>> img1
array([[ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  1.5,  0. ,  1. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ]])
>>> peak_local_max(img1, min_distance=1) array([[3, 2], [3, 4]])

>>> peak_local_max(img1, min_distance=2) array([[3, 2]])


now the, in my opinion, not normal behavior:

 

>>> img1 = np.zeros((7, 7))
>>> img1[3, 4] = 1
>>> img1[3, 2] = 1
>>> img1
array([[ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  1. ,  0. ,  1. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ],
       [ 0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ]])
>>> peak_local_max(img1, min_distance=1) array([[3, 2], [3, 4]])

>>> peak_local_max(img1, min_distance=2)
array([[3, 2], [3, 4]])



Thanks again!

Siggi

Johannes Schoenberger

unread,
Jan 16, 2015, 5:11:15 AM1/16/15
to scikit...@googlegroups.com
This is not ideal, but please try `skimage.feature.corner_peaks`. It should work with this function (untested).

Sigmund

unread,
Jan 16, 2015, 8:53:25 AM1/16/15
to scikit...@googlegroups.com
Thanks!

skimage.feature.corner_peaks is working like I expect peak_local_max to do.

Siggi

Stéfan van der Walt

unread,
Jan 16, 2015, 10:01:38 AM1/16/15
to scikit-image
On Fri, Jan 16, 2015 at 5:53 AM, Sigmund <sig...@gmail.com> wrote:
> skimage.feature.corner_peaks is working like I expect peak_local_max to do.

Thanks for the feedback, Sigmund. We've been discussing a rewrite of
this functionality exactly because it yields unexpected results like
those you mentioned.

Stéfan
Reply all
Reply to author
Forward
0 new messages