Skip to content

borderInterpolate

Core and matricesfunctionOpenCV 5.0.0
import { borderInterpolate } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSp, len, borderType
FUNCTIONborderInterpolate
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Computes the source location of an extrapolated pixel.

The function computes and returns the coordinate of a donor pixel corresponding to the specified extrapolated pixel when using the specified extrapolation border mode. For example, if you use cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img, it looks like:

    float val = img.at<float>(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
                              borderInterpolate(-5, img.cols, cv::BORDER_WRAP));

Normally, the function is not called directly. It is used inside filtering functions and also in copyMakeBorder.

See: copyMakeBorder

borderInterpolate(p: number, len: number, borderType: number): number;
p

0-based coordinate of the extrapolated pixel along one of the axes, likely <0 or >= len

len

Length of the array along the corresponding axis.

borderType

Border type, one of the #BorderTypes, except for #BORDER_TRANSPARENT and #BORDER_ISOLATED. When borderType==#BORDER_CONSTANT, the function always returns -1, regardless of p and len.

Returns

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.