显示 更早的评论
Hey, Im trying to build a GUI for the Quality Assessment tools of an X-Ray machine. In this , i have to load an image and then do various operations on it. I have created a push button to load my image and another push button to do operations on it. I have to send the image from the callback of the Load Push Button to the callback of the push button of the Operations. Please help me how to do this! Thanks a lot.
Gaurav
采纳的回答
更多回答(3 个)
Image Analyst
2012-1-10
0 个投票
Try this image processing GUI framework. It will get you up to speed quickly:
Description
This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can optionally apply a mask (region of interest) to the image so that only the area within the mask will be analyzed. The results are optionally sent to Excel. In this demo, I do some very basic particle sizing but in use, the user would replace that simple demo code in the function AnalyzeSingleImage() with their own code. Works with Windows or Unix since paths are all forward slashes. Requires the Image Processing Toolbox to do the simple particle sizing demo, but if you delete that demo code before using it, then the IP toolbox would not be required and it would still demonstrate the basic GUI-based file processing functionality.
Gaurav Kaila
2012-1-10
0 个投票
3 个评论
Chandra Kurniawan
2012-1-10
If I did not misunderstand,
what do you mean with 6 images?
Did you mean in 'Load Push Button' callback we have 6 different images?
Gaurav Kaila
2012-1-11
Chandra Kurniawan
2012-1-11
You can use uigetfile with 'multiselect' -> 'on'
And when reading the image, you can use for loop
Eq:
handles.output = hObject;
[fn pn] = uigetfile('*.jpg','select image','multiselect','on')
if ~isempty(fn)
for x = 1 length(fn)
handles.I{x} = imread(fullfile(pn,fn{x}));
end
end
guidata(hObject, handles);
In another pushbutton callback, you can call the image by the index
Eq:
handles.output = hObject;
handles.bw = im2bw(handles.I{1});
imshow(handles.bw);
guidata(hObject, handles);
Gaurav Kaila
2012-1-10
0 个投票
13 个评论
Chandra Kurniawan
2012-1-10
Eq : I need to show mean value of the image
handles.output = hObject;
handles.Imean = mean(handles.I((:));
set(handles.edit1,'string',num2str(handles.Imean));
guidata(hObject, handles);
Note : you must have uicontrol named edit1 in your GUI
Gaurav Kaila
2012-1-11
Gaurav Kaila
2012-1-11
Chandra Kurniawan
2012-1-11
You should place my code above in button callback (Mean Evaluation)
Image Analyst
2012-1-11
I don't recommend that since it's a measurement, not something you want the user to change. If you don't want the user to edit your value, I'd use a static text control instead, and use set() to assign a string to it.
text1String = sprintf('The mean = %.3f', meanValue);
set(handles.text1, 'String', text1String);
Again, there are nice demos and framework for this in MAGIC.
Gaurav Kaila
2012-1-11
Chandra Kurniawan
2012-1-11
a = str2double(get(handles.edit1,'string'));
now, you can pass 'a' in your function
Eq:
y = yourfunction(a)
Gaurav Kaila
2012-1-11
Chandra Kurniawan
2012-1-11
You should place it not in edit callback.
Gaurav Kaila
2012-1-11
Gaurav Kaila
2012-1-11
Chandra Kurniawan
2012-1-11
What is 'data_Callback'?
Your function?
Can you show me about 'data_Callback'?
Gaurav Kaila
2012-1-11
类别
在 帮助中心 和 File Exchange 中查找有关 Entering Commands 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!