get upper and lower limit from imcontrast

4 ビュー (過去 30 日間)
Mohamed Amine Henchir
Mohamed Amine Henchir 2018 年 11 月 5 日
編集済み: Rena Berman 2021 年 11 月 18 日
I'm using imcontrast to adjust the histogram of one image, once I'm satisfied with the result, I would like to apply the same transformation to a set of images. I'm using multiple callbacks so the Idea is to get the limits pass it on to the next callback and use imadjust to do the operation. here is my code so far
if true
function adjust_contrast_Callback(hObject, eventdata, handles)
axes(handles.axes1);
h = imshow(handles.I);
dbh = imcontrast(handles.figure1);
set(dbh, 'CloseRequestFcn', @(s,e)getValues(s))
waitfor(dbh);
I = get(h,'CData');
handles.I = I;
imshow(handles.I);
end
%the callback function for when the user closes the imcontrast window
function getValues(dbh)
window_min = str2double(get(findobj(dbh, 'tag', 'window min edit'), 'String'));
window_max = str2double(get(findobj(dbh, 'tag', 'window max edit'), 'String'));
contrast = [window_min window_max];
handles.contrast = contrast;
I'm able to get the values but I can't close the imcontrast window anymore, I tried close() didn't work... anyreason why would this happen?
thank you!

採用された回答

Prakhar Jain
Prakhar Jain 2018 年 11 月 15 日
Hi Mohamed,
To close all open figures, use the command
close all
Figures with the 'HandleVisibility' property set to 'off' will not be closed with "close all". To close these figures, use the command
delete(findall(0));
To close all open Simulink models, use the command
bdclose all
If you have a GUI that opens plot windows and you would like to close all plots without closing the GUI at the same time, then you can use the following code:
% Delete all Figures with an empty FileName property
delete(findall(groot, 'Type', 'figure', 'FileName', []));
I hope this should help.
Thanks.
  1 件のコメント
Mohamed Amine Henchir
Mohamed Amine Henchir 2018 年 11 月 20 日
a wholesome answer thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by