|
| 1 | +# anaglyph |
| 2 | + |
| 3 | +```julia |
| 4 | +I = anaglyph(G|fname; vscale=1, sscale=2, kw...) |
| 5 | +``` |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +```julia |
| 10 | + I = anaglyph(G|fname; view3d::Bool=false, zsize=4, azim=190, dazim=2, cmap="gray", kw...) |
| 11 | +``` |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +Generate an anaglyph image from the input \myreflink{GMTgrid} `G` or grid's file name `fname`. |
| 16 | + |
| 17 | +An anaglyph 3D is the stereoscopic 3D effect achieved by means of encoding each eye's image using |
| 18 | +filters of different (usually chromatically opposite) colors, typically red and cyan. Anaglyph 3D |
| 19 | +images contain two differently filtered colored images, one for each eye. When viewed through the |
| 20 | +"color-coded" "anaglyph glasses", each of the two images is visible to the eye it is intended for, |
| 21 | +revealing an integrated stereoscopic image (ref [Wiki](https://en.wikipedia.org/wiki/Anaglyph_3D)). |
| 22 | + |
| 23 | +This function offers two methods to create anaglyphs from a gridded terrain model. The first one, |
| 24 | +based on a simple gradient of the surface elevation, is very fast, takes a little while to fool |
| 25 | +the brain (that is, to make it think it's looking into a true 3D surface) but gives a very impressive |
| 26 | +feeling of depth. The second method, that generates 2 3D views using the \myreflink{grdview} program |
| 27 | +and construct the anaglyph from those two images, is slower and creates a less perceptually depth |
| 28 | +image but it is easier to see and displays more 3D info. |
| 29 | + |
| 30 | +### Args |
| 31 | +- `G`: The input \myreflink{GMTgrid} or filename of data to be processed. |
| 32 | + |
| 33 | +### Kwargs |
| 34 | +- `vscale`: Terrain vertical scale factor (default: 1). Applies only to first method. |
| 35 | + |
| 36 | +- `sscale`: Stereo separation scale factor (default: 2). Applies only to first method. |
| 37 | + |
| 38 | +- `R`: Region of interest when reading a grid from disk (default: entire grid). |
| 39 | + Ignored when `G` is a GMTgrid. |
| 40 | + |
| 41 | +- `view3d`: If true, selects an alternative and slower method that generates 2 3D views using |
| 42 | + the \myreflink{grdview} program and construct the anaglyph from those two images (default: false). |
| 43 | + |
| 44 | +- `zsize`: z-axis size of the 3D view. Same as in \myreflink{grdview} (default: 4 cm). |
| 45 | + |
| 46 | +- `azim`: Azimuth of the 3D view (default: 190). |
| 47 | + |
| 48 | +- `dazim`: Azimuth step (default: 2). It means, create the anaglyph from the pair of images obtained |
| 49 | + with `azim` and `azim - dazim`. |
| 50 | + |
| 51 | +- `cmap`: Color map (default: "gray"). |
| 52 | + |
| 53 | +### Returns |
| 54 | +An anaglyph \myreflink{GMTimage} suitable for viewing with red-cyan glasses. |
| 55 | + |
| 56 | +### Credits |
| 57 | +The method that uses the grid's gradient is based on an ancient program called ManipRaster by Tierrt Souriot. |
| 58 | +The second method, the one that uses the \myreflink{grdview} program, was proposed by Tim Hume in the GMT forum. |
| 59 | +(https://forum.generic-mapping-tools.org/t/bringing-the-third-dimension-to-gmt-stereograms/6189) |
| 60 | + |
| 61 | + |
| 62 | +Examples |
| 63 | +-------- |
| 64 | + |
| 65 | +Create an anaglyph of first type overt the Iberian peninsula. |
| 66 | + |
| 67 | +\begin{examplefig}{} |
| 68 | +```julia |
| 69 | +using GMT |
| 70 | + |
| 71 | +I = anaglyph("@earth_relief_30s", region="-13/-5.5/35/44") |
| 72 | +viz(I) |
| 73 | +``` |
| 74 | +\end{examplefig} |
| 75 | + |
| 76 | +Now let us see the Tonga Trench using the second method. |
| 77 | + |
| 78 | + |
| 79 | +\begin{examplefig}{} |
| 80 | +```julia |
| 81 | +using GMT |
| 82 | + |
| 83 | +I = anaglyph("@earth_relief_30s", R="-175.8/-171/-23/-14", view3d=true) |
| 84 | +viz(I) |
| 85 | +``` |
| 86 | +\end{examplefig} |
0 commit comments