Back to FabImage Library website
You are here: Start » Function Reference » Region » Region Basics » CreatePolygonRegion
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Creates a polygonal region corresponding to a given closed path.
Syntax
C++
C#
void fil::CreatePolygonRegion ( const fil::Path& inPolygon, ftl::Optional<const fil::CoordinateSystem2D&> inPolygonAlignment, int inFrameWidth, int inFrameHeight, fil::Region& outRegion, ftl::Optional<fil::Path&> outAlignedPolygon = ftl::NIL )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inPolygon | const Path& | |||
![]() |
inPolygonAlignment | Optional<const CoordinateSystem2D&> | NIL | Adjusts the polygon to the position of the inspected object | |
![]() |
inFrameWidth | int | 0 - 65535 | Width of the created region's frame | |
![]() |
inFrameHeight | int | 0 - 65535 | Height of the created region's frame | |
![]() |
outRegion | Region& | Output region | ||
![]() |
outAlignedPolygon | Optional<Path&> | NIL | The input polygon transformed to the absolute coordinate system |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::NIL
to these parameters: outAlignedPolygon.
Read more about Optional Outputs.
Description
The operation creates a region containing pixels lying inside the shape described by inPolygon.
The inFrameWidth and inFrameHeight parameters most often should be set equal to the dimensions of the image this region will be used with. If the input polygon exceeds these dimensions, the output region will be cropped.
Hints
- Remember to set inFrameWidth and inFrameHeight inputs to specify the region frame.
Examples
![]() |
![]() |
Remarks
- inPolygon has to be a closed path, otherwise an error with appropriate description occurs.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Open path on input in CreatePolygonRegion. |
See Also
- CreateBoxRegion – Creates a rectangular region corresponding to a given box.
- CreateCrossRegion – Creates a cross-shaped region with given parameters.