title: Obtain two dimensional linear space on trapezoid shape inside image frame
body: <p><a href="https://i.stack.imgur.com/PQrBq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PQrBq.png" alt="enter image description here"></a></p>
  
  <p>In this image, the black frame is a frame of an image, and the trapezoid is a rectangular plane as seen by a camera. </p>
  
  <p>I know the pixel coordinate of the 4 corners and can iterate through each pixel inside that trapezoid. Since I don't/cannot know the transformation/rotation vectors from camera to plane, I'd like to transform the pixels into [0,0] [1,1] coordinates according to the position inside that trapezoid, so that I choose a point inside the trapezoid and obtain some coordinates in the [0, 0] [1, 1] range.</p>
  
  <p>By linear space, I mean create a number of values that range from 0 to 1 linearly. So, a unidimensional linear space from 0 to 1 in 100 steps would look like [0, 0.01, 0.02, 0.03 ... 1]. In this case, I'd like to do this but in two dimensions in the trapezoid. If this were a rectangle it would be trivial, I'm not sure there is a way to do this for a trapezoid.</p>
  
  <p>For example, each point in the line of left side of the trapezoid would be always X=0, and y going from 0 to 1 linearly as you move "up" (though X coordinate actually changes in the image frame).</p>