OpenCV  4.0.0
Open Source Computer Vision
Remapping

Prev Tutorial: Hough Circle Transform

Next Tutorial: Affine Transformations

Goal

In this tutorial you will learn how to:

a. Use the OpenCV function cv::remap to implement simple remapping routines.

Theory

What is remapping?

Code

Explanation

This is expressed in the following snippet. Here, map_x represents the first coordinate of h(i,j) and map_y the second coordinate.

Result

  1. After compiling the code above, you can execute it giving as argument an image path. For instance, by using the following image:

    Remap_Tutorial_Original_Image.jpg
  2. This is the result of reducing it to half the size and centering it:

    Remap_Tutorial_Result_0.jpg
  3. Turning it upside down:

    Remap_Tutorial_Result_1.jpg
  4. Reflecting it in the x direction:

    Remap_Tutorial_Result_2.jpg
  5. Reflecting it in both directions:

    Remap_Tutorial_Result_3.jpg