Quantcast
Channel: Get coordinates of local maxima in 2D array above certain value - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Get coordinates of local maxima in 2D array above certain value

$
0
0
from PIL import Imageimport numpy as npfrom scipy.ndimage.filters import maximum_filterimport pylab# the picture (256 * 256 pixels) contains bright spots of which I wanna get positions# problem: data has high background around value 900 - 1000im = Image.open('slice0000.png')data = np.array(im)# as far as I understand, data == maximum_filter gives True-value for pixels# being the brightest in their neighborhood (here 10 * 10 pixels)maxima = (data == maximum_filter(data,10))# How can I get only maxima, outstanding the background a certain value, let's say 500 ?

I'm afraid I don't really understand the scipy.ndimage.filters.maximum_filter() function. Is there a way to obtain pixel-coordinates only within the spots and not within the background?

https://i.stack.imgur.com/RImHW.png (16-bit grayscale picture, 256*256 pixels)


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images