showing the histogram in UIAxes_2 And not separately in the application
2 次查看(过去 30 天)
显示 更早的评论
my code:
global a;
global input;
input=im2gray(a);
imhist(input);
imshow(input,'Parent',app.UIAxes_2);
0 个评论
采纳的回答
Walter Roberson
2022-12-17
imhist() does not have any possibility of passing in an an axes.
You will need to use the form of imhist() with outputs, and then draw the results. Something like
a = app.a;
app.gray_a = im2gray(a);
[counts, locations] = imhist(app.gray_a);
imshow(app.gray_a, 'Parent', app.UIAxes_2);
hold(app.UIAxes_2, 'on');
bar(locations, counts, 'Parent', app.UIAxes_2);
hold(app.UIAxes_2, 'off');
Notice the lack of global variables. Using global variables in App Designer is most often... misguided...
0 个评论
更多回答(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!