⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deconv.m

📁 采用matlab编写的数字图像恢复程序
💻 M
📖 第 1 页 / 共 2 页
字号:
% deconvGUI.m%%  Add to list of directories to search for m-files.path(path,'TV_PCG');path(path,'FFT');path(path,'NONNEG');path(path,'DATA');% Setup parameters:  n_reduce = 0;  scrn = get(0,'ScreenSize');  guifigsize = [20 scrn(4)-225 350 150];    % Position of the GUI figure  plotfigsize_x = 560;  % Size for figures with 4 subplots  plotfigsize_y = 420;  %  x_brdr = 14;		% Border allowence for X-windows systems  y_brdr = 40;		%  dataplotfigsize = [guifigsize(1)+guifigsize(3)+2*x_brdr, ... 	scrn(4)-(plotfigsize_y+y_brdr) plotfigsize_x plotfigsize_y]; % CG perfomance and TV solver figures are created in TV_PCG/pcg_os.m % or in TV_PCG/pcg_ml.m; so the figure sizes must declared globally.% also used by nonneg routine.  global tvplotfigsize cgplotfigsize;  cgplotfigsize = [guifigsize(1) scrn(4)-2*(plotfigsize_y+y_brdr) ...		 plotfigsize_x plotfigsize_y];  tvplotfigsize = cgplotfigsize+[plotfigsize_x+x_brdr 0 0 0];% Controls are placed relative to the "first" one.  a1size and b1size % set the position of "first" control, then most other controls are % placed by adding multiples of rowheight.  a1size = [0 guifigsize(4)-75 floor(1/3*guifigsize(3)) 20];  b1size = [a1size(3)+3 guifigsize(4)-75 floor(1/6*guifigsize(3)) 20];  rowheight = [0 25 0 0];  % control height=20, add 5 for spacing.% Define colors to be used throughout.  bgcolor = [0.3516    0.6094    0.7383];  red = [1 .3 .35];  yellow = [1 .9 .1];  green = [.5 .9 .5];  white = [1 1 1];  black = [0 0 0];  guifigy = guifigsize(4)-20; % -20 to allow for xwin borders% datasetuppos is the position of the text box containing datasetupflag  datasetuppos = [0 guifigy 2/3*guifigsize(3) 20];% Initialize datasetupflag.  This changes to reflect the data set selected.  datasetupflag=['Set up data first'];% datasizepos is the position for the text box containing the size of% the reduced system - "n by n"  datasizepos = [datasetuppos(3) guifigy 90 20];% datareduce*pos sets the position for text message/input box/go button% related to the level of data reduction.  datareducetxtpos = [0 guifigy-25 .5*guifigsize(3) 20];  datareducepos = [.5*guifigsize(3) guifigy-25 .16*guifigsize(3) 20];  datareducebtnpos = [.75*guifigsize(3) guifigy-25 .25*guifigsize(3) 20];% Keep track of figures % [gui, data, tv_cg, tv_newt, fft/pcg, fft, nonneg1, nonneg2]% Initialize with "-1" then as figures are created store fignum in % the appropriate component.figure_list = [-1,-1,-1,-1,-1,-1,-1,-1];% "macro" to reset all controls to invisible"hideall = ['set(ui_frame_r,''visible'',''off'');', ...	'set(ui_a1,''visible'',''off'');', ...	'set(ui_a2,''visible'',''off'');', ...	'set(ui_a3,''visible'',''off'');', ...	'set(ui_a4,''visible'',''off'');', ...	'set(ui_a5,''visible'',''off'');', ...	'set(ui_a6,''visible'',''off'');', ...	'set(ui_a7,''visible'',''off'');', ...	'set(ui_a8,''visible'',''off'');', ...	'set(ui_a9,''visible'',''off'');', ...	'set(ui_a10,''visible'',''off'');', ...	'set(ui_a11,''visible'',''off'');', ...	'set(ui_a12,''visible'',''off'');', ...	'set(ui_a13,''visible'',''off'');', ...	'set(ui_a14,''visible'',''off'');', ...	'set(ui_a15,''visible'',''off'');', ...	'set(ui_a16,''visible'',''off'');', ...	'set(ui_a17,''visible'',''off'');', ...	'set(ui_a18,''visible'',''off'');', ...	'set(ui_a19,''visible'',''off'');', ...	'set(ui_a20,''visible'',''off'');', ...	'set(ui_b1,''visible'',''off'');', ...	'set(ui_b2,''visible'',''off'');', ...	'set(ui_b3,''visible'',''off'');', ...	'set(ui_b4,''visible'',''off'');', ...	'set(ui_b5,''visible'',''off'');', ...	'set(ui_b6,''visible'',''off'');', ...	'set(ui_b7,''visible'',''off'');', ...	'set(ui_b8,''visible'',''off'');', ...	'set(ui_b9,''visible'',''off'');', ...	'set(ui_b10,''visible'',''off'');', ...	'set(ui_b11,''visible'',''off'');', ...	'set(ui_b12,''visible'',''off'');', ...	'set(ui_b13,''visible'',''off'');', ...	'set(ui_b14,''visible'',''off'');', ...	'set(ui_b15,''visible'',''off'');', ...	'set(ui_b16,''visible'',''off'');', ...	'set(ui_b17,''visible'',''off'');', ...	'set(ui_b18,''visible'',''off'');', ...	'set(ui_b19,''visible'',''off'');', ...	'set(ui_b20,''visible'',''off'');', ...	'set(uirunbtn,''visible'',''off'');', ...	'set(uiexitbtn,''visible'',''off'');', ...	'set(uibreakbtn,''visible'',''off'');'];% find the last fignum, create guifig as the next and store in figure_list  guifig = figure( length(findobj('type', 'figure'))+1 );  figure_list(1) = guifig;  set(guifig,...	'units','pixels',...	'pos',guifigsize ,...	'numbertitle','off',...	'name','"DeconvGUI"',...	'menubar','none', ...	'color',bgcolor);% Setup Menus (Data and method)% Define callback actions for data menu% Set n_reduce and display new system size.datareduce_action = ['n_reduce=str2num(get(ui_a4,''string''));', ...	'set(ui_a2,''string'',[num2str(max(size(z))/(2^n_reduce)),' ...	' '' by '', num2str(max(size(z))/(2^n_reduce)) ]);'];% When the user clicks "GO", we run setup_data.m and reset the % bgcolor in case it was red (if they tried to run a method % before setting up the data).uidatareducebtn_action = ['setup_data;' ...		'set(ui_a1,''background'',bgcolor)'];% Clear z, kernal, and u_exact from previous dataclearold = ...		['clear z;', ...		'clear kernal;', ...                 'clear u_exact;'];% Hide controls and setup new controls for data reductionsetup_data_controls = ...		['eval(hideall);', ...		'guifigsize = [20 scrn(4)-225 350 150];', ...		'set(guifig,''position'',guifigsize);', ...		'guifigy = guifigsize(4)-20;', ...		'datasetuppos = [0 guifigy 2/3*guifigsize(3) 20];', ...		'datasizepos = [datasetuppos(3) guifigy 90 20];', ...        	'set(ui_a1,''style'',''text'');', ...        	'set(ui_a1,''string'',datasetupflag);', ...        	'set(ui_a1,''position'',datasetuppos);', ...        	'set(ui_a1,''backgroundcolor'',bgcolor);', ...        	'set(ui_a1,''foregroundcolor'',white);', ...		'set(ui_a1,''visible'',''on'');', ...		'set(ui_a2,''style'',''text'');', ...		'sizestring=[num2str(max(size(z))),' ...		' '' by '', num2str(max(size(z)))];', ...        	'set(ui_a2,''string'',sizestring);', ...        	'set(ui_a2,''position'',datasizepos);', ...        	'set(ui_a2,''backgroundcolor'',bgcolor);', ...        	'set(ui_a2,''foregroundcolor'',white);', ...		'set(ui_a2,''visible'',''on'');', ...        	'set(ui_a3,''style'',''text'');',...        	'set(ui_a3,''string'',''Levels of data reduction: '');',...          	'set(ui_a3,''position'',datareducetxtpos);',...		'set(ui_a3,''horizontalAlignment'',''right'');', ...        	'set(ui_a3,''backgroundcolor'',bgcolor);',...        	'set(ui_a3,''foregroundcolor'',white);', ...		'set(ui_a3,''visible'',''on'');', ...        	'set(ui_a4,''style'',''edit'');',...	        'set(ui_a4,''string'',''0'');',...  	        'set(ui_a4,''position'',datareducepos);',...	        'set(ui_a4,''backgroundcolor'',white);',...	        'set(ui_a4,''foregroundcolor'',black);',...		'set(ui_a4,''callback'',datareduce_action);', ...		'set(ui_a4,''visible'',''on'');', ...        	'set(ui_a5,''style'',''push'');',...        	'set(ui_a5,''foregroundcolor'',black);',...        	'set(ui_a5,''horizontalalign'',''center'');',...        	'set(ui_a5,''string'',''GO'');',...          	'set(ui_a5,''position'',datareducebtnpos);',...        	'set(ui_a5,''backgroundcolor'',green);',...		'set(ui_a5,''callback'',uidatareducebtn_action);', ...		'set(ui_a5,''visible'',''on'');'];uidatamenu_sim_action = ...		[clearold, ...		'data=[''simulated''];', ...		'datasetupflag=[''Simulated Satallite Data''];', ...		'load sim;', ...		setup_data_controls];uidatamenu_obs_action = ...		[clearold, ...		'data=[''observed''];', ...		'datasetupflag=[''Observed Satallite Data''];', ...		'load obs;', ...		setup_data_controls];uidatamenu_load_action = ...	[clearold, ...	'[sfile,spath] = uigetfile(''*.mat'',''Load file'');', ...	'disp(sprintf(''Loading file %s%s ...'',spath,sfile));', ...	'stat=1;', ...	'eval(sprintf(''load %s%s'',spath,sfile),''stat=0;'');', ...	'if ~stat,', ...		'disp([''Could not load file '',spath,sfile]);', ...	'end,', ...	'if (exist(''z'')==1) & (exist(''kernel'')==1),', ...		'data=[''user''];' ...		'datasetupflag=[''User Defined Data''];', ...		setup_data_controls, ...	'else,', ...	'eval(hideall),', ...	'datasetupflag=[''Error! See Command Window.''];', ...        'set(ui_a1,''style'',''text'');', ...        'set(ui_a1,''string'',datasetupflag);', ...        'set(ui_a1,''position'',datasetuppos);', ...        'set(ui_a1,''backgroundcolor'',bgcolor);', ...        'set(ui_a1,''foregroundcolor'',white);', ...	'set(ui_a1,''visible'',''on'');', ...	'disp(sprintf(''File %s%s is not valid.'',spath,sfile));', ...	'disp(sprintf(''Expecting Image Data ', ...        '(z) and PSF (kernal). See Help''));', ...	'end,'];uidatamenu_help_action = ...	['eval(hideall);', ...	'guifigsize = [20 scrn(4)-225 350 150];', ...	'set(guifig,''position'',guifigsize);', ...	'guifigy = guifigsize(4)-20;', ...	'datasetuppos = [0 guifigy guifigsize(3) 20];', ...       	'set(ui_a1,''style'',''text'');', ...        'set(ui_a1,''string'',', ...        ' ''See the MatLab Command Window for help.'');', ...        'set(ui_a1,''position'',datasetuppos);', ...        'set(ui_a1,''horizontalalignment'',''center'');', ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -