ImageEn, unit imageenproc

TImageEnProc.GetRGBChannel

TImageEnProc.GetRGBChannel


Declaration

function GetRGBChannel(ch: TIEChannel): TIEBitmap; overload;
function GetRGBChannel(ch: TIEChannel; var AveragePct: Double): TIEBitmap; overload;
procedure GetRGBChannel(BitmapR, BitmapG, BitmapB: TIEBitmap); overload;


Description

Return a Bitmap with the specified RGB channel or all three RGB channels. The resulting Bitmap is a gray level representation of the specified channel.
ch is the RGB channel: iecRed, iecGreen, iecBlue.
AveragePct returns the average value for that channel in the image.

To re-create the image from the RGB channel bitmaps, use SetFromRGBChannels.

Note:
If the image PixelFormat is not ie24RGB, it will be converted
You need to free the bitmap returned by GetRGBChannel()


Demos

Demo  Demos\ImageEditing\RGBChannels\RGBChannels.dpr
Demo  Demos\ImageEditing\CompleteEditor\PhotoEn.dpr
Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Image Testing

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Return the Red channel of the image
bmp1 := ImageEnView1.Proc.GetRGBChannel( iecRed );

  

// Return the Green channel of the image
bmp1 := ImageEnView1.Proc.GetRGBChannel( iecGreen );

  

// Return the Blue channel of the image
bmp1 := ImageEnView1.Proc.GetRGBChannel( iecBlue );

  


Overload 1 Example

blue  := ImageEnView1.Proc.GetRGBChannel(iecBlue);
green := ImageEnView1.Proc.GetRGBChannel(iecGreen);
red   := ImageEnView1.Proc.GetRGBChannel(iecRed);

ImageEnView2.IEBitmap.Assign(blue);  // Show Blue channel
ImageEnView3.IEBitmap.Assign(green); // Show Green channel
ImageEnView4.IEBitmap.Assign(red);   // Show Red channel

ImageEnView2.Update();
ImageEnView3.Update();
ImageEnView4.Update();

blue .Free():
green.Free():
red  .Free():


Overload 2 Example

ImageEnView1.Proc.GetRGBChannel(ImageEnViewRed.IEBitmap, ImageEnViewGreen.IEBitmap, ImageEnViewBlue.IEBitmap);
ImageEnViewRed.Update();
ImageEnViewGreen.Update();
ImageEnViewBlue.Update();