文档详情

点操作及直方图均衡化算法实现.doc

发布:2017-03-21约字共6页下载文档
文本预览下载声明
南京信息工程大学 实验(实习)报告 实验名称 点操作及直方图均衡化算法实现 实验日期 xxxxx 得分 指导教师_ xxxx 院 xx 专业 xx 年级 xxxx 班次 x 姓名 xxx 学号 xxxx 一、实验目的 理解点操作图像增强方法熟练使用man命令 理解直方图均衡化算法的原理,掌握算法的实现 二、实验内容 理解图像灰度拉伸,练习imadjust函数的使用; 编程实现图像线性灰度变换算法; 编程实现图像二值化算法; 编程实现图像灰度对数变换、指数变换算法; 在Matlab中编程实现直方图均衡化算法(不使用histeq函数,编程实现其功能)。 三、实验步骤 1. imadjust函数的使用: 2. 图像截取性线性灰度变换算法: 3. 图像二值化算法: 4_1. 图像灰度对数变换: 4_2. 指数变换算法: 5. 直方图均衡化算法: 四、实验总结 通过此次试验,我了解了图像灰度拉伸的函数,掌握了线性灰度变换算法、二值化算法和直方图均衡化算法。 I = imread(pout.tif); J = imadjust(I); subplot(1,3,1),imshow(I),title(原图); subplot(1,3,2),imshow(J),title(imadjust1); K = imadjust(I,[0.3 0.7],[]); subplot(1,3,3),imshow(K),title(imadjust2); clear ;clc; i=imread(pout.tif); d=double(i); imhist(i); a=75.0;b=150.0; a1=0.0;b1=255.0; n1=iaib; n2=ia; n3=ib; clear;clc; f=imread(eight.tif); g=f; [m,n]=size(f); lever=floor(m); vertical=floor(n); for x=1:lever for y=1:vertical if g(x,y)175 g(x,y)=250; end if g(x,y)175 g(x,y)=0; end d2=d; d2(n1)=(d(n1)-a)*(b1-a1)/(b-a)+a1; d2(n2)=a1; d2(n3)=b1; i2=uint8(d2); subplot(221),imshow(i),title(原图); subplot(222),imshow(i2),title(截取性线性灰度变换图); subplot(223),imhist(i); subplot(224),imhist(i2); end end subplot(221),imshow(f),title(原图); subplot(222),imhist(f); subplot(223),imshow(g),title(图像二值化); subplot(224),imhist(g); clear;clc; I=imread(circuit.tif); c=18/log(196); [m,n]=size(I); I2=double(I); for(i=1:m) for j=1:n g(i,j)=c*log(I2(i,j)+1); end end subplot(121),imshow(I),title(原图); subplot(122),imshow(mat2gray(g)),title(灰度范围压缩图像); clear;clc; tu=imread(pout.tif); %读入图片 graydis=zeros(1,256);%设置矩阵大小 graydispro=zeros(1,256); new_graydis=zeros(1,256); new_graydispro=zeros(1,256); [h w]=size(tu); new_tu=zeros(h,w); %计算原始直方图各灰
显示全部
相似文档