'Reverse' Anaglyph [solved]

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cantilever
Posts: 6
Joined: 2017-06-23T22:07:21-07:00
Authentication code: 1151

'Reverse' Anaglyph [solved]

Post by cantilever »

Hi All -

I've used the following code to try and produce a red/cyan anaglyph:

composite <filepath> -stereo +20+0 <filepath> anaglyph.jpg
magick convert <filepath> -channel r -separate -roll +20+0 ( +channel <filepath> -separate -delete -3 ) +channel -combine anaglyph.jpg

Both work - but both create an image that has the red channel as the dominate image with the cyan channel as a transparent ghost shifted. I'd like to reverse this where the cyan channel is the dominate image with the red channel ghosting it.

Thoughts?
Last edited by cantilever on 2017-06-24T10:48:36-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 'Reverse' Anaglyph

Post by fmw42 »

I understand a bit about anaglyph, but what determines which image is dominant. Are you taking about left right eye or something else?

Have you tried -roll -20+0? Is that what you want?

Or add +insert before the combine?

Please always provide your IM version and platform and example images, if possible.
cantilever
Posts: 6
Joined: 2017-06-23T22:07:21-07:00
Authentication code: 1151

Re: 'Reverse' Anaglyph

Post by cantilever »

ImageMagick-7.0.6-0-Q16-x64 - Windows 10

The -roll as it concerns these two scripts always repositions the cyan overlay. A better description would be as follows: the dominate/red image looks like the contents of the photo with the red channel overlaid whereas the cyan overlay looks transparent at about 10%. I'd like to reverse this and show the image contents with the cyan overlay and a ghosted transparent red channel.

The image attached shows this dominant red vs transparent cyan issue.

*image removed.
Last edited by cantilever on 2017-06-24T00:08:43-07:00, edited 4 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 'Reverse' Anaglyph

Post by fmw42 »

This works for me. I am not sure which way you want it. But cyan is a secondary color and thus is appears lighter than the red primary color. So I think your eyes will alway want to see red over cyan.

Code: Select all

convert input.jpg \
\( -clone 0 -channel r -separate -roll +20+0 +channel \) \
\( -clone 0 -channel gb -separate +channel \) \
-delete 0 \
-combine result2.jpg

Code: Select all

convert input.jpg \
\( -clone 0 -channel r -separate -roll -20+0 +channel \) \
\( -clone 0 -channel gb -separate +channel \) \
-delete 0 \
-combine result2.png
cantilever
Posts: 6
Joined: 2017-06-23T22:07:21-07:00
Authentication code: 1151

Re: 'Reverse' Anaglyph

Post by cantilever »

Thanks for the quick response.

The -roll seems to shift only the cyan transparency to the left or right, which isn't exactly what I'm looking for. I'm not concerned with which direction or order the colors are in at the moment, moreso, I want to see the main image with a green/cyan overtone and let the red 'float'. Is there any way to show the anaglyph with, if not a dominate color, at least an equal green/cyan and red transparency?

*image removed.
Last edited by cantilever on 2017-06-24T00:11:08-07:00, edited 2 times in total.
cantilever
Posts: 6
Joined: 2017-06-23T22:07:21-07:00
Authentication code: 1151

Re: 'Reverse' Anaglyph

Post by cantilever »

It's most likely an issue with the background coloring and not the organization/transparency of the channels. I think I will revisit this with a darker photography backdrop...
cantilever
Posts: 6
Joined: 2017-06-23T22:07:21-07:00
Authentication code: 1151

Re: 'Reverse' Anaglyph

Post by cantilever »

Looks like the background color was the culprit - thanks for walking through the process!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 'Reverse' Anaglyph

Post by fmw42 »

I have moved this post to the Users forum, since it is about the use of ImageMagick and not esoteric image processing.
Post Reply