ImageEn, unit ievision

TIEVisionImage.warpPerspective

TIEVisionImage.warpPerspective


Declaration

function warpPerspective(M: TIEVisionMatrix; destSize: TIEVisionSize; interpolation: TIEVisionInterpolation = ievLINEAR; borderMode: TIEVisionBorderType = ievBORDER_CONSTANT; inverseMap: bool32 = false): TIEVisionImage; overload; safecall;
function warpPerspective(M: TIEVisionMatrix; destSize: TIEVisionSize; interpolation: TIEVisionInterpolation; borderMode: TIEVisionBorderType; const borderValue: TIEVisionScalar; inverseMap: bool32 = false): TIEVisionImage; overload; safecall;


Description

Apply a perspective transformation to an image.

Parameter Description
M 3x3 transformation matrix
destSize Size of the output image
interpolation Interpolation method (ievNEAREST or ievLINEAR)
borderMode Border mode (ievBORDER_CONSTANT or ievBORDER_REPLICATE)
borderValue Border color (B, G, R, 0)
inverseMap Sets M as the inverse transformation

Returns the warped image.

Using Homography to correct the perspective of an image:



Note: A shortcut method for this is available: OrbDetectAndDeskew


Demo

Demo  Demos\IEVision\ImageAlignment\ImageAlignment.dpr


Example

// warps img1 (TIEBitmap) using hmat matrix to a 1000x1000 bitmap
imgres := img1.GetIEVisionImage().warpPerspective(hmat, IEVisionSize(1000, 1000));
ImageEnView1.IEBitmap.AssignIEVisionImage(imgres);

// warps img1 (TIEBitmap) using hmat matrix to a 1000x1000 bitmap, with a red (scalar 0,0,255,0) border
imgres := img1.GetIEVisionImage().warpPerspective(hmat, IEVisionSize(1000, 1000), ievNEAREST, ievBORDER_CONSTANT, IEVisionScalar(0, 0, 255, 0));
ImageEnView1.IEBitmap.AssignIEVisionImage(imgres);


See Also

detect
findHomography