Feature #660

grdimage to produce 3D-anaglyphs

Added by Remko about 2 years ago. Updated about 2 years ago.

Status:NewStart date:2015-01-07
Priority:LowDue date:
Assignee:Remko% Done:

0%

Category:-
Target version:Candidate for next minor release
Platform:

Description

I saw today a poster with a 3D red/cyan anaglyph of the moon. And of course I thought: GMT5 should be able to do that!

The way it could work in grdimage is the following:
  1. Add an additional option to assign a "depth map"
  2. Add an additional option to assign a maximum left-to-right displacement
  3. Compute the pixel colors as per usual (with shading if so desired)
  4. Normalize the depth map so that 0 is the largest depth of view, 1 is the nearest.
  5. Shift pixels right proportional to the normalized depth map; this is your left image
  6. Shift pixels left proportional to the normalized depth map; this is your right image
  7. Merge the left and right images to a single image

For links on these steps, see: http://stackoverflow.com/questions/7714289/3d-anaglyph-creation-algorithm-using-depth-map-image-where-to-find

History

#1 Updated by Joaquim about 2 years ago

and you know what? Some 10 years ago grdimage was able to do anaglyphs but I lost that version long ago.
I have it in Mirone. It only lacks an optional amplification factor. Have a look at line 2208 of (it even uses grdgradient)

https://code.google.com/p/mirone/source/browse/trunk/mirone.m

#2 Updated by Paul about 2 years ago

If you are motivated, then go for it. I note unused options are -F, -L, -S and -W.

Also available in: Atom PDF