Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Focus Measure

4.92857
4.9 | 14 ratings Rate this file 94 Downloads (last 30 days) File Size: 4.54 KB File ID: #27314 Version: 2.1
image thumbnail

Focus Measure

by

Said Pertuz (view profile)

 

20 Apr 2010 (Updated )

A function to measure the relative degree of focus of an image.

| Watch this File

File Information
Description

This function measures the relative degree of focus of an image. Several up-to-date focus measuring algorithms have been implemented and the function supports uint8 or double images. For futher details on each focus measuring algorithm the reader is referred to [1] and the references therein.
[1] S. Pertuz et al., Analysis of focus measure operators for shape-from-focus. Pattern Recognition, 46(5):1415:1432, 2013. DOI: 10.1016/j.patcog.2012.11.011

Acknowledgements

This file inspired Shape From Focus and Extended Depth Of Field.

Required Products Image Processing Toolbox
Wavelet Toolbox
MATLAB release MATLAB 7.7 (R2008b)
MATLAB Search Path
/
/fmeasure
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (19)
05 Apr 2016 shike

shike (view profile)

6666666666666666

Comment only
12 Mar 2016 Said Pertuz

Said Pertuz (view profile)

@Anthony, the normalization is not strictly necessary since the operations are performed in double precision. However, your suggestion is quite correct if we want to avoid stability issues. I have corrected the code accordingly, thanks!

Comment only
11 Mar 2016 Anthony

Thanks for providing your code!
Concerning the GDER criterion, I wonder wether the divisions in l 80/81 should not be replaced by

Gx = Gx / max(max(abs(Gx))) (resp. Gy)

in order to normalize the kernels?
The symmetry of the kernels implicates sum(Gx(:)) -> 0 thus creating extremely high values in resulting Gx & Gy (order of 10^13).

Sorry if I completely missed the point!

Comment only
04 Dec 2015 Pascal Böhmler

Thanks.
In your implementation of Brenners metric there seems to be a bug. diff(Image,2,1) and diff(Image,2,2) is used. This is somewhat like calculating the second order discrete derivation but shouldn't it be the (~first order) difference between two pixels with a distance d=2?

Comment only
17 Nov 2015 Jesse

Jesse (view profile)

Sayonics.com seems to have gone away.

Comment only
05 Oct 2015 Misha

Misha (view profile)

 
11 Aug 2015 Ahmed

Ahmed (view profile)

Thanks very much :)

29 Jan 2015 Nicole Roamans

How do you choose WSize=15 and sig=N/2.5 in 'GDER'? If anyone can help I would appreciate it.
Thank you for providing your code.

24 Jul 2014 George Aprilis

Very helpful, allows you to try quickly many different methods and see what suits your case.
There is for sure a small bug in SFIL case, between 270 and 315 degrees, R(:,:,7) appears twice instead of R(:,:,7) and R(:,:,8)

22 Jul 2014 Rishabh Battulwar  
10 Jul 2014 MTJ1990  
26 Jan 2014 Engin

Engin (view profile)

It seems like some of the metrics (options) needs Wavelet Toolbox (if there is something like this?), because a lot of functions for WAVS, WAVV and WAVR are missing.

Moreover, it is not exactly clear if an image should be of type uint8 or double or what - however results of some metrics depends on datatype of image.

29 Jul 2013 Karthik MSwamy

Quite a useful tool to measure various focus measures.

29 Nov 2012 Rob

Rob (view profile)

I was wondering how you got the plot.

07 Oct 2011 Bosheng  
05 Aug 2011 Nek Valous  
18 Feb 2011 Jonathan

Great tool, exactly what I was looking for!

Note that the ACMO method as written also requires the Fixed-Point Toolbox. I just commented out the isdouble() check, and make sure my images are uint8 before passing them in.

03 Sep 2010 Dave Holden

Very useful

07 Jun 2010 Mohamed Shams  
Updates
27 Nov 2012 1.3

- The function no longer requires the floating-point toolbox.

25 Jan 2016 2.0

- Some bugs have been fixed (Brenner's and GDER's focus measure operators)

12 Mar 2016 2.1

- Bug fixed in GDER focus operator

Contact us