You are here: Start » FIL.NET » Function Reference » Computer Vision » Template Matching » FIL.LocateMultipleObjects_Edges2
Finds all occurrences of a predefined template on an image by comparing object edges.
Namespace: | FilNet |
---|---|
Assembly: | FIL.NET.dll |
Syntax
public static void LocateMultipleObjects_Edges2 ( FilNet.Image inImage, FilNet.EdgeModel2 inEdgeModel, int inMinPyramidLevel, float inEdgeThreshold, FilNet.EdgePolarityMode inEdgePolarityMode, FilNet.EdgeNoiseLevel inEdgeNoiseLevel, bool inIgnoreBoundaryObjects, int inMaxDeformation, float inMinScore, float inMinDistance, IList<FilNet.Object2D> outObjects )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() | inImage | FilNet.Image | Image on which object occurrences will be searched. | ||
![]() | inEdgeModel | FilNet.EdgeModel2 | Model of objects to be searched. | ||
![]() | inMinPyramidLevel | int | <0, 12> | 0 | Defines the lowest pyramid level at which object position is still refined. Default value: 0. |
![]() | inEdgeThreshold | float | <0.01f, INF> | 10.0f | Minimum strength of edges used for matching with the model. Default value: 10.0f. |
![]() | inEdgePolarityMode | FilNet.EdgePolarityMode | MatchStrictly | Defines how edges with reversed polarity will contribute to the object score. Default value: MatchStrictly. | |
![]() | inEdgeNoiseLevel | FilNet.EdgeNoiseLevel | High | Defines how much noise the objects edges have. Default value: High. | |
![]() | inIgnoreBoundaryObjects | bool | False | Flag indicating whether objects crossing image boundary should be ignored or not. Default value: False. | |
![]() | inMaxDeformation | int | <0, INF> | 0 | Maximal distance in pixels between model edge and an edge visible in the input image. Default value: 0. |
![]() | inMinScore | float | <0.0f, 1.0f> | 0.7f | Minimum score of object candidates accepted at each pyramid level. Default value: 0.7f. |
![]() | inMinDistance | float | <0.0f, INF> | 10.0f | Minimum distance between two found objects. Default value: 10.0f. |
![]() | outObjects | System.Collections.Generic.IList<FilNet.Object2D> | Found objects. |
Description
The operation matches the object model, inEdgeModel, against the input image, inImage. The inSearchRegion region restricts the search area so that only in this region the centers of the objects can be presented. The inMinScore parameter determines the minimum score of the valid object occurrence. The inMinDistance parameter determines minimum distance between any two valid occurrences (if two occurrences lie closer than inMinDistance from each other, the one with greater score is considered to be valid).
In the inImage every pixel with gradient's magnitude at least inEdgeThreshold is considered an edge pixel. Only those are later used during the matching process. To establish the value of this threshold properly the diagEdgePyramid output which shows all the edges with sufficient gradient's magnitude may be used. If the inEdgePolarityMode parameter is set to Ignore, the object occurrences in the inImage image do not have necessarily to have the same contrast as the object in the model image.
The computation time of the filter depends on the size of the model, the sizes of inImage and inSearchRegion, but also on the value of inMinScore. This parameter is a score threshold. Based on its value some partial computation can be sufficient to reject some locations as valid object instances. Moreover, the pyramid of the images is used. Thus, only the highest pyramid level is searched exhaustively, and potential candidates are later validated at lower levels. The inMinPyramidLevel parameter determines the lowest pyramid level used to validate such candidates. Setting this parameter to a value greater than 0 may speed up the computation significantly, especially for higher resolution images. However, the accuracy of the found object occurrences can be reduced. Larger inMinScore generates less potential candidates on the highest level to verify on lower levels. It should be noted that some valid occurrences with score above this score threshold can be missed. On higher levels score can be slightly lower than on lower levels. Thus, some valid object occurrences which on the lowest level would be deemed to be valid object instances can be incorrectly missed on some higher level. The diagMatchPyramid output represents all potential candidates recognized on each pyramid level and can be helpful during the difficult process of the proper parameter setting.
The outObjects.Point array contains the model reference points of the matched object occurrences. The corresponding outObjects.Angle array contains the rotation angles of the objects. The corresponding outObjects.Match array provides information about both the position and the angle of each match combined into value of Rectangle2D type. Each element of the outObjects.Alignment array contains informations about the transform required for geometrical objects defined in the context of template image to be transformed into object in the context of corresponding outObjects.Match position. This array can be later used e.g. by 1D Edge Detection or Shape Fitting categories filters.
Examples
Following example locates an EdgeModel object for loaded mounts.jpg image. It is a part of the bigger Basic Template Matching Example.
List<Object2D> matches = new List<Object2D>(); FIL.LoadImage("mounts.jpg", false, inspectingImage); if (model.HasValue) { FIL.LocateMultipleObjects_Edges1( inspectingImage, model.Value, 0, 10.0f, EdgePolarityMode.MatchStrictly, EdgeNoiseLevel.High, false, 0.8f, 20.0f, matches); }

Locating multiple objects with the edge-based method.
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.
Function Overrides
- LocateMultipleObjects_Edges2(Image, NullableRef<ShapeRegion>, Nullable<CoordinateSystem2D>, EdgeModel2, Int32, Nullable<Int32>, Single, EdgePolarityMode, EdgeNoiseLevel, Boolean, Int32, Single, Single, IList<Object2D>)
- LocateMultipleObjects_Edges2(Image, NullableRef<ShapeRegion>, Nullable<CoordinateSystem2D>, EdgeModel2, Int32, Nullable<Int32>, Single, EdgePolarityMode, EdgeNoiseLevel, Boolean, Int32, Single, Single, IList<Object2D>, NullableRef<SafeList<SafeList<Path>>>, NullableValue<Int32>, NullableRef<ShapeRegion>)
- LocateMultipleObjects_Edges2(Image, NullableRef<ShapeRegion>, Nullable<CoordinateSystem2D>, EdgeModel2, Int32, Nullable<Int32>, Single, EdgePolarityMode, EdgeNoiseLevel, Boolean, Int32, Single, Single, IList<Object2D>, IList<SafeList<Path>>, Int32, ShapeRegion, IList<Image>, IList<Image>, IList<List<Single>>)
- LocateMultipleObjects_Edges2(Image, NullableRef<ShapeRegion>, Nullable<CoordinateSystem2D>, EdgeModel2, Int32, Nullable<Int32>, Single, EdgePolarityMode, EdgeNoiseLevel, Boolean, Int32, Single, Single, IList<Object2D>, NullableRef<SafeList<SafeList<Path>>>, NullableValue<Int32>, NullableRef<ShapeRegion>, IList<Image>, IList<Image>, IList<List<Single>>)