Example 1: Locate a long hole on a chain saw sword
To separate a long hole from other blob can be a little challenge - with
the feature classification features in scorpion this is easy. In the example
below six blob are found and returned as blob results.
Feature Classification Setup
To classes are defined
Long has one reference of a long hole. The no hole class is used to add
references of other blobs of no interest.
A maximum distance of 5 is defined. Automatic weight calculation is
selected.
The classification vector consists of the following results:
- Contour area
- Circularity
- Axis Ratio
- Angle
This result vector defines a good vector space.
Results after activating Feature Classification
Only the long hole is accepted and returned as a result and no result
validation is required.
Example 2: Iterate all center on a toolbox component
ring = GetTool('VerifyRing')
img = GetImageMatr('Image')
center = GetResultValue('tf3.AllCenters')
for pos in center:
ring.executeCmd('SET','OBJECT=CENTER;VALUE=((%.4f,%.4f,0))' % (pos[0],pos[1]))
ring.execute(img)