RSS/Atom feed Twitter
Site is read-only, email is disabled

Unskewing images of flat rectangular objects in Gimp

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

8 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

Unskewing images of flat rectangular objects in Gimp Elmer Wix 04 Feb 05:11
  Unskewing images of flat rectangular objects in Gimp Øyvind Kolås 04 Feb 05:46
   Unskewing images of flat rectangular objects in Gimp Elmer Wix 04 Feb 08:46
    Unskewing images of flat rectangular objects in Gimp Richard Gitschlag 04 Feb 15:00
    Unskewing images of flat rectangular objects in Gimp Liam R E Quin 04 Feb 15:51
    Unskewing images of flat rectangular objects in Gimp Steve Kinney 04 Feb 18:19
     Unskewing images of flat rectangular objects in Gimp Gary Aitken 04 Feb 20:28
      Unskewing images of flat rectangular objects in Gimp Elmer Wix 07 Feb 08:41
Elmer Wix
2013-02-04 05:11:18 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

I often use my digital camera to take pictures of flat, rectangular objects, like framed paintings on a wall, book or album covers, or pages of documents. Of course, I can't take these pictures straight on and perfectly level, but that's OK. I know what the dimensions of the objects are, so I can just correct the perspective in software.

In Graphic Converter (a Mac OS X app), I just use the "Unskew" function. I simply need to select the four corners of the rectangular object I photographed. (Guide lines connecting the four points helps me to locate them.) After I've located the four corners, I tell it to "unskew" and a rectangular image is produced.

Does Gimp have any function like this? I found the perspective tool, but that requires me to manually shift the perspective and eyeball when I think a rectangular image is produced. That's not nearly as convenient.

Øyvind Kolås
2013-02-04 05:46:06 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

On Mon, Feb 4, 2013 at 4:11 PM, Elmer Wix wrote:

I often use my digital camera to take pictures of flat, rectangular objects, like framed paintings on a wall, book or album covers, or pages of documents. Of course, I can't take these pictures straight on and perfectly level, but that's OK. I know what the dimensions of the objects are, so I can just correct the perspective in software.

Does Gimp have any function like this? I found the perspective tool, but that requires me to manually shift the perspective and eyeball when I think a rectangular image is produced. That's not nearly as convenient.

The perspective tool has an inverse mode, if you align the grid lines from the wireframe preview with the lines desired to become horizontal/vertical and then do the transform you should end up with a rectified version of the quadliteral.

/pippin

The future is already here. It's just not very evenly distributed
                                                 -- William Gibson
http://pippin.gimp.org/                            http://ffii.org/
Elmer Wix
2013-02-04 08:46:53 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

Øyvind Kolås wrote:

On Mon, Feb 4, 2013 at 4:11 PM, Elmer Wix wrote:

I often use my digital camera to take pictures of flat, rectangular objects, like framed paintings on a wall, book or album covers, or pages of documents. Of course, I can't take these pictures straight on and perfectly level, but that's OK. I know what the dimensions of the objects are, so I can just correct the perspective in software.

Does Gimp have any function like this? I found the perspective tool, but that requires me to manually shift the perspective and eyeball when I think a rectangular image is produced. That's not nearly as convenient.

The perspective tool has an inverse mode, if you align the grid lines from the wireframe preview with the lines desired to become horizontal/vertical and then do the transform you should end up with a rectified version of the quadliteral.

Thanks! That worked. The size and aspect ratio of the rectified quadrilateral isn't always close to what I want it to be, though. Is there a way to specify this before I do the perspective transform, or do I just need to do it in 2 steps (correct perspective, and then re-size)?

Richard Gitschlag
2013-02-04 15:00:49 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

Date: Mon, 4 Feb 2013 00:46:53 -0800 From: elmer.cabekaziruronometu.wix@gmail.com To: gimp-user-list@gnome.org
Subject: Re: [Gimp-user] Unskewing images of flat rectangular objects in Gimp

Øyvind Kolås wrote:

The perspective tool has an inverse mode, if you align the grid lines from the wireframe preview with the lines desired to become horizontal/vertical and then do the transform you should end up with a rectified version of the quadliteral.

Thanks! That worked. The size and aspect ratio of the rectified quadrilateral isn't always close to what I want it to be, though. Is there a way to specify this before I do the perspective transform, or do I just need to do it in 2 steps (correct perspective, and then re-size)?

This
is certainly an issue - the perspective tool would really benefit from having an option to automatically preserve the x/y aspect ratio (much like scaling already does), though exactly how it would work mathematically I don't know. I've found that if you note the [1,1] and [2,2] numbers in the transformation matrix you can do a manual rescale using those values as your X and Y scalars and it really helps, but it's not exact since it doesn't take rotations into account.

-- Stratadrake strata_ranger@hotmail.com
--------------------
Numbers may not lie, but neither do they tell the whole truth.

=

Liam R E Quin
2013-02-04 15:51:18 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

On Mon, 2013-02-04 at 00:46 -0800, Elmer Wix wrote:

The size and aspect ratio of the rectified quadrilateral isn't always close to what I want it to be, though.

I use it like this when I can:
1. crop the image so the object is in the middle, approximately (or float it to a new layer together with enough of the surrounding image to contain the result easily)

2. use "corrective (reverse)" mode with the grid

3. align the grid with a vertical one the left side, half-way doen.

4. move the top *and* the bottom of the grid by the same amount, but in opposite directions.

5. Now repeat for the right-hand side.

6. Do the top of the image, again using a half-way point, and being careful to move the corner points diagonally in a line with the adjustments you already did!

7. Finally do the bottom - this is the most important edge usually, for the human eye, to think something is level, so do it last.

This way the image doesn't grow huge or shrink to be tiny.

If you get it wrong, you have to undo and start over. I've spent half an hour or more doing this on some images.

Liam

Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
Steve Kinney
2013-02-04 18:19:12 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

On 02/04/2013 03:46 AM, Elmer Wix wrote:

Øyvind Kolås wrote:

[...]

The perspective tool has an inverse mode, if you align the grid lines from the wireframe preview with the lines desired to become horizontal/vertical and then do the transform you should end up with a rectified version of the quadliteral.

Thanks! That worked. The size and aspect ratio of the rectified quadrilateral isn't always close to what I want it to be, though. Is there a way to specify this before I do the perspective transform, or do I just need to do it in 2 steps (correct perspective, and then re-size)?

I has a "well DUH!" moment over this because I never noticed the function, so I started tinkering around with it. If there is a rectangular selection on the canvas, the area selected by the perspective tool conforms to the selection when resampled. The tool options dialog dock for Rectangular Select has settings for adjusting the size and position of the selection in pixels.

I can't believe the amount of time I have wasted squaring up photographed or scanned rectangular objects "by hand." But I love it when posters like Øyvind point out things that should have been obvious to me - better to learn late than never!

:o)

Steve

Gary Aitken
2013-02-04 20:28:55 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

On 02/04/13 11:19, Steve Kinney wrote:

On 02/04/2013 03:46 AM, Elmer Wix wrote:

Øyvind Kolås wrote:

[...]

The perspective tool has an inverse mode, if you align the grid lines from the wireframe preview with the lines desired to become horizontal/vertical and then do the transform you should end up with a rectified version of the quadliteral.

Thanks! That worked. The size and aspect ratio of the rectified quadrilateral isn't always close to what I want it to be, though. Is there a way to specify this before I do the perspective transform, or do I just need to do it in 2 steps (correct perspective, and then re-size)?

I has a "well DUH!" moment over this because I never noticed the function, so I started tinkering around with it. If there is a rectangular selection on the canvas, the area selected by the perspective tool conforms to the selection when resampled. The tool options dialog dock for Rectangular Select has settings for adjusting the size and position of the selection in pixels.

I can't believe the amount of time I have wasted squaring up photographed or scanned rectangular objects "by hand." But I love it when posters like Øyvind point out things that should have been obvious to me - better to learn late than never!

Thank you! I've been wondering how to do that for a *long* time.

Elmer Wix
2013-02-07 08:41:26 UTC (almost 12 years ago)

Unskewing images of flat rectangular objects in Gimp

Thanks for everyone's help with the corrective mode ("inverse") for the perspective tool. This makes my workflow noticeably more streamlined!