One image input for multiple buttons and fields in a gui
Show older comments
I'm new to the forums and Matlab, so bear with me.
I'm working on a program where I upload a photo and have several buttons along the side that perform certain functions to that image (grayscale, resize etc.). My question is this:
Some of my functions require input from the user (blur, rotate etc.)
I've made fields for all the appropriate inputs. To upload the photo into my program, I've used the following code which is associated with a Browse button.
%Browse Button
function browse_Callback(hObject, eventdata, handles)
H.Id = imread((uigetfile('*.JPG')));
H.Ih = imshow(H.Id)
guidata(gcbf,H)
axes(handles.orig2)
imshow(H.Id)
This loads the image and copies it into another axes. That way, I can display the original image and the augmented image at the same time.
All this works so far, but here is where it gets tricky:
% --- Executes on button press in regblurbtn.
function regblurbtn_Callback(hObject, eventdata, handles)
a = get(handles.RADI,'String')
H=guidata(gcbf);
%sets up filter
blurfilt=fspecial('disk', a);
%applies filer to H
g=imfilter(H.Id, blurfilt, 'replicate');
imgshow(g);
Basically, I want to type a number in the field with the tag RADI. I want to upload the photo, have it displayed, type in a number in the RADI field and then click on the "Blur" button. I then want that number typed by the user to be passed in. It must perform this to the image stored in guidata. I believe my function for the image transform is correct, but trying to pass through the value is yielding a "Reference to non-existent field 'RADI'". Any help is appreciated. Also, if someone provides support, will it change for multiple inputs? Thank you!
Accepted Answer
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!