STClib module¶

exception
STClib.
BaseToolWarning
¶ Bases:
exceptions.Warning

exception
STClib.
DynamicTagError
¶ Bases:
exceptions.Exception

STClib.
extendBaseToolSelf
(self)¶ Factory function that supplies and extends a BaseTool instance with methods and properties found in the associated Tool instance given by calling GetTool(self.name).
The self parameter should be an instance of the python wrapper object for scorpion tools as given by the self parameter in BaseTool classes or as returned by the Tool.pyinst attribute.

STClib.
boxEdges
(b=None)¶

STClib.
toPinhole
(cam, other, p)¶ Convert points p from other tool to normalized pinhole coord corresponding with camera calibration given in tool cam (typically an ExternalRefeerence3D tool or equivalent)

STClib.
objToPixViaPin
(cam, p, pinObj=None)¶ Convert points, p given in arbitray object coord to pixel coord that correspond with the camera calibration given in ‘cam’ (typically an ExternalReference3D tool or equivalent). The transformation from the cameras pinhole coordinates to p’s coord must be given by the optional 3x3 matrix (M33f) pinObj.
When pinObj=None the result is a pure pin to pix transformation.

STClib.
pixToObjViaPin
(cam, p, pinObj=None)¶ Convert points p given in pixel coord of camera with calibration given in tool cam (typically an ExternalReference3D tool or equivalent). The transformation from the cameras pinhole coordinates to the coordinates of p must be given by the optional 3x3 matrix (M33f) pinObj.
When pinObj=None the result is a pure pix to pin transformation.

STClib.
toResultRef
(trails)¶

STClib.
arr2tuple
(a)¶ Converts various vector formats to a Scorpion edible tuples.

STClib.
parseClipboardPolygon
(clp)¶

STClib.
trueRuns
(m)¶ Find index pairs that mark start and end of consecutive runs of true values in m. Returns Nx2 matrix.

STClib.
sameSignIntervals
(y)¶ Finds consecutive nonzero intervals in y that have the same sign. Returns list of tuples (a,b,p) where the interval is given by y[a:b] and p is true if the sign is positive.

STClib.
boundingBoxFilter
(points, bbox, pose=None, nmin=0)¶ Remove points that are outside a 3D bounding box.
points  possibly nested list or tuple of arrays of points. bbox  ((xMin,xMax),(yMin,yMax),(zMin,zMax)) or c_Box3f pose  optional pose (c_Pose3f) of the bounding box. Used when points
and bbox are given in different reference systems. points are multiplied by pose before they are filtered. nmin  optional minimum number of points returned per point array.
 Useful to make sure returned trails are nontrivial.
 returns  points as possibly nested list of arrlibct Arr of c_XYZf.
 numpy arraylike structures will be converted to Arr of c_XYZf.

STClib.
getRefToolRefSys
(tool, float32=True)¶

STClib.
getRefToolPose
(tool, float32=True)¶

STClib.
changeRefSys
(fromRefTool, toRefTool, p, makefloat32=True)¶ Transform 2D and 3D points between reference systems given by fromRefTool and toRefTool.
The result is normally returned as c_XYf, c_XYZf or an array of these. If the optional argument makefloat32 is not true the result will have a precision (float32 or float64) corresponding with the input data type. Output with float64 precision are represented by XYd or XYZd.
Note that the result is always an arrlibct object. Arrays may be converted to numpy objects by the toNumpy() method. The XY* singleton objects behave like numpy objects when indexed.

STClib.
polygonCorners
(plg, resamp, presmoo, smoo, diagData=False)¶ Find corner candidates in a closed polygon. plg  polygon as a n x 2 arraylike object resamp  approximate step length with which the polygon will be resampled.
The step length is rounded to ensure uniformly spaced resampling. Resmapling is disabled ff bool(resamp)==False. presmoo  Number of smoothing iterations prior to resampling. Each iteration
 convolves the polygon with [0.25 0.5 0.25]. This may result in a more uniform resampling, but also may remove high curvature details.
 smoo  Halfwidth of gaussian low pass filter used to remove irrelevant high
 frequency features on the polygon. have a positive curvature. Zero disables this filter.
 diagData  Flag that optionally enables the return of additional diagnostic
 data: k,dk  see results description below.
Results: ———
plg  The polygon used, same as input unless resampling is enabled. cornerInd  Array of indices to the points in plg which have been identified
as corner points. curvature  Array of curvature (inverse radius of osculating circle) for
 each corner found.
 cornerness  Array of cornerness values for each of the corners found. Cornerness
 is a value indicating how distinguised the point is as a dominant feature of the polygon. It is basically the absolute curvature value multiplied by the smallest absolute value of the adjacent pair of peaks in the curvature derivative.
 k  Optional, raw curvature values.
 Useful for diagnostic graphing. See diagData parameter above.
 dk  Optional, raw curvature derivative values.
 Useful for diagnostic graphing. See diagData parameter above.

STClib.
pathCorners
(pth, resamp, presmoo, smoo, diagData=False)¶ Find corner candidates in a path (open polygon). pth  path as a n x 2 arraylike object resamp  approximate step length with which the path will be resampled.
The step length is rounded to ensure uniformly spaced resampling. Resmapling is disabled ff bool(resamp)==False. presmoo  Number of smoothing iterations prior to resampling. Each iteration
 convolves the path with [0.25 0.5 0.25]. This may result in a more uniform resampling, but also may remove high curvature details.
 smoo  Halfwidth of gaussian low pass filter used to remove irrelevant high
 frequency features on the polygon. have a positive curvature. Zero disables this filter.
 diagData  Flag that optionally enables the return of additional diagnostic
 data: k,dk  see results description below.
Results: ———
pth  The path used, same as input unless resampling is enabled. cornerInd  Array of indices to the points in pth which have been identified
as corner points. curvature  Array of curvature (inverse radius of osculating circle) for
 each corner found.
 cornerness  Array of cornerness values for each of the corners found. Cornerness
 is a value indicating how distinguised the point is as a dominant feature of the path. It is basically the absolute curvature value multiplied by the smallest absolute value of the adjacent pair of peaks in the curvature derivative.
 k  Optional, raw curvature values.
 Useful for diagnostic graphing. See diagData parameter above.
 dk  Optional, raw curvature derivative values.
 Useful for diagnostic graphing. See diagData parameter above.