You are here

Depthmap Plugin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

This plugin generates a depthmap out of two stereoscopic images.
Install it with:
gimptool-2.0 --install elsamuko-depthmap.c
Then open the two images as layers in GIMP and start the plugin under Filters -> Map -> Depthmap.

The two layers need to be identical in size. The algorithm takes a pixel of the first layer plus its surrounding area and searches on the second layer for the best match.
First option changes the horizontal parallax size the algorithm searches for a match. Try smaller values first, it's getting slow with big ones. Second option is the radius of the tile, which is compared to the tiles of the other image in the search area. Start here with small values too.
This algorithm can't interpret the image content, so the results will be 'ugly' in digital noisy or under- or overexposed areas. Just try out.


The two layers (

The depthmap:

The depthmap can be used then e.g. in another plugin like focus blur to simulate a bigger aperture and more beautiful bokeh:

Update1: Gained some speed by searching on the left side only for a matching pattern. The backgrounds of the two pictures have to be aligned.
Update2: Complete rewrite with OpenCV and preview included. Extract the zip folder and type "make", the code needs the libcv-dev packet. Example here:

For all my scripts together, go here:

elsamuko-depthmap.c12.61 KB
elsamuko-depthmap-cv.zip6.39 KB
GIMP Version: 
Code License: 


thank you. It's up and running. I was hopeing this little plugin would be of help. And it is for the purposes it was design for. I wanted to make maps with it, and when I did, well the results were less then stella. However, I have a new and fascinating plugin to entertain my ideas with. It's a great plug in to have in one's arsenal. Thanks again.

I'm familiar, somewhat with Windows XP. But I find the directions as to how to install this plugin properly incomprehensible. I can't find gimptool anywhere in GIMP. And if I did, I wouldn't have a clear conception as what to do to install it. I'm not a programmer, thus at a disadvantage to those of you who do and understand these things. Can somebody please expound on and help clarify what I need to know, get, and do, so that I too can enjoy this terrific little plugin.

I plan to use LROC color height maps, in DepthMap and evaluate how much better it is compared to the present techniques that I now use to make volumetric maps. Then render them in Terraine to generate small vide and assess the results. I think its worth the trouble to do all that. I just can't seem to get the ball rolling. I can't compile or install DepthMap at all.

Use one of the precompiled packages that are mentioned in the comments here.

The c source code doesn't compile without some help. :-)

On my Fedora11, I had to set 8 include directories and 3 libraries to link.

Something like this works for a Makefile:
-I /usr/include/gimp-2.0 \
-I /usr/include/glib-2.0 \
-I /usr/lib64/glib-2.0/include/ \
-I /usr/include/gtk-2.0/ \
-I /usr/include/cairo/ \
-I /usr/include/pango-1.0/ \
-I /usr/lib64/gtk-2.0/include/ \
-I /usr/include/atk-1.0/

-lgimp-2.0 \
-lgimpui-2.0 \
-lgtk-x11-2.0 \

elsamuko-depthmap_0: elsamuko-depthmap_0.c
gcc $(CFLAGS) $(LDLIBS) -o $@ $^
(You will have to re-insert a TAB at the beginning of that last gcc line.)


That's why I recommend
$ gimptool-2.0 --install elsamuko-depthmap.c
to install that plugin.

binary, compiled for windows by Francois Collard, and so ready to be installed on Windows Xp or Vista may be downloaded here

I get a gimp 2.6.10 installed on my pc. And I download this and try to use it to get a depth map. But it shows an error. I do not know why.
I open two images with the same size as layers.
Could you help me ?
By the way, I'm using winXP.
Thanks a lot

Subscribe to Comments for "Depthmap Plugin"