Back to Adaptive Vision Library website
You are here: Start » Function Reference » Image Analysis » CheckPresence_EdgeAmount
CheckPresence_EdgeAmount
Verifies object presence by analysing the amount of edges in the specified region.
Syntax
C++
C#
void avl::CheckPresence_EdgeAmount ( const avl::Image& inImage, const avl::ShapeRegion& inRoi, atl::Optional<const avl::CoordinateSystem2D&> inRoiAlignment, avl::GradientMaskOperator::Type inEdgeOperator, avl::MagnitudeMeasure::Type inEdgeMeasure, const int inEdgeScale, int inMinStrength, float inMinAmount, float inMaxAmount, bool& outIsPresent, atl::Optional<float&> outAmount = atl::NIL, atl::Optional<avl::Region&> outForeground = atl::NIL, atl::Optional<avl::ShapeRegion&> outAlignedRoi = atl::NIL )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inImage | const Image& | Input image | |||
inRoi | const ShapeRegion& | Location at which object presence is being checked | |||
inRoiAlignment | Optional<const CoordinateSystem2D&> | NIL | Adjusts the region of interest to the position of the inspected object | ||
inEdgeOperator | GradientMaskOperator::Type | Selected gradient operator | |||
inEdgeMeasure | MagnitudeMeasure::Type | Sum | Selected method of gradient magnitude computation | ||
inEdgeScale | const int | 1 - 16 | 1 | Scales the resulting gradient magnitudes | |
inMinStrength | int | 0 - 255 | 15 | Lowest acceptable edge magnitude | |
inMinAmount | float | 0.0 - 1.0 | 0.2f | Lowest acceptable fraction of pixels meeting the criteria | |
inMaxAmount | float | 0.0 - 1.0 | 1.0f | Highest acceptable fraction of pixels meeting the criteria | |
outIsPresent | bool& | Flag indicating whether the object is present or not | |||
outAmount | Optional<float&> | NIL | Fraction of pixels from meeting the criteria | ||
outForeground | Optional<Region&> | NIL | Region of pixels meeting the criteria | ||
outAlignedRoi | Optional<ShapeRegion&> | NIL | Input ROI after transformation (in the image coordinates) |
Description
The filter extracts foreground pixels and checks if their number comparing to the area of the whole ROI fits the range (inMinAmount, inMaxAmount). The pixel is considered a foreground pixel if and only if its gradient magnitude is at least inMinStrength.
Hints
- If the object location is variable, Pass an appropriate local coordinate system to inRoiAlignment.
- Define inRoi to specify the image location at which the object presence will be checked.
- Set inMinStrength to a value that results in good edges visible on the outForeground output.
- Investigate the values that appear on the outAmount output, then set inMinAmount and inMaxAmount to values appropriate for correct objects.
- When creating data previews, use outAlignedRoi and NOT inRoi as only the former will be properly aligned to the object location.