Up | Example 01 - Calculate Area | Example 02 - Calculate mean value | Example 03 - Manipulate the results from two LineFinders | Example 04 - Dynamic threshold | Example 05 - Auto Exposure | Example 06 - DrawLine | Example 07 - Overlays | Example 08 - Python Objects | Example 09 - Timing | Example 10 - Image Averaging | Example 11 - Image Resampling | Example 12 - Constant Contrast | Example 13 - Serial Communication | Example 14 - Python results | Example 15 - Making a result string | Example 16 - Running tools from a script | Example 17 - Image Manipulation using Python Scripting | Example 18 - Calculating the median angle | Example 19 - Iterating objects located by a blob | Example 20 - Resampling using non-linear calibration | Example 21 - Custom Scorpion Python extension | Example 22 - Accessing Image Pixels | Example 23 - Implementing a tcp/ip Socket Server | Example 24 - Setting ExternalReference from calculated four points | Example 25 - Rotating a reference around in a circle | Example 26 - Grabbing an image from an MOXA Video IP Server | Example 27 - Toolbox Switch | Example 28 - Color Matcher Iteration | Example 29 - Audio Notification | Example 30 - Windows MessageBox | Example 31 -  Client to tcp Socket Server | Example 32 -  Read / Write External Data from / to file | Example 33 - Changing a tool's ROI | Example 34 - Histogram Equalization | Example 35 - Robust Adam 6060 scripts | Example 36 - Bubblesort | Example 37 - Element Statistics | Example 38 - Saving 3D Image | Example 39 - Disabling Zoom in Image Windows | Example 40 - Filtering timeseries | Example 41 - Scorpion Watchdog keep system running | Example 42 - Binary Search | Example 43 - Creating an ordered pointcloud | Example 44 - UDP Socket Communication

 

  

 
Example 14 - Python results

A number of tools returns results as python string. These results contains array of scalars or points.

A typical result string looks like this:

((190.41,208.87),(190.61,225.7),(190.9,242.52),(191.18,259.35),(191.34,276.18))

Example:

pointStr = GetValue('Edges.Edge points')

print ' python string : ', pointStr
points = eval(pointStr)

print ' points as list ', points

print ' length of list : ', len(points[0])

print ' first element : ',points[0][0]
print ' x : ',points[0][0][0]
print ' y : ',points[0][0][1]

Output in the console windows:

python string : (((190.41,208.87),(190.61,225.7),(190.9,242.52),(191.18,259.35),(191.34,276.18),(191.5,293.28),(191.85,310.3),(191.98,327.08),(192.08,343.8),(192.35,360.52),(192.59,377.24),(192.76,393.89),(192.86,410.55),(193.03,427.3),(193.34,444.04),(19
3.61,460.77),(193.75,477.44),(193.95,494.18),(194.2,510.92),(194.42,527.67),(194.59,544.41),),)

points as list (((190.41, 208.87), (190.61000000000001, 225.69999999999999), (190.90000000000001, 242.52000000000001), (191.18000000000001, 259.35000000000002), (191.34, 276.18000000000001), (191.5, 293.27999999999997), (191.84999999999999, 310.30000000000001), (191.97999999999999, 327.07999999999998), (192.08000000000001, 343.80000000000001), (192.34999999999999, 360.51999999999998), (192.59, 377.24000000000001), (192.75999999999999, 393.88999999999999), (192.86000000000001, 410.55000000000001), (193.03, 427.30000000000001), (193.34, 444.04000000000002), (193.61000000000001, 460.76999999999998), (193.75, 477.44), (193.94999999999999, 494.18000000000001), (194.19999999999999, 510.92000000000002), (194.41999999999999, 527.66999999999996), (194.59,544.40999999999997)),)

length of list : 21

first element : (190.41, 208.87)

x : 190.41
y : 208.87
 

 

 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.