ImageEn

Preview of Geometric Methods


The "Every Method" editing demo allows you to preview 300 editing, analysis and effects methods.


Image Editing Methods
Analysis Methods
Color Adjustment Methods
Color Depth Methods
Detection Methods
Effects Methods
Filter Methods
Geometric Methods
Painting and Alpha Methods
Smoothing Methods
Other Methods
Interactive Tools

 Test Images

ImageEnView1.IO.LoadFromFile( 'D:\ImageTest1.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
                         ]);

  

// Crop the image to a random shape
ImageEnView1.Proc.Crop( 0, 0, ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height, TIEShape( Random( ord( High( TIEShape )) - 1 )), clNone, False );

  


 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 );




 thinPlateSplineShapeTransform (IEVision)

// Apply a Thin Plate Spline Shape Transformation to an image
srcPoints := IEVisionLib().createVectorPoint2f();
dstPoints := IEVisionLib().createVectorPoint2f();

// Create a four point selection of the middle third of the image
// TL
srcPoints.push_back( IEVisionPoint2f( 50, 50 ));
dstPoints.push_back( IEVisionPoint2f( 50, 50 ));
// TR
srcPoints.push_back( IEVisionPoint2f( 250, 50 ));
dstPoints.push_back( IEVisionPoint2f( 250, 50 ));
// BR
srcPoints.push_back( IEVisionPoint2f( 50, 250 ));
dstPoints.push_back( IEVisionPoint2f( 50, 250 ));
// BL
srcPoints.push_back( IEVisionPoint2f( 250, 250 ));
dstPoints.push_back( IEVisionPoint2f( 300, 300 ));    // Offset bottom right to edge

im := SourceIEViewer.IEBitmap.GetIEVisionImage().thinPlateSplineShapeTransform( srcPoints, dstPoints );
DestIEViewer.IEBitmap.AssignIEVisionImage( im );

  


 Warp

// Push the center of the image to the right
ImageEnView1.Proc.Warp( Point( 150, 150 ), 25, 0, 50 );

  


 JoinBitmaps

// Joining two bitmaps that are 300px wide with some overlapping content

   


// Join two images horizontally and display them (without checking for overlapping content)
bmpL := TIEBitmap.Create();
bmpR := TIEBitmap.Create();
bmpL.Read( 'D:\JoinBitmap_Left.png' );
bmpR.Read( 'D:\JoinBitmap_Right.png' );
ImageEnView1.Proc.JoinBitmaps( bmpL, bmpR, False, clNone );
bmpL.Free();
bmpR.Free();

// Result is 600px wide - Overlap remains


// Join two images horizontally and display them (performing a non-exhaustive search for overlapping content)
bmpL := TIEBitmap.Create();
bmpR := TIEBitmap.Create();
bmpL.Read( 'D:\JoinBitmap_Left.png' );
bmpR.Read( 'D:\JoinBitmap_Right.png' );
ImageEnView1.Proc.JoinBitmaps( bmpL, bmpR, False, clNone, True, 0.99 );
bmpL.Free();
bmpR.Free();

// Result is 477px wide - Small amount of overlap remains


// Join two images horizontally and display them (performing anon-exhaustive search for overlapping content)
bmpL := TIEBitmap.Create();
bmpR := TIEBitmap.Create();
bmpL.Read( 'D:\JoinBitmap_Left.png' );
bmpR.Read( 'D:\JoinBitmap_Right.png' );
ImageEnView1.Proc.JoinBitmaps( bmpL, bmpR, False, clNone, True, 0.8, True );
bmpL.Free();
bmpR.Free();

// Result is 473px wide - Overlap is correctly removed




See Also

Analysis Methods
Color Adjustment Methods
Color Depth Methods
Detection Methods
Effects Methods
Filter Methods
Geometric Methods
Painting and Alpha Methods
Smoothing Methods
Other Methods
Interactive Tools