back to iatexture

Function normhiststret normalization

Synopse

The normhiststret function performs histogram stretching in the image as a pre-processing method.

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

Description

The normhiststret function performs the histogram stretching method in the input image. It increases the dynamic range of the resulting image was carried out

Function Code

1. def normhiststret(f):
2.     MIN = f.min()
3.     MAX = f.max()
4.     return 1.0*(f-MIN)/(MAX-MIN)

Example

01. import ia636
02. from normhiststret import normhiststret
03. 
04. f = adreadgray('p/LesionMRI/EM/Iani Surian Batalini - 746587-5 - 32A/22.png')
05. roi = adreadgray('p/LesionMRI/EM/Iani Surian Batalini - 746587-5 - 32A/Peri_22_1.png')>0
06. adshow(f, 'original image')
07. print 'f.min,f.max()',f.min(),f.max()
08. 
09. result = normhiststret(f)
10. adshow(ia636.ianormalize(result),'norm stret result')
11. print 'result.min,result.max()',result.min(),result.max()
f.min,f.max() 1 254
result.min,result.max() 0.0 1.0

original image

norm stret result