I have images created by scanning old paper topographic maps.
Because of the age of the paper maps it is stretched and shrinked at different places.
This means a different scale on different places in different directions on the map.
On the map are grid lines with their lat/lon coordinates.
Is it possible to resample the image using the grid points as control points to get a new image of the map with a constant scale everywhere on the map?
Thanks
Jan
How to correct distortions in a scanned map
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to correct distortions in a scanned map
Anthony needs to answer this one, as he has been working on a -distort polynomial function that takes pairs of control point and does a least squares fit and polynomial warp on them. The current issue is a convenient means of measuring the control points and getting enough control points to do an adequate job considering that if one does not have enough control points to pin down the image edges, the warp tends to "leak" out or bulge out. This function has not been well tested yet and I don't know if it is fully available. I do not know if this will be adequate for your purposes.
The other option is a Shepards distortion that is an inverse square distance distortion given control points. The shift at any point is the average of the inverse squared distances to the pixel from all the control points. See http://www.imagemagick.org/Usage/distorts/#shepards. But again I am not sure that this is what you want.
The other option is a Shepards distortion that is an inverse square distance distortion given control points. The shift at any point is the average of the inverse squared distances to the pixel from all the control points. See http://www.imagemagick.org/Usage/distorts/#shepards. But again I am not sure that this is what you want.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to correct distortions in a scanned map
The -distort polynominal will work if you have enough control points, but created a polynominal distortion function over the entire image. The problem is that if you specify too high a polynomial order you can get some very large effects as polynomal tries to fit the function to the points.
The -distort shepards however is more of a 'local area effect' distortion. Moving one point has a tendency to only effect the immediate area (according to inverse square of radius. If you have a lot of points it can be slow, but works very well. I would try that first.
We do have plans in the future for a 'grid' distortion which distorts edge connected quadrilateral regions. Unfortunately I am not ready to proceed with it implementation as yet, though I have the plans for doing this figured out.
However there has been one user on the forum how has already performed this type of distortion by appling it to individual pieces of the original image. His online example was rectifying a crumpled piece of paper. It was not perfect, especially as he used perspective rather than bilinear, but his managed to do it.
Fast perspective distortion of segments of warped mesh
viewtopic.php?f=1&t=14660&p=51271&hilit ... esh#p51271
The -distort shepards however is more of a 'local area effect' distortion. Moving one point has a tendency to only effect the immediate area (according to inverse square of radius. If you have a lot of points it can be slow, but works very well. I would try that first.
We do have plans in the future for a 'grid' distortion which distorts edge connected quadrilateral regions. Unfortunately I am not ready to proceed with it implementation as yet, though I have the plans for doing this figured out.
However there has been one user on the forum how has already performed this type of distortion by appling it to individual pieces of the original image. His online example was rectifying a crumpled piece of paper. It was not perfect, especially as he used perspective rather than bilinear, but his managed to do it.
Fast perspective distortion of segments of warped mesh
viewtopic.php?f=1&t=14660&p=51271&hilit ... esh#p51271
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: How to correct distortions in a scanned map
fmw42 and anthony,
Thanks for your information. I have choosen to correct the map image with Ilwis (http://52north.org/index.php?option=com ... &Itemid=67). This os software is specialized in image processing for maps. I published my experiences with Ilwis for correcting scanned maps in a blog: http://usingoziexplorer.blogspot.com/20 ... -maps.html.
Jan
Thanks for your information. I have choosen to correct the map image with Ilwis (http://52north.org/index.php?option=com ... &Itemid=67). This os software is specialized in image processing for maps. I published my experiences with Ilwis for correcting scanned maps in a blog: http://usingoziexplorer.blogspot.com/20 ... -maps.html.
Jan