Determining focus distance ... - page 2 - DSLR Hack development - CHDK Forum
supplierdeeply

Determining focus distance ...

  • 12 Replies
  • 9162 Views
Re: Determining focus distance ...
« Reply #10 on: 01 / December / 2011, 17:33:07 »
Advertisements
You want to extract depth information from some static scene, right?

As suggested before, focus stacking from Magic Lantern may help. The smallest focus step is the lowest focus increment in EOS utility, in LiveView (this is very small, usually the focus change is barely noticeable, even with 50/1.8 lens).

You can also write down the focus distance (as reported by the lens) and interpolate it using raw focus steps, to get a better resolution. The relationship between raw focus steps and physical distance is nonlinear.

Thanks for other good ideas. and yes it is going to be depth information for a static scene.

Using a combination of focus step count as well as distance information can be a good approach.

Also Its true that relationship between focus steps and focus distance is non-linear. However *IF* the focus steps correspond to constant increments in lens-to-sensor distance then we know that the relationship is given by  the lens equation 1/u + 1/v = 1/f (obviously DSLR lenses being complex multi-element designs don't follow this exactly but it should work fairly well for non-macro distances)
 


Re: Determining focus distance ...
« Reply #11 on: 01 / December / 2011, 17:47:30 »
Is the scene static ?

I am sure you will be aware of many of the papers published regarding depth maps from a single camera.

Here is one http://vision.ai.uiuc.edu/?p=320

This work is interesting. However it is still based on the principle of stereo matching and requires extra hardware support to capture multiple images with different views of the scene using the same camera. Unfortunately I don't have access to that hardware :). Also as I said, the aim is not to create a highly detailed and precise depth map. The coarse depth estimate from the camera is going to be just one of many inputs which my system will use to understand the scene.

Re: Determining focus distance ...
« Reply #12 on: 18 / December / 2011, 17:13:06 »
Here we go...

http://dl.dropbox.com/u/14091554/DepthMap.zip

I took a series of photographs with a 400D, using a 50mm at f/1.8, and moving the focus ring by hand between each shot. I downloaded the images to the computer, and extracted the embedded JPEG in the RAW files; the used the following command to merge the images:

Code: [Select]
enfuse -o result.jpg --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --save-masks *.jpg
(the resulting image leaves a lot to be desired, probably a good example of how bad enfuse may work sometimes)

Mask files were unreadable by almost any software I tried, and decided to convert them to JPEG:

Code: [Select]
for FILE in *.tif; do convert $FILE $FILE.jpg; done
Then I finally opened all files into GIMP as layers, changed the levels of each layer, so each one was a bit darker that the previous one, and put them all into "Addition" mode. The final result resembles what I would expect as a depth map, but reflects the bad job made by enfuse.

Hope this helps.

 

Related Topics