Visualizing 2D MER imagery in pseudo-3D

Rupert Scammell


In a fit of boredom, I began wondering one night if it'd be possible to take 2D raster images from the MER mission, and vectorize them in such a way that 3D terrain information could be visualized (yes, I know about Maestro), and the information used in 3D modelling programs other than Maestro.

After some desultory attempts to find a decent, free raster-to-vector converter for the Windows box that I was sitting at at the time, I began searching for Linux tools to do the job, and stumbled upon the excellent autotrace tool, which accepts a variety of raster image formats, and dutifully outputs a vector file in a variety of different formats (DXF, EPS, etc).

However, despite being a great program in many respects, the vector files output by autotrace create a vectorization of a raster image that invariably map the raster information onto a two dimensional plane, which I found disappointing. After some hopeful glancing at autotrace's man page in search of an elusive --make-it-3d flag, or something similar, I spent the next day thinking about the problem.

The next day, I tried running a few JPEG images through autotrace, and examined the resultant DXF files. Mercifully, DXF files are designed to be human readable, and there are plenty of good references out on the 'Net that describe the various sections and flags in detail. Armed with a better understanding of the DXF format, examination of the file revealed that autotrace had made its best attempt to translate the color information in the raster file to the DXF file, by tagging created lines with color information. At this point, the pieces began to fall into place, and I realized how to insert elevation information into the file, and thereby create an odd breed of 3D-from-2D image.

I wrote a quick Python script, dxfel, which given a DXF file generated by the autotrace tool, the name of the DXF file to output to, an elevation increment (explained below), and the name of the elevation information generation algorithm (simple|smart) will produce a DXF file containing a 3D projection of a DXF file which lacks 3D information.

The elevation height generation algorithm reads the color table of the DXF file, and builds a hash table which contains the name of the color that each POLYLINE (lines connected by points) element references. Using the simple algorithm, the first color encountered has elevation 0, the next has the height of the elevation increment provided by the user, the next elevation_increment * 2, and so on. I've since realized that this is not the best way to do things, and so a far more sophisticated algorithm, 'smart', is in the works.

The results

The images below are examples of those produced via the use of autotrace DXF files, post-processed with the dxfel script.

Image of RAT hole at Opportunity El Capitan site

Top view of RAT hole

Angled view from the top, color layers visible

'grey' layer removed from the top

Upside down - view of the bottom-most color layer

Another view of the top layer, looking down.

Cross section of color layers. Highlighted area with high density color layers between the main color bands is the RAT hole.

Close up of RAT hole.

Another close up of the RAT hole, this time with some color layers turned off.

Image of Adirondack Spirit Gusev Crater site

Top view of Adirondack.

Adirondack and surrounding rocks at an angle. Note the much greater separation between layers than in the RAT images, due to the use of a higher elevation increment when running dxfel.

Adirondack at an angle, with bottom color layers turned off.

Adirondack, looking from the bottom (base of blue arrow) sideways toward top grey layers.

Same perspective as previous image, with even more layers made inactive.

Images of Spirit Lander

Top view of lander.