Feature #660

grdimage to produce 3D-anaglyphs

Added by Remko over 6 years ago. Updated over 6 years ago.

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


Target version:Candidate for next minor release


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


#1 Updated by Joaquim over 6 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)


#2 Updated by Paul over 6 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