Shear
Shear the image horizontally or vertically
1. imgShear a:=30 h:=vertical fill:=0;
2. imgShear a :=30 img:=[Mbook1]1!Mat(1) oimg:=<new>;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Angle | a |
Input double |
|
Specifies the amount of shearing, which refers to the angle between the original edges and the changed edge. The value varies between [-45, 45]. A positive value will slide the image clockwise, while a negative value will slide it counterclockwise. |
Direction | h |
Input int |
|
Specifies the shear direction. Option list
|
Input Matrix | img |
Input Image |
|
Specifies the image to be manipulated. The default input is the active image. |
Output Image | oimg |
Output Image |
|
Specifies the output image. By default, the output image is the same as the input image. See the syntax here. |
Fill Color | fill |
Input int |
|
Specifies a color from the Origin color list to be used to fill the background of the output image. |
This X-Function allows user to shear an image, or change the relative geometries of the x- and y-axes of that image. Shearing can change the geometry of an image from a rectangle to a non-rectangular parallelogram, or vice versa. The resulting image will look perspective-shifted to the viewer. Horizontal shearing fixes the length of the horizontal edge and allows the y-axis to change, while vertical shearing performs the same thing by fixing the length of the y-axis and allowing the x-axis to change length. The x- and y- axes can be independently manipulated via separate shearing angles.
Sheared images usually have empty triangles along each edge. These triangles are filled with black by default, but can be filled with a user-specified color from the dialog.
In this example, we use the imgShear function to shear the input image by 30 degree and fill the background of the output image with orange:
The computation uses L_ShearBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_ShearBitmap topic.
LEADTOOLS Main API Help file, Version 14