Sunday, July 31, 2011

Building an Over/Under Stereo Viewer

Introduction

This paper gives instructions for making an over/under stereo viewer. This is similar to the ViewMagic ™ viewer sold by Berezion.com and rmm3d.com. Note that it is a lot easier to just buy the ready-made unit, but if it is out of stock or if you want a different size viewer, this tells you how to make your own.
What you are building here is a pair of periscopes that you will mount together. One will allow the left eye to see an image three inches below eye level and the other will allow the right eye to see an image three inches above eye level.
The original of this file is stored as Building and Over-Under Stereo Viewer in the same directory as the specification for the 3Deifier.

Materials Required

Here is a list of materials required to make a viewer based on a 2” initial measurement. You can easily scale this up or down as desired. The original View Magic viewer seems to have been based on about 1.5”.
  • A 12” x 12” mirror tile. You can purchase a package of 6 of these from Home Depot for $10.
  • A ½” thick board at least three inches wide and at least 15” long. I used a scrap of ½” hardwood plywood.
  • A ¼” piece of plywood from which you will cut 4 pieces, each 3” x 7 ¼”.
  • 24 tiny nails – ¾” long.
  • 8 wood or sheet metal screws – about 1” long.
  • Some thick glue to hold the mirrors onto the backing plates.

Step 1 – Cutting the Side Boards

In this step, you will cut four diamond shaped boards that will make up the sides of the periscopes.
  • Set the rip fence on your saw for 2”. Cut a 2” wide piece from your ½ inch plywood.
  • Use a miter gauge to cut a 45” angle at one end like this:
clip_image002
  • Without moving the rip fence, cut 4 diamonds using the same 2” width. The resulting diamonds will be about 5 ¼” between the two sharp points. I tacked a small piece of scrap wood to each of the diamonds to make them easier to hold against the rip fence:
clip_image004

Step 2 – Cutting the mirror

You will need 4 pieces of glass. Two will be 6” by 2 ¾”. Two more will be 3” by 2 ¾”. You can purchase a glass cutter at the hardware store or Home Depot for $5. YouTube has a video named “Basic Glass Cutting” that explains how to do this if you don’t already know.

Step 3 – Cutting the Backing Boards

In this step, you will create the plates on which the mirrors will be glued.
  • Cut four rectangles from the ¼” plywood. Each should be 3” x 7 ¼”. If you used ¾” wood for the sides, increase the length of the plywood pieces to 7 ¾”.
  • Bevel the long sides of the plywood pieces to 45”.
  • Put ½” x 1/8” grooves in the short sides. The resulting pieces should all look like the following:
clip_image006
clip_image008

Step 4 – Trimming the Inner Backing Boards

In this step, you will cut out part of the inner backing boards. This allows the periscopes to be moved closer together so that you can use them both at the same time. I used a band saw for this, but you can do this on the table saw or with a hand saw. The piece I cut out is half-way in each dimension – in this case 1 7/16 x 3 1/8. Note the position of the bevel. It is very easy to cut out a wrong quarter.
clip_image010

Step 5- Assemble the Two Periscopes

Glue and nail the backing boards to the side boards. The side boards go on opposite sides of the two diamonds. Unfortunately, I forgot to take a photo of the two sub-assemblies before trimming the diamonds (which happens in the next step), but the photo below shows them after they have been trimmed. Sorry about that. . .
clip_image012

Step 6 – Trim Excess Side Board

At this point, your sub-assemblies will not look exactly like the ones above because the side boards are both still complete diamonds. Part of one diamond sticks out beyond the backing board cutout. We need to trim that. I used the table saw as shown below:clip_image014

Step 7 – Join the two Sub-Assemblies

Next we join the two periscope pieces together using 2 pieces of the ½” plywood cut to a 1’ width. One piece should be about 6” long and the other should be about a foot long. The longer one creates a handle. You can put the handle on either side – or both sides if you want. Drill holes in the pieces for the screws to go through:
clip_image016
The drill should be just large enough so that the screws you use will slide through easily.
Next you will connect the two subassemblies using these wood strips as shown in the image below. When doing this it is very important that the top and bottom edges are exactly perpendicular to the strips used to join them together. This is more important than having everything tight. I used the small square to line everything up before screwing it together.
clip_image018

Step 8 – Install the mirrors

You can use any kind of thick glue that will stick to glass. The viewer is shown below with the mirrors installed.
clip_image020
In this photo, you can see the two smaller mirrors. You can’t see the two larger mirrors. They are on the inner side of the ¼” thick backing pieces – the side you can’t see in the photo.

Step 9 – Try it out.

The easiest way to try this is with two prints – one from a left image and one from a right image. Place the right image 18 cm above the left image and look at them through the viewer. Your left eye should see mostly the left image and vice versa. You might have to adjust the images to optimize viewing. Once you have this working, you can try it on the computer. Use a viewing program to position the two images one over the other on your monitor. Of course, the easiest way to view them is with the 3Deifer software program, but that is a topic for another paper.

Step 10 – Variations

Now that you have built your first over/under viewer, you can try to build others with slight variations. The most obvious is to make viewers that are larger or smaller. I have a very large monitor, so I made one where I made the side pieces using a width of 2 ½ inches on my saw’s rip fence instead of 2” as in these instructions. This resulted in a viewing separation of about 17.75 cm which is a tiny bit too large even for my giant monitor. Note that the separation distance between the images goes with the square of the linear size of the side pieces. Don’t assume it is linear (as I did).
Another variation would be using different materials. I think it would be interesting to use very thick corrugated cardboard for the sides and thinner cardboard or corrugated plastic for the backing pieces. This would result in a lighter weight viewer and would not require the use of a table saw. I would be interested in hearing how this works out if anyone tries it. Or maybe I will.

Monday, July 25, 2011

Split .MPO file into left and right .JPG files

This morning, I got csharp code working that splits an MPO file from a Fujifilm FinePix Real3D camera into left and right components. Here is the code that does it.

using System;
using System.IO;
using System.Collections;

/// <summary>
/// Breaks an MPO file into two JPG files having names _L.jpg and _R.jpg.
/// Throws error if source file does not have .mpo extension.
/// Works by searching for 4 bytes: ff d8 ff e1 which is the start of both files.
/// Throws error if file does not start with ff d8 ff e1.
/// Throws error if other than one additional ff d8 ff e1 is found.
/// </summary>
/// <param name="sFullFileName">Full path to the .MPO file being split</param>
/// <param name="bOverwrite">If true, it will overwrite any existing left or right files. If false, it throws and error of the target files already exist</param>
public static void SplitMpoFile(string sFullPath, bool bOverwrite) {
    string sExt = sFullPath.Substring(sFullPath.Length - 4);
    if (sExt.ToUpper() != ".MPO") {
        throw new Exception(sFullPath + " does not have .MPO extension.");
    }
    string sFileNameBase = sFullPath.Substring(0, sFullPath.Length - 4);
    string sFileNameLeft = sFileNameBase + "_L.jpg";
    string sFileNameRght = sFileNameBase + "_R.jpg";
    if (File.Exists(sFileNameLeft)) {
        if (bOverwrite) {
            File.Delete(sFileNameLeft);
        }else{
            throw new Exception(sFileNameLeft + " already exists.");
        }
    }
    if (File.Exists(sFileNameRght)) {
        if (bOverwrite) {
            File.Delete(sFileNameRght);
        }else{
            throw new Exception(sFileNameRght + " already exists.");
        }
    }
      
    FileStream fs = new FileStream(sFullPath, FileMode.Open);
    long lFileLength = fs.Length;
    byte[] bytes = new byte[lFileLength];
    BinaryReader br = new BinaryReader(fs);
    br.Read(bytes, 0, (int)lFileLength);
    br.Close();
    fs.Close();

    // Verify that file starts with ff d8 ff e1
    if (bytes[0] != 255 || bytes[1] != 216 || bytes [2] != 255 || bytes[3] != 225) {
        throw new Exception(sFullPath + " does not start with correct code.");
    }
    // Make an array list of all the places in the file that start with ff d8 ff e1
    ArrayList alBreakPoints = new ArrayList(8);
    for (int i = 1; i < lFileLength - 4; i++) {
        if (bytes[i] == 255 && bytes[i + 1] == 216 && bytes[i + 2] == 255 && bytes[i + 3] == 225) {
            alBreakPoints.Add(i);
        }
    }
    // At this point, there should be exactly 1 element in the array list.
    if (alBreakPoints.Count != 1) {
        throw new Exception(alBreakPoints.Count + " breakpoints found in " + sFullPath);
    }
    int iBreakPoint = (int)alBreakPoints[0];

    // OK - everything looks good here. Output the two parts of the file.
    fs = new FileStream(sFileNameLeft, FileMode.CreateNew);
    BinaryWriter bw = new BinaryWriter(fs);
    bw.Write(bytes, 0, iBreakPoint);
    bw.Close();
    fs.Close();
    fs = new FileStream(sFileNameRght, FileMode.CreateNew);
    bw = new BinaryWriter(fs);
    bw.Write(bytes, iBreakPoint, (int)lFileLength - iBreakPoint);
    bw.Close();
    fs.Close();


}

Saturday, July 23, 2011

Saved my Paella Recipe

Today, I managed to enclose the area above the double doors in the new pottery studio. I used mostly 5/4 pine scraps to do this, but for the last piece, I cut down a scrap piece of 2x8.

I also wrote out the recipe I have been using for paella. I saved this to Documents\hobbies\recipes\paella.txt.

Here we go

I am starting this blog with the idea that it is primarily for my personal use, but others are welcome to visit and learn. I want to use it as a journal where I can save notes as to what I am doing and more importantly, how I do things that I might have to do again someday. The advantage of a blog (I am told) is that I can post either directly or via email from my cell phone and later I can search for entries that I might have made weeks, months or years previously.