Generating maps from images with MMPS, Part II

Take a four view image eg:

Black out the text and crop to four separate images with your favourite image editor:

       

Trim off the borders, using 30% fuzz to trim the rather indistinct borders aggressively:

convert -fuzz 30% -trim p0.ppm p0a.ppm
convert -fuzz 30% -trim p90.ppm p90a.ppm
convert -fuzz 30% -trim p180.ppm p180a.ppm
convert -fuzz 30% -trim p270.ppm p270a.ppm

       

Use the circularize utility to convert to an exactly circular image:

circularize -fuzz 2.5 -f p0a.ppm > p0b.ppm
circularize -fuzz 2.5 -f p90a.ppm > p90b.ppm
circularize -fuzz 2.5 -f p180a.ppm > p180b.ppm
circularize -fuzz 2.5 -f p270a.ppm > p270b.ppm

       

(The fuzz parameter determines how close a match should be made with the edge color, similar to the fuzz convert parameter).

Now do an inverse projection:

project rectilinear -w 1000 -h 500 -i -long 0   -f p0b.ppm > pmap0.ppm
project rectilinear -w 1000 -h 500 -i -long -90  -f p90b.ppm > pmap90.ppm
project rectilinear -w 1000 -h 500 -i -long -180 -back pmap0.ppm -f p180b.ppm > pmap180.ppm
project rectilinear -w 1000 -h 500 -i -long -270 -back pmap90.ppm -f p270b.ppm > pmap270.ppm
generating two maps from complementary parts of the original images:

   

The surface features on the two maps line up reasonably well, though not exactly (unsurprising since we have a fairly non-ellipsoidal moon, are ignoring perspective effects, and the original images seem to be lit from different directions). The area where the alignment is worst seems to be the large blue area, corresponding to the least spherical part of moon.

The two images can be combined with the combine utility, which takes two identically sized images and produces a combined image. Pixels in the input background color (parameter -ibg color, default black) are ignored, when neither pixel is ignored, the output image uses the maximum rgb values from the two input pixels:

combine -fuzz 2 pmap180.ppm pmap270.ppm > map.ppm

Darkish lines in the image show where the original images joined up.

Now this can be used for projections:

project perspective -w 250 -h 250 -x 6.0 -long 45 -f map.ppm > i1.ppm
project perspective -w 250 -h 250 -x 6.0 -long 135 -f map.ppm > i2.ppm
project perspective -w 250 -h 250 -x 6.0 -long 225 -f map.ppm > i3.ppm
project perspective -w 250 -h 250 -x 6.0 -long 315 -f map.ppm > i4.ppm

       

Of course, projecting a proper 3D model would look rather better...