Home > SuperSegger > Internal > agd.m

agd

PURPOSE ^

agd : autogains the image setting hot pixels to min value

SYNOPSIS ^

function im = agd( im, HOT_PX)

DESCRIPTION ^

 agd : autogains the image setting hot pixels to min value
 it sets pixels > hot pixels * Std.Dev to the min value

 INPUT : 
       im : image
       HOT_PX : hot pixel value
 OUTPUT :
       im : autogained image with increased contrast.


 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 im = agd( im, HOT_PX)
0002 % agd : autogains the image setting hot pixels to min value
0003 % it sets pixels > hot pixels * Std.Dev to the min value
0004 %
0005 % INPUT :
0006 %       im : image
0007 %       HOT_PX : hot pixel value
0008 % OUTPUT :
0009 %       im : autogained image with increased contrast.
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 if ~exist('HOT_PX')
0031     HOT_PX = 50;
0032 end
0033 
0034 sz = size(im);
0035 im = reshape(double(im),1,[]);
0036 
0037 s = std(im);
0038 
0039 im_min = min(im(:));
0040 im(im > HOT_PX*s) = im_min;
0041 im_max = max(im(:));
0042 
0043 im = im - im_min;
0044 im = double(255*im/im_max);
0045 
0046 im = reshape(im, sz);
0047 
0048 end

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