This interface expose APIs to create/modify/manipulate/draw a LPV region object (LRectRegion , LRotRectRegion , LCircleRegion , etc.). More...
Public Member Functions | |
ILCompoundRegion * | Add (ILRegion *other) |
void | Drag (LPVRoiHandle roiHandle, int x, int y, double zoomX, double zoomY, double panX, double panY) |
void | Draw (HDC hdc, BOOL drawHandles, double zoomX, double zoomY, double panX, double panY) |
void | EnableHandle (LPVRoiHandle roiHandle, BOOL enabled) |
LPVRoiHandle | HitTest (int x, int y, double zoomX, double zoomY, double panX, double panY) |
ILCompoundRegion * | Intersect (ILRegion *other) |
ILCompoundRegion * | Invert () |
void | MapFromImage (double imagePointX, double imagePointY, double *regionPointX, double *regionPointY) |
ILObject * | MapObjectFromImage (ILObject *imageObject) |
ILObject * | MapObjectToImage (ILObject *regionObject) |
void | MapToImage (double regionPointX, double regionPointY, double *imagePointX, double *imagePointY) |
void | ReduceImage (ILImage *image, ILImage **newImage, ILImage **newMask) |
ILRegion * | Rotate (double da) |
ILRegion * | RotateAndTranslate (double x, double y, double newX, double newY, double da) |
ILRegion * | Scale (double factorX, double factorY) |
ILCompoundRegion * | Subtract (ILRegion *other) |
ILImage * | ToMask (int w, int h) |
ILRegion * | Translate (double offsetX, double offsetY) |
ILCompoundRegion * | Union (ILRegion *other) |
ILCompoundRegion * | XOR (ILRegion *other) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
Properties | |
LPVInterpolationMethod | InterpolationMethod [get, set] |
The interpolation method used in image reduction. | |
double | ReduceAngle [get, set] |
The angle of the reduced result. By default, it's 0. A non-zero value means we'll rotated the reduced result image by the angle clockwise. More... | |
double | ReduceScale [get, set] |
The scale of the reduced result. By default, it's 1. Change this value to scale the reduced result image. More... | |
This interface expose APIs to create/modify/manipulate/draw a LPV region object (LRectRegion , LRotRectRegion , LCircleRegion , etc.).
Region object is useful to restrict the detection and inspection to required region.
To use this interface, you should create a region object.
There are several ways to modify a region's placement. The most popular options are listed below:
ILCompoundRegion* Add | ( | ILRegion * | other | ) |
Add the current and provided region, output a new one, P' = P + other. Same as Union(), parts in either regions are all included.
[in] | other | The region to be union-ed. |
newRegion | Return a new result compound region. |
void Drag | ( | LPVRoiHandle | roiHandle, |
int | x, | ||
int | y, | ||
double | zoomX, | ||
double | zoomY, | ||
double | panX, | ||
double | panY | ||
) |
Move the specified handle to a new position and update placement of the region.
[in] | roiHandle | Handle identifier, usually it's returned by HitTest(). |
[in] | x | The x-coordinate of the cursor position. |
[in] | y | The y-coordinate of the cursor position. |
void Draw | ( | HDC | hdc, |
BOOL | drawHandles, | ||
double | zoomX, | ||
double | zoomY, | ||
double | panX, | ||
double | panY | ||
) |
Draw the region onto the provided device context.
[in] | drawHandles | Whether to draw the handles |
void EnableHandle | ( | LPVRoiHandle | roiHandle, |
BOOL | enabled | ||
) |
Enable or disable the input handle. The disabled wouldn't be drawn and dragged. Not-supported handles are ignored.
By default, all handles are enabled.
[in] | roiHandle | Handle identifier |
[in] | enabled | Enable or not. |
LPVRoiHandle HitTest | ( | int | x, |
int | y, | ||
double | zoomX, | ||
double | zoomY, | ||
double | panX, | ||
double | panY | ||
) |
Detect if the cursor is placed over one of the dragging handles.
[in] | x | The x-coordinate of the cursor position. |
[in] | y | The y-coordinate of the cursor position. |
roiHandle | Return a handle identifier. |
ILCompoundRegion* Intersect | ( | ILRegion * | other | ) |
Intersect the current and provided region, output a new one, P' = P ∩ other. Parts in both regions are included.
[in] | other | The region to be intersected. |
newRegion | Return a new result compound region. |
ILCompoundRegion* Invert | ( | ) |
Create a copy of the region that is inverted.
newRegion | Return a new result compound region. |
void MapFromImage | ( | double | imagePointX, |
double | imagePointY, | ||
double * | regionPointX, | ||
double * | regionPointY | ||
) |
Map the pixel position from the image to the region's local coordinates.
[in] | imagePointX | The x-coordinate of the pixel position in image coordinates. |
[in] | imagePointY | The y-coordinate of the pixel position in image coordinates. |
[out] | regionPointX | Return the x-coordinate of the pixel position in the region's local coordinates. |
[out] | regionPointY | Return the y-coordinate of the pixel position in the region's local coordinates. |
Map the given object's position from image to the region's local coordinates.
[in] | imageObject | The positional LPV object in the image coordinates. It's usually some geometric shape, or detection result which implemented the ISortable or ISortables interface. |
regionObject | Return the transformed LPV object of the same type as the input, in the region's local coordinates. |
Map the given object's position from the region's local coordinates to the image.
[in] | regionObject | The positional LPV object in the region's local coordinates. It's usually some geometric shape, or detection result which implemented the ISortable or ISortables interface. |
imageObject | Return the transformed LPV object of the same type as the input, in the image coordinates. |
void MapToImage | ( | double | regionPointX, |
double | regionPointY, | ||
double * | imagePointX, | ||
double * | imagePointY | ||
) |
Map the pixel position from the region's local coordinates to the image.
[in] | regionPointX | The x-coordinate of the pixel position in the region's local coordinates. |
[in] | regionPointY | The y-coordinate of the pixel position in the region's local coordinates. |
[out] | imagePointX | Return the x-coordinate of the pixel position in image coordinates. |
[out] | imagePointY | Return the y-coordinate of the pixel position in image coordinates. |
Reduce the provided image to current region. All pixels outside the bounding rectangle of the region is excluded, if the region is not a rectangle, a region mask image is generated, with pixels inside the region as white, others as black.
[in] | image | The input image to be reduced. |
[out] | newImage | Output the result image. |
[out] | newMask | Output the result mask. Could be null if you don't want it. |
ILRegion* Rotate | ( | double | da | ) |
Create a copy of the region that is rotated by provided delta angle, around the center of the region.
Notes: The rotated LRectRegion or LMaskRegion may looks bigger than the original, as we use the bounding rect of the rotated vertexes as region.
[in] | da | The rotated delta angle. |
newRegion | Return the transformed new region of the same type as the input. |
ILRegion* RotateAndTranslate | ( | double | x, |
double | y, | ||
double | newX, | ||
double | newY, | ||
double | da | ||
) |
Create a copy of the region that is the transformation based on the translation and rotation of the specified anchor point. The relative position of the region and the anchor point is not changed.
[in] | x | The x-coordinate of the anchor point's current position. |
[in] | y | The y-coordinate of the anchor point's current position. |
[in] | newX | The x-coordinate of the anchor point's new position. |
[in] | newY | The y-coordinate of the anchor point's new position. |
[in] | da | The rotated delta angle of the anchor point. |
newRegion | Return the rotated and translated new region of the same type as the input. |
ILRegion* Scale | ( | double | factorX, |
double | factorY | ||
) |
Create a copy of the region that is scale by provided zoom factor, the region's center is not changed.
Notes: Anisotropic scaling is not supported for a LCircleRegion or a LAnnulusRegion object.
[in] | factorX | Factor for zooming in or out in the x-coordinate direction. |
[in] | factorY | Factor for zooming in or out in the x-coordinate direction. |
newRegion | Return the transformed new region of the same type as the input. |
ILCompoundRegion* Subtract | ( | ILRegion * | other | ) |
Subtract the provided region from the current region, output a new one, P' = P - other.
[in] | other | The region to be subtracted. |
newRegion | Return a new result compound region. |
ILImage* ToMask | ( | int | w, |
int | h | ||
) |
Create a mask image out of the region, the mask is of w * h size. Pixels inside the region as white, others as black.
[in] | w | The width of the mask image. |
[in] | h | The height of the mask image. |
newRegion | Return the generated mask image . |
ILRegion* Translate | ( | double | offsetX, |
double | offsetY | ||
) |
Create a copy of the region that is moved by offset, relative to current position, P' = P + offset.
[in] | offsetX | Offset in the x-coordinate direction. |
[in] | offsetY | Offset in the y-coordinate direction. |
newRegion | Return the transformed new region of the same type as the input. |
ILCompoundRegion* Union | ( | ILRegion * | other | ) |
Union the current and provided region, output a new one, P' = P U other. Same as Add(), parts in either regions are all included.
[in] | other | The region to be union-ed |
newRegion | Return a new result compound region. |
ILCompoundRegion* XOR | ( | ILRegion * | other | ) |
Calculate the symmetric difference of the current and provided region, output a new one, P' = P XOR other. The parts in and only in one of regions are included.
[in] | other | The region to perform the operation. |
newRegion | Return a new result compound region. |
|
getset |
The angle of the reduced result.
By default, it's 0. A non-zero value means we'll rotated the reduced result image by the angle clockwise.
|
getset |
The scale of the reduced result.
By default, it's 1. Change this value to scale the reduced result image.