It is currently Fri Apr 19, 2024 11:13 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Depth from Focus
PostPosted: Thu Feb 26, 2015 5:51 am  (#1) 
Offline
New Member

Joined: Feb 26, 2015
Posts: 3
Hello,

i had the idea that it should be possible to create a depth map[1] from images with different focus.
I searched and found:
1. A Gimp plugin that is able to create a depth map from two photos shot from a different angle. [2]
2. An ImageJ plugin, that looks interesting. But I haven't it installed and tested here. [3]
3. A tool, that creates 3D data from a photo stack. [4]
4. A homework, from the Northwestern University to solve this problem with a lot of useful math. [5]

With none of this I was able to create something useful. Then I experimented with the convolution matrix plugin from Gimp [6] but I don't have the necessary deep mathematic knowledge to get useful results.

Now I would like to know if there is something in G'MIC that is able to crate a depth map from images with different focus?

Regard,
Tobias

<Your post looks too spamy for a new user, please remove off-site URLs.>
I'll add the links later. :(


Update:
[1] https://en.wikipedia.org/wiki/Depth_of_focus
[2] http://registry.gimp.org/node/10217
[3] http://bigwww.epfl.ch/demo/edf/
[4] http://www.stareat.it/sp.aspx?g=3ce7bc3 ... rettyPhoto
[5] http://users.eecs.northwestern.edu/~oll ... W5/HW5.htm
[6] http://docs.gimp.org/en/plug-in-convmatrix.html


Last edited by tobias on Thu Feb 26, 2015 8:07 am, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Depth from Focus
PostPosted: Thu Feb 26, 2015 6:42 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Hi Tobias,

You might want to take a peek at Filters -> G'MIC -> Stereographic 3d. In particular, Tom Keil's "Depth Map Reconstruction." You need two images taken from slightly different positions; about the distance that separates left and right eyes in people.

Commons.Wikimedia has about 270 or so stereographic cards from the 1870's of Prospect Park, Brooklyn which will give you bunches of stereo pairs with which to experiment. Also check out the Stereo Images Category. I haven't tried this myself, but I'm going to, just to see if it plays.

After five posts here, you'll be able to attach things, make links, and put up pictures. Welcome to Gimp Chat.

Garry


Top
 Post subject: Re: Depth from Focus
PostPosted: Thu Feb 26, 2015 6:45 am  (#3) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Welcome to Gimp Chat tobias. You can add your images after you have 5 posts. then you can use this Image
Until then you can use the attachments to upload now which is under the submit button after you click full editor. Then click browse.

_________________
Image


Top
 Post subject: Re: Depth from Focus
PostPosted: Thu Feb 26, 2015 7:59 am  (#4) 
Offline
New Member

Joined: Feb 26, 2015
Posts: 3
Hi Garry,

your Wikimedia links are really cool. I'll have a look at it at the weekend. And now I'll post 3 more posts to get the right to post links.

Regard,
Tobias


Top
 Post subject: Re: Depth from Focus
PostPosted: Thu Feb 26, 2015 11:32 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Hi tobias,

Reference [2] is a related, but different, problem from [1],[3],[4],[5]. My previous post, and the G'MIC tool I suggested, addresses [2], which is: given two photographic images taken from slightly separated vantage points (such as what a pair of human eyeballs might establish) reconstruct depth distances from the vantage points of the eyes/cameras to points in the scene. Once I've identified a pair of analogous points in separate images as being one and the same, I can recover the depth from the displacement of the analogous points. The trick is, actually identifying two points in the stereo pair as being one and the same. If I can crack that, I can encode depth in varying shades of gray: black represents a great distance from the eyes/cameras, nearly white represents very close points (or vice-versa - whatever floats your boat).

[1],[3],[4],[5] involves synthesizing a deep depth of field from an optical system that has an extremely shallow depth of field. The classic example is an optical microscope. If what you are looking at are single cells immersed in a liquid, getting the specimen in focus is straightforward - a bacterium is essentially a point. Not so with the compound eye of an insect! That has front-to-back depth, and at any one setting, the compound eye is entirely out of focus except for the tiny slice that corresponds to the focal plane. The trick there is to drive the focusing mechanism of the microscope with a precision servomotor, that essentially steps the focal plane through a depth, capturing in-focus "slices" at every step. Now armed with a few hundred in-focus slices arranged in depth order (a "focus stack"), we cut out all the focused parts from each image and paste them together into a composite.

I'm not sure that a Gimp-G'MIC filter has been written that can do this out of the box (there's four hundred of them - I don't know them all), but a solution falls well within G'MIC's ken (that is, the underlying command language from which Gimp-G'MIC filters are built). My inclination would be to walk through the focus stack using something like -gradient_norm on each slice to identify the in-focus regions of interest (ROI), setting all other pixels outside that mask in each slice transparent, then either collapsing the so-reduced stack into a composite, or have G'MIC build 3D objects from the 2D slices. The latter will give you something you can zoom in on and turn around in space.

Well, yes, there are the bits about noise and artifact issues, but G'MIC has pieces for that as well. Could be a nice rainy day project for anyone sufficiently smitten with the itch.

[6], on convolution matrices, is another outlier - a very basic tool used nearly everywhere, including bits and pieces of both these problems, but, just by itself, such a thing won't directly solve your problem (but it gets used in concert with other techniques to solve your problem).

Garry
EDIT:
-------------------
PS - Well, them Modderateurs went and trimmed your empty posts. They run a tight board here, for which I thank them. Now what you SHOULD have done (and can still do) is march yourself over to the "Introduce Yourself" topic and post an introduction to yourself.

What that does is trigger a reaction among the regulars here, who are then induced to write "Welcome to Gimp Chat, Tobias!!!" using whatever filter, font, texture mapper, script, environment map, self-automated bit flipper, and who knows what else -- that they can get running, and it can go on for a day or two, at least, because this is a global community, and as the local daybreak moves westward, Gimp-Chatters wake up in turn and greet the newcomer with some pretty astounding stuff.

And, of course, you will have to answer the lot of them, and in a day or two will have about thirty posts to your credit.

You should really do it. Heck, first time joining can happen only once to you. May as well set it off, kick back and enjoy it.
G.


Top
 Post subject: Re: Depth from Focus
PostPosted: Wed Mar 11, 2015 4:52 am  (#6) 
Offline
New Member

Joined: Feb 26, 2015
Posts: 3
Update:
I plaied with the images from wikipedia, but didn't get any usefull results.

Then I tried to compile DephtInition but got this error:
Error CS1566: Error reading resource file `/home/XXX/dev/DephtInition/DephtInition/DephtInition/ValuesGraphForm.resources' (CS1566) (DephtInition)

I'll give you update if I reach something useful...


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Focus

9

No new posts Attachment(s) Experiment with a Lighten-only Height/Depth/Bumpmap Brush

2



* Login  



Powered by phpBB3 © phpBB Group