2017-05-08 69 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

相關問題