Prev Up Top Next Contents

4.5 Sketch morphing

Therion can import scanned survey sketches both in the xtherion map editor, as background images, and into the generated PDF outputs. The imported sketched can be further morphed to adapt to the measured cave points.
Sketch Morphing is a procedure to warp a sketch picture according to measured point positions. The proper name, in the Image Processing professional world should be "Sketch Warping", but cavers use the word "Morphing", so we will stick with that.

Background sketch
Fig. 63. Background sketch

4.5.1 Morphed sketches as background images

You need to morph a sketch picture according to the station points of a scrap, and later import it as background image in the map editor. The morphed sketch is saved in "xvi" (xtherion vector image) format.
You first open the xtherion map editor on the scrap with the picture of the original (un-morphed) sketch as background image.
Then you select the scrap object, by selecting the scrap line in the list of the "Objects" control. Next click on the "Insert sketch" button of the "Scrap" control: the status bar shows a "Insert sketch" message. Now if you click on the background image, the image is added to the list of sketches to morph with this scrap data.
To generate the morphed sketches you need to export the map in xvi format. In the "thconfig" file put the command
    export map \
      -fmt xvi \
      -o cave.xvi \
      -layout-sketches on
You can avoid to specify the format if you have an output filename with extension "xvi". If you do not specify the name of the output file, therion generates a file named "cave.xvi". You must put the layout option "sketches on". Alternatively you can define a layout with that option and add it to the export command,
    layout morph
      sketches on
    endlayout

    export map -o cave.xvi -layout morph
When you compile, ie, run therion, it generates the xvi file you requested. If you insert it as background image ("Edit -> Insert image" menu, or "Insert image" button of the "Background" control) you will get the morphed sketch with the proper station points, into the map editor canvas.
From this point on you can continue to draft the cave map using the morphed sketch.

Morphed sketch
Fig. 64. Morphed sketch

4.5.2 Morphed sketches in the PDF output

To add a morphed sketch to you PDF output you must associate the sketch to the scrap, the same way you did to export a xvi, and add the layout sketches on option to the export command in the configuration file.

4.5.3 Therion morphing algorithms.

There are four morphing algoriths implemented in therion: By default the first is used. You can select a different algorithm by specifying the command (in thconfig)
   sketch-warp algorithm
where algorithm is one of the four names above.
What is the difference among these algorithms ?
You do not need to know this. You can just try them out and use whichever you find better. However some idea of the inner working of the algorithms may help you to understand why the result you are getting does not really look as you want.
The "line" algorithm changes a point position on the basis of the inverse of the distances of the point from the survey legs lines and stations.
The "linear" algorithm changes the sketch by a linear transformation (translation + rotation), to adapt it as best as possible to the two fartest stations.
The "plaquette" algorithm splits the sketch into triangles and rectangles, using the centerline as skeleton, and warp each of them bilinearly.
The "point" algorithm changes a point positions on the basis of the inverse of the distances of the point from the station points.
The differences between these algorithms can be seen in the image below. In each case the positions of the station points have been emphasized with green marks. The "linear" algorithm simply does a rototranslation of the sketch without any deformation, and cannot adapt to the measured points. The "point" tends to produce bulges on the cave linear features (eg, walls) between the stations.
The "line" and the "plaquette" algorithms seem to do a fair job since both these two algorithms use the centerline shots as backbone for their job. The "plaquette" algorithm is faster as it splits the image in patches and map each patch one at a time, while the "line" algorithm map each point by weighting the contributions to the map by all the survey lines. However the "plaquette" algorithm suffers from severe image distorsions, when plaquettes pairs, in the sketch and in the map images, are have rather different shape. Therefore it is experimental, and it is advisable to use the "line" algorithm (which is the default).

Morphing algorithms
Fig. 65. Morphing algorithms
The morphing subdirectory of the samples in the therion distribution has some complete examples of sketch morphing.

4.5.4 Extra points

If your survey data contain also the transversal dimensions (or other measured or extimated distance) you can use this information in the sketch morphing. to this aim you must tell therion where the transversal dimensions end in the sketch, ie, where is the left and the right points, or the up and down points, or whatever point you used in the extra data.
You use points of type extra. If you do not specify any option, therion will guess from which station is your measure, by taking the closest station point (in the scrap). In case there is another station closer to the extra point, you should use the option -from followed by the station name. You can specify the value of the dimension (option -dist or -value, followed by a number, and optionally a unit), or leave it to therion to figure it out from the LRUD data in your survey.

4.5.5 Examples

The dist option
The sketch option

therion users - Tue Feb 21 10:49:45 2012
Prev Up Top Next Contents

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.