Image processing tips for geoscientists – 1

Today I would like to show a way to quickly create a pseudo-3D display from this map:

Original image

The map is a screen capture of a meandering river near Galena, Alaska, taken in Google Earth. I love this image; it is one of my favorite maps for several reasons. First of all it is just plainly and simply a stunningly beautiful image. Secondly, and more practically, the meanders look not too dissimilar to what they would appear on a 3D seismic time slice displayed in grayscale density which is great because it is difficult to get good 3D seismic examples to work with. Finally, this is a good test image from the filtering standpoint as it has a number of linear and curved features of different sizes, scales, and orientation.The method I will use to enhance the display is the shift and subtract operation illustrated in The Scientist and Engineer’s Guide to Digital Signal Processing along with other 3×3 edge modification methods. The idea is quite simple, and yet extremely effective – we convolve the input image with a filter like this one:

0 0 0
0 1 0
0 0 -1

which will create a shifted version of the image (at the -1 location) and subtract it from the original (at the 1). Quoting the author:” this processing produces the optical illusion that some objects are closer or farther away than the background, making a 3D or embossed effect. The brain interprets images as if the lighting is from above, the normal way the world presents itself. If the edges of an object are bright on the top and dark on the bottom, the object is perceived to be poking out from the background”.

This is the same result you would achieve using Emboss filter in Photoshop and other similar programs. The only time I saw embossing used on seismic data was a few years ago when I took a Seismic Geomorphology course taught by Henry Posamentier for the Canadian Society of Exploration Geophysicists (CSEG). So thank you for the idea, Henry.

Like with derivative maps and with illumination, the outcome of this operation is not unique, in the sense that with changing the direction (or azimuth) of the process, i.e. the position of the -1, different features will be enhanced, and some in fact will be obscured as a result of the subtraction. Let’s look at a few examples below.

Here is the shift and subtract to the South, using this kernel:

0 0 0
0 1 0
0 -1 0

It looks like a good result, with most linear and curved features are enhanced. It has however suppressed features oriented N-S. For example many of the channels in the NE corner, and the “l” in Google, which is all but gone. Notice also that the pseudo-3D effect is noticeable but not as pronounced as in the shift and subtract to the Southwest below. Look at the main river on the left for instance. The reason is that when applied along the diagonals, the copied image is shifted both horizontally and vertically, as opposed to just vertically or just horizontally:

0 0 0 0 0 0
0 1 0 0 1 0
0 -1 0 -1 0 0

The shift and subtract to the West delivers the least pseudo-3D effect. This is because not only are we applying the shift in one direction, but also that happens to be the direction a lot of the channels in the center are oriented. So directionality is a drawback of the method, but on the other hand I find very often that going through the exercise of comparing the alternatives I will learn a lot more about my data and the geological features in it than if I hadn’t, so I do it if I have the opportunity.

Try it yourself, and let me know if you agree with my conclusions. Did you find any of the remaining 5 direction better overall? The original image is here, and the code to create all filters and output displays is below:

However, it is far better for comparison and QC to display all the directions at once together with the original, like this:

I did that with this additional code below. Notice that to run it you will need to download from the Matlab File Exchange the function linkzoom by Carlos Vargas Aguilera. Linkzoom allows synchronizing of all subplots so that when zooming or panning one of the images, all other images will zoom or pan accordingly.

save the code to a text file
remove my comments at the top, or comment them out with //
drag the text file and drop it on the ImageJ interface…an editor will open it.
open your image that you would like to process in imageJ from the File menu or drag and drop the image
select Macro>Run Macros, or press Ctrl+R in the editor

Blogroll

Meta

Go ahead if you want to use my code, modify it, improve it, for non-commercial AND for commercial use. You are also welcome to download and reuse my media files - unless otherwise stated. With both code and images, please give full and clear credit to Matteo Niccoli as the author and mycarta.wordpress.com as the source.
WordPress bloggers are welcome to reblog my posts. For republishing outside of WordPress or any other request, please e-mail me at: matteo@mycarta.ca