%%Compute and plot(show the image and its histogram)the histogram of flower
%.pgm,swan.pgmand tools.pgm.comment on what information can be discerned
%about the images from an examination of the histogram.
clc;clear all;close all;
%%========================================================================
%% showing the images and the histogram plots
%%=======================================================================
%%histogram plot of flower.pgm
d=imread('image/flower.pgm');
%%d=rgb2gray(d);
[m n]=size(d);
s=double(d);
for i=0:255 %find the no. of occurance of each gray level
a=find(s==i);
x(i+1)=length(a);
end
y=x/(m*n); %probability
l=0:255;
figure;
subplot(211);imshow(d);title('original image');
subplot(212);stem(l,x);title('histogram plot');
%%histogram plot of swan.pgm
d1=imread('image/swan.pgm');
%%d=rgb2gray(d1);
[m1 n1]=size(d1);
s1=double(d1);
for i=0:255 %find the no. of occurance of each gray level
a1=find(s1==i);
x1(i+1)=length(a1);
end
y1=x1/(m1*n1); %probability
l1=0:255;
figure;
subplot(211);imshow(d1);title('original image');
subplot(212);stem(l1, x1);title('histogram plot');
%%histogram plot of tools.pgm
d3=imread('image/tools.pgm');
%%d3=rgb2gray(d3);
[m2 n2]=size(d3);
s2=double(d3);
for i=0:255 %find the no. of occurance of each gray level
a2=find(s1==i);
x2(i+1)=length(a2);
end
y2=x2/(m2*n2); %probability
l2=0:255;
figure;
subplot(211);imshow(d3);title('original image');
subplot(212);stem(l2, x2);title('histogram plot');
plot-histogram.rar_The Show
版权申诉
21 浏览量
2022-09-20
21:09:58
上传
评论
收藏 56KB RAR 举报
小贝德罗
- 粉丝: 69
- 资源: 1万+
最新资源
- 21219119313侯志航.zip
- 50-50.渗透测试-Kali Linux漏洞利用
- 联通会员注册入口自动化视频
- python 声音-10-JavaScript的使用.ev4.rar
- 基于C8051F双单片机的雷达式生命探测仪后端系统的研制
- 47-47.渗透测试-配置Kali Linux
- 卷积神经网络(Convolutional Neural Network,CNN)是一种深度学习模型
- DHT11温湿度传感器是一款常用的数字温湿度传感器,它结合了温度和湿度的测量功能,能够准确感知环境中的温度和湿度,并输出相应的数
- 45-45.渗透测试-天境漏洞扫描工具安装使用
- 基于PC817光耦隔离继电器模块PDF原理图+AD集成封装库文件.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈