Displaying Histogram IN GUI AXES using imhist
조회 수: 7 (최근 30일)
이전 댓글 표시
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);
댓글 수: 0
답변 (2개)
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);
댓글 수: 0
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);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!