Equations for anaglyph creation Log Out | Topics | Search
Moderators | Register | Edit Profile

stereo3d.com webboard » General 3D Discussion » Equations for anaglyph creation « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

M.H.

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, September 06, 2001 - 10:35 am:   Edit PostDelete PostView Post/Check IPPrint Post

Does anybody know some good equations
for transfer of the RGB values of
2 images into anaglyph ?
Top of pagePrevious messageNext messageBottom of page Link to this message

David C. Qualman

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, September 06, 2001 - 8:13 pm:   Edit PostDelete PostView Post/Check IPPrint Post

I'll assume that you have two images to start with - one for left and one for right. You have three basic choices. Make a pure anaglyph, make a mono anaglyph, or make a full color anaglyph.

You also have three colors Red, Green, Blue. Only two of these are in the lenses - Red and Green, or Red and Blue. The other is the "unused" color.

For discussion, I'll assume that you have red on left, blue on right.

For "full color", put the red of each pixel from left image into the red channel. Put the green (the "other color") from the left channel, or maybe the average of of the left green and right green, into the green channel. Put the blue from the right image into the blue channel. This preserves most color, and loses some depth info. It also is no more than byte copies for RGB24 and RGB32, so is quick to perform.

For mono and true color, you need to compute the intensity of each pixel. If your image is already mono, you already have the intensity. Otherwise, yoy can use the equation

Gray = 0.299*Red+0.587*Green+0.114*Blue

for simplicity of integer math, this could be approximated as
Gray = (9*Red + 19*Green + 4*Blue)/ 32

There are other equations that some specialists use, but the coefficients are all similar. The goal is to compute the intensity to match the human eye.

Scan the image, and compute this for each pixel of the left and right image.

If you are constructing a "pure image", put the Left Gray value into the red channel. Put the Right Gray value into the blue channel. Leave the green channel (the "other" color) as 0. This technique will maintain the stereo information the best, but looks odd, since it is only red and blue.

If you are constructing a "mono image", do the same for the red and blue as for the pure image. But, set the green value (the "other" color) to your choice: the gray of the right, the gray of the left, or the average. This technique is a compromize between looking good and maintaining stereo information.
Top of pagePrevious messageNext messageBottom of page Link to this message

M.H.

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, September 07, 2001 - 10:33 am:   Edit PostDelete PostView Post/Check IPPrint Post

David: Thank you for your opinion. The problem is I am not sure that just simply making the blue and right chanel equivalent to the luminance (you call it Gray) is the best way ... Human eye have diferent sensitivty to R,G,B as it is just demonstrated in the equation for luminance calculation ... 100% blue intensity
looks like 54% red intensity ... Maybe some reduction for effect this shuld be done ...
The best method shuld be probably chosen
experimentaly ...
Top of pagePrevious messageNext messageBottom of page Link to this message

David C. Qualman

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, September 07, 2001 - 9:31 pm:   Edit PostDelete PostView Post/Check IPPrint Post

You are right Michal. I wondered about that as well. Since we weight the RGB to create the luminance, or gray value, why not weight each eyes luminance when we reconstruct the RG or RB image? I saw no references that anyone did this, and assumed that the red and blue filter in front of each eye would be appropriate to balance the colors.

An experiment in which the relative intensities of the red and blue or red and green colors were varied would be valuable. Perhaps you want to do some research, and present it at the SPIE or equivalent conference?
Top of pagePrevious messageNext messageBottom of page Link to this message

M.H.

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, September 09, 2001 - 3:46 pm:   Edit PostDelete PostView Post/Check IPPrint Post

David: I thing that such work was probably
done by somebody. I hope that some optimized
anaglyph creation equation exist somewhere -
just to find them. Unfortunately my searches on the net did not find anything realy good.
I am afraid that I have no time to do research in this area - to much work on other projects ...
Top of pagePrevious messageNext messageBottom of page Link to this message

David C. Qualman

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, September 10, 2001 - 3:17 am:   Edit PostDelete PostView Post/Check IPPrint Post

I was taking a trip to Mt. St. Helens this weekend, to see the exploded crater, and while driving, I arrived at what I think is the anaglyph solution. As I mentioned above, I have found conversions that other used to convert from RGB values into an Intensity value. But, you asked why do we stuff an intensity value directly into an R, G, or B value, without converting it prior.

My thought is that we don't have to. The monitor does it for us.

I know that when I capture images from a monochrome video camera, I have only the intensity. To display it on a color display, I always replicate the same value for the R, G, and B values. For instance, if the monochrome pixel has a value of 147, I create an (R, G, B) pixel of (147, 147, 147). It always is displayed as a gray value. You can create a palette to demonstrate this, as I do whenever displaying mono images, by filling all palette entries to a unity value. That is, intensity value 0 is (0, 0, 0), intensity value 25 is (25, 25, 25), up to pure white of (255, 255, 255). This always works, and never shows a pixel with stronger red, or green, or blue. These pixels are always displayed with the right balance so that they look gray.

I think that the combination of monitor circuitry and phosphors are tuned to mix the intensities of Red, Green, and Blue correctly. Thus, if you tell the monitor to set Red, Green, and Blue to the same values, then the light eminating from the red phosphors would be about 196% as bright as the light from the green phosphors, and the light from the blue phosphors would be about 4 times as bright as the green light. (Assuming that I did the division correctly :-)

So, I think that to convert an RGB value into a mono value, you use an equation similar to what I showed above. This converts what the monitor would display, to the net intensity that we would see. Then, once we have this intensity, we plug it directly back into the RGB values, and let the monitor display it at the levels that it expects the eyes to see. Thus, we would only need to convert in one direction, and let the monitor convert in the other direction for us.

At least, this is how I am doing it in the upcoming WINx3D.
Top of pagePrevious messageNext messageBottom of page Link to this message

M.H.

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, September 10, 2001 - 10:00 am:   Edit PostDelete PostView Post/Check IPPrint Post

David: It sounds like it have realy sense.
Lets's test it in praxis :-)

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image

Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | User List | Help/Instructions | Program Credits Administration