2017-05-08 108 views

回答

3

使用inputdlg

I = imread('cameraman.tif'); 
imshow(I); 
% prompts for the two inputs 
prompt = {'Enter LOW contrast limit:','Enter HIGH contrast limit:'}; 
% title of the dialog box 
dlg_title = 'Input'; 
% number of input lines available for each variable 
num_lines = 1; 
% default answer for each input 
defaultans = {'0','1'}; 
% generate the dialog box and wait for answer 
answer = inputdlg(prompt,dlg_title,num_lines,defaultans); 
% convert string answers into doubles 
lo_in = str2double(answer{1}); 
hi_in = str2double(answer{2}); 
% apply on image 
K = imadjust(I,[lo_in hi_in],[]); 
figure 
imshow(K) 

enter image description here

+0

太感谢你了。它像我期望的那样工作。你能帮我解决另一个问题吗?我稍后会发布一个新问题 – jolene

相关问题