Thursday, August 14, 2008

Window Lifting


The number of variables or parameters involved in the process of lifting the stereo window, and inter-relatedness of these parameters can be quite intimidating. Stereo pairs prepared for an anaglyph add to the complexity of the matter. It took me quite some time to organize my thoughts and come up with a systematic plan of action. Photoshop helped me a lot by handing me an example, a prototype actually, that put parts of the puzzle in place. The next puzzle to solve was, what is exactly a window violation in terms of relationship between the stereo window and the chips. Once I understood this one, the rest of the pieces of the puzzle fell into place.

A Qualitative Description


So let's start with window violation. A violation is simply a case of missing information. Objects in front of of the screen that touch the boundaries of the stereo window get truncated by the edge of the window, one eye doesn't get the corresponding information (field of view) that the other eye sees. But this becomes a violation only if the missing field of view is supposed to be there. The view of objects that are placed behind the stereo window could also be asymmetrical but we don't care if our left eye doesn't see what the right eye sees around the left edge of the window. That's why trimming the window doesn't introduce a violation. All the necessary information is available from both chips.

When we float the window, just as in moving closer to an actual window, we see a broader field of view. This is where the expanded view seen exclusively by each eye, must be appended to the view , in the form of red and cyan fringes, the red to the left of the right view, and the cyan, to the right of the left view. Now the right eye sees around the left border, but the left eye misses that sliver of the view, because it gets filtered out. Similarly things get correctly arranged on the other end. What happens at the top and bottom end of the window is irrelevant.


Quantitative Considerations


1-. So how wide are the fringes?

2-. How far do we pull the window?

3-. What if our chips don't have the needed area for the fringes?

Non of these questions can be answered independently. We have to settle on something before we get started.

Let's start with placing the objects where we want them to appear with regard to the screen. A natural choice would be to place the main subject on or near the screen, and allowing everything else to fall where they may. We are ignoring any possible window violation, for now. Our goal is to achieve the same placement after the window is lifted. Let's call this placement a

If we can determine that the violation occurs at the bottom or top edges of the window, then we know that the window must be pulled all the way to the frontmost part of the picture. Since fixing the violation pushes the plane of violation all the way back to the screen, placement nv1, the elevation can be measured by the offset between the two views at the bottom edge, in our initial placement.(placement a). However if the violation occurs on the sides of the window, we can get away with less window lifting. The less window lifting,the better it is for our health and for the environment! The drill is to find the plane of violation, go back to placement a and measure the offset at that plane. The catch is that, if we are working with untrimmed chips and a violation has already occurred, we have already run out of information. This means we have to accept a smaller window and sacrifice some margin in one side or another. But at least we know the elevation and the offset necessary to fix the violation

Before you despair and give up on the whole enterprise, remember that photoshop can do most of the heavy lifting for us. This is what happened with club_penguin anaglyph:

In Bridge CS3 I selected the left and right chip, then chose- tools/photoshop/photomerge.

In the dialog window that opened I selected Reposition Only and unchecked the square Blend images together. Photoshop then made a two layer panorama that has some section of the interior of the two views overlapped, correctly, shifting the left chip to right- the right chip to left, and more importantly, it expanded the canvas to accommodate both chips, filling the expanded wings with transparency, so each view now has a transparent wing on the opposite side. Now if I send these layers as a new document to any anaglyph producing application, I'll get the correctly lifted window, without having performed any color channel manipulation.

See, I told you, it can't be that bad.

Here is where a new parameter pops into the picture: Camera lens convergence .

Ideally, if each camera is trained on the main subject, Photoshop may recognize that object as the overlapping region, and do the rest for us. This triangulation or squinting of the cameras, also guarantees that we have plenty of coverage at the opposite side of each chip, and hopefully, a correctly placed main subject, namely- on the screen plane. So now suddenly everything becomes automatic, that is, if our cameras triangulate, as we train them on the near or far objects. This is not pie in the sky, but something that we should work on for our next rig design.

Now back to the present: - Here is a recap of the steps involved:

  1. Make a test anaglyph as you would like the objects to be placed.

  2. Notice where the violation occurs that needs to be corrected. (the intersection of the plane of violation with the picture)

  3. Estimate or measure the distance between the chips in this section of the picture (distance a in pixels) . The idea being that this is how far we will pull the chips apart, after we push this plane, back into the screen to fix the violation.

  4. Extend the canvas, by a total of a pixels

  5. shift the left chip all the way to right. Shift the right chip all the way to the left.

  6. If a pixels are not available at the other end of each chip, reduce the size of selection ( all-a ), until there is enough pixels available on the fringes.

  7. Send the chips to SPM for fine tuning the alignment, and building the anaglyph

The anaglyph looks best on white background.

If you are still with me go treat yourself to a nice cold beer or something, you deserve it.

Saturday, August 2, 2008

Harris Shutter and Harris Shutter Effect

Yes Virginia there is such a thing as Harris Shutter, not a commercial product, but a contraption devised by Bob Harris that can be fashioned out of cardboard or similar materials. It is a guillotine like device placed in front of the camera lens, that in raised or cocked position shutters the lens, and after it drops and comes to a stop, it shutters the lens again, in between the leading and trailing curtains, is an opening