The geographical coordinates of the chosen calibration points can be specified either as "projected" X, Y coordinates (read along the map grid lines), or as longitude and latitude (in WGS84 datum, i.e. as GPS coordinates).
For instance, on the following swiss map, we have measured the X and Y (swiss) coordinates of 2 points, see numbers in red:
To calibrate this map, one can write the following ref.txt file:
PROJ:projection parameter string
Line 1 in the above file describes the projection. For a swiss map, the projection parameter string would read "+proj=somerc +lat_0=46.952405555556 +lon_0=7.4395833333333 +ellps=bessel +x_0=600000 +y_0=200000 +k_0=1.0 +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs".
135,56 = 569000,193000
1136,656 = 574000,190000
Line 2 specifies the first calibration point: the point at position x=135 pixels and y=56 pixels has geographical coordinates X=569000 and Y=193000.
Line 3 specifies similarly a second calibration point.
The two calibration points can be located anywhere on the map, but they must not lie on the same horizontal or vertical line. For best results, place the two calibration points near opposite corners.
To specify the geographical coordinates as longitude and latitude (instead of "projected" X,Y coordinates), add keyword "(WGS84)" after the coordinates, as in the following example:
PROJ:projection parameter string
135,56 = 7.03191, 46.88733 (WGS84)
1136,656 = 7.09766, 46.8606 (WGS84)
PROJ:projection parameter string
135,56 = 569000,193000
resolution: 5
Bilinear interpolation
135,56 = 7.03191, 46.88733
1136,656 = 7.09766, 46.8606
Calibration with 2 points only will give good results if lines of constant longitude (constant latitude) are vertical (resp. horizontal) lines. If these lines are not aligned along the vertical and horizontal directions, use 4 calibrations points.