ImgCropTrapezoid

Top  Previous  Next

Prototype

 

ImgCropTrapezoid(intImageHandle, intLeftCorner1, intTopCorner1, intLeftCorner2, intTopCorner2,intLeftCorner3, intTopCorner3,intLeftCorner4, intTopCorner4,  intColorBack)

 

Description

 

Effettua un taglio trapezoidale dell’immagine

 

Parameters

 

intImageHandle: numeric value corresponding to image handle.

 

intLeftCorner1..4 : numeric  value corresponding to left coordinate of each trapezoid angle point

 

intTopCorner1..4: numeric  value corresponding to top coordinate of each trapezoid angle point

 

intColorBack:numeric  value corresponding to background color

 

 

Returned Value

 

None.

 

Notes

 

None.

 

Example

 

// image size

W:=ImgGetWidth(_CurrentImage);

H:=ImgGetHeight(_CurrentImage);

 

// Calculate binding area

YStart:=0;

YEnd:=H-1;

XStart:=Round((W/11)*5);

XEnd:=Round((W/11)*6);

 

//Set tolerance to 5%

Noise:=-5; // 5% of pixels surrounding white holes

 

// Find binding line

L:=ImgfindbindingbyValleys(_CurrentImage,XStart,YStart,XEnd,YEnd,Noise);

 

// Find Line coordinates

XTop:=ImgLineGetX1(L);

XBottom:=ImgLineGetX2(L);

 

// deallocate handle

ImgLineFree(L);

 

if (XTop<>-1) and (XBottom<>-1) then

begin

 

 // Duplicate the handle of image

 OtherPage:=ImgDuplicate(_CurrentImage);

 

 // crop image left side

 ImgCropTrapezoid(_CurrentImage,0,0,XTop,0,XBottom,H-1,0,H-1,0);

 

 // crop image rigth side

 ImgCropTrapezoid(OtherPage,XTop,0,W-1,0,W-1,H-1,XBottom,H-1,0);

...