The Local Stretch Option:
This option should mainly be used for geometric correction of old maps relative to modern ones. Although it may be used for normal imagery, there is little advantage in doing so unless you have 7 or more control points. The modern map should have a white background, but its lines may be of any colour. If the background is a colour image, then the output options Overlay Source & Target White, Overlay Source & Target Black, or Merge can not be used.
Using the Option:
In Options, choose the Transformation and Interpolation page. There, select Local Stretch:
Use the multiple image file opening button or menu entry and select a source image and a target image (usually a map).
Add 5 or more corresponding control points to source and target if you haven't already done so. 7 or more points may improve the result.
Click on the source image and press F3 to show "Source" in it's caption.
Click on the target image and press F3 to show "Target" in it's caption:
Click again on the Source image.
Click on the Transform button and the image will be transformed and locally stretched around each control point:
Examine the area around each control point to make sure that no inconsistencies have been created. If OK, save the result normally.
If not, verify the triangulation and if need be add or move control points:
Click on the Target and then on the Undo button
Click on the Control option of the main menu:
and click Toggle Triangle Display then reopen the control menu and click Show All Triangles
Click the Source image and the transformation button again and the triangulation will be shown:
You can view this in greater detail with a right-click enlargement.
Algorithms and implementation:
The algorithm used by the programme adapts to the number of selected points. Control points are first checked for consistency. Then a modified projective transformation is used to produce approximate correspondence between source and target based on singular value decomposition global optimisation using the selected control points. If there are between 4 and 6 points, a simple projective transformation is computed, If there are more points, an additional bi-variate polynomial correction factor is introduced, the order of the correction polynomial depending on the available number of points up to a maximum order of five, with: 8 to 9, order 2, 10 to 12, order 3, 13 to 17 order 4, 18 or more, order 5. This completes the first correction phase. The intermediate result is now aligned approximately with the final target so that global ambiguity is avoided.
After the approximate correction offered by the preceding operation ends, the approximately rectified target image now becomes a new temporary image source. Delaunay triangulations of the control points in both the new source and the original target are computed. In such a triangulation, the control points are optimally connected via the shortest path between them. The points of the triangulation for the new source are the original control points from the old source forward transformed to the old rectified target.
For each corresponding triangle in the approximately rectified and the original target, a local affine transformation is computed and applied to transfer the data from the previously rectified target image to the original target. This produces an additional small local stretch around each of the control points which improves on the global result of the first phase so that source and target control points now correspond and any errors in the other image picture element positions are confined locally to the immediate area around the point. This technique is modified for greater stability by adding additional points outside the corners of the source image so that all points are contained within them.
The triangles in source and target may be inconsistent in shape or position for a number of reasons. For example, if four control points lie on the circumference of a circle, there are two valid ways in which triangles within the rectangle may be drawn. The triangulation algorithm works independently on the source and the target, so it is entirely possible that the alternative triangle appears in one or the other. Triangles may also be degenerate, i.e. have zero area if three control points like precisely in a vertical or horizontal line. The programme tries to detect both situations and posts a message telling you how many inconsistent triangles between source and target it has found. Detection is performed by computing the ratio of the area to the perimeter for each corresponding source and target triangle. If these rations exceed a threshold chosen by the user, then the triangle pair is declared to be inconsistent and so labelled. For such pairs, the rectified source pixels are simply transferred to the target without transformation. You may adjust the acceptance threshold over a range of 1 to 100%. The higher the ratio, the fewer the rejections, but the result image will have more defects. The value should be chosen so that there are no inconsistent triangles visible.
The output options available with local stretching are fewer than with other types of transformation. You may also choose to show the triangulation of the source and the target superimposed on the output. The triangles of the source are shown in blue and those of the target in green. Consistent triangles are numbered in green, and inconsistent triangles are numbered in red. This may help you in disabling or entering new control points to remove the inconsistencies.
Start with a few (less than a dozen) widely spaced control points on very obvious and sure matching points. Before you use local stretch, first use Automatic Transformation on these points and reduce the control point errors with tweaking as far as possible every time you add a control point, then try Local Stretch and continue. The idea there is to give the Local Stretch as little as possible to do. You can tweak from 5 points onwards, but it's more sensible to start with about 10 or so. In Options, the tolerance percentage on the similarity of the triangles may be chosen. The higher the tolerance, the fewer the inconsistent triangles rejected, but they may be placed incorrectly in the result image. Add new control points one at a time and watch the rejection rate and the appearance of the image. From time to time, turn on "Show Triangles" on the control point menu, re transform and look at the triangles to see where something is disturbing the picture. Since triangles of the source image are shown in blue and those of the target are shown in green and each pair is numbered, you can see discrepancies more readily than by looking at the final data. The best results are usually obtained with a network of control points which has relatively even spacing. Clusters of control points will usually result in more inconsistencies. For consistent triangles in source and target, the match between source and target control points is perfect, and errors are distributed linearly between them.
Correcting a large detailed old map is a long and tedious operation with considerable hand labour involved for best results. Unfortunately, there is no way of automating the process, since recognition of suitable corresponding points is best done visually.
If you choose the Merge output option, you can easily see where divergences are present.
Adding a few control points in the right places can make a great difference in the appearance of the result.
See Local Stretch, Theory for more information.