Home > SuperSegger > Internal > isFocus.m

isFocus

PURPOSE ^

focusNum : Computes how in focus an image is.

SYNOPSIS ^

function focusNum = isFocus( image )

DESCRIPTION ^

 focusNum : Computes how in focus an image is.
 It multiplies the fourier transform with the complex conjugate.

 INPUT :
      image : fourier transform of image

 OUTPUT :
       focusNum : error value


 Copyright (C) 2016 Wiggins Lab 
 Written by Paul Wiggins.
 University of Washington, 2016
 This file is part of SuperSegger.
 
 SuperSegger is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 SuperSegger is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function focusNum = isFocus( image )
0002 % focusNum : Computes how in focus an image is.
0003 % It multiplies the fourier transform with the complex conjugate.
0004 %
0005 % INPUT :
0006 %      image : fourier transform of image
0007 %
0008 % OUTPUT :
0009 %       focusNum : error value
0010 %
0011 %
0012 % Copyright (C) 2016 Wiggins Lab
0013 % Written by Paul Wiggins.
0014 % University of Washington, 2016
0015 % This file is part of SuperSegger.
0016 %
0017 % SuperSegger is free software: you can redistribute it and/or modify
0018 % it under the terms of the GNU General Public License as published by
0019 % the Free Software Foundation, either version 3 of the License, or
0020 % (at your option) any later version.
0021 %
0022 % SuperSegger is distributed in the hope that it will be useful,
0023 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0025 % GNU General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License
0028 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0029 
0030 
0031 ss = size(image);
0032 pp1 = image.*conj(image);
0033 mean_pp1 = mean(pp1(1:10,1:floor(0.5*ss(2))));
0034 k = (1:numel(mean_pp1))/ss(2);
0035 
0036 lam  = 1./k;
0037 mm1 = mean( mean_pp1( lam<3 ));
0038 mm2 = mean( mean_pp1( and(lam>8,lam<12)));
0039 
0040 focusNum = mm2/mm1-1;
0041 
0042 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005