Message Boards Message Boards

Turning anaglyph images into stereo pairs

A colleague sent this link to an article about the strangest solar system object I've ever seen, Saturn's moon Pan: . The article contains an anaglyph stereo image:

Pan anaglyph

I love stereo images and hate anaglyph images. I prefer free-viewing side-by-side stereo pairs. The images are cleaner, and I don't have to hunt for the stereo glasses that I can never find when I need them. It occurred to me that all the information I need to turn the anaglyph image into a stereo pair is in the image. And the code turns out to be practically a one-liner.

A little poking around with the Get Pixel Color tool (in the right-click menu) revealed that apparently all of the information for the red image is in the red channel and all of the information for the cyan image is in the blue and green channels (surprise!). So producing a left-right pair is just a matter of picking out the red and blue (or green) channels, which is just what ColorSeparate does. For cross-eyed viewing, you want the blue channel on the left and red on the right, so I had to use Reverse to change the channel order. This is the complete code:

UnAnaglyph[image_] :=
  Row[Reverse[Image[#, ImageSize -> 250] & /@ Most[ColorSeparate[image, "RGB"]]], " "]

It works beautifully:

UnAnaglyph[ImageTake[image, All, 450]]

enter image description here

UnAnaglyph[ImageTake[image, All, -450]]

enter image description here

I had fun applying UnAnaglyph to random anaglyph images I found in a Google image search.

enter image description here - you have earned "Featured Contributor" badge, congratulations !

This is a great post and it has been selected for the editorial Staff Picks group. Your profile is now distinguished by a "Featured Contributor" badge and displayed on the "Featured Contributor" board.

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract