Search code examples
opencvremap

opencv:: remap() function


cv::remap(imageA,
          dst1,
          map_x,
          map_y,
          cv::INTER_LINEAR,
          cv::BORDER_CONSTANT,
          cv::Scalar(0,0,0));

can any body explain cv::INTER_LINEAR and cv::BORDER_CONSTANT for me? Except this, what does other option like BORDER_TRANSPARENT mean? Please list all the options and explanations. Thank you very much in advance.


Solution

  • remap() will apply a generic geometrical transformation to an image.

    can any body explain cv::INTER_LINEAR and cv::BORDER_CONSTANT for me?

    cv::INTER_LINEAR is the parameter for setting interpolation method, i.e. to use the bilinear interpolation. Besides this, there are other methods you can use:

    • INTER_NEAREST - a nearest-neighbor interpolation
    • INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood
    • INTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhood

    cv::BORDER_CONSTANT is the parameter for setting pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the “outliers” in the source image are not modified by the function.


    P.S.: for such questions, you can easily find useful info from OpenCV's online documentation.