Author Topic: Z-Depth as grayscale image  (Read 6454 times)

federico.albertini

  • New to the forum
  • *
  • Posts: 6
Z-Depth as grayscale image
« on: October 30, 2013, 08:15:16 AM »
Hi all,

I'm wondering if it is posible to save, as a grayscale image (even at the lower resolution of the 'silent picture'), a representation of the object distance from the camera. In alternative, the representation of the focus position.
For reference I link this page from Wikipedia, that contains a couple of images that could explain much better what I mean: http://en.wikipedia.org/wiki/Depth_map
I think this information could probably be derived with the same process used to draw the focus peak marks, probably with no need of changing manually the focus point.
The resulting image should look like the z-channel in 3d graphics: http://rbcdn.polytown.netdna-cdn.com/wp-content/uploads/2010/04/making-gh-house-ivo-sucur-interior-wireframe_zdepth.jpg or http://www.intiaz.com/wp-content/uploads/2013/04/zdepth-photoshop-1.jpg

With this kind of image, saved together with the original picture, one could change the depth-of-field, simulate fog in a proper way, etc...

Thank you,
Federico

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Z-Depth as grayscale image
« Reply #1 on: October 30, 2013, 08:21:28 AM »
Last time I've checked, there was no Magic Lantern for Kinect, only for Canon cameras.

Quote
I think this information could probably be derived with the same process used to draw the focus peak marks, probably with no need of changing manually the focus point.

How exactly? (describe the math behind it)

federico.albertini

  • New to the forum
  • *
  • Posts: 6
Re: Z-Depth as grayscale image
« Reply #2 on: October 30, 2013, 10:48:49 AM »
Eheheheh ;D
Besides this, what do you think of it: is there any way to freeze in a grayscale image the representation of the focal point or the distance of the objects from the lens?

How do you tell where the focus peek marks should be drawn? Is it something that can be extended to the wole area of the sensor? or just of the live view? How do you tell what area of the image is on focus and what is not? If not, can you tell if it has a 'negative focus' (closer) or 'positive focus' (farther)?
Can the sensor that measure the distance of an object from the sensor be brushed around and the measures turned into shades of gray?

I'm just asking, have no tips on how to achieve it because I don't really know what's behind ML, so I don't know if what I'm asking is something that has any chance to be achieved or not. I'm sorry if it was a stupid request: the resulting image would be *really* useful...

Cheers,
F.

eduperez

  • Contributor
  • Member
  • *****
  • Posts: 111
Re: Z-Depth as grayscale image
« Reply #3 on: October 30, 2013, 11:37:27 AM »
Perhaps you could try to combine the focus stacking and focus peak features (this is just some wild idea):

Use the focus stacking feature to create a series of shots with different focusing distances. For each image in the stack, focused areas should correspond to zones in the scene that share the same distance to the camera (the focusing distance). Then, you could use the focus peak feature to grab those focused areas from each image, assign a proper grayscale color to each one, and merge them.

For a quick and dirty experiment, you do not need any modifications to ML, you can do most of the heavy work outside of the camera:

First, choose a nice scene, do a focus stack, and copy all the files to your computer. Then use enfuse to make a contrast-based fusing, and save all the masks; finally, use PS / GIMP / ... to combine those masks.

Just my two cents.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Z-Depth as grayscale image
« Reply #4 on: October 30, 2013, 11:45:51 AM »
Some useful links:

http://www.magiclantern.fm/forum/index.php?topic=7662.0
http://www.stareat.it/sp.aspx?g=3ce7bc36fb334b8d85e6900b0bdf11c3#prettyPhoto
http://lmb.informatik.uni-freiburg.de/research/3dreconstruction/

and indeed, it doesn't make sense as a feature request, because it's just focus stack (already in ML) and postprocessing.

federico.albertini

  • New to the forum
  • *
  • Posts: 6
Re: Z-Depth as grayscale image
« Reply #5 on: October 31, 2013, 03:12:30 AM »
Thank you Eduperez,
thank you Alex,

the idea is good: post production can solve it but it's a bit of a pain, especially if you need to grab several pics from different angles.

Alex, I can't agree with you when you say it's useless because it can be achieved by post processing: such a feature would be the first and only producing good depth files for every 3d Application where you need to combine CAD and Enviromental pictures (for example while testing the impact of a new building in the environment). Or to create the virtual sets for movie makers.

Being able to generate it together with the original picture would be a great feature and would help a lot several categories of users.
It's the first step to create a 3d Scanner out of a Canon.
It could be used to generate the bump map of a surface in order to use it as a shader in gaming or any other 3d application.

The Focus Stack is really a good starting point: min+max focus can be set, the portion of the pic that is on focus at each step saved directly as a darker gray shade into the target image. As many gray levels as are the steps between max and min.

Please don't just discard it as a silly request.

Thank you guys,
cheers,
Federico