topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 3:18 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: correction of distorted grid in image ??  (Read 14057 times)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
correction of distorted grid in image ??
« on: February 14, 2007, 11:24 AM »
does anyone know of software that would correctly align a grid in an image:

What I would use it for:

Say I have a photo or scan of a drawing on graph paper. The graph will be more or less distorted depending on means of capture. (Also sometimes the graph-paper itself doesn't have an accurate grid cause of age etc, or sometimes it's photocopied or simply cause it's paper)

The ideal software would atomatically recognise the grid & correct any distortion in the image.
But of course manually marking points on the grid wouldn't kill me  :D

There is stuff like this for correcting lens distortion in digital cameras but this requires more then "just" that correction.
I know photogrammetry uses software to align points in an image in order to correct an image of, say, the face of a building, but beyond that .. (also prob. very expensive as geared to 3D as well)

thanks for any suggestions, tom

I've also posted that in http://www.imaging-resource.com/ forums. It's a good site for camera info but not so busy on the software front.
I would also appreciate any ideas of where I might get ideas for this.
Tom

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #1 on: February 14, 2007, 05:36 PM »
Hm, dunno if a specific app exists, but photo morphing software might do what you need? Usually you set up some control points (has always been a grid for the stuff I've played with), and can then move those control points around... dunno if it's accurate enough for your uses.
- carpe noctem

tsaint

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 497
  • Hi from the a*** end of the earth
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #2 on: February 14, 2007, 05:47 PM »
does anyone know of software that would correctly align a grid in an image:

What I would use it for:

Say I have a photo or scan of a drawing on graph paper. The graph will be more or less distorted depending on means of capture. (Also sometimes the graph-paper itself doesn't have an accurate grid cause of age etc, or sometimes it's photocopied or simply cause it's paper)
This might not be exactly what you want Tom, but its related. I use an application called "whiteboard photo" in this circumstance.
Every lesson, I take a photo of the whiteboard Ive been doing maths on. The photos have perspective distortions, as well as looking bad (the white isnt white etc)
Whiteboard photo's purpose is to "clean" those photos by fixing the colour and the perspective problem.
For the latter, it does this by suggesting a moveable trapezium you set around the outline of the board, and this trapezium gets transfomed to a rectangle. (ie eliminating distortion)
Re the colour problem... I have tried setting white balance and messing about in both photoshop and psp ... Whiteboard photo worked much easier and better.
This colour aspect might be relevant to you depending on how you obtained your images (eg photo of a page from a book)

A negative is the price, listed at $249 (go to http://www.polyvisio...com/products/wbp.asp for info), but note that a long time ago it used to be $79. When I came to buy it, I hunted around and found a place on the net STILL selling it for $79 (I think I searched for "pixid" who used to own the software)
tony

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #3 on: February 14, 2007, 08:25 PM »
there is defintely software for doing such distortion corrections - maybe look for photoshop filters.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #4 on: February 15, 2007, 03:36 AM »
Hm, dunno if a specific app exists, but photo morphing software might do what you need? Usually you set up some control points (has always been a grid for the stuff I've played with), and can then move those control points around... dunno if it's accurate enough for your uses.

f0dder, sounds interesting - I had a look, but couldnt tell from what I found on google - what software are you using?

tony - thanks for that idea,
I've actually read about that elsewhere -
If the edge of board is curved in photo (say from wide angle shot) does it correct that as well ?
-
I suspect it wont be up to what i want ... because of the irregular nature of some of the distortion - especially from photocopied images - but I will go have a look (as you say, full price is very expensive for what it does)


Am trying out a couple of photoshop filters but havent found anything appropriate yet. Problem is there seems to be millions of them out there (& this was supposed to be a time saving exercise  :)  -  )

thanks, tom
Tom

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #5 on: February 15, 2007, 08:25 PM »
if you use PhotoFiltre, there are tools within the program to do this trick..

One of the most annoying things in a great landscape or coastline photo can be a crooked or titled horizon.  PhotoFiltre can solve this problem in no time.

check out the tutorial: http://frontpagesolu...iltre/s/06/index.htm


tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #6 on: February 16, 2007, 04:13 AM »
thanks lanux,
       
Photofiltre looks quite nice

I have Photoshop 5.5, the first decent version I think, but never bothered upgrading cause 
1) I happy with it &
2) dont use it enough to justify the money

so I'll have a look at Photofiltre
Just downloaded the new PaintdotNet 3 as well

also want to try panoramatools, think there might be something there, see tutorial:
http://www.magicpixe...op/ptperspective.cfm

Tom

geektechnu

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 16
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #7 on: February 23, 2007, 04:13 PM »
If you have Photoshop, manual perspective correction is very easy.

1) Turn on the grid (Ctrl+') - you can customize the grid in Photoshop's preferences.
2) Make a rectangular selection around the object to correct.
3) Switch to free-transform mode (Ctrl+T).
4) Hold down Ctrl and start dragging the corner transform handles.
5) When happy with the result, press Enter.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #8 on: February 24, 2007, 07:24 AM »
If you have Photoshop, manual perspective correction is very easy.

1) Turn on the grid (Ctrl+') - you can customize the grid in Photoshop's preferences.
2) Make a rectangular selection around the object to correct.
3) Switch to free-transform mode (Ctrl+T).
4) Hold down Ctrl and start dragging the corner transform handles.
5) When happy with the result, press Enter.

problem is the distortion is very irregular -
instead of having a straight line, I often have a wavey line - the distortion is not correctable by a simple transform/skew/straighten up the edges of image/solution, or even by correction of curved line to straight line (which way lens correction software works)

For the moment I've given up following the options mentioned above (time pressure  :( )
But,
I have found a relatively simple solution to current problem - I'm tracing/copying (vector) these dodgy scans, so, I overlay a 1cm grid - same as what original was drawn on.
They dont match due to the distortion, so as I move around the image I shift the scan so it lines up with the overlaid grid. Relatively easy & relatively accurate to boot.

But I'm happy to have found out about, or be reminded of -
Photofiltre
PanoramaTools

& another recommended by Tony:
"squirlz lite" from  http://www.xiberpix.com/index.html (freeware)

I imagine my idea while seeming simple to me initially would prob in actuality be very difficult to make (software would need to be able to recognise grid on image & not to mix it up with actual drawing & then to correct it to boot)


Tom

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #9 on: February 24, 2007, 08:26 AM »
have you got an example image that we can experiment with - there might be a solution but it requires a bit of serendipity to find it.

iphigenie

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,170
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #10 on: February 24, 2007, 08:56 AM »
I have seen several tools that are made to allow you to use your digital camera to take photos of pages in a book, for example, and which can clean up the distorsion. They might work for your kind of usage.

They're the "photocopy with your digital camera" / "scan with your digital camera" tools, I'll see if I can dig some up. Some have been mentioned in this forum this year, I'm sure I learned about them here.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #11 on: February 24, 2007, 03:06 PM »
have you got an example image that we can experiment with - there might be a solution but it requires a bit of serendipity to find it.

okay,
heres a quarter of one image (A4 size), it's a plan of a stone circle - I've overlaid a heavy grid for clarity here, also tried to choose an area that wasn't too cluttered with stones

Grid03FH.gifcorrection of distorted grid in image ??

If you think it's not too bad,
keep in mind it's a quarter of one image that's supposed to join up with four other A4 images to make one large drawing.
Also, it's at a scale of 1 to 100 so if it's one mm out thats multiplied by 100 ..

Note: they were drawn in the field this way, notebook-paper is already distorted from years of heated room to cold humidity & back, then photocopied & sent to me & I scan it - I know there must be a better way but thats the way it's happening for the foreseeable future.

Also, across 297mm (A4 page height) you can get a lot of wobbeldy bits going in various directions on one line  :D

It would be nice though, to be able to photograph a really large drawing & know you could correct it later.
I was working on some over 6 foot drawings a couple of years ago but that was all done by hand & photographically reduced later (professionally). no, it was scanned professionally, they used to be photographed (reprographed)

Grid03a.gifcorrection of distorted grid in image ??

EDIT:
PS. these are screenshots & so not to scale!
Tom
« Last Edit: February 24, 2007, 03:10 PM by tomos »

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #12 on: February 24, 2007, 03:50 PM »
hmm, that looks like i nightmare to correct perfectly.

if you can get away with it i think i'd try using a fresh perfect grid and then overlay the stones over the top of it - using something like photoshop that allows using layers and the usual blending and opacity features. this would look okay with the right amount of time spent on it but it wouldn't be an automatic one click process - so it's not really the solution you are looking for. it really depends on how much manual input you want to use.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: correction of distorted grid in image ??
« Reply #13 on: February 25, 2007, 12:40 PM »
hmm, that looks like i nightmare to correct perfectly.

if you can get away with it i think i'd try using a fresh perfect grid and then overlay the stones over the top of it - using something like photoshop that allows using layers and the usual blending and opacity features. this would look okay with the right amount of time spent on it but it wouldn't be an automatic one click process - so it's not really the solution you are looking for. it really depends on how much manual input you want to use.

Ooops, maybe I didn't make that fully clear (its hard to think of everything  :o  ) but yes/no/(maybe):

I have found a relatively simple solution to current problem - I'm tracing/copying (vector) these dodgy scans, so, I overlay a 1cm grid - same as what original was drawn on.
They dont match due to the distortion, so as I move around the image I shift the scan so it lines up with the overlaid grid. Relatively easy & relatively accurate to boot.

Yeah,
I'm actually "tracing" these scans,
so its not that I have to correct them in & of themselves -
I just have to be able to correct the final (vector) image &, as I say, I think the solution above is the best for me at the moment (& possibly forever!)
Tom