You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I greatly appreciate your software! It is very well thought out and extremely useful.
Besides of that, I'm pretty sure I have found a bug in erode/dilate. I have attached the TEST.PNG plus the python test file below.
As I understand erosion/dilation, it is the min or max of the local neighbourhood. So it should not produce new pixel values which are not contained in the original image, right?
See attached python file with image. I also cross checked with the scpiy ndimage version, which does not produce the problem.
Regards,
Clemens Steckner
import mahotas
im= mahotas.imread('test.png')
find list of all values of pixels gt 0
def pixelvalues(imi):
im=imi.copy()
lst=[]
mn=im.min()
while True:
val= im.max()
assert (im==val).any()
if val == mn:
break
lst.append(val)
im[im==val] = mn
assert (im==mn).all()
lst.append(mn)
return [i for i in lst if i > 0]
show pixelvalues which have been 'invented' by mahotas
If you do want local maxima/minima, there is a function mahotas.morph.locmax which does take a structuring element defining a region. Perhaps check that out.
Hi,
I greatly appreciate your software! It is very well thought out and extremely useful.
Besides of that, I'm pretty sure I have found a bug in erode/dilate. I have attached the TEST.PNG plus the python test file below.
As I understand erosion/dilation, it is the min or max of the local neighbourhood. So it should not produce new pixel values which are not contained in the original image, right?
See attached python file with image. I also cross checked with the scpiy ndimage version, which does not produce the problem.
Regards,
Clemens Steckner
import mahotas
im= mahotas.imread('test.png')
find list of all values of pixels gt 0
def pixelvalues(imi):
im=imi.copy()
lst=[]
mn=im.min()
while True:
val= im.max()
assert (im==val).any()
if val == mn:
break
lst.append(val)
im[im==val] = mn
assert (im==mn).all()
lst.append(mn)
return [i for i in lst if i > 0]
show pixelvalues which have been 'invented' by mahotas
print set(pixelvalues(mahotas.erode(im))) - set(pixelvalues(im))
print set(pixelvalues(mahotas.dilate(im))) - set(pixelvalues(im))
erode invents pixel value 254
print (mahotas.erode(im) == 254).any(), (im==254).any()
dilate invents pixel value 103
print (mahotas.dilate(im) == 103).any(), (im==103).any()
The text was updated successfully, but these errors were encountered: