mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-07 11:28:14 +08:00
fix >80 linelength
This commit is contained in:
@@ -3,20 +3,24 @@
|
||||
Entropy
|
||||
=======
|
||||
|
||||
In information theory, information entropy is the log-base-2 of the number of possible outcomes
|
||||
for a message.
|
||||
In information theory, information entropy is the log-base-2 of the number of
|
||||
possible outcomes for a message.
|
||||
|
||||
For an image, local entropy is related to the complexity contained in a given neighborhood, typically defined by a
|
||||
structuring element. A large number of various gray levels has a higher entropy than an homogeneous neighborhood.
|
||||
For an image, local entropy is related to the complexity contained in a given
|
||||
neighborhood, typically defined by a structuring element. A large number of
|
||||
various gray levels has a higher entropy than an homogeneous neighborhood.
|
||||
|
||||
Entropy filter can detect subtle variations of local gray level distribution, in the example, the
|
||||
image is composed of two surfaces with two slightly different distributions.
|
||||
Entropy filter can detect subtle variations of local gray level distribution,
|
||||
in the example, the image is composed of two surfaces with two slightly
|
||||
different distributions.
|
||||
|
||||
Image center has a random distribution in the range [-14,+14] centered on 128, while the borders has a
|
||||
random distribution in the range [-15,+15] centered on 128.
|
||||
Image center has a random distribution in the range [-14,+14] centered on 128,
|
||||
while the borders has a random distribution in the range [-15,+15] centered
|
||||
on 128.
|
||||
|
||||
We apply the local entropy measure using a circular structuring element of radius 10. As a result, one can
|
||||
detect the central square. Radius should be big enough to efficiently sample the local gray level distribution.
|
||||
We apply the local entropy measure using a circular structuring element of
|
||||
radius 10. As a result, one can detect the central square. Radius should be big
|
||||
enough to efficiently sample the local gray level distribution.
|
||||
|
||||
In the second example, the local entropy is used to detect image texture.
|
||||
|
||||
@@ -29,10 +33,11 @@ from skimage.util import img_as_ubyte
|
||||
from skimage.filters.rank import entropy
|
||||
from skimage.morphology import disk
|
||||
|
||||
noise_mask = 28*np.ones((128, 128), dtype=np.uint8)
|
||||
noise_mask = 28 * np.ones((128, 128), dtype=np.uint8)
|
||||
noise_mask[32:-32, 32:-32] = 30
|
||||
|
||||
noise = (noise_mask*np.random.random(noise_mask.shape)-.5*noise_mask).astype(np.uint8)
|
||||
noise = (noise_mask * np.random.random(noise_mask.shape) - .5 *
|
||||
noise_mask).astype(np.uint8)
|
||||
img = noise + 128
|
||||
|
||||
radius = 10
|
||||
@@ -52,7 +57,7 @@ plt.imshow(e)
|
||||
plt.xlabel('image local entropy ($r=%d$)' % radius)
|
||||
plt.colorbar()
|
||||
|
||||
#second example: texture detection
|
||||
# second example: texture detection
|
||||
|
||||
image = img_as_ubyte(data.camera())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user