title: Image warping in OpenCV
body: <p>I am rather new to Python (basic knowledge) and almost ignorant of OpenCV.
  I need to "warp" an image of curved arcs to make them straight. I thought of using OpenCV.</p>
  
  <p>The image in this <a href="https://drive.google.com/file/d/0B0dqKGVhLqweblcyV2lSWWtUQk0/view?usp=sharing" rel="nofollow noreferrer">link</a> illustrates my problem (sorry, am new and dont have the credentials to embed images...).</p>
  
  <p>On the left is the original image with the position of a few arcs overplotted in green.
  On the right is the original image and the desired position for the straight lines.</p>
  
  <p>I was following the instructions and code by <a href="https://stackoverflow.com/a/10374811/3953234">Heslil</a> for a similar problem given in a very nice post <a href="https://stackoverflow.com/questions/10364201/image-transformation-in-opencv">"Image transformation in OpenCV"</a></p>
  
  <p>and using the positions of the green dots as "source" and red dots as "destination".
  But for some reason the grid_z variable that contains the dense mapping only contains NaN.</p>
  
  <p>Here is the code, simply copy/paste of Heslil answer to the above mentioned post:</p>
  
  <pre><code>import cv2
  from scipy.interpolate import griddata
  import numpy as np
  
  # read image 
  orig = cv2.imread("test3.png")
  
  grid_x, grid_y = np.mgrid[0:orig.shape[0], 0:orig.shape[1]]
  source = np.array([[33.95,0],[70.6,0],[83.5,0],[110.98,0],[147.84,0],[166.79,0],[176.16,0],[196.13,0],[204.8,0],[227.5,0],[248.21,0],[264.21,0],[276.57,0],[296.71,0],[304.67,0],[33.73,10],[70.42,10],[83.37,10],[110.76,10],[147.6,10],[166.61,10],[175.97,10],[195.94,10],[204.63,10],[227.36,10],[248.03,10],[264.03,10],[276.41,10],[296.55,10],[304.54,10],[33.57,20],[70.24,20],[83.16,20],[110.58,20],[147.45,20],[166.46,20],[175.76,20],[195.74,20],[204.47,20],[227.18,20],[247.83,20],[263.86,20],[276.24,20],[296.4,20],[304.38,20],[33.36,30],[70.03,30],[82.89,30],[110.34,30],[147.27,30],[166.29,30],[175.59,30],[195.57,30],[204.31,30],[226.97,30],[247.65,30],[263.68,30],[276.05,30],[296.23,30],[304.21,30],[33.13,40],[69.79,40],[82.69,40],[110.21,40],[147.03,40],[166.07,40],[175.4,40],[195.38,40],[204.07,40],[226.76,40],[247.5,40],[263.5,40],[275.83,40],[296.06,40],[304.02,40],[32.87,50],[69.58,50],[82.5,50],[109.99,50],[146.79,50],[165.89,50],[175.23,50],[195.18,50],[203.86,50],[226.6,50],[247.3,50],[263.36,50],[275.65,50],[295.84,50],[303.82,50],[32.63,60],[69.38,60],[82.26,60],[109.71,60],[146.58,60],[165.66,60],[174.98,60],[194.97,60],[203.66,60],[226.41,60],[247.1,60],[263.13,60],[275.47,60],[295.66,60],[303.62,60],[32.43,70],[69.14,70],[82,70],[109.51,70],[146.42,70],[165.46,70],[174.75,70],[194.74,70],[203.47,70],[226.17,70],[246.87,70],[262.89,70],[275.29,70],[295.47,70],[303.44,70],[32.2,80],[68.86,80],[81.75,80],[109.32,80],[146.14,80],[165.23,80],[174.55,80],[194.53,80],[203.03,80],[225.99,80],[246.66,80],[262.7,80],[275.1,80],[295.3,80],[303.26,80],[31.93,90],[68.64,90],[81.57,90],[109.05,90],[145.91,90],[164.99,90],[174.34,90],[194.34,90],[203.05,90],[225.74,90],[246.45,90],[262.51,90],[274.86,90],[295.05,90],[303.03,90],[31.65,100],[68.42,100],[81.33,100],[108.81,100],[145.66,100],[164.73,100],[174.1,100],[194.09,100],[202.78,100],[225.53,100],[246.25,100],[262.28,100],[274.63,100],[294.82,100],[302.81,100],[31.42,110],[68.15,110],[81.04,110],[108.55,110],[145.48,110],[164.5,110],[173.82,110],[193.85,110],[202.55,110],[225.3,110],[246,110],[262.05,110],[274.44,110],[294.61,110],[302.58,110],[31.14,120],[67.85,120],[80.75,120],[108.31,120],[145.2,120],[164.27,120],[173.57,120],[193.61,120],[202.32,120],[225.03,120],[245.74,120],[261.79,120],[274.19,120],[294.4,120],[302.38,120],[30.86,130],[67.62,130],[80.52,130],[108.05,130],[144.9,130],[163.99,130],[173.36,130],[193.35,130],[202.11,130],[224.67,130],[245.54,130],[261.57,130],[273.96,130],[294.19,130],[302.16,130],[30.57,140],[67.35,140],[80.23,140],[107.74,140],[144.65,140],[163.72,140],[173.1,140],[193.11,140],[201.81,140],[224.57,140],[245.32,140],[261.38,140],[273.7,140],[293.93,140],[301.91,140],[30.31,150],[67.06,150],[79.95,150],[107.49,150],[144.37,150],[163.47,150],[172.8,150],[192.84,150],[201.58,150],[224.31,150],[245.04,150],[261.12,150],[273.48,150],[293.67,150],[301.65,150],[29.99,160],[66.72,160],[79.67,160],[107.26,160],[144.16,160],[163.21,160],[172.55,160],[192.58,160],[201.33,160],[224.06,160],[244.77,160],[260.81,160],[273.25,160],[293.44,160],[301.42,160],[29.69,170],[66.47,170],[79.4,170],[106.93,170],[143.83,170],[162.94,170],[172.31,170],[192.32,170],[201.06,170],[223.76,170],[244.53,170],[260.58,170],[272.96,170],[293.22,170],[301.19,170],[29.41,180],[66.2,180],[79.13,180],[106.62,180],[143.54,180],[162.65,180],[172.01,180],[192.04,180],[200.76,180],[223.51,180],[244.27,180],[260.35,180],[272.69,180],[292.93,180],[300.91,180],[29.08,190],[65.82,190],[78.76,190],[106.36,190],[143.37,190],[162.3,190],[171.71,190],[191.75,190],[200.49,190],[223.29,190],[243.98,190],[260.07,190],[272.44,190],[292.65,190],[300.64,190],[28.74,200],[65.51,200],[78.5,200],[106.06,200],[142.99,200],[162.09,200],[171.44,200],[191.48,200],[200.21,200],[222.96,200],[243.68,200],[259.76,200],[272.19,200],[292.42,200],[300.39,200],[28.44,210],[65.25,210],[78.18,210],[105.73,210],[142.71,210],[161.76,210],[171.12,210],[191.18,210],[199.9,210],[222.65,210],[243.43,210],[259.48,210],[271.87,210],[292.14,210],[300.12,210],[28.12,220],[64.92,220],[77.82,220],[105.41,220],[142.39,220],[161.49,220],[170.82,220],[190.84,220],[199.61,220],[222.35,220],[243.15,220],[259.27,220],[271.54,220],[291.82,220],[299.82,220],[27.76,230],[64.56,230],[77.51,230],[105.13,230],[142.08,230],[161.17,230],[170.53,230],[190.56,230],[199.3,230],[222.06,230],[242.85,230],[258.91,230],[271.33,230],[291.55,230],[299.55,230],[27.43,240],[64.27,240],[77.21,240],[104.78,240],[141.75,240],[160.82,240],[170.23,240],[190.28,240],[198.98,240],[221.76,240],[242.53,240],[258.63,240],[271.01,240],[291.29,240],[299.29,240],[27.07,250],[63.89,250],[76.82,250],[104.42,250],[141.43,250],[160.52,250],[169.87,250],[189.94,250],[198.66,250],[221.46,250],[242.25,250],[258.33,250],[270.69,250],[290.98,250],[298.97,250],[26.67,260],[63.51,260],[76.46,260],[104.1,260],[141.06,260],[160.2,260],[169.53,260],[189.61,260],[198.38,260],[221.16,260],[241.91,260],[258.02,260],[270.41,260],[290.65,260],[298.65,260],[26.34,270],[63.2,270],[76.16,270],[103.72,270],[140.72,270],[159.82,270],[169.25,270],[189.31,270],[198.03,270],[220.8,270],[241.59,270],[257.69,270],[270.11,270],[290.37,270],[298.38,270],[25.96,280],[62.8,280],[75.73,280],[103.38,280],[140.37,280],[159.48,280],[168.87,280],[188.92,280],[197.65,280],[220.48,280],[241.28,280],[257.4,280],[269.75,280],[290.05,280],[298.05,280],[25.6,290],[62.48,290],[75.41,290],[103.03,290],[140.01,290],[159.18,290],[168.54,290],[188.58,290],[197.36,290],[220.17,290],[240.94,290],[257.04,290],[269.47,290],[289.71,290],[297.73,290],[25.21,300],[62.09,300],[75.04,300],[102.65,300],[139.66,300],[158.78,300],[168.2,300],[188.26,300],[196.97,300],[219.78,300],[240.6,300],[256.68,300],[269.14,300],[289.4,300],[297.41,300],[24.79,310],[61.68,310],[74.63,310],[102.28,310],[139.34,310],[158.45,310],[167.82,310],[187.88,310],[196.66,310],[219.49,310],[240.28,310],[256.38,310],[268.75,310],[289.07,310],[297.08,310],[24.4,320],[61.3,320],[74.3,320],[101.89,320],[138.91,320],[158.08,320],[167.47,320],[187.54,320],[196.35,320],[219.14,320],[239.91,320],[256.03,320],[268.44,320],[288.7,320],[296.72,320],[24.02,330],[60.88,330],[73.85,330],[101.5,330],[138.6,330],[157.67,330],[167.08,330],[187.19,330],[195.92,330],[218.74,330],[239.56,330],[255.64,330],[268.1,330],[288.39,330],[296.39,330],[23.6,340],[60.51,340],[73.49,340],[101.14,340],[138.22,340],[157.34,340],[166.7,340],[186.78,340],[195.56,340],[218.4,340],[239.21,340],[255.34,340],[267.71,340],[288.05,340],[296.05,340],[23.2,350],[60.11,350],[73.07,350],[100.72,350],[137.8,350],[156.92,350],[166.35,350],[186.43,350],[195.24,350],[218.03,350],[238.82,350],[254.97,350],[267.39,350],[287.64,350],[295.68,350],[22.76,360],[59.67,360],[72.66,360],[100.34,360],[137.41,360],[156.54,360],[165.95,360],[186.05,360],[194.82,360],[217.64,360],[238.45,360],[254.57,360],[267.02,360],[287.34,360],[295.35,360],[22.36,370],[59.29,370],[72.27,370],[99.93,370],[137.02,370],[156.18,370],[165.55,370],[185.65,370],[194.47,370],[217.3,370],[238.1,370],[254.24,370],[266.64,370],[286.95,370],[294.98,370],[21.9,380],[58.85,380],[71.83,380],[99.5,380],[136.56,380],[155.76,380],[165.17,380],[185.28,380],[194.04,380],[216.86,380],[237.7,380],[253.81,380],[266.3,380],[286.58,380],[294.59,380],[21.47,390],[58.4,390],[71.38,390],[99.09,390],[136.14,390],[155.37,390],[164.74,390],[184.85,390],[193.65,390],[216.48,390],[237.34,390],[253.44,390],[265.86,390],[286.23,390],[294.26,390],[21.01,400],[57.98,400],[70.98,400],[98.66,400],[135.75,400],[154.93,400],[164.36,400],[184.46,400],[193.26,400],[216.08,400],[236.92,400],[253.08,400],[265.5,400],[285.81,400],[293.83,400],[20.55,410],[57.52,410],[70.51,410],[98.24,410],[135.37,410],[154.49,410],[163.9,410],[184.04,410],[192.81,410],[215.66,410],[236.53,410],[252.66,410],[265.13,410],[285.45,410],[293.47,410],[20.11,420],[57.09,420],[70.13,420],[97.77,420],[134.92,420],[154.11,420],[163.48,420],[183.62,420],[192.4,420],[215.29,420],[236.13,420],[252.31,420],[264.7,420],[285.06,420],[293.1,420],[19.73,430],[56.62,430],[69.62,430],[97.36,430],[134.49,430],[153.65,430],[163.08,430],[183.23,430],[191.98,430],[214.86,430],[235.68,430],[251.88,430],[264.33,430],[284.64,430],[292.66,430],[19.64,440],[56.19,440],[69.17,440],[96.87,440],[134.02,440],[153.23,440],[162.64,440],[182.76,440],[191.56,440],[214.45,440],[235.33,440],[251.48,440],[263.89,440],[284.28,440],[292.3,440],[18.98,450],[55.67,450],[68.68,450],[96.43,450],[133.57,450],[152.75,450],[162.21,450],[182.36,450],[191.13,450],[213.99,450],[234.87,450],[251.03,450],[263.5,450],[283.82,450],[291.86,450],[18.26,460],[55.22,460],[68.23,460],[95.95,460],[133.12,460],[152.34,460],[161.73,460],[181.89,460],[190.67,460],[213.58,460],[234.46,460],[250.6,460],[263.07,460],[283.42,460],[291.47,460],[17.5,470],[54.72,470],[67.77,470],[95.49,470],[132.7,470],[151.86,470],[161.32,470],[181.45,470],[190.27,470],[213.16,470],[234.03,470],[250.21,470],[262.63,470],[283.01,470],[291.04,470]])
  destination = np.array([[25.21,0],[62.09,0],[75.04,0],[102.65,0],[139.66,0],[158.78,0],[168.2,0],[188.26,0],[196.97,0],[219.78,0],[240.6,0],[256.68,0],[269.14,0],[289.4,0],[297.41,0],[25.21,10],[62.09,10],[75.04,10],[102.65,10],[139.66,10],[158.78,10],[168.2,10],[188.26,10],[196.97,10],[219.78,10],[240.6,10],[256.68,10],[269.14,10],[289.4,10],[297.41,10],[25.21,20],[62.09,20],[75.04,20],[102.65,20],[139.66,20],[158.78,20],[168.2,20],[188.26,20],[196.97,20],[219.78,20],[240.6,20],[256.68,20],[269.14,20],[289.4,20],[297.41,20],[25.21,30],[62.09,30],[75.04,30],[102.65,30],[139.66,30],[158.78,30],[168.2,30],[188.26,30],[196.97,30],[219.78,30],[240.6,30],[256.68,30],[269.14,30],[289.4,30],[297.41,30],[25.21,40],[62.09,40],[75.04,40],[102.65,40],[139.66,40],[158.78,40],[168.2,40],[188.26,40],[196.97,40],[219.78,40],[240.6,40],[256.68,40],[269.14,40],[289.4,40],[297.41,40],[25.21,50],[62.09,50],[75.04,50],[102.65,50],[139.66,50],[158.78,50],[168.2,50],[188.26,50],[196.97,50],[219.78,50],[240.6,50],[256.68,50],[269.14,50],[289.4,50],[297.41,50],[25.21,60],[62.09,60],[75.04,60],[102.65,60],[139.66,60],[158.78,60],[168.2,60],[188.26,60],[196.97,60],[219.78,60],[240.6,60],[256.68,60],[269.14,60],[289.4,60],[297.41,60],[25.21,70],[62.09,70],[75.04,70],[102.65,70],[139.66,70],[158.78,70],[168.2,70],[188.26,70],[196.97,70],[219.78,70],[240.6,70],[256.68,70],[269.14,70],[289.4,70],[297.41,70],[25.21,80],[62.09,80],[75.04,80],[102.65,80],[139.66,80],[158.78,80],[168.2,80],[188.26,80],[196.97,80],[219.78,80],[240.6,80],[256.68,80],[269.14,80],[289.4,80],[297.41,80],[25.21,90],[62.09,90],[75.04,90],[102.65,90],[139.66,90],[158.78,90],[168.2,90],[188.26,90],[196.97,90],[219.78,90],[240.6,90],[256.68,90],[269.14,90],[289.4,90],[297.41,90],[25.21,100],[62.09,100],[75.04,100],[102.65,100],[139.66,100],[158.78,100],[168.2,100],[188.26,100],[196.97,100],[219.78,100],[240.6,100],[256.68,100],[269.14,100],[289.4,100],[297.41,100],[25.21,110],[62.09,110],[75.04,110],[102.65,110],[139.66,110],[158.78,110],[168.2,110],[188.26,110],[196.97,110],[219.78,110],[240.6,110],[256.68,110],[269.14,110],[289.4,110],[297.41,110],[25.21,120],[62.09,120],[75.04,120],[102.65,120],[139.66,120],[158.78,120],[168.2,120],[188.26,120],[196.97,120],[219.78,120],[240.6,120],[256.68,120],[269.14,120],[289.4,120],[297.41,120],[25.21,130],[62.09,130],[75.04,130],[102.65,130],[139.66,130],[158.78,130],[168.2,130],[188.26,130],[196.97,130],[219.78,130],[240.6,130],[256.68,130],[269.14,130],[289.4,130],[297.41,130],[25.21,140],[62.09,140],[75.04,140],[102.65,140],[139.66,140],[158.78,140],[168.2,140],[188.26,140],[196.97,140],[219.78,140],[240.6,140],[256.68,140],[269.14,140],[289.4,140],[297.41,140],[25.21,150],[62.09,150],[75.04,150],[102.65,150],[139.66,150],[158.78,150],[168.2,150],[188.26,150],[196.97,150],[219.78,150],[240.6,150],[256.68,150],[269.14,150],[289.4,150],[297.41,150],[25.21,160],[62.09,160],[75.04,160],[102.65,160],[139.66,160],[158.78,160],[168.2,160],[188.26,160],[196.97,160],[219.78,160],[240.6,160],[256.68,160],[269.14,160],[289.4,160],[297.41,160],[25.21,170],[62.09,170],[75.04,170],[102.65,170],[139.66,170],[158.78,170],[168.2,170],[188.26,170],[196.97,170],[219.78,170],[240.6,170],[256.68,170],[269.14,170],[289.4,170],[297.41,170],[25.21,180],[62.09,180],[75.04,180],[102.65,180],[139.66,180],[158.78,180],[168.2,180],[188.26,180],[196.97,180],[219.78,180],[240.6,180],[256.68,180],[269.14,180],[289.4,180],[297.41,180],[25.21,190],[62.09,190],[75.04,190],[102.65,190],[139.66,190],[158.78,190],[168.2,190],[188.26,190],[196.97,190],[219.78,190],[240.6,190],[256.68,190],[269.14,190],[289.4,190],[297.41,190],[25.21,200],[62.09,200],[75.04,200],[102.65,200],[139.66,200],[158.78,200],[168.2,200],[188.26,200],[196.97,200],[219.78,200],[240.6,200],[256.68,200],[269.14,200],[289.4,200],[297.41,200],[25.21,210],[62.09,210],[75.04,210],[102.65,210],[139.66,210],[158.78,210],[168.2,210],[188.26,210],[196.97,210],[219.78,210],[240.6,210],[256.68,210],[269.14,210],[289.4,210],[297.41,210],[25.21,220],[62.09,220],[75.04,220],[102.65,220],[139.66,220],[158.78,220],[168.2,220],[188.26,220],[196.97,220],[219.78,220],[240.6,220],[256.68,220],[269.14,220],[289.4,220],[297.41,220],[25.21,230],[62.09,230],[75.04,230],[102.65,230],[139.66,230],[158.78,230],[168.2,230],[188.26,230],[196.97,230],[219.78,230],[240.6,230],[256.68,230],[269.14,230],[289.4,230],[297.41,230],[25.21,240],[62.09,240],[75.04,240],[102.65,240],[139.66,240],[158.78,240],[168.2,240],[188.26,240],[196.97,240],[219.78,240],[240.6,240],[256.68,240],[269.14,240],[289.4,240],[297.41,240],[25.21,250],[62.09,250],[75.04,250],[102.65,250],[139.66,250],[158.78,250],[168.2,250],[188.26,250],[196.97,250],[219.78,250],[240.6,250],[256.68,250],[269.14,250],[289.4,250],[297.41,250],[25.21,260],[62.09,260],[75.04,260],[102.65,260],[139.66,260],[158.78,260],[168.2,260],[188.26,260],[196.97,260],[219.78,260],[240.6,260],[256.68,260],[269.14,260],[289.4,260],[297.41,260],[25.21,270],[62.09,270],[75.04,270],[102.65,270],[139.66,270],[158.78,270],[168.2,270],[188.26,270],[196.97,270],[219.78,270],[240.6,270],[256.68,270],[269.14,270],[289.4,270],[297.41,270],[25.21,280],[62.09,280],[75.04,280],[102.65,280],[139.66,280],[158.78,280],[168.2,280],[188.26,280],[196.97,280],[219.78,280],[240.6,280],[256.68,280],[269.14,280],[289.4,280],[297.41,280],[25.21,290],[62.09,290],[75.04,290],[102.65,290],[139.66,290],[158.78,290],[168.2,290],[188.26,290],[196.97,290],[219.78,290],[240.6,290],[256.68,290],[269.14,290],[289.4,290],[297.41,290],[25.21,300],[62.09,300],[75.04,300],[102.65,300],[139.66,300],[158.78,300],[168.2,300],[188.26,300],[196.97,300],[219.78,300],[240.6,300],[256.68,300],[269.14,300],[289.4,300],[297.41,300],[25.21,310],[62.09,310],[75.04,310],[102.65,310],[139.66,310],[158.78,310],[168.2,310],[188.26,310],[196.97,310],[219.78,310],[240.6,310],[256.68,310],[269.14,310],[289.4,310],[297.41,310],[25.21,320],[62.09,320],[75.04,320],[102.65,320],[139.66,320],[158.78,320],[168.2,320],[188.26,320],[196.97,320],[219.78,320],[240.6,320],[256.68,320],[269.14,320],[289.4,320],[297.41,320],[25.21,330],[62.09,330],[75.04,330],[102.65,330],[139.66,330],[158.78,330],[168.2,330],[188.26,330],[196.97,330],[219.78,330],[240.6,330],[256.68,330],[269.14,330],[289.4,330],[297.41,330],[25.21,340],[62.09,340],[75.04,340],[102.65,340],[139.66,340],[158.78,340],[168.2,340],[188.26,340],[196.97,340],[219.78,340],[240.6,340],[256.68,340],[269.14,340],[289.4,340],[297.41,340],[25.21,350],[62.09,350],[75.04,350],[102.65,350],[139.66,350],[158.78,350],[168.2,350],[188.26,350],[196.97,350],[219.78,350],[240.6,350],[256.68,350],[269.14,350],[289.4,350],[297.41,350],[25.21,360],[62.09,360],[75.04,360],[102.65,360],[139.66,360],[158.78,360],[168.2,360],[188.26,360],[196.97,360],[219.78,360],[240.6,360],[256.68,360],[269.14,360],[289.4,360],[297.41,360],[25.21,370],[62.09,370],[75.04,370],[102.65,370],[139.66,370],[158.78,370],[168.2,370],[188.26,370],[196.97,370],[219.78,370],[240.6,370],[256.68,370],[269.14,370],[289.4,370],[297.41,370],[25.21,380],[62.09,380],[75.04,380],[102.65,380],[139.66,380],[158.78,380],[168.2,380],[188.26,380],[196.97,380],[219.78,380],[240.6,380],[256.68,380],[269.14,380],[289.4,380],[297.41,380],[25.21,390],[62.09,390],[75.04,390],[102.65,390],[139.66,390],[158.78,390],[168.2,390],[188.26,390],[196.97,390],[219.78,390],[240.6,390],[256.68,390],[269.14,390],[289.4,390],[297.41,390],[25.21,400],[62.09,400],[75.04,400],[102.65,400],[139.66,400],[158.78,400],[168.2,400],[188.26,400],[196.97,400],[219.78,400],[240.6,400],[256.68,400],[269.14,400],[289.4,400],[297.41,400],[25.21,410],[62.09,410],[75.04,410],[102.65,410],[139.66,410],[158.78,410],[168.2,410],[188.26,410],[196.97,410],[219.78,410],[240.6,410],[256.68,410],[269.14,410],[289.4,410],[297.41,410],[25.21,420],[62.09,420],[75.04,420],[102.65,420],[139.66,420],[158.78,420],[168.2,420],[188.26,420],[196.97,420],[219.78,420],[240.6,420],[256.68,420],[269.14,420],[289.4,420],[297.41,420],[25.21,430],[62.09,430],[75.04,430],[102.65,430],[139.66,430],[158.78,430],[168.2,430],[188.26,430],[196.97,430],[219.78,430],[240.6,430],[256.68,430],[269.14,430],[289.4,430],[297.41,430],[25.21,440],[62.09,440],[75.04,440],[102.65,440],[139.66,440],[158.78,440],[168.2,440],[188.26,440],[196.97,440],[219.78,440],[240.6,440],[256.68,440],[269.14,440],[289.4,440],[297.41,440],[25.21,450],[62.09,450],[75.04,450],[102.65,450],[139.66,450],[158.78,450],[168.2,450],[188.26,450],[196.97,450],[219.78,450],[240.6,450],[256.68,450],[269.14,450],[289.4,450],[297.41,450],[25.21,460],[62.09,460],[75.04,460],[102.65,460],[139.66,460],[158.78,460],[168.2,460],[188.26,460],[196.97,460],[219.78,460],[240.6,460],[256.68,460],[269.14,460],[289.4,460],[297.41,460],[25.21,470],[62.09,470],[75.04,470],[102.65,470],[139.66,470],[158.78,470],[168.2,470],[188.26,470],[196.97,470],[219.78,470],[240.6,470],[256.68,470],[269.14,470],[289.4,470],[297.41,470]])
  
  grid_z = griddata(destination, source, (grid_x, grid_y), method='cubic')
  # couldnt go further than this as grid_z contains only NaN... but report the rest of the code for completeness.
  map_x = np.append([], [ar[:,1] for ar in grid_z]).reshape(orig.shape[0],orig.shape[1])
  map_y = np.append([], [ar[:,0] for ar in grid_z]).reshape(orig.shape[0],orig.shape[1])
  map_x_32 = map_x.astype('float32')
  map_y_32 = map_y.astype('float32')
  warped = cv2.remap(orig, map_x_32, map_y_32, cv2.INTER_CUBIC)
  </code></pre>
  
  <p>Something is wring in what am doing but I cannot see the difference between my transformation and the transformation proposed by Heslil in the above mentioned post...</p>
  
  <p>Anyone can help?</p>
  
  <p>Thank you!</p>
  
  <p>Hervé</p>
  
  <p>ps: <a href="https://drive.google.com/file/d/0B0dqKGVhLqwedFNYX1UxTGxzRjQ/view?usp=sharing" rel="nofollow noreferrer">here</a> is the original image </p>