In this post we describe another important element in the Scorpion Vision framework were we want to explain that
Python SMARTscript is Dynamic Configuration
Scripting supplements the ease of point & click configuration to develop more accurate, robust and smarter 2D and 3D machine vision solutions.
This example, SDP-0147 DynamicResultPythonScript, uses an image of three valves. The image is from an old and simple 2D robot vision solution. The example is made to be an inspiration for Scorpion Vision developers.
The example shows how a simple script can do the following operations:
- PreCornerFilter image using the STC-0011-ImageFilter 22.214.171.124
- FindCornerCandidates using the Blob4 tool
- Display the filter image using a color palette.
- Cluster the candidates using a smart python script
- Display the clusters and the results using the STC-0013-DisplayResult 126.96.36.199
- Create the ClusterArea for each Cluster – STC-0100-PolygonCreator2D 188.8.131.52
- Display the ClusterArea
This is the 4th post in series of Scorpion Vision Software important tool improvements included in upcoming – Scorpion Vision XII.
Python makes Scorpion an Open Flexible Development Platform
Python is an integral part of Scorpion Vision Software. It makes Scorpion Vision an open, extendable and flexible development platform for the most advanced machine vision solutions.
Easy to import major Open-Source libraries like OpenCV 3, Numpy and SciPy.
- Beautiful is better than ugly
- Explicit is better than implicit
- Simple is better than complex
- Complex is better than complicated
- Readability counts
PreCornerFilter image using the STC-0011-ImageFilter 184.108.40.206
The ImageFilter Scorpion Tool Component is very useful. The filter string does the following:
- m3 – median filter image block size 3
- p11,0.0005 – precornerfilter image with size 11 and scale 0.0005
- X normalises the image
The image below shows the input image and the filtered image with a color palette.
FindCornerCandidates using the Blob4 tool
The Blob4 tool locates the strongest peaks from the precorner filter to find corner candidates
Cluster the candidates using a Smart Script
The core clustering uses a KDTree from Scipy to cluster all corner candidates. The script locates the largest cluster – removes repeatably the candidates in the largest cluster MaxIterations times and clusters again.
Display the clusters and the results using the STC-0013-DisplayResult 220.127.116.11
The DisplayResult displays the cluster string C1=(3,(315.7,334.2),11) in the image.
Create the ClusterArea for each Cluster – STC-0100-PolygonCreator2D 18.104.22.168
The polygon creator uses the result from ClusterScript to create a polygon describing the cluser area.
Display the ClusterArea
Scorpion Tools in Action
The following Scorpion Tools and STCs, Scorpion Tool Components, are used in the demo profile SDP-0147 DynamicResultPythonScript – 22.214.171.124
- PreCornerFilter – STC-0011-ImageFilter 126.96.36.199
- FindCornerCandidates – Tool 87 – Blob4
- ClusterScript – Tool 3 – PythonScript
- ClusterN – STC-0013-DisplayResult 188.8.131.52
- CircleN – STC-0100-PolygonCreator2D 184.108.40.206