ImageEn, unit imageenproc

Geometric Method Testing


Testing of Geometric Methods


These images were generated using the demo:
\Demos\InputOutput\EveryMethod\EveryMethod.dpr

All Test Results
- Analysis Methods
- Color Adjustment Methods
- Color Depth Methods
- Alpha and Painting Methods
- Effects Methods
- Geometric Methods
- Filter Methods
- Smoothing Methods
- Other Methods


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

  


 CropSel

// Make circular selection of entire image and crop
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.SelectEllipse(ImageEnView1.IEBitmap.Width div 2,
                           ImageEnView1.IEBitmap.Height div 2,
                           ImageEnView1.IEBitmap.Width,
                           ImageEnView1.IEBitmap.Height);
ImageEnView1.Proc.CropSel();

  


 Crop

// Crop 25% of all sides of the image
ImageEnView1.Proc.Crop( ImageEnView1.IEBitmap.Width div 4,
                        ImageEnView1.IEBitmap.Height div 4,
                        MulDiv( ImageEnView1.IEBitmap.Width, 3, 4 ),
                        MulDiv( ImageEnView1.IEBitmap.Height, 3, 4 ));

  

// Crop 10% from top-left corner, and 30% from bottom-right corner and stretch
// by specifying 4 points (which will become the new corners)
x1 := MulDiv( ImageEnView1.IEBitmap.Width, 10, 100 );
y1 := MulDiv( ImageEnView1.IEBitmap.Height, 10, 100 );
x2 := ImageEnView1.IEBitmap.Width - MulDiv( ImageEnView1.IEBitmap.Width, 30, 100 );
y2 := ImageEnView1.IEBitmap.Height - MulDiv( ImageEnView1.IEBitmap.Height, 30, 100 );
ImageEnView1.Proc.Crop([ DPoint( x1, y1 ), // Top-Left corner
                         DPoint( ImageEnView1.IEBitmap.Width, 0 ), // Top-right corner
                         DPoint( x2, y2 ), // Bottom-right corner
                         DPoint( 0, ImageEnView1.IEBitmap.Height ) // Bottom-Left corner
                         ]);

  


 Flip

// Flip the image horizontally
ImageEnView1.Proc.Flip( fdHorizontal );

  


 ImageResize

// Add a black border to the image
ImageEnView1.Proc.ImageResize( ImageEnView1.IEBitmap.Width + 20,
                               ImageEnView1.IEBitmap.Height + 20,
                               iehCenter, ievCenter,
                               255, clBlack );

  


 Resample

// Scale the image to half size
ImageEnView1.Proc.Resample( 0.5, rfLanczos3 );

  


 Rotate

// Rotate the image 90° counter-clockwise
ImageEnView1.Proc.Rotate( 90 );

  


 RotateAndCrop

// Rotate the image 15° counter-clockwise and crop to maintain only image area
ImageEnView1.Proc.RotateAndCrop( 15, ierBicubic, 0, iecaAngledPhoto );

  


 RoundImage

// Add round corners to the image
ImageEnView1.Proc.RoundImage( ImageEnView1.IEBitmap.Width div 10,
                              ImageEnView1.IEBitmap.Height div 10 );

  


 ShiftChannel

// Shift to -5 horizontally and -2 vertically in the Blue channel, filling new areas with 0
ImageEnView1.Proc.ShiftChannel( -5, -2, iecBlue, 0 );

  


 PerspectiveDraw

// Perspective drawing image offset on left
yOffset := 0;
ImageEnView1.IEBitmap.Allocate( 300, 300, clBlack );
ImageEnView1.Proc.PerspectiveDraw( srcBMP, // Source image
                                   0, yOffset, // Top-left
                                   ImageEnView1.IEBitmap.Width - 1, 0, // top-Right
                                   ImageEnView1.IEBitmap.Width - 1, ImageEnView1.IEBitmap.Height - 1, // Bottom-right
                                   0, ImageEnView1.IEBitmap.Height - yOffset, // Bottom-left
                                   -1, -1, true);

  


 AutoCrop

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



// Remove any black border from the image (with tolerance of 30)
ImageEnView1.Proc.AutoCrop( 30, clBlack );




 CropTransparentBorder

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



// Remove any transparent area from the edge of the image
ImageEnView1.Proc.CropTransparentBorder();




 RadialStretch



// Minor correction of pin cushion effect in image
a := 0.045;
b := 0;
c := 0;
d := 1.0 - (a+b+c);
ImageEnView1.Proc.RadialStretch( a, b, c, d,
                                 a, b, c, d,
                                 a, b, c, d );




 CalcOrientation

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



// Automatically rotate a document
n := ImageEnView1.Proc.CalcOrientation();
ImageEnView1.Proc.Rotate( n );




 SkewDetection

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

 

// Check for skew within the range -15 to 15 with 0.1 degrees of precision and automatically orient (for printed text)
d := ImageEnView1.Proc.SkewDetection( ImageEnView1.IEBitmap.Width div 4, 30, 0.1, false );
ImageEnView1.Proc.RotateAndCrop( d, ierBicubic );

 


 SkewDetectionFine

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

 

// Check for skew within the range -5 to 5 with 0.1 degrees of precision and automatically orient (for printed text)
d := ImageEnView1.Proc.SkewDetectionFine( 0, 0.1, 10, True );
ImageEnView1.Proc.RotateAndCrop( d, ierBicubic );

 



See Also

- Analysis Methods
- Color Adjustment Methods
- Color Depth Methods
- Alpha and Painting Methods
- Effects Methods
- Geometric Methods
- Filter Methods
- Smoothing Methods
- Other Methods