title: Calculating the x & y coordinates in cm from the pixelcoordinates
body: <p>Heyho!<br>
  I've got an image of a flat surface (taken from above and with an angle of 30°)  and I want the x &amp; y coordinates of a specific pixel but in cm (with the coordinate system being in the surface).<br>
  Is there a method to archive this?<br>
  I'm using python but any help is appreciated! :)</p>
  
  <p>Edit: 
  I tried the homographie method from below however I didn't quiet manage to make it work. Her is what I did:</p>
  
  <pre><code>#two sets of points I used 
  #src: corners + center of my 400px*460px image 
  #dst: coordinate system being outside the image 
  src = np.matrix(((1, 1, 1),(400, 1, 1),(1, 460, 1),(400, 460, 1),(200,230,1)))
  dst= np.matrix(((31.6, 7, 1),(14.5, 7, 1),(28.4, 26.3, 1),(17, 26.3, 1),(22.6,18.6,1 )))
  
  #src: random points from the image of my 400px*460px image 
  #dst: coordinate system being in the actual image
  src = np.matrix(((1, 1, 1),(400, 460, 1),(200,1,1), (100, 170, 1), (280, 320, 1),(300, 50, 1)))
  dst= np.matrix(((0, 0, 1),(14.6, 19.3, 1),(17.1/2,0,1), (5.0, 9.2, 1), (11.65, 15.3, 1), (12.9, 2.9, 1) ))
  
  H = cv2.findHomography(src,dst,0)[0]
  print (H)    
  for c in range(0,5):
      x= c*100
      y = 1
      print(x,y,np.dot(H,np.array((x,y,1))))  
  </code></pre>
  
  <p><a href="https://www.dropbox.com/home/Camera%20Uploads?preview=2016-05-30%2010.30.17.jpg" rel="nofollow">Actual Photo of the setup</a><br>
  The square is the area visible on the (400px*460px) picture. The Camera is located in the black box on the right. The X &amp; Y are my Pixelcoordinates.<br>
  Results with both sets of numbers are good as long as you stay on the x-axis. As soon as I move down the y-axis the numbers go wrong.</p>