[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HIST_EQUAL



"Sergio Ahumada N." ("Sergio Ahumada N." <san[@]inf.utfsm.cl>) writes:

> I need to know what's the difference between HISTOGRAM and
> HIST_EQUAL functions, I don't find so much info about this.
> 
> Is HIST_EQUAL a graphics of density distribution ?

HIST_EQUAL is a histogram equalization method, whereby
the pixel values in an image are changed and re-distributed
in such as way that if you took a histogram of a histogram-
equalized image, there would be approximately the same 
number of pixels in each histogram bin.

HISTOGRAM is a function for performing black magic on
IDL arrays. (I would strongly advise you against reading
any article that has "histogram" in the Subject field.
Along that path lies destruction.) 

In every day use, however, the HISTOGRAM function can 
tell you how many pixels in an image have the same 
value. In other words, the histogram gives you a sense 
of how the pixel values are distributed in an image.

For example, try this:

*************************************************************
filename = Filepath('ctscan.dat', Subdir=['examples','data'])
OpenR, lun, filename, /Get_Lun
image = BytArr(256, 256)
ReadU, lun, image
Free_Lun, lun

Window, 0, XSize=600, YSize=350
!P.Multi = [0, 2, 1]
TVImage, image
Plot, Histogram(image), XTitle='Pixel Value', XStyle=1, $
   YTitle='Number of Pixels', Title='Normal Image'

Window, 1, XSize=600, YSize=350
histoimage = Hist_Equal(image)
TVImage, histoimage
Plot, Histogram(histoimage), XTitle='Pixel Value', XStyle=1, $
   YTitle='Number of Pixels', Title='Histogram Equalized Image'

!P.Multi=0
*************************************************************

You can find the TVImage program on my web page:

   http://www.dfanning.com/programs/tvimage.pro

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155