冈萨雷斯数字图像处理——彩色图像增强3实例

该博客介绍了冈萨雷斯数字图像处理中关于彩色图像增强的三个实例:利用直方图均衡化提升图像亮度和清晰度,应用双边滤波进行图像平滑处理,以及探讨图像的模糊增强技术。每个实例都结合matlab进行了仿真验证。
摘要由CSDN通过智能技术生成

             冈萨雷斯数字图像处理——彩色图像增强3实例


实例一:基于直方图均衡化的彩色图像增强

    要处理的图片:fruit.jpg

   
     
    example1.m:
clc;
RGB=imread('fruit.jpg');    %输入彩色图像,得到三维数组

R=RGB(:,:,1);             %分别取三维数组的一维,得到红绿蓝三个分量
G=RGB(:,:,2);             %为R G B
B=RGB(:,:,3);

subplot(4,2,1),imshow(RGB);       %绘制各分量的图像及其直方图
title('原始真彩色图像');          
subplot(4,2,3),imshow(R);
title('真彩色图像的红色分量');
subplot(4,2,4), imhist(R);
title('真彩色图像的红色分量直方图');
subplot(4,2,5),imshow(G);
title('真彩色图像的绿色分量');
subplot(4,2,6), imhist(G);
title('真彩色图像的绿色分量直方图');
subplot(4,2,7),imshow(B);
title('真彩色图像的蓝色分量');
subplot(4,2,8), imhist(B);
title('真彩色图像的蓝色分量直方图');

r=histeq(R);             %对个分量直方图均衡化,得到个分量均衡化图像   
g=histeq(G);  
b=histeq(B); 
figure,
subplot(3,2,1),imshow(r);
title('红色分量均衡化后图像');
subplot(3,2,2), imhist(r);
title('红色分量均衡化后图像直方图');
subplot(3,2,3),imshow(g);
title('绿色分量均衡化后图像');
subplot(3,2,4), imhist(g);
title('绿色分量均衡化后图像直方图');
subplot(3,2,5), imshow(b);
title('蓝色分量均衡化后图像');
subplot(3,2,6), imhist(b);
title('蓝色分量均衡化后图像直方图');

figure,       %通过均衡化后的图像还原输出原图像                    
newimg = cat(3,r,g,b);                
imshow(newimg,[]);
title('均衡化后分量图像还原输出原图');

   处理效果:

  
    
   

   通过matlab仿真,比较均衡化后的还原图像与输入原始真彩色图像,输出图像轮廓更清晰,亮度明显增强。

实例二: 双边滤波(Bilateral Filtering)

     双边滤波是一种非线性的滤波方法,是结合图像的空间邻近度和像素值相似度的一种折衷处理,同时考虑空域信息和灰度相似性,达到保边去噪的目的。具有简单、非迭代、局部的特点。
    双边滤波器的好处是可以做边缘保存(edge preserving),一般过去用的维纳滤波或者高斯滤波去降噪,都会较明显地模糊边缘,对于高频细节的保护效果并不明显。双边滤波器顾名思义比 高斯滤波 多了一个高斯方差sigma-d,它是基于空间分布的高斯滤波 函数 ,所以在边缘附近,离的较远的像素不会太多影响到边缘上的像素值,这样就保证了边缘附近像素值的保存。但是由于保存了过多的高频信息,对于彩色图像里的高频噪声,双边滤波器不能够干净的滤掉,只能够对于低频信息进行较好的滤波。
    测试用例图:

  
   matlab代码:
   bfilter2.m
% BFILTER2 Two dimensional bilateral filtering.
%    This function implements 2-D bilateral filtering using
%    the method outlined in:
%
%       C. Tomasi and R. Manduchi. Bilateral Filtering for 
%       Gray and Color Images. In Proceedings of the IEEE 
%       International Conference on Computer Vision, 1998. 
%
%    B = bfilter2(A,W,SIGMA) performs 2-D bilateral filtering
%    for the grayscale or color image A. A should be a double
%    precision matrix of size NxMx1 or NxMx3 (i.e., grayscale
%    or color images, respectively) with normalized values in
%    the closed interval [0,1]. The half-size of the Gaussian
%    bilateral filter window is defined by W. The standard
%    deviations of the bilateral filter are given by SIGMA,
%    where the spatial-domain standard deviation is given by
%    SIGMA(1) and the intensity-domain standard deviation is
%    given by SIGMA(2).
%
% Douglas R. Lanman, Brown University, September 2006.
% dlanman@brown.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值