Transform a trapezium into a rectangle

4

3

I used my iPhone to capture a painting. However, the angle was not perfect, so instead of getting a straight rectangle, I get a trapezium. I want to transform this trapezium back into a rectangle (using some affine transformation). However, I cannot find a good way to do it. Please advise.

Phuong Nguyen

Posted 2010-03-09T03:00:19.120

Reputation: 949

My guest would be I can select four points in the captured photo and define the other 4 points of the rectangle and have the software transform it for me based on the coordinates of these points. However, I cannot figure out how to do that with GIMP – Phuong Nguyen – 2010-03-09T03:00:59.617

As in the dupe - have a look at Imagemagick http://www.imagemagick.org/script/index.php

– Linker3000 – 2011-08-17T09:43:27.990

Answers

5

In GIMP, it is called the perspective tool. I think it is the same in Photoshop.

There is an icon for it in the menu on the left. It looks like a trapezoid with two arrows at the bottom corners.

jonfhancock

Posted 2010-03-09T03:00:19.120

Reputation: 466

4

paint.net will do this - you're looking for the 'layers', 'rotate/zoom' option. just move the ball to get it aligned

Journeyman Geek

Posted 2010-03-09T03:00:19.120

Reputation: 119 122

3

ImageMagick gives you the -distort Perspective option. Like explained in Perspective Distortion:

convert image.jpg -distort Perspective '7,4 4,3 4,1 4,1 85,1 100,1 85,2 100,3' result.jpg

Arjan

Posted 2010-03-09T03:00:19.120

Reputation: 29 084

2

I know there already is an accepted answer, but Hugin that can also be used to fix perspectives in pictures, and is much better at it than a regular photo editing software. There is a tutorial on their website explaining how to do this.

Xr.

Posted 2010-03-09T03:00:19.120

Reputation: 200

Thanks. This software is amazing. It deserves to be an answer, though. – Phuong Nguyen – 2010-03-09T14:26:15.117