ImageEn, unit imageenproc |
|
TImageEnProc.GetHistogram
Declaration
procedure GetHistogram(Hist: pointer; Content: THistogramKind = [hkRed, hkGreen, hkBlue, hkGray, hkHue]); overload;
function GetHistogram(Content: THistogramKind = [hkRed, hkGreen, hkBlue, hkGray, hkHue]): TIEHistogram; overload;
Description
First overload fills
Hist with the histogram of the current image.
Hist is a pointer to
THistogram array (Image will be converted to ie24RGB).
Second overload returns a dynamic array which contains 256, 360 or 65536 items, and works natively with 8 and 16 bit gray scale images.
Content specifies which color component to calculate. If only hkHue is specified a 360 items histogram is created.
Note:
◼If the image
PixelFormat is not one of ie8g, ie16g, ie24RGB, it will be converted
◼To output a histogram to an image, use
IEDrawHistogramToBitmap
◼To display histograms for an image, you can use the
THistogramBox component
| Demos\ImageEditing\EveryMethod\EveryMethod.dpr |
Image Testing
// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

// Output the histogram of the gray-scale level
hist := ImageEnView1.Proc.GetHistogram( [hkGray] );
IEDrawHistogramToBitmap( hist, bmp, ImageEnView2.ClientWidth, ImageEnView2.ClientHeight,
[hkGray], hsFilledLines, iehsLinearClipped );
ImageEnView2.Update();

// Output the histogram of the RGB level
hist := ImageEnView1.Proc.GetHistogram( [hkRed, hkGreen, hkBlue] );
IEDrawHistogramToBitmap( hist, bmp, ImageEnView2.ClientWidth, ImageEnView2.ClientHeight,
[hkRed, hkGreen, hkBlue], hsFilledLines, iehsLinearClipped );
ImageEnView2.Update();

// Output the histogram of the hue level
Hist := ImageEnView1.Proc.GetHistogram( [hkHue] );
IEDrawHistogramToBitmap( hist, bmp, ImageEnView2.ClientWidth, ImageEnView2.ClientHeight,
[hkHue], hsFilledLines, iehsLinearClipped );
ImageEnView2.Update();
