Take an image, eg. the one of Europa at: http://ali.apple.com/space/space_images/EuropaBall.jpg
Convert to ppm format and use mogrify
to trim down:
mogrify -format ppm EuropaBall.jpg mogrify -fuzz 20% -trim EuropaBall.ppm
Now do an inverse rectilinear transform, using the -i
projection parameter:
project rectilinear -w 1000 -h 500 -i -f EuropaBall.ppm > europamap.ppm
Now we have an (incomplete) map of Europa:
We can then use this in the usual way:
project rectilinear -long 60 -w 500 -h 500 -f europamap.ppm > europa1.ppm
project perspective -long -60 -lat -30 -w 500 -h 500 -f europamap.ppm > europa2.ppm
Of course, only the mapped part of the moon appears.
One partial map may be used as a background to another:
project rectilinear -long 180 -w 1000 -h 500 -i -back europamap.ppm -f EuropaBall.ppm > europamap2.ppm
leaving only a few holes to be filled in (of course, the two maps may be generated from different images).
Photographs really are perspective views, so we can use the inverse perspective
map too, but this requires knowing or working out the correct viewpoint and
scaling factor to use. The -x
parameter specifies the distance from the
centre of the object (in object radii) and the -scale
parameter
specifies the overall magnification of the input image from the default. For a square
image filled by the image of the object, the ratio of -x
to -scale
will be approximately 5.7, slightly more for small values of -x
due to
foreshortening. The -bg
parameter may be used to specify a different
background for the map image to aid correct scaling.
project perspective -x 5.76 -w 1000 -h 500 -i -f EuropaBall.ppm | display project perspective -x 11.4 -scale 2 -w 1000 -h 500 -i -f EuropaBall.ppm | display project perspective -x 100 -bg 255:0:0 -scale 17.6 -w 1000 -h 500 -i -f EuropaBall.ppm | display&
For space images, taken from a relatively large distance, the rectilinear
transformation should give reasonably good results (for x
distance greater
than about 20, the difference with the perspective projection will be small).