Displaying Histogram IN GUI AXES using imhist

7 Ansichten (letzte 30 Tage)
Luke Dineen-Woolnough
Luke Dineen-Woolnough am 2 Mär. 2016
I am trying to display the histogram of an image in a GUI using GUIDE. The Gui has two AXIS the first axis displays the image and the second Axis is meant to display the Histogram, however whenever i run the call back the histogram figure will appear correctly but not in the axis. I'm not sure if the handles.axes2 is in the right place, however i have tried it in all other logical (to my mind) places within the code. Any Advice would be very appreciated.
Code below
Many Thanks
Luke
a=imread('Im2.png');
agray=rgb2gray(a);
x=agray;
figure, imshow(x);
handles.axes2;
figure, imhist(x);

Antworten (2)

Sankarshan Bangaloree
Sankarshan Bangaloree am 6 Feb. 2017
I created a fcn from axes guide then i used this you can try this it worked for me
function axes3_CreateFcn(hObject, eventdata, handles)
I=imread('Im2.png');
I=rgb2gray(I);
imhist(I)
axes(handles.axes3);

Geoff Hayes
Geoff Hayes am 5 Mär. 2016
Bearbeitet: Geoff Hayes am 5 Mär. 2016
Luke - I am unsure about the line of code
handles.axes2;
What is the intent of this line? If you wish to set this to be the current axes, then you should do this as
axes(handles.axes2);
However, I don't know if that will be sufficient as I don't have the Image Processing Toolbox to verify.
If the above doesn't work, then see the documentation for imhist. There isn't an input parameter indicating the target axes upon which to draw the histogram, so you may have to draw it yourself using the output from imhist as
[counts,binLocations] = imhist(x);
stem(handles.axes2,binLocations,counts);

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by