TensorMath.getContour
FunctionLooks for contour points in a grayscale texture, or any one-channel tensor.
- Available on all platforms
getContour(
grayscaledTexture,textureShape,threshold,winSize,maxNearCount,outTensor):number
Looks for contour points in a grayscale texture, or any one-channel tensor.
grayscaledTexture - Float32Array of size (width * height). Grayscale texture or one-channel tensor to evaluate
textureShape - Should be {width, height, 1}
threshold - Quality value threshold for found contour points
Each contour point found must satisfy these conditions:
-
The point's quality value should be >=
threshold -
The number of points which have values <
thresholdand lie in the rectangle with left corner vec2(x-winSize, y-winSize) and right corner vec2(x+winSize-1, y+winSize-1) should be <=maxNearCount
outTensor - Float32Array where results are written. Found contour points are written in the format: x0, y0, x1, y1, etc.
The number of points found will not exceed outTensor's size / 2.
Parameters
| Parameter | Type |
|---|---|
grayscaledTexture | Float32Array |
textureShape | vec3 |
threshold | number |
winSize | number |
maxNearCount | number |
outTensor | Float32Array |
Returns
number