数字图像处理实验一课件_第1页
数字图像处理实验一课件_第2页
数字图像处理实验一课件_第3页
数字图像处理实验一课件_第4页
数字图像处理实验一课件_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、数字图像处理实验一图像灰度变换及直方图显示熟悉matlab的编程环境;复习MATLAB语言的基本用法;掌握MATLAB语言中图象数据与信息的读取存储方法;掌握matlab中图像灰度变换方法;掌握在MATLAB中绘制灰度直方图的方法; 实验目的实验中运用的函数 A=imread(FILENAME.FMT) imshow(A,low high) imwrite(A,FILENAME.FMT) G = intrans(F, neg) G = intrans(F, log, C, CLASS) G = intrans(F, gamma, GAM) G = intrans(F, stretch, M,

2、E)实验中运用的函数imhist(I):displays a histogram for the image I above a grayscale colorbar. imhist(I, n):displays a histogram where n specifies the number of bins used in the histogramimhist(X, map) :displays a histogram for the indexed image X.counts,x = imhist(.): returns the histogram counts in counts a

3、nd the bin locations in x so that stem(x,counts) shows the histogram. 实验中运用的函数imhist(f)Bar(horz, v, width) v:一个行向量,包含被绘制的点 horz:与v维数相同的向量,包含水平标度值的增量,若忽略horz, 则horz在0到length(v)之间等分若干 width:0到1之间的数值。width为1时条状最明显,0时为线。Stem(horz, v, color_linestyle_marker, fill) color_linestyle_marker:颜色,线类型,标记 fill:若使

4、用fill,标记点颜色与corlor一致Plot(horz, v, color, g, linestyle,none,marker,s)实验内容读出一副图像,利用灰度变换函数,基于switch语句分别实现图像灰度的反变换,对数变换,对比度拉伸变换,gamma变换操作,利用subplot在一个图像窗口的不同区域分别显示变换的结果。针对灰度变换后的图像,采用不同的方法绘制直方图,分析每种灰度变换后,直方图之间的区别。实验内容:操作提示function yourOutput = Yourfunctionname (yourInput)H1 行参数介绍%读入图像利用imadjust实现反变换,及对数变

5、换,再利用intrans实现gamma变换和对比度拉伸变换。这里要进行哪种变换,需要利用switch语句来控制;分别把每种变换结果利用subplot显示出来对每种变换的图像进行直方图计算,并利用不同的方法显示直方图实验内容:操作提示function g = intrans(f, varargin)% Verify the correct number of inputs.error(nargchk(2, 4, nargin) % Store the class of the input for use later.classin = class(f); % If the input is of

6、 class double, and it is outside the range0, 1, and the specified transformation is not log, convert the input to the range 0, 1.if strcmp(class(f), double) & max(f(:) 1 & . strcmp(varargin1, log) f = mat2gray(f);else % Convert to double, regardless of class(f). f = im2double(f);end实验内容:操作提示% Determ

7、ine the type of transformation specified.method = varargin1;% Perform the intensity transformation specified. switch methodcase neg g = imcomplement(f); case log if length(varargin) = 1 c = 1; elseif length(varargin) = 2 c = varargin2; elseif length(varargin) = 3 c = varargin2; classin = varargin3;

8、else error(Incorrect number of inputs for the log option.) end g = c*(log(1 + double(f);实验内容:操作提示case gamma if length(varargin) 2 error(Not enough inputs for the gamma option.) end gam = varargin2; g = imadjust(f, , , gam); case stretch if length(varargin) = 1 % Use defaults. m = mean2(f); E = 4.0; elseif length(varargin) = 3 m = varargin2; E = varargin3; else error(Incorrect number of inputs for the stretch option.) end g = 1./(1 + (m./(f +

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论