-3
I = imread('image.jpg');
imshow(I);
K = imadjust(I,[0.35 0.45],[]);
figure
imshow(K)
imwrite(K,'image.jpg')
我想彈出一個對話框讓用戶輸入[0.35 0.45]的值。如何修改提供的編碼以提示用戶輸入?我如何要求提供用戶輸入的matlab代碼?
I = imread('image.jpg');
imshow(I);
K = imadjust(I,[0.35 0.45],[]);
figure
imshow(K)
imwrite(K,'image.jpg')
我想彈出一個對話框讓用戶輸入[0.35 0.45]的值。如何修改提供的編碼以提示用戶輸入?我如何要求提供用戶輸入的matlab代碼?
使用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)
太感謝你了。它像我期望的那樣工作。你能幫我解決另一個問題嗎?我稍後會發佈一個新問題 – jolene