// Load test image ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );
CalcAverageRGB // Return the average RGB values of the selection (with sample size of 100) rgb := ImageEnView1.Proc.CalcAverageRGB( 100 ); s := format( 'Average RGB: %d, %d, %d', [ rgb.r, rgb.g, rgb.b ]);
ImageTest1.jpg: Average RGB: 138, 106, 86 ImageTest2.jpg: Average RGB: 245, 218, 144 ImageTest3.jpg: Average RGB: 102, 91, 82
CalcImageNumColors // Return the number of colors found in the image n := ImageEnView1.Proc.CalcImageNumColors(); s := format( 'Color count: %d', [ n ]);
ImageTest1.jpg: Color count: 62008 ImageTest2.jpg: Color count: 15910 ImageTest3.jpg: Color count: 21283
CalcImageTransparency // Return the percentage of pixels that are partially or fully transparent ImageEnView1.Proc.SetTransparentColors( CreateRGB(192, 192, 192), CreateRGB(255, 255, 255), 0 ); // Make colors similar to white transparent d := ImageEnView1.Proc.CalcImageTransparency(); s := format( 'Image Transparency: %d%%', [ Round( d * 100 )]);
CalcStdDev // Return the Standard Deviation of the image d := ImageEnView1.Proc.CalcStdDev(); s := 'Standard Deviation: ' + FloatToStr( d );
ImageTest1.jpg: Standard Deviation: 59.55442 ImageTest2.jpg: Standard Deviation: 66.16412 ImageTest3.jpg: Standard Deviation: 78.59620
GetDominantColor // Return the most common color in the image (and its percentage of the image) d := ImageEnView1.Proc.GetDominantColor( rgb ); s := format( 'Dominant Color (%d%%): %s', [ Round( d ), ColorToHex( TRGB2TColor( rgb )) ]);
ImageTest1.jpg: Dominant Color (0%): #060606 ImageTest2.jpg: Dominant Color (39%): #FFFFFF ImageTest3.jpg: Dominant Color (20%): #1C1C1C
GetCMYKChannels // Return the Cyan channel of the image bmp1 := ImageEnView1.Proc.GetCMYKChannels( 0 );
// Return the Magenta channel of the image bmp1 := ImageEnView1.Proc.GetCMYKChannels( 1 );
// Return the Yellow channel of the image bmp1 := ImageEnView1.Proc.GetCMYKChannels( 2 );
// Return the Key (black) channel of the image bmp1 := ImageEnView1.Proc.GetCMYKChannels( 3 );
GetHSVChannel // Return the Hue channel of the image bmp1 := ImageEnView1.Proc.GetHSVChannel( 0 );
// Return the Saturation channel of the image bmp1 := ImageEnView1.Proc.GetHSVChannel( 1 );
// Return the Value channel of the image bmp1 := ImageEnView1.Proc.GetHSVChannel( 2 );
GetRGBChannel // 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 );
SeparateObjects // Show detected objects in the image ImageEnView1.Proc.SaveUndo(); ImageEnView1.Proc.ConvertToBWThreshold( 80 ); // Better detection rects := ImageEnView1.Proc.SeparateObjects( 4, True, 10 ); ImageEnView1.Proc.Undo(); // Get full color image back ImageEnView1.IEBitmap.IECanvas.DrawRects( rects, clRed, 2 ); // Output object count ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Objects: %d', [ rects.Count ]), 'Arial', 10, clRed, [fsBold] ); ImageEnView1.Update; rects.free;