Problems displaying edited images in GUI created in MATLAB

I have a task to create a GUI using MATLAB GUIDE, and I had a problem displaying the edited image. I need to have buttons that edit the image (for example, remove the red, blue, green components and rotate) and display this edited image. I use imshowto display the edited image, but it displays in a new window and disables the GUI that I had. Can anyone help?

I worked on this and tried many different ways to solve the problem, but no one worked. However, I am using MATLAB 7.0.1, and 7.7.0 may have an update for this problem.

+3
source share
2 answers

When you first draw an image with imshow, let it return a handle to the image object it creates:

A = (the initial matrix of image data);
hImage = imshow(A);

Then, to refresh the image with new data, try the following instead of calling again imshow:

B = (modification of the original image matrix A);
set(hImage, 'CData', B);

Using the command set, you will modify the created image object (the list of properties of the image object can be found here ).

Alternatively, you can also add additional parameters to the call imshowto indicate which axis object will display the image in:

hAxes = (the handle to an axes object);
imshow(A, 'Parent', hAxes);

EDIT:

GUI , MATLAB . , , GUI: ( SO ), UserData ( SO ) setappdata/getappdata guidata. guidata , GUIDE.

+4

GUI m hObject. , , hObject:

hObject = imshow(newimagedata)

:

guidata(hObject, handles)
0

Source: https://habr.com/ru/post/1706730/


All Articles