[][src]Function opencv::core::border_interpolate

pub fn border_interpolate(p: i32, len: i32, border_type: i32) -> Result<i32>

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:

This example is not tested
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.

Parameters

  • 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.

See also

copyMakeBorder