How to set default window min and max, for imcontrast tool.

2 ビュー (過去 30 日間)
SCOTT LIM
SCOTT LIM 2017 年 3 月 14 日
編集済み: Mann Baidi 2024 年 2 月 23 日
I want to open an image via imcontrast. However, I want to set the slider values of min/max instead of the default.
hfig = figure(12);
%code
imshow(Im);
imcontrast(hfig);
Is there an OpenFcnRequest?
set(hfig, 'OpenRequestFcn', ...)? If yes, how would I implement it?
Or is there a way to set the UI slider min/max like the GUI method:
set(handles.hfig, 'Min', myWin_Min);
set(handles.hfig, 'Max', myWin_Max);

回答 (1 件)

Mann Baidi
Mann Baidi 2024 年 2 月 23 日
編集済み: Mann Baidi 2024 年 2 月 23 日
Hi Scott,
I understand that you would like to set the contrast of the image instead of the default. For this, I would suggest you to use the 'clim' property. This will set the range of the slide in the 'imcontrast' panel. Here is an example for the same:
% Load your image
image_data = imread('gray.png');
% Display the image
imshow(image_data);
% Open the interactive contrast adjustment tool
h = imcontrast(gca);
min_value = 100; % Set your desired minimum value
max_value = 200; % Set your desired maximum value
clim([min_value max_value]);
You can know more about the 'imcontrast' function using the link below:
Hoping this will help in resolving your issue!

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by