


bpdq_show_im : Display image, with correct pixel zoom bpdq_show_im(im,range,zoom) Inputs : im - 2-d image range - 2 element vector giving display color map range, range(1) maps to black, range(2) maps to white If range not given, or empty matrix given for range, then the default is to set it to the minimum and maximum of input image. zoom - # of screen pixels taken by single image pixel. Default is 1 This file is part of BPDQ Toolbox (Basis Pursuit DeQuantizer) Copyright (C) 2009, the BPDQ Team (see the file AUTHORS distributed with this library) (See the notice at the end of the file.)


0001 % bpdq_show_im : Display image, with correct pixel zoom 0002 % 0003 % bpdq_show_im(im,range,zoom) 0004 % 0005 % Inputs : 0006 % im - 2-d image 0007 % range - 2 element vector giving display color map range, 0008 % range(1) maps to black, range(2) maps to white 0009 % If range not given, or empty matrix given for range, then 0010 % the default is to set it to the minimum and maximum of input image. 0011 % zoom - # of screen pixels taken by single image pixel. Default is 1 0012 % 0013 % This file is part of BPDQ Toolbox (Basis Pursuit DeQuantizer) 0014 % Copyright (C) 2009, the BPDQ Team (see the file AUTHORS distributed with 0015 % this library) (See the notice at the end of the file.) 0016 0017 function bpdq_show_im(im,range,zoom) 0018 if nargin<3 0019 zoom=1; 0020 end 0021 if ( nargin<2 || isempty(range) ) 0022 range(1)=min(im(:)); 0023 range(2)=max(im(:)); 0024 end 0025 0026 nshades=256; 0027 d_im = ( im-range(1) ) *(nshades-1) /(range(2)-range(1)); 0028 dsize=size(im)*zoom; % size in pixels to show on screen 0029 image( d_im ); 0030 colormap(gray(nshades)); 0031 0032 ax=gca; 0033 oldunits=get(ax,'Units'); 0034 set(ax,'Units','pixels'); 0035 pos = get(ax,'Position'); 0036 axis('off'); 0037 ctr = pos(1:2)+pos(3:4)/2; 0038 set(ax,'Position',[floor(ctr-dsize/2)+0.5, dsize] ); 0039 axis('equal'); 0040 0041 % restore units 0042 set(ax,'Units',oldunits); 0043 0044 % The BPDQ Toolbox is free software: you can redistribute it and/or modify 0045 % it under the terms of the GNU General Public License as published by 0046 % the Free Software Foundation, either version 3 of the License, or 0047 % (at your option) any later version. 0048 % 0049 % The BPDQ Toolbox is distributed in the hope that it will be useful, 0050 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0051 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0052 % GNU General Public License for more details. 0053 % 0054 % You should have received a copy of the GNU General Public License 0055 % along with The BPDQ Toolbox. If not, see <http://www.gnu.org/licenses/>.