Crop image to a rectangle area
1. imgCrop x:=0 y:=0 w:=100 h:=100;
2. imgCrop x=:10 y=:10 w:=50 h:=50 img:=mat(1) oimg:=mat(2);
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 |
---|---|---|---|---|
X Coordinate | x |
Input int |
|
Specifies the X coordinate of the top-left corner of the rectangle area to be kept. |
Y Coordinate | y |
Input int |
|
Specifies the Y coordinate of the top-left corner of the rectangle area to be kept. |
Width | w |
Input int |
|
Specifies the width (in pixels) of the rectangle area to be kept. |
Height | h |
Input int |
|
Specifies the height (in pixels) of the rectangle area to be kept. |
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. |
The imgCrop function crops the image to a specified rectangle area. You can use it to extract useful part and remove unneeded parts from the image.
In this example, we use the imgCrop function to cut an rectangle area that contains only one cell from the input image:
The computation uses L_TrimBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_TrimBitmap topic.
LEADTOOLS Main API Help file, Version 14