GIMP‎ > ‎

Depthmap Plugin

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 depthmap can be used then e.g. in another plugin like focus blur to simulate a bigger aperture.

Examples here and here:

The two layers conjoined to an anaglyph:


The depthmap:


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 and the libcvaux-dev packet.
Example here:
http://sites.google.com/site/elsamuko/c-cpp/opencv-depthmap

For all scripts together, go here.
ċ
El Samuko,
Sep 30, 2012, 4:23 AM
ċ
elsamuko-depthmap-cv.tar.gz
(6k)
El Samuko,
Sep 2, 2012, 4:35 AM
ċ
elsamuko-depthmap-w32.zip
(17k)
El Samuko,
Sep 12, 2010, 2:59 PM
ċ
elsamuko-depthmap.c
(13k)
El Samuko,
Sep 2, 2012, 4:33 AM
Comments