Declaration
procedure cmp(rhs: TIEVisionImage; dest: TIEVisionImage; cmpOp: TIEVisionCmpOp); overload; safecall;
procedure cmp(rhs: Double; dest: TIEVisionImage; cmpOp: TIEVisionCmpOp); overload; safecall;
Description
Perform a per-element comparison of two images or an image and scalar value.
| Parameter | Description |
| rhs | Right-side image to compare |
| dest | Container for the results |
| cmpOp | Compare operation |
Note:
◼The images being compared must be the same size and color depth
◼You should allocate the destination image to the same size as the compare images
Demo
| Demos\ImageEditing\EveryMethod\EveryMethod.dpr |
Examples
ImageEnView1.IO.LoadFromFile( 'D:\im.jpg' );
ImageEnView2.IO.LoadFromFile( 'D:\im2.jpg' );
// Allocate destination image
DestIEViewer1.IEBitmap.Allocate( ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height );
ImageEnView1.IEBitmap.GetIEVisionImage().cmp( ImageEnView2.IEBitmap.GetIEVisionImage(),
DestIEViewer1.IEBitmap.GetIEVisionImage(),
ievEQUAL );
DestIEViewer1.Update();
// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

// Compare the left half of the image with the right half (white pixels are equal)
bw := ImageEnView1.IEBitmap.Width;
bh := ImageEnView1.IEBitmap.Height;
bmp := TIEBitmap.Create( ImageEnView1.IEBitmap, Rect( 0, 0, bw div 2 - 1, bh - 1 )); // Left half
bmp2 := TIEBitmap.Create( ImageEnView1.IEBitmap, Rect( bw div 2, 0, bw - 1, bh - 1 )); // Right half
ImageEnView1.IEBitmap.Allocate( bmp.Width, bmp.Height, bmp.PixelFormat );
bmp.GetIEVisionImage().cmp( bmp2.GetIEVisionImage(), ImageEnView1.IEBitmap.GetIEVisionImage(), ievEQUAL );
ImageEnView1.Update(); // Show changes in our viewer
bmp.Free();
bmp2.Free();
See Also
◼CompareWith
◼ComputeImageEquality
◼GetHash