<p>As @user1118321 mentioned, as well as @NathanReed in <a href="https://computergraphics.stackexchange.com/a/5838/7541">this answer</a> to another question, you can do a perspective transform to transform <a href="http://www.reedbeta.com/blog/quadrilateral-interpolation-part-1/" rel="nofollow noreferrer">any convex quadrilateral to any other</a>.</p>

<p><a href="https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#getperspectivetransform" rel="nofollow noreferrer">OpenCV</a> has a good library for doing perspective transformations if you don't want to roll your own.</p>

CC BY-SA 3.0
2017-11-08T05:12:05.033Z
2017-11-08T05:12:05.033Z
Lincoln Bergeson
<p>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?</p>

CC BY-SA 3.0
2017-10-26T04:57:37.453Z
Check out the answer to [this question](https://computergraphics.stackexchange.com/questions/3742/how-to-unproject-quadrilateral-into-rectangle). 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.
user1118321
CC BY-SA 3.0
2017-10-26T12:27:22.553Z
Does the transformation need to be perspective correct ?
PaulHK
CC BY-SA 3.0
2017-10-26T15:38:09.833Z
@PaulHK what do you mean by perspective correct?
Lincoln Bergeson
CC BY-SA 3.0
2017-10-27T02:40:05.170Z
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.
PaulHK
<image-processing><projections>
How would I convert a picture of a slanted surface into a straight one?
Lincoln Bergeson
# How would I convert a picture of a slanted surface into a straight one?

(Asked by: username_0 on 2017-10-25)

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?

**Tags:** image-processing, projections

> **Comments:**
> **username_1**: Check out the answer to [this question](https://computergraphics.stackexchange.com/questions/3742/how-to-unproject-quadrilateral-into-rectangle). 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.  
> **username_2**: Does the transformation need to be perspective correct ?  
> **username_0**: @username_2 what do you mean by perspective correct?  
> **username_2**: 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.  

---

## 1 answers

### Answer by username_0 on 2017-11-08. Score: 0

As @username_1 mentioned, as well as @NathanReed in [this answer](https://computergraphics.stackexchange.com/a/5838/7541) to another question, you can do a perspective transform to transform [any convex quadrilateral to any other](http://www.reedbeta.com/blog/quadrilateral-interpolation-part-1/).

[OpenCV](https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#getperspectivetransform) has a good library for doing perspective transformations if you don't want to roll your own.


---

