intAlignIm : aligning image A to image B with given precision INPUT : imA : image A imB : image B precision : Upsampling factor (integer). Images will be registered to within 1/precision of a pixel. OUTPUT : out : [error,diffphase,net_row_shift,net_col_shift] error : Translation invariant normalized RMS error between f and g diffphase : Global phase difference between the two images (should be zero if images are non-negative). net_row_shift, net_col_shift : Pixel shifts between images errNum : error value of alignment focusNum : score of how focused the images are 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/>.
0001 function [out, errNum, focusNum] = intAlignIm( imA, imB, precision ) 0002 % intAlignIm : aligning image A to image B with given precision 0003 % 0004 % INPUT : 0005 % imA : image A 0006 % imB : image B 0007 % precision : Upsampling factor (integer). Images will be registered to 0008 % within 1/precision of a pixel. 0009 % 0010 % OUTPUT : 0011 % out : [error,diffphase,net_row_shift,net_col_shift] 0012 % error : Translation invariant normalized RMS error between f and g 0013 % diffphase : Global phase difference between the two images (should be 0014 % zero if images are non-negative). 0015 % net_row_shift, net_col_shift : Pixel shifts between images 0016 % errNum : error value of alignment 0017 % focusNum : score of how focused the images are 0018 % 0019 % Copyright (C) 2016 Wiggins Lab 0020 % Written by Paul Wiggins. 0021 % University of Washington, 2016 0022 % This file is part of SuperSegger. 0023 % 0024 % SuperSegger is free software: you can redistribute it and/or modify 0025 % it under the terms of the GNU General Public License as published by 0026 % the Free Software Foundation, either version 3 of the License, or 0027 % (at your option) any later version. 0028 % 0029 % SuperSegger is distributed in the hope that it will be useful, 0030 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0031 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0032 % GNU General Public License for more details. 0033 % 0034 % You should have received a copy of the GNU General Public License 0035 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0036 0037 0038 0039 % fourier transform images 0040 fftA = fft2(imA); 0041 fftB = fft2(imB); 0042 0043 % subpixel image registration by crosscorrelation 0044 try 0045 out = dftregistration(fftA,fftB,precision); 0046 catch ME 0047 printError( ME ) 0048 end 0049 0050 % calculate error 0051 lamMin = 5; 0052 lamMax = 100; 0053 errNum = compErrInt( fftA, fftB, lamMin, lamMax ); 0054 0055 % calculates how in focus image A is 0056 focusNum = isFocus( fftA ); 0057 0058 end