getRectSubPix
import { getRectSubPix } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Retrieves a pixel rectangle from an image with sub-pixel accuracy.
The function getRectSubPix extracts pixels from src:
patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)
where the values of the pixels at non-integer coordinates are retrieved using bilinear interpolation. Every channel of multi-channel images is processed independently. Also the image should be a single channel or three channel image. While the center of the rectangle must be inside the image, parts of the rectangle may be outside.
See: warpAffine, warpPerspective
getRectSubPix(image: Mat, patchSize: Size, center: Point2f, patch: Mat, patchType: number): void;2 available overloads
getRectSubPix(image: Mat, patchSize: Size, center: Point2f, patch: Mat): void;getRectSubPix(image: Mat, patchSize: Size, center: Point2f, patch: Mat, patchType: number): void;imageSource image.
patchSizeSize of the extracted patch.
centerFloating point coordinates of the center of the extracted rectangle within the source image. The center must be inside the image.
patchOutput destination, filled by the native operation. Extracted patch that has the size patchSize and the same number of channels as src .
patchTypeDepth of the extracted pixels. By default, they have the same depth as src .
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.