pointPolygonTest
import { pointPolygonTest } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Performs a point-in-contour test.
The function determines whether the point is inside a contour, outside, or lies on an edge (or coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. Otherwise, the return value is a signed distance between the point and the nearest contour edge.
See below a sample output of the function where each image pixel is tested against the contour:

pointPolygonTest(contour: Mat, pt: Point2f, measureDist: boolean): number;contourInput contour.
ptPoint tested against the contour.
measureDistIf true, the function estimates the signed distance from the point to the nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.
The number result.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.