Monday, August 25, 2014

Frame Sequence Generator 5 (FSG5)

Frame Sequence Generator 5 (FSG5) generates synthesized frames given a reference image and a disparity/depth map. The inpainting process is similar to the one in Frame Sequence Generator 2 (FSG2), that is, it is very basic (and therefore very fast). FSG5 generates frames on either side of the reference image.

The positioning of the stereo window is controlled by the "Stereo Window" parameter which is a grayscale value (from 0 and 255). A value of 255 places the stereo window at the depth of the white areas in the depth map. A value of 0 places the stereo window at the depth of the black areas in the depth map. You might want to use the eye-dropper tool in The Gimp or Photoshop to get the value you want.

The stereo effect is controlled by the "Stereo Effect" percentage. The higher the percentage, the stronger the stereo effect but the more difficult it is to inpaint (and the less sense it makes).

If image.xxx is the reference image, the frames generated will be named frame1.xxx, frame2.xxx, etc, going from left to right. If the number of images requested is odd, the reference image will be one of the frames. For example, if the number of frames is 5, frame 3 will be the reference image. To animate the frames, I suggest loading the generated images into some third-party software like Lenticular Image Creator (or anything else that can be used to generate animated gifs).

The disparity/depth map should be a grayscale image where white indicates closest foreground object and black indicates furthest background object. The disparity/depth map doesn't need to come from any of my programs.

Here's an example using stereo window = 220, stereo effect = 3%, and number of frames = 3:


Reference image.


Depth map.


Frame 1.


Frame 2 (reference image).


Frame 3.

This rudimentary method of view interpolation generates streaks around object boundaries. For a more sophisticated inpainting method (using interpolation), you may want to use Frame Sequence Generator 4 (FSG4).

Here's what FSG4 does for the same reference image and depth map using focal plane = 220, stereo effect = 0.1, and number of frames per side = 1:


Left frame 1 (corresponds to frame 1).


Right frame 1 (corresponds to frame 3).

Note that the stereo effect parameter behavior in FSG4 is not the same as in FSG5 (sorry about that). One day, I'll probably change the one in FSG4 so that it behaves the same as in FSG5.

At some point, I will probably release Frame Sequence Generator 6 (FSG6) or Frame Sequence Generator 52 (FSG52) which will use two depth maps instead of just one for view interpolation.

The windows executable (guaranteed to be virus free) is available for free via the 3D Software Page. Please, refer to the 'Help->About' page in the actual program for how to use it.

Edge Preserving Smoothing 5 (EPS5)

If you want to smooth the disparity map you have obtained (doesn't have to come from my programs), Edge Preserving Smoothing 5 (EPS5) can do the job for you. It is edge preserving meaning that, for a given pixel, the neighboring pixels that are considered in the smoothing process are of a similar color. This kinda guarantees that smoothing doesn't go across depth discontinuities and "fatten" object boundaries.

The smoothing of the depth map is done using the same guided filter that's used in Depth Map Automatic Generator 5 (DMAG5). Instead of smoothing raw costs, we are smoothing disparities.

Here's an example:


Left image of the Tsukuba stereo pair.


Depth map in dire needs of smoothing.


Depth map smoothed by EPS5 using window radius = 12, epsilon = 4, and number of iterations = 1.

The windows executable (guaranteed to be virus free) is available for free via the 3D Software Page. Please, refer to the 'Help->About' page in the actual program for how to use it.

Thursday, August 14, 2014

Lenticulars - Interlacing with Lenticular Image Creator

We already know that we can interlace with Lenticulars - Interlacing with SuperFlip for free but there's also Lenticular Image Creator Software, created by Jameson Bennett that's also free (for personal use). Let's have a look at LIC then, shall we?


Here, I have loaded 5 frames. Recall that number of frames = printer resolution / lpi (lenticules per inch aka lenticular pitch). Since I am planning to use a 60 lpi lenticular lens and I intend to print at 300 dpi, the number of frames is indeed 5. Note that I could have opted to print at 600 dpi and chosen 10 for the number of frames. Of course, the higher the resolution, the bigger the file to print (which may or may not be a problem for the printer's memory). The "Lens LPI" is whatever your pitch test tells you to choose and we have already discussed the "Printer DPI" option a bit. For HP printers, it's 600 dpi (or 300 dpi or 1200 dpi). I don't know about other printer brands but it's either 600 or 720 dpi (You can easily find out anyways.) The "Viewable Image Size" is whatever size you want the interlaced to be (without counting the registration marks on the left and/or right side). The "Final Output Size" includes the registration marks if you have checked them in the "Registration" tab. So, if you have checked both left and right alignment marks (each with a 0.25 inch width), the final output width is gonna be 0.5 inch wider than the viewable image width. Those sizes depend on whatever lenticular lens you are gonna use to laminate the interlaced image. In my case, I am using a 4x6 lenticular lens. Once everything is all set, you just press the "Interlace" button and LIC will generate and save the interlaced image for you.


This is what you see if you click on the "Registration" tab. Alignment marks are useful in terms of making sure the lenticular lens is aligned in the vertical direction.


Unlike SuperFlip, LIC doesn't allow you to print the interlaced image directly. I like to use Gimp to load the interlaced image and print it. Before printing, you have to make sure the print size is correct. To do that, go into "Image"->"Print Size..." and adjust the resolution to whatever dpi (ppi) you chose in LIC. If you change the print size unit to inch, you should get the same output size you had in LIC. Now, you are ready to print the interlaced image. In all cases, don't let the printer resize the image! The image printed on the paper should be the same size as the final output size indicated by LIC.

When the resolution is pretty high, you may end up with gigantic files to print and the printer may not like it at all (not enough memory). If, for some reason, you can't cancel the print job, you may have to stop the print spooler and restart it to flush the printing queue. To do that (windows 7), click on "Start", "Control Panel", "System and Security", "Administrative Tools", "Services", and locate the "Print Spooler". If you stop it and then restart it, the printer queue will be purged and you will be able to print again (at a lower resolution this time).

I haven't talked about LIC's pitch test creation capability (under the "Calibrate" tab) because I haven't tried it. I am sure however that it's quite similar to Lenticulars - Pitch Test with SuperFlip and certainly as reliable.

Something that's a bit weird about LIC is that when you press the "Interlace" button and give the file name (including the extension), nothing seems to happen. Solution: When you give the file name, use the drop-down "Files of type" menu, select a format and then type the name of the file without the extension.

Tuesday, August 12, 2014

Lenticulars - Lenticular Interlacing

This is my attempt at trying to explain how lenticular interlacing works and, most importantly, why it works.

First thing first, let's figure out the number of frames needed for a given printer and a given lenticular pitch (lenticules per inch aka lpi). The formula is simple: number of frames = printer's resolution / lenticular's LPI (pitch). So, if you have an HP printer with a resolution of 600 dpi and you have a 60 lpi lenticular, then the number of frames is 600/60=10. Here, I am using dpi (dots per inch), but it really should be the ppi (pixels per inch). People have a tendency to use the dpi instead of the ppi, so I am doing the same here (to add to the confusion, I guess). You may use fewer or more although I don't guarantee anything good will come out if you use more. Note that this number of frames corresponds to what you can put under each lenticule (the individual lens of a lenticular sheet).

Now that we have figured out the number of images (frames) to have on our interlaced image, let's have a look at what is actually printed on the interlaced image:


For simplicity, you can think of a what I call a column as a column of pixels, although its width doesn't have to be one pixel.

Let's have a look at what the eyes see when one is looking straight down at the lenticular:


Let's have a look at what the eyes see when one is not looking straight down at the lenticular (head is shifted):


It's important to note that the eye never sees an image in full resolution (the image one would see if it were not interlaced) but a sample of it. The image is seen through a mask with regularly cut vertical slits. In our case of 10 image interlacing, the vertical slit is placed every 10 columns. Whether the head looks straight down at the lenticular sheet or shifts to the left or right, you always experience a 3D effect but the scenes you are seeing are not the same (the vertical slits in the mask are not at the same place). It's a bit like virtually exploring the scene by simply shifting your head, or tilting the lenticular (which is basically the same thing, geometry wise). When you make a lenticular with just two images (the left and right image of a stereo pair), you don't get that effect and the head must be looking at the lenticular sheet straight on to get the 3D effect.

If you want to make your own interlaced image with Photoshop or The Gimp, I suggest you read 3D Lenticular Printing Interlacing Algorithm Illustrated Using Photoshop.