# Perspective transformation for binary images

**URL:** <https://discourse.itk.org/t/perspective-transformation-for-binary-images/2014>\
**Category:** Beginner Questions\
**Created:** [July 6, 2019, 9:22pm UTC](https://discourse.itk.org/t/perspective-transformation-for-binary-images/2014 "2019-07-06T21:22:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgdgn](https://discourse.itk.org/user_avatar/discourse.itk.org/dgdgn/32/848_2.png) [@dgdgn](https://discourse.itk.org/u/dgdgn)\
**Post date:** [July 6, 2019, 9:22pm UTC](https://discourse.itk.org/t/perspective-transformation-for-binary-images/2014/1 "2019-07-06T21:22:49Z")

</div>

I am trying to register two binary images. The fixed image is a planar shape, and the moving image comes from a camera image of the same shape but additionally has a perspective distortion due to the camera angle. Here is an example:

![02](https://discourse.itk.org/uploads/default/original/1X/b3fbd95c4e129a335fdb13e06c3c6591b5908500.png)

For this simple example, I used an affine transformation as an approximation, but it’s not perfect since any lines that are parallel before an affine transformation stay parallel afterwards, as it only does rotation, scale, shear, and translation.

I believe what I need is a projective/homography transformation that will take into account the perspective distortion.  
[https://www.graphicsmill.com/docs/gm5/Transformations.htm](https://www.graphicsmill.com/docs/gm5/Transformations.htm)

Do you know if any image registration tool can apply projective transformations? I used SimpleElastix in this example.

Thank you very much for your help and interest.

Kind regards,  
Doga

---

<div class="post-metadata">

**Author:** ![tsvilans](https://discourse.itk.org/user_avatar/discourse.itk.org/tsvilans/32/3888_2.png) [@tsvilans](https://discourse.itk.org/u/tsvilans)\
**Post date:** [January 25, 2024, 4:50pm UTC](https://discourse.itk.org/t/perspective-transformation-for-binary-images/2014/2 "2024-01-25T16:50:57Z")

</div>

Hi,

I see this is an old topic - but I am looking for the same answer 🙂

Any luck finding a solution? I’m trying to replicate a workflow in OpenCV for correcting the perspective of some images using a perspective projection matrix.

Best,  
Tom
