3
$\begingroup$

This question already has an answer here:

Suppose I took a picture of a whiteboard at an angle. If I could detect where the corners of the whiteboard are, what algorithms and linear projections could I use to convert this slanted view into a "head on" view?

$\endgroup$

marked as duplicate by Nathan Reed, Christian Rau, trichoplax Nov 10 '17 at 21:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Check out the answer to this question. You can take any 4 points and transform the quadrilateral between them into a unit square. From there you can simply scale in x and y to the size and shape you want. $\endgroup$ – user1118321 Oct 26 '17 at 4:57
  • $\begingroup$ Does the transformation need to be perspective correct ? $\endgroup$ – PaulHK Oct 26 '17 at 12:27
  • $\begingroup$ @user1118321 thanks for the link, that's perfect! $\endgroup$ – Lincoln Bergeson Oct 26 '17 at 15:38
  • $\begingroup$ @PaulHK what do you mean by perspective correct? $\endgroup$ – Lincoln Bergeson Oct 26 '17 at 15:38
  • $\begingroup$ For example, if the floor was a huge chess board, we would see squares vanish into the distance. When transforming back to 2d we need to take that perspective into account. $\endgroup$ – PaulHK Oct 27 '17 at 2:40
0
$\begingroup$

As @user1118321 mentioned, as well as @NathanReed in this answer to another question, you can do a perspective transform to transform any convex quadrilateral to any other.

OpenCV has a good library for doing perspective transformations if you don't want to roll your own.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.