ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Transforms an image by applying perspective correction.
Example
srcImg is Image = "Rubiks_cubes.jpg"
dstImg is Image = srcImg
dstImg.FillColor = LightOrange

srcPoly is Polygon
Add(srcPoly.Point, [SLD_SRC_TL, SLD_SRC_TL])
Add(srcPoly.Point, [srcImg.Width - SLD_SRC_TL, SLD_SRC_TL])
Add(srcPoly.Point, [srcImg.Width - SLD_SRC_TL, srcImg.Height - SLD_SRC_TL])
Add(srcPoly.Point, [SLD_SRC_TL, srcImg.Height - SLD_SRC_TL])

dstPoly is Polygon
Add(dstPoly.Point, [SLD_SRC_TL, SLD_SRC_TL])
Add(dstPoly.Point, [srcImg.Width - SLD_SRC_TL, SLD_SRC_TL + SLD_Right])
Add(dstPoly.Point, [srcImg.Width - SLD_Bottom-SLD_SRC_TL, srcImg.Height - SLD_Right - SLD_SRC_TL])
Add(dstPoly.Point, [SLD_SRC_TL + POT_Bottom, srcImg.Height - SLD_SRC_TL])

srcImg = srcImg.Crop(SLD_SRC_TL, SLD_SRC_TL, srcImg.Width - SLD_SRC_TL, srcImg.Height - SLD_SRC_TL)

IMG_Image = dst_Img

IF IMG_Image.Straighten(srcPoly, dstPoly) = False THEN
Error()
END
Syntax

Straightening an image in a destination polygon Hide the details

<Result> = <Image control>.Straighten(<Source polygon> , <Destination polygon>)
<Result>: Boolean
  • True if the transformation has been applied,
  • False otherwise.
<Image control>: Control name
Name of the Image control to be used.
<Source polygon>: Polygon variable
Name of the Polygon variable used to define the area to be transformed. This polygon must be a quadrilateral.
<Destination polygon>: Polygon variable
Name of the Polygon variable used to define the area that contains the transformed image. The coordinates of this quadrilateral are used to define the transformation. The source quadrilateral is transformed into the destination quadrilateral.

Straightening an image in a destination rectangle Hide the details

<Result> = <Image control>.Straighten(<Source polygon> [, <Destination rectangle>])
<Result>: Boolean
  • True if the transformation has been applied,
  • False otherwise.
<Image control>: Control name
Name of the Image control to be used.
<Source polygon>: Polygon variable
Name of the Polygon variable used to define the area to be transformed. This polygon must be a quadrilateral.
<Destination rectangle>: Optional Rectangle variable
Name of the Rectangle variable used to define the area that contains the transformed image. The coordinates of this rectangle are used to define the transformation. The image contained in the source quadrilateral will be transformed to fit the destination rectangle.
If this parameter is not specified, a rectangle is automatically generated.
Remarks
  • Any part of the image outside the <Source polygon> is lost in the transformation. The resulting image will not contain these elements.
  • The resulting image will be contained in a rectangle around the <Destination polygon>. The result is placed at coordinates (0,0).
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/21/2023

Send a report | Local help