灰度直方图、直方图均衡化及图像滤波
2017-03-27 14:38
113 查看
1、灰度直方图
I=imread('guilin.jpg');
I=rgb2gray(I);
subplot(121),imshow(I)
subplot(122),imhist(I)
I=imread('pubu.jpg');
subplot(141),imshow(I);
subplot(221),imshow(I);
%R分量的灰度直方图
subplot(222),imhist(I(:,:,1));
%G分量的灰度直方图
subplot(223),imhist(I(:,:,2));
%B分量的灰度直方图
subplot(224),imhist(I(:,:,3));
2、直方图均衡化
%读入待转换的彩色图像,并将其转换成灰度图像
I=imread('diaosu.jpg');
I=rgb2gray(I);
%进行直方图均衡化处理
J=histeq(I);
%显示输入图像预处理后的结果
subplot(211),imshow(I)
subplot(212),imshow(J)
3、图像滤波
%读入原始图像,添加椒盐噪声
I=imread('lena.jpg');
I=rgb2gray(I);
J=imnoise(I,'salt & pepper',0.04);
%进行中值滤波
K=medfilt2(J,[3,3]);
subplot(121),imshow(J)
subplot(122),imshow(K)
I=imread('guilin.jpg');
I=rgb2gray(I);
subplot(121),imshow(I)
subplot(122),imhist(I)
I=imread('pubu.jpg');
subplot(141),imshow(I);
subplot(221),imshow(I);
%R分量的灰度直方图
subplot(222),imhist(I(:,:,1));
%G分量的灰度直方图
subplot(223),imhist(I(:,:,2));
%B分量的灰度直方图
subplot(224),imhist(I(:,:,3));
2、直方图均衡化
%读入待转换的彩色图像,并将其转换成灰度图像
I=imread('diaosu.jpg');
I=rgb2gray(I);
%进行直方图均衡化处理
J=histeq(I);
%显示输入图像预处理后的结果
subplot(211),imshow(I)
subplot(212),imshow(J)
3、图像滤波
%读入原始图像,添加椒盐噪声
I=imread('lena.jpg');
I=rgb2gray(I);
J=imnoise(I,'salt & pepper',0.04);
%进行中值滤波
K=medfilt2(J,[3,3]);
subplot(121),imshow(J)
subplot(122),imshow(K)
相关文章推荐
- 图像处理基础(8):图像的灰度直方图、直方图均衡化、直方图规定化(匹配)
- 图像直方图均衡化和空间滤波
- [Other]数字图像处理:各种变换滤波和噪声的类型和用途总结
- 图像处理------直方图均衡化
- 【图像处理】图像强度变换、直方图均衡化(Image Intensity Transformations and Histogram Equalization)
- 数字图像滤波
- 使用blur函数进行基于均值滤波的图像模糊操作
- 图像处理之滤波---gabor
- openCV—Python(9)—— 图像平滑与滤波
- 图像处理基本概念——卷积,滤波,平滑
- Matlab图像的灰度直方图
- 【图像处理】从图像空间域滤波到频域滤波
- 图像滤波综合(方框、均值、高斯、中值、双边)
- MATLAB中实现图像的空间域滤波和频率域滤波
- OpenCV-图像滤波
- 图像增强处理之:同态滤波与Retinex算法(一)同态滤波
- 基于直方图均衡化的激光水下图像处理
- Python下opencv使用笔记(图像频域滤波与傅里叶变换)
- 空间域滤波:图像平滑和锐化