怎么用matlab编程实现一幅图像的灰度直方图,要纵坐标为概率,横坐标为梯度值.

学习 时间:2026-04-03 19:40:22 阅读:236
怎么用matlab编程实现一幅图像的灰度直方图,要纵坐标为概率,横坐标为梯度值.如图所示!

最佳回答

长情的保温杯

斯文的帆布鞋

2026-04-03 19:40:22

gradient计算梯度值, 然后用hist计算频次,就可以画出来了 再问: 能稍微在具体点吗?hist怎么计算频次?谢谢。。 再答: N = HIST(Y,M)M是分组数,N是频次再问: 最后是bar(N)吗?好像不对啊。。 再答: I=imread('lena。jpg');I=rgb2gray(I);subplot(221);imshow(I);[Gx Gy]= gradient(double(I));G = sqrt(Gx。^2+Gy。^2);subplot(222);imshow(uint8(G));[m,n]=size(G);G=reshape(G,1,m*n);h=[1:0。5:150];subplot(223);hist(G,h);[counts,x]=hist(G,h);subplot(224);plot(x,counts);

最新回答共有2条回答

  • 飘逸的小伙
    回复
    2026-04-03 19:40:22

    gradient计算梯度值, 然后用hist计算频次,就可以画出来了 再问: 能稍微在具体点吗?hist怎么计算频次?谢谢。。 再答: N = HIST(Y,M)M是分组数,N是频次再问: 最后是bar(N)吗?好像不对啊。。 再答: I=imread('lena。jpg');I=rgb2gray(I);subplot(221);imshow(I);[Gx Gy]= gradient(double(I));G = sqrt(Gx。^2+Gy。^2);subplot(222);imshow(uint8(G));[m,n]=size(G);G=reshape(G,1,m*n);h=[1:0。5:150];subplot(223);hist(G,h);[counts,x]=hist(G,h);subplot(224);plot(x,counts);

上一篇 一件商品按30%的利润率定价,然后按8折卖出,获得利润32元,这件商品的成本是多少元?

下一篇 下面这句话是否有不得体之处?