EasyObjectEChecker2
Support |
|
Required licenses |
EasyObject |
Recommended images |
Any image from the folder Sample Images\EasyObject\Fiducial |
Location |
Matching and Measurement\EasyObjectEChecker2 \ |
Purpose
EChecker2 is a golden template inspection algorithm.
This sample program demonstrates how to:
□ | Specify the inspection area. |
□ | Select fiducials for the localization and the alignment of the inspection area. |
□ | Train the method and apply it on new images. |
Code highlights
1. | Initialize an object EChecker2 with a reference image, a vector of ERegion corresponding to the fiducials and an ERegion corresponding to the region to inspect. |
// Put fiducial regions in vector
std::vector<ERegion*> fiducials;
fiducials.push_back(regions_[RegionID_Fiducial1]);
fiducials.push_back(regions_[RegionID_Fiducial2]);
// Initialize training
checker_.Initialize(referenceImage_, fiducials, *(regions_[RegionID_Inspection]));
2. | Train the checker with a vector of training images. |
NOTE: | As all the parameters of EChecker have an influence on how the model is built, you must restart the model creation if any of these parameters is changed. |
// Train
checker_.SetInspectionTolerance(5.0f);
checker_.Train(images);
3. | Inspect an image and filter the list of defects based on their area. |
► | The result of a EChecker inspection is an object EasyObject ECodedImage2. |
// Inspect Image
checker_.Inspect(image, codedImage_);
// Clear defect selection
defects_.Clear();
// Select defects on area
defects_.AddObjects(codedImage_);
defects_.RemoveUsingUnsignedIntegerFeature(EFeature_Area, 25, ESingleThresholdMode_Less);