classPiiDefectGeometryOperation
#include <PiiDefectGeometryOperation.h>
An operation that calculates the geometry of a defect area within a detection window.
Inherits PiiDefaultOperation
Description
The defect is first framed according to its gray level or edges. Then, the geometric properties of the detection area are calculated.
Inputs
Outputs
Classes
| struct | |
| struct | |
| struct |
Properties
|
The type of defect to be detected. |
|
|
The detection type. |
|
|
bool
|
A flag that controls the automatic finding of a suitable gray level threshold. |
|
Feature names (read only). |
|
|
double
|
An absolute threshold for the edge-based detection technique. |
|
double
|
An absolute threshold for the gray level based detection technique. |
Public types
|
enum
|
{ DarkDefect, BrightDefect }
Defect types. |
|
enum
|
{ GrayLevelDetection, EdgeDetection, LevelAndEdgeDetection }
Detection types. |
Constructors and destructor
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
|
( )
|
|
|
( )
|
|
|
bool
|
( )
|
|
( )
|
|
|
double
|
|
|
double
|
( )
|
|
void
|
|
|
void
|
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
Protected member functions
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
DefectType defectType
[read, write]The type of defect to be detected.
Default is
DarkDefect. -
DetectionType detectionType
[read, write]The detection type.
Default is
GrayLevelDetection. -
bool discardExtrema
[read, write]A flag that controls the automatic finding of a suitable gray level threshold.
If set to
true(the default) pixels with the maximum gray level (255 for integer types, 1.0 for floats) will be ignored when looking for dark defects Similarly, pixels with the minimum gray level (0 for all types) will be ignored when looking for bright defects. Set tofalseto disable this behavior. -
QStringList features
[read]Feature names (read only).
-
double gradientThreshold
[read, write]An absolute threshold for the edge-based detection technique.
The default value is 10. Set to 0 to make the operation choose an appropriate threshold value automatically.
-
double levelThreshold
[read, write]An absolute threshold for the gray level based detection technique.
The default value is zero, which causes the threshold to be automatically selected.
Enumeration details
-
enum DefectType
Defect types.
The operation must know whether it is looking for bright or dark defects to be able to reliably frame the defect area.
-
DarkDefect- detected defects are darker than the background -
BrightDefect- detected defects are brighter than the background
-
-
enum DetectionType
Detection types.
The defect area can be framed based on its gray level or edges.
-
GrayLevelDetection- detect the defect area by its darkness/brightness relative to the surroundings. -
EdgeDetection- detect the defect area by its edges. The detection algorithm automatically decides which gradient direction is more reliable and uses either horizontal or vertical gradient to frame the defect area. If neither is a clear winner, both gradient directions will be used. -
LevelAndEdgeDetection- detect defects using both absolute gray levels and edges. The detection algorithm is based on heuristics that won't stand objective judgement, but here's the shameful truth: 1) Defect seeds are fist found by applying both theGrayLevelDetectionand theEdgeDetectionschemes and performing a logicalANDoperation on the results. 2) Detections less than two pixel wide or high are removed from the seeds. 3) The detection is repeated with looser thresholds to find a larger set of defect candidates. 4) If a candidate does not intersect with any of the seeds, it will be discarded. The remaining candidates are the detections for which the geometry will be calculated.
-
Function details
-
PiiDefectGeometryOperation
() -
virtual void check
(- bool reset
[virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
DefectType defectType
() -
DetectionType detectionType
() -
bool discardExtrema
() -
QStringList features
() -
double gradientThreshold
() -
double levelThreshold
() -
void setDefectType
-
void setDetectionType
-
void setDiscardExtrema
(- bool discardExtrema
-
void setGradientThreshold
(- double gradientThreshold
-
void setLevelThreshold
(- double levelThreshold
-
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.