title: OpenCV: Remap axis direction?
body: <p>When I study the CV2.remap() function, the result sometime does not looks like same as my expectation.</p>
  <p>I am very confused about this function, perhaps it related to matrix dot and remap mechanism, but I cannot figure it out from the CV2 <a href="https://docs.opencv.org/3.4/d1/da0/tutorial_remap.html" rel="nofollow noreferrer">manual</a>.</p>
  <p>Source code in python 3.x:</p>
  <pre><code>def test_image_remap(self):
      image218time52 = cv2.imread(&quot;C:\\Users\\mac\\sample\\cvaxis.png&quot;)
      x_size = 52
      y_size = 218
      u = np.zeros((x_size, y_size), dtype=np.float32)(52, 218)#u.shape = (52, 218)
      v = np.zeros((x_size, y_size), dtype=np.float32)         #v.shape = (52, 218)
      ybase, xbase = np.mgrid[:image218time52.shape[0], :image218time52.shape[1]]
      map1 = (xbase + u).astype(np.float32) #map1.shape = (52, 218)
      map2 = (ybase + v).astype(np.float32) #map2.shape = (52, 218)
      warped = cv2.remap(image218time52, map1, map2, cv2.INTER_LINEAR)
  
      cv2.imshow('warped_image.png', warped)
      cv2.imwrite(&quot;.//result.png&quot;, warped)
      cv2.waitKey()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/vxhj0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vxhj0.png" alt="cvaxis.png" /></a></p>
  <p>This is the source file cvaxis.png, it is 218 by 52 (w, h), however in the source code it defines x_size = 52 and y_size = 280 and the map1 shape is (52,218).</p>
  <p>I tried to change it to x_size = 218, y_size = 52 and the code does not run.</p>
  <p>Why the CV2.remap() asking its map1 shape is (52,218) when source picture is (218,52)?</p>
  <p>Thank you.</p>