You are here: Start » FIL.NET » Function Reference » Computer Vision » Template Matching » FIL.CreateGrayModel
Creates a model for NCC or SAD template matching.
Namespace: | FilNet |
---|---|
Assembly: | FIL.NET.dll |
Syntax
public static void CreateGrayModel ( FilNet.Image inImage, NullableRef<FilNet.Region> inTemplateRegion, FilNet.Rectangle2D? inReferenceFrame, int inMinPyramidLevel, int? inMaxPyramidLevel, float inMinAngle, float inMaxAngle, float inAnglePrecision, float inMinScale, float inMaxScale, float inScalePrecision, FilNet.GrayModel outGrayModel, out FilNet.Point2D outGrayModelPoint, IList<FilNet.Image> diagTemplatePyramid )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() | inImage | FilNet.Image | Image from which model will be extracted. | ||
![]() | inTemplateRegion | FilNet.NullableRef<FilNet.Region> | Region of the image from which model will be extracted. Default value: ftl::NIL. | ||
![]() | inReferenceFrame | FilNet.Rectangle2D? | Exact position of the model object in the image. Default value: ftl::NIL. | ||
![]() | inMinPyramidLevel | int | <0, 12> | 0 | Defines the index of the lowest reduced resolution level used to speed up computations. Default value: 0. |
![]() | inMaxPyramidLevel | int? | <0, 12> | Defines the number of reduced resolution levels used to speed up computations. Default value: ftl::NIL. | |
![]() | inMinAngle | float | 0.0f | Start of range of possible rotations. Default value: 0.0f. | |
![]() | inMaxAngle | float | 0.0f | End of range of possible rotations. Default value: 0.0f. | |
![]() | inAnglePrecision | float | <0.001f, 10.0f> | 1.0f | Defines angular resolution of the matching process. Default value: 1.0f. |
![]() | inMinScale | float | <0.0f, INF> | 1.0f | Start of range of possible scales. Default value: 1.0f. |
![]() | inMaxScale | float | <0.0f, INF> | 1.0f | End of range of possible scales. Default value: 1.0f. |
![]() | inScalePrecision | float | <0.001f, 10.0f> | 1.0f | Defines scale resolution of the matching process. Default value: 1.0f. |
![]() | outGrayModel | FilNet.GrayModel | Created model that can be used by LocateMultipleObjects_NCC and LocateMultipleObjects_SAD filters. | ||
![]() | outGrayModelPoint | FilNet.Point2D | The middle point of the created model. | ||
![]() | diagTemplatePyramid | System.Collections.Generic.IList<FilNet.Image> | Visualization of the model at different resolution levels. |
Description
The operation creates a Gray Matching model for the object represented in inTemplateRegion region in inImage image. The resulting model can be matched against any image using the LocateMultipleObjects_NCC filter or the LocateMultipleObjects_SAD filter.
The model consists of a pyramid of iteratively downsampled images, the original image being the first of them. The inMaxPyramidLevel parameter determines how many additional images of the pyramid shall be computed. Greater inMaxPyramidLevel values can speed up matching process considerably, but it should be set so the image on the highest pyramid level is not too distorted.
The inMinAngle and inMaxAngle parameters describe possible rotation angles of the model, i.e. only those object occurrences will be later found by LocateMultipleObjects_NCC (or LocateMultipleObjects_SAD) whose rotation angles are in the range <inMinAngle,inMaxAngle>. The inAnglePrecision parameter controls the angular resolution of the matching process. The model is created in several rotations. The angles of consecutive rotations differ by an angle step from each other. The value of this angle step is determined on the basis of inAnglePrecision. Its value represents the multiplicity of the automatically computed angle step used as an actual step. So the greater inAnglePrecision is, the greater accuracy can be achieved and the lower is the chance of missing object occurrences. In practice however increasing inAnglePrecision above a certain threshold (unique for every object) does not increase the accuracy, only the computation time.
The inReferenceFrame is a characteristic rectangle, the position of which will be returned by LocateMultipleObjects_NCC (or LocateMultipleObjects_SAD) as an occurrence of the object. By default, it is set to the bounding box of the inTemplateRegion.
Remarks
Read more about Local Coordinate Systems in Machine Vision Guide: Local Coordinate Systems.
Additional information about Template Matching can be found in Machine Vision Guide: Template Matching
Hardware Acceleration
This operation supports automatic parallelization for multicore and multiprocessor systems.
Hardware acceleration settings may be manipulated with Settings class.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Incorrect scale range in CreateGrayModel. |
DomainError | Minimal pyramid level cannot be greater than maximal pyramid level in CreateGrayModel. |
DomainError | Region of interest exceeds an input image in CreateGrayModel. |
Function Overrides
- CreateGrayModel(Image, Int32, Single, Single, Single, Single, Single, Single, GrayModel)
- CreateGrayModel(Image, NullableRef<Region>, Nullable<Rectangle2D>, Int32, Nullable<Int32>, Single, Single, Single, Single, Single, Single, GrayModel)
- CreateGrayModel(Image, NullableRef<Region>, Nullable<Rectangle2D>, Int32, Nullable<Int32>, Single, Single, Single, Single, Single, Single, GrayModel, NullableValue<Point2D>)
- CreateGrayModel(Image, NullableRef<Region>, Nullable<Rectangle2D>, Int32, Nullable<Int32>, Single, Single, Single, Single, Single, Single, GrayModel, NullableValue<Point2D>, IList<Image>)