Eduardo Munizaga
2016-04-08 20:24:58 UTC
I am using the algorithm attached and the intention is to measure the
amount of pixels of the regions identified by the code "mahotas.label
(image)".
The problem is that the greater the area of the background, the greater the
number of pixels that detects, considering that all points have the same
number of pixels in different images. This is due to the following line:
"mh.gaussian_filter (image 4)"
However this should not happen because what I need is that the regions are
exactly independent measurements of the area that has the background.
Attached the script and images of different sizes but with the same picture
of 200 x 200 pixels as examples.
*****************************************************
import mahotas as mh
import mahotas.demos
import numpy as np
from pylab import imshow, show
imagen = mahotas.imread('76x66.png')
imagen = imagen[:,:,0]
imagen = mh.gaussian_filter(imagen, 4)
imagen = (imagen> imagen.mean())
etiquetas, unidades = mahotas.label(imagen)
sizes = mahotas.labeled.labeled_size(etiquetas)
print sizes[0]
imshow(imagen)
show()
**********************************
Result:
100x100.png print sizes = 1012 pixeles
200x 200.png print sizes = 1292 pixeles
76x66.png print sizes = 848 pixeles
How I can do that, regardless of the background area, the result will not
have change?
<Loading Image...
>
<Loading Image...
>
<Loading Image...
>
amount of pixels of the regions identified by the code "mahotas.label
(image)".
The problem is that the greater the area of the background, the greater the
number of pixels that detects, considering that all points have the same
number of pixels in different images. This is due to the following line:
"mh.gaussian_filter (image 4)"
However this should not happen because what I need is that the regions are
exactly independent measurements of the area that has the background.
Attached the script and images of different sizes but with the same picture
of 200 x 200 pixels as examples.
*****************************************************
import mahotas as mh
import mahotas.demos
import numpy as np
from pylab import imshow, show
imagen = mahotas.imread('76x66.png')
imagen = imagen[:,:,0]
imagen = mh.gaussian_filter(imagen, 4)
imagen = (imagen> imagen.mean())
etiquetas, unidades = mahotas.label(imagen)
sizes = mahotas.labeled.labeled_size(etiquetas)
print sizes[0]
imshow(imagen)
show()
**********************************
Result:
100x100.png print sizes = 1012 pixeles
200x 200.png print sizes = 1292 pixeles
76x66.png print sizes = 848 pixeles
How I can do that, regardless of the background area, the result will not
have change?
<Loading Image...
<Loading Image...
<Loading Image...
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.