3D Stereo using One Camera - Completed and Working Scripts - CHDK Forum  

3D Stereo using One Camera

  • 3 Replies

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
3D Stereo using One Camera
« on: 10 / April / 2012, 16:24:33 »
3D Stereo using One Camera

Recently I was asked by a teacher to create some 3D stereo photos of things young children would be seeing on an upcoming field trip. Since this was going to be the first time I'd experimented with 3D using a single camera, I decided I needed to do some research. My first choice would have been to use Stereo Data Maker (SDM), but alas my SX20IS isn't supported in SDM. Consequently, I decided to write a script that I could use with a single camera and tripod. Although this script was adequate for this project, I'd recommend SDM for anyone needing a robust system for 3D Stereo photography. SDM can be found here http://stereo.jpn.org/eng/sdm/index.htm

Background Information

To produce a 3D effect requires simulating the view you would get from two eyes positioned apart. If we used a lens of about the length that would be similar to our normal view, say 50mm, and nothing was too close this could be a fixed difference apart of around 7.5cm or a little under, the often quoted distance is 65mm. Increasing it a little expands the 3D effect. When we have different lens lengths, or get closer to the subject we need to change the distance between the positions that the two images are taken. This separation distance is called the Stereo Base.

The factors that affect the stereo base, (distance between the camera when taking one image and the next) are the focal length of the lens, the nearest item in focus and the furthest item in focus. As long as the stereo base is about right, you will get the desired effect, and experimenting you will find that unless you are very near something you can be quite a long way out from the theoretical stereo base and still get good results.

Professional 3D photography typically requires the use of some complicated formulas (http://nzphoto.tripod.com/3d/330baseformulae.html), however for the hobbiest simplier formulas can provide satisfactory results. The methodology used in this script is based upon one described at http://www.photographers-resource.co.uk/photography/3D/3D_stereo_base.htm

Script Options

- Shoot photos. First, position the camera centered on the tripod (and macro focus rail), zoom the camera to the focal length you want, set the focus using Manual Focus (MF) and run the script. The camera will estimate the focal length, read the near and far distances, calculate the appropriate stereo base and then direct you to move the camera left or right to take your photos. Typical display with notes:

      Focal Length: 28mm
      Dist: 3500 mm (11ft 5in)
      Near/Far (mm): 2867-4111
      Move Cam left 51 mm
      press Set to proceed
      Move Cam right 102 mm
      press Set to proceed

Note: After pressing the "Set" button, there is a delay of 2.5 sec before the camera shoots the photo; this allows time for the camera vibration/movement to cease. In the above example the stereo base was 102mm.

- Calculate the "Stereo Base". Follow the procedures mentioned in the "Shoot photos" option and the stereo base will be calculated & displayed without taking a photo. You can then determine if you need to adjust the focal length or distance to your subject. Typical display:

      Focal Length: 28mm
      Dist: 3500 mm (11ft 5in)      
      Near/Far (mm): 2867-4111
      Stereo Base: 102mm

- Calculate the "Nearest" focus point using a specific Stereo Base. This option allows you to calculate the nearest focus distance that should be used in a 3D photo - this is not the same as the distance from the subject. First you set the "Test SB max" parameter to the stereo base you would like to use for the actual shots. Next you zoom the camera as you like and run the script. The Nearest distance will be displayed without taking a photo. You can then determine if you want to adjust the focal length or change the distance to the subject. The nearest and farthest focus points are determined by the depth of field you have setup for your camera. Typical display:

      Focal Length: 28mm
      Not closer than:
        1904 mm (6ft 2in)

- Keep/Save a log of the shots taken (does not log when doing the "Stereo Base" or "Nearest" calculations only). This option can be enabled by setting the "Save log" parameter to 1. The script creates a log in the CHDK/LOGS folder. In order to capture multiple logs, the hour and minute are used as part of the file name. For example, if a log was created at 15:41 the filename would be "LOG_1541.TXT". The script overwrites any log with the same name. Typical Output:

      3D Stereo Photo Log
      Date: 4/9/2012
      Time: 15:41:8
      Focal Length: 28mm
      Dist: 5502 mm (18ft 0in)
      Near/Far (mm): 561--1

      Move Cam left 10 mm
      press Set to proceed

      Move Cam right 20 mm
      press Set to proceed

Basic instructions:
- Set Continuous Shooting mode “off”; Review “off”; Flash “off”; MF-Point Zoom "on"; Safety MF "off"; AF-Point Zoom “on”
- Set script parameters
- Select Manual Focus Mode (MF), press half shutter to set focus point
- Run the script & take photos

- For each new subject, be sure to reset your Manual Focus before running the script again
- Be sure to disable MF when finished taking photos
- Before using this script, you will need to set the "Min Focal Length" and "Max Focal Length" parameters to the capabilities of the camera being used.
- This script relies upon the accuracy of you camera when using Manual Focus (MF). I noticed that when I use the MF on my SX20 the camera sometimes incorrectly estimates the distance to the subject. When using this script, be sure to check the distance to the subject reported by your camera to be sure the distance seems reasonable. If not, simply return to normal focus and then try MF again and the distance will probably be accurate. Once the distance seems reasonable, you can run the script and expect accurate results.
- Recommend using a tripod with macro focusing rail. Macro focusing rails typically allow you to accurately & easily shift left and right up to 50mm. Thus, for stereo bases wider than 100mm you will need to use something other than a macro focusing rail.

Place "3dStereo.bas" in Scripts folder.

If you are using a SX20IS, here is a section of code you can add that will alert you when any of the more important camera settings have not been set correctly. It uses PropCas statements specific for the SX20IS. The code should be inserted after the: if x<3 then print "IS not disabled"

Code: [Select]
rem -------------- Uses SX20IS specific propcas statements --------------
  get_prop 50 x
  if x=-32767 or x=-32766 then y=y+1 else print "Camera mode not Av or M"
  get_prop 133 x
  if x=1 then y=y+1 else print "Not in MF mode"
  get_prop 281 x
  if x=0 then y=y+1 else print "Safety MF not disabled"
  if y<>3 then end
rem -------------- Uses SX20IS specific propcas statements --------------
« Last Edit: 10 / April / 2012, 16:29:45 by SkyWalker9 »

Re: 3D Stereo using One Camera
« Reply #1 on: 10 / April / 2012, 17:39:08 »
That is quite a coincidence because I have spent the last few days testing a new SDM feature specifically for this, from macro to hyper landscapes.

The calculations are done automatically in the background, all that you see are indications of nearpoint (if infinity included) otherwise farpoint for current nearpoint (which you have measured at full zoom setting).

Even easier are the movable vertical guidelines that you set to a distinctive near feature and far feature.

After taking first photo, you move camera (from mm to metres) and align distinctive nearpoint again.

If the distinctive farpoint is between the previous marker and a flashing white line to the right you know the resulting stereo depth is less than your personal defined maximum and will not result in eyestrain..

This is extremely easy and works well, especially if you use a monopod.

Switch to playback, browse to first image and press SET.
Browse to second image and press SET again.

The pair will be displayed as colour or grey anaglyph or partial side-by-side, thanks to 'hiker_john' s original code.

This is more effective on cameras with a 75mm screen.

You are the ideal person to test this and suggest improvements, please contact me directly.

« Last Edit: 10 / April / 2012, 17:41:10 by Microfunguy »

Re: 3D Stereo using One Camera
« Reply #2 on: 26 / May / 2012, 23:48:19 »
I'd be interested in trying that, too.  I've been shooting stereo with a single camera for forty-some years, off & on.  I shot this yesterday, handheld & guessing on the spacing (probably 8 or 9 inches/20+ cm).  The subject is one that's always struck me as a natural for stereo.

S3 IS with LensMate filter/hood adapter

Re: 3D Stereo using One Camera
« Reply #3 on: 27 / May / 2012, 06:58:17 »
What we call 'big bale silage' in the UK.

Contact me directly with a suitable email address, Eric.

That is a very nice part of the United States.

(Incidentally, I am a co-author of StereoPhotoMaker that you use).



Related Topics

SimplePortal 2.3.6 © 2008-2014, SimplePortal