back to iatexture

Function normhisteq normalization

Synopse

The normhisteq function performs histogram equalization in the image as a pre-processing method.

  • g = *normhisteq(f)
    • Output
      • g: output image
    • Input
      • f: ndarray: input image.

Description

The normhisteq function performs the histogram equalization method in the input image. It redistributes the pixels in the image based on the normalized cumulative histogram. The normalized cumulative histogram can be used as a mapping between the original gray levels in the image and the new gray levels required for enhancement. The enhanced image (result) will have a uniform histogram

Function Code

1 from skimage import exposure
2 
3 def normhisteq(f):
4 
5     return exposure.equalize_hist(f)

Example

 1 import ia636
 2 from normhisteq import normhisteq
 3 
 4 f = adreadgray('p/LesionMRI/EM/Iani Surian Batalini - 746587-5 - 32A/22.png')
 5 roi = adreadgray('p/LesionMRI/EM/Iani Surian Batalini - 746587-5 - 32A/Peri_22_1.png')>0
 6 adshow(f, 'original image')
 7 print 'f.min,f.max()',f.min(),f.max()
 8 
 9 adshow(ia636.iaplot(ia636.iahistogram(f)))
10 adshow(ia636.iaplot(ia636.iahistogram(f)[1::]))
11 result = normhisteq(f)
12 adshow(ia636.ianormalize(result),'norm histeq result')
13 print 'result.min,result.max()',result.min(),result.max()
f.min,f.max() 1 254
result.min,result.max() 0.0338287353516 1.0

original image

norm histeq result