Categories

Thursday, April 2, 2015

Correcting distortions in scanned maps

In a previous blog I wrote about some challenges using historical maps in OziExplorer.

Distortions
Another challenge can be image distortions by scanning old paper maps. There are several causes for distortions such as scanner mechanical, paper deformation and humidity. When you view the scanned image, sometimes you can see that lines that should be straight, are not. If you calibrate (georeference) the map in OziExplorer and display the lat/lon grid, you will see that the grid of the image does not match with the grid displayed by OziExplorer. These distortions are not linear in the map, in some parts the difference is for example +1 mm, in some other -5 mm or so.

Resample
A georeference definies the transformation between the pixel row/colum coordinate in the image and the X/Y map coordinate in the real world.
About the grid points in the map we know both coordinates, when we are able to define the relation between them better, with a non-linear transformation, it is possible to resample the image to get a map that can be used better in OziExplorer, representing correct lat/lon positions of any pixel of the image. The resample software can calculate the correct new pixel coordinates of the grid points and transform the closed-by pixels according to them in the new image.

On the Internet you can find several image processing software products for correcting distortions. In this blog I write about my experiences how this can be done with Ilwis.

Ilwis
Ilwis (Integrated Land and Water Information System) is open source GIS & Remote Sensing software, developed by ITC up to release 3.3 in 2005. ILWIS comprises a complete package of image processing, spatial analysis and digital mapping.
Because it has rich functionality you need some time to learn using it, but there is a very good user guide with extensive tutorials and it has a full on-line help.

Download the software and the tutorials and do some exercises to introduce yourself to ILWIS. When you are ready to correct your scanned images take the follwing steps:

Step 1 Get your image in the right file format
If necessary convert your input file to Tif format (it can be done with IrfanView).

Step 2 Import your image in Ilwis
In the main window of Ilwis select Open>Import>Ilwis>Raster>Tif.
Select the input file
Choose a name for the output file
and click OK and a Ilwis raster map is produced.

Step 3 Create a Georeference for the raster map
A Georeference is the same as a callibration in OziExplorer. In this step we define the controlpoints and the non-linear transformation to resample the image.
In the Map Window select File>Create Georeference.
Choose a Georeference name (I choose the same name as the raster map).
Give it some Description
Select the radio button Georeference Tiepoints.
Coordinate system> push the button to create one.
Choose a Coordinate system name (I choose Nord de Guerre).
Give a description (I choose: Coordinate system for the M831 map serie).
Select the radiobutton CoordSystem Projection
I used the 1SP parameters with the scale factor, if the 2SP parameters are used the scale factor is 1.
Projection: Lambert Conformal Conic
Ellipsoid: Du Plessis Modified
False Easting: 600000
False Northing: 300000
Central Meridiaan: 07 44' 13.95"
Central Parallel: 49 30' 00"
Scale Factor: 0.999509081
Standard Parallel 1: 49 30'00"
Standard Parallel 2: 49 30'00"
Datum: User defined, dx= 1383, dy=44, dz=454
Press OK

Step 4 Digitize the grid points (Tie points)
With the opened Georeference Editor you can digitize the grid points with your mouse. In the dialog box you see the local pixel coordinates, you have to type in the XY values from the map. It depends on the distortions in the map how many points you need, I took many.
Choose a non-linear transformation method, like Full Second Order, look to the Sigma value (standard deviation), the lower the value the better the results.
To check the results you can display grid lines and see how they match with the grid lines of the map.
Stop the editor and select in the map window: Layers>Add Grid Lines
Choose as Grid distance: 1000 m
Choose as color: white
Press OK
You can remove the grid lines with Remove layer in the map window.
Add/change tiepoints and/or change the transformation method with the Georeference Editor as the results are not good enough.

In the Map window you can check the georeference by selecting File>Open Pixel Information. In the Pixel Information window select: File>Add Coordinate system> LatLon and LatLonWGS84. When you move your curser in the map windows you can check the XY and LatLon coordinates in the WGS84 and NDG datum.

Step 5 Resample map
In the Operation List, select Resample
Choose the input rastermap
Choose the resample method
Choose a name for the resampled output file
Choose the target georeference: New, this is a Georeference Corner
Give the pixel size: I choose 2.5 (it is a 1: 25000 map)
Press Ok and your map is being resampled
When it is ready you have to export the resampled raster map to GeoTif, you can do that with File>Export.

Step 6 Load the corrected map in OziExplorer
The GeoTiff file can directly be loaded in OziExplorer,it uses the information in the header of the file to use the callibration points.
In OziExplorer select File>Import Map>Single DRG Map
OziExplorer guides you in the import proces.









The left picture is the uncorrected map, the distortions are in different places in different directions, the right picture is the corrected. When you enlarge the picture you can see the corrections.

I think Ilwis is a great software package.

No comments:

Post a Comment