EasyFindVectorLearn
Support |
|
||||||||||
Required licenses |
EasyFind |
||||||||||
Recommended images |
Any gray level image from the folder Sample Images\EasyFind |
||||||||||
Location |
Matching and Measurement\EasyFindVectorLearn \ Python: Matching and Measurement \Console samples\ |
||||||||||
![]()
|
Purpose
EasyFind learns then finds patterns inside images.
This sample program demonstrates how to:
□ | Use EasyFind with vectorized learning patterns. In this mode, learning is done on collections of 2D geometrical shapes rather than rasterized patterns. |
□ | Open a DXF or Open eVision vector model with File > Open Model. Right-click to change the polarity of a transition. |
□ | Save the vector model with the edited polarity. |
□ | Learn the pattern with the button Learn. |
□ | Open a search image and find the pattern with the button Find . |
Code highlights
1. | Define a model as a collection of shapes. |
EVectorModel vectorModel;
2. | Load the vector model from a file. |
vectorModel.Load(fileName);
3. | Load the vector model from a DXF file. |
vectorModel.LoadDXF(fileName);
4. | Set the scale of the vector model with respect to the search image. |
vectorModel.GetRoot().GetWorldShape()->SetScale(fScale);
5. | Set the polarity of any shape in the vector model. |
shape.SetProperty(“polarity”,”direct”);
6. | Learn a vector pattern. |
patternfinder.Learn(vectorModel);
7. | Find the pattern that you previously learned inside the image. |
► | Retrieve the results as a vector of EFoundPatterns. |
std::vector<EFoundPattern> foundPatterns = patternfinder.Find(image);
8. | Draw the vector model and show the polarity as arrows pointing from a dark to light transition. |
vectorModel.Draw(…);
9. | Draw a found pattern in the same reference frame as the search image. |
foundPatterns[n].Draw(…);