Shear the image horizontally or vertically
Command Line Usage
1. imgShear a:=30 h:=vertical fill:=0;
2. imgShear a :=30 img:=[Mbook1]1!Mat(1) oimg:=<new>;
X-Function Execution Options
Please refer to the page for additional option switches when accessing the x-function from script
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.
Specifies the shear direction.
- Slides the image horizontal edge along the X axis
- Slides the image vertical edge along the Y axis
Specifies the image to be manipulated. The default input is the active image.
Specifies the output image. By default, the output image is the same as the input image.
See the syntax here.
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:
- When the image is active, select Image: Geometric Transform: Shear to open the dialog of the X-Function.
- In the dialog, change the settings as the screenshot below and click OK to close the dialog.
A new image is created. It is the shared image.
The original image
The output image
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
imgRotate, imgFlip, imgTrim, imgCrop, imgResize