フィルターのクリア

Displaying Histogram IN GUI AXES using imhist

7 ビュー (過去 30 日間)
Luke Dineen-Woolnough
Luke Dineen-Woolnough 2016 年 3 月 2 日
回答済み: Sankarshan Bangaloree 2017 年 2 月 6 日
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);

回答 (2 件)

Sankarshan Bangaloree
Sankarshan Bangaloree 2017 年 2 月 6 日
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 2016 年 3 月 5 日
編集済み: Geoff Hayes 2016 年 3 月 5 日
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);

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by