Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
06-04-2012, 10:19 PM   #1
Veteran Member




Join Date: Jun 2011
Location: Utah
Posts: 428
How do processing engines "know" what is in focus?

Hi, gang -

Thanks to a recently acquired set of extension tubes--cheapies w/o contacts--I've been looking into focus stacking. I've seen that photoshop has a relatively routine way of stacking images (although I'm a Gimp user m'self), and I have recently downloaded CombineZP for similar purposes.

My question...

How do these programs know which part of the image is in focus? Or, phrased differently, if I were to "manually" do a focus stack by applying various filters and blending, how is it done?

I've started using high pass filters for sharpening, so I can see the effect that these have. The leap to in-focus vs not-in-focus is escaping me, though.

Thanks!


Last edited by ofer4; 06-04-2012 at 11:12 PM.
06-04-2012, 11:29 PM   #2
Senior Member
sajah's Avatar

Join Date: Mar 2009
Location: South Korea
Photos: Gallery
Posts: 275
In short, Contrast Detect, similar to how Contrast Detect Autofocus works. The program scans the image, if a pixel (or small area, maybe) contrast is over a certain threshold then it is considered in focus.

However, this is all my opinion and I don't have anything to back it up, but I'm pretty sure it's correct or at least in the ballpark.
06-05-2012, 07:28 AM   #3
Veteran Member




Join Date: Jun 2011
Location: Utah
Posts: 428
Original Poster
Thanks, Sajah. This actually makes sense. I found a discussion (that gets a bit technical...and heated ) on the topic here.

You're correct that a contrast-detect algorithm would probably work, and it would likely be pretty simple to implement. Some remaining variables:

1. The size of the region over which contrast is detected must be determined. It certainly cannot be global, but it probably has to be larger than a few pixels...akin to focusing regions in the camera.
2. The algorithm likely has to have some sort of cutoff, as well, to "decide" what is in focus.
3. Most importantly, the routine probably has to have some smart way of aiming its efforts on the "edge" regions between images. It cannot just eliminate out-of-focus portions, or it would delete the bokeh areas in the final photo.
4. The last step would involve the manner in which the stacked photos are blended together. I imagine some flexibility exists here, but a simple layer mask would probably work.
06-06-2012, 09:41 PM   #4
Senior Member
sajah's Avatar

Join Date: Mar 2009
Location: South Korea
Photos: Gallery
Posts: 275
Good find! I work as a lowly programmer and while the article is too technical so I just skimmed it, and my current project totally unrelated to image processing, who knows I might need it in the future so thanks too!

Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
filters, focus, photography, photoshop, thanks
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Post your "Park Bench" "or "Picnic Table" images tessfully Mini-Challenges, Games, and Photo Stories 2196 03-13-2024 09:29 AM
Don't say Pentax "Q" in French ... "Q" = "cul" = "A--" Jean Poitiers Pentax Q 52 11-10-2013 06:25 AM
How long until "out of focus blur" / DoF will be a non argument for any equipment? beholder3 Photographic Industry and Professionals 12 03-10-2012 01:32 PM
The "No Post Processing" Craze Designosophy Photographic Technique 214 06-24-2011 08:56 AM



All times are GMT -7. The time now is 04:12 AM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top