图像增强与平滑实验报告

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

实验一图像增强与平滑

一.实验目的及要求

1.了解MATLAB的操作环境和基本功能。

2.掌握MATLAB中图像增强与平滑的函数的使用方法。

3.加深理解图像增强与平滑的算法原理。

二、实验内容

(一)研究以下程序,分析程序功能;输入执行各命令行,认真观察命令执行的结果。熟悉程序中所使用函数的调用方法,改变有关参数,观察试验结果。(可将每段程序保存为一个.m文件)

1.直方图均衡

clear all; close all % Clear the MATLAB workspace of any variables

% and close open figure windows。

I = imread('pout.tif'); % R eads the sample images ‘ pout.tif’, and stores it in

imshow(I) % an array named I.display the image

figure, imhist(I) % Create a histogram of the image and display it in

% a new figure window.

[I2,T] = histeq(I); % Histogram equalization.

figure, imshow(I2) % Display the new equalized image, I2, in a new figure window.

figure, imhist(I2) % Create a histogram of the equalized image I2.

figure,plot((0:255)/255,T); % plot the transformation curve.

imwrite (I2, 'pout2.png'); % Write the newly adjusted image I2 to a disk file named

% ‘pout2.png’.

imfinfo('pout2.png') % Check the contents of the newly written file

执行结果如下:

Command窗口:

ans =

Filename: 'pout2.png'

FileModDate: '29-Apr-2006 15:33:34'

FileSize: 36938

Format: 'png'

FormatVersion: []

Width: 240

Height: 291

BitDepth: 8

ColorType: 'grayscale'

FormatSignature: [137 80 78 71 13 10 26 10]

Colormap: []

Histogram: []

InterlaceType: 'none'

Transparency: 'none'

SimpleTransparencyData: []

BackgroundColor: []

RenderingIntent: []

Chromaticities: []

Gamma: []

XResolution: []

YResolution: []

ResolutionUnit: []

XOffset: []

YOffset: []

OffsetUnit: []

SignificantBits: []

ImageModTime: '29 Apr 2006 07:33:34 +0000'

Title: []

Author: []

Description: []

Copyright: []

CreationTime: []

Software: []

Disclaimer: []

Warning: []

Source: []

Comment: []

OtherText: []

上述命令窗口显示的是图片pout2.png的相关信息,包括文件名- 'pout2.png'、文件最后修改时间-'29-Apr-2006 15:33:34'、文件大小-36938、图片格式-'png'、格式版本、图片宽度-240、图片高度-291、图像像素值所占用的二进制位数-8、图像类型- 'grayscale'等等。

下面是所显示的图像:

原图像原图像的灰度直方图

利用直方图均衡化函数处理后的图像图像被均衡化后的灰度直方图

Matlab均衡化函数的函数曲线图以.png格式保存后的图像

对实验结果分析如下:

由以上有关图像对比可以看出,经过均衡化的图像比原图像更富有层次感,对比度更加明显,图像效果也显得更为好一些。从原图像的灰度直方图和变换后的灰度直方图可以看出,均衡化函数拉伸了原图像灰度值较为密集的部分(大约在75-150归一化为0.3-0.6),从而使图像的灰度范围得以扩大,灰度值更加均匀而非原图像的集中分布,所以原图像却是灰蒙蒙的,变换后的图像显得非常清亮。

2.直接灰度变换

clear all; close all

I = imread('cameraman.tif'); J = imadjust(I,[0 0.2],[0.5 1]); imshow(I)

figure, imshow(J) 注意:imadjust()

功能:

调整图像灰度值或颜色映像表,也可实现伽马校正。

语法:

J = imadjust(I,[low_in high_in],[low_out high_out],gamma) newmap = imadjust(map,[low_in high_in],[low_out high_out],gamma) RGB2 = imadjust(RGB1,...)

相关文档
最新文档