- 9
- 0
- 约4.26千字
- 约 8页
- 2019-08-17 发布于江西
- 举报
MATLAB图像增强程序举例
1.灰度变换增强程序:
% GRAY TRANSFORMclc;I=imread(pout.tif);imshow(I);J=imadjust(I,[0.3 0.7],[0 1],1);??%transforms the walues in the %intensity image I to values in J by linealy mapping %values between 0.3 and 0.7 to values between 0 and 1.figure;imshow(J);J=imadjust(I,[0.3 0.7],[0 1],0.5);??% if GAMMA is less than 1,the ?mapping si weighted toward higher (brighter)
%output values.figure;imshow(J);J=imadjust(I,[0.3 0.7],[0 1],1.5);??% if GAMMA is greater than 1,the mapping si weighted toward lower (darker)
%output values.figure;imshow(J)J=imadjust(I,[0.3 0.7],[0 1],1);??% If TOPBOTTOM,the output image is reversed,as in a photographic negative.figure;imshow(J);?
2.直方图灰度变换
%直方图灰度变换[X,map]=imread(forest.tif);I=ind2gray(X,map);%把索引图像转换为灰度图像imshow(I);title(原图像);improfile%用鼠标选择一条对角线,显示线段的灰度值figure;subplot(121)plot(0:0.01:1,sqrt(0:0.01:1))axis squaretitle(平方根灰度变换函数)subplot(122)maxnum=double(max(max(I)));%取得二维数组最大值J=sqrt(double(I)/maxnum);%把数据类型转换成double,然后进行平方根变换%sqrt函数不支持uint8类型J=uint8(J*maxnum);%把数据类型转换成uint8类型imshow(J)title(平方根变换后的图像)
3.直方图均衡化程序举例
% HISTGRAM EAQUALIZATIONclc;% Clear command windowI=imread(tire.tif);% reads the image in tire.tif into Iimshow(I);% displays the intensity image I with 256 gray levelsfigure;%creates a new figure windowimhist(I);% displays a histogram for the intensity image IJ=histeq(I,64);% transforms the intensity image I,returning J an intensityfigure;%image with 64 discrete levelsimshow(J);figure;imhist(J);J=histeq(I,32);%transforms the intensity image ,returning in % J an intensityfigure;%image with 32 discrete levelsimshow(J);figure;imhist(J);
4.直方图规定化程序举例
% HISTGRAM REGULIZATIONclc;
%Clear command windowI=imread(tire.tif);%reads the image in tire.tif into IJ=histeq(I,32);%transforms the intensity image I,returning in%J an intensity image with 32 discrete levels[counts,x]=imhist(J);%displays a histogram for the intensity image IQ=imread(pout.tif);%reads the imag
您可能关注的文档
最近下载
- 专题2 数据采集与编码 学案(含解析)2025届高中信息技术.DOCX VIP
- 高中地理课件湘教版:1-1中国的人口和民族.ppt
- 鲁科版高中化学选择性必修1第3章物质在水溶液中的行为3.3.2沉淀溶解平衡的应用课件(内嵌音频+视频).ppt VIP
- 建筑施工安全管理论文【推荐】.doc VIP
- 2025年高考地理识图填图完全手册(扫描版).docx
- 防火封堵材料 GB23864-2023.pdf
- 专题2 数据采集与编码 课件 2025届高中信息技术.pptx VIP
- 专题1 数据与大数据 课件 2025届高中信息技术.pptx VIP
- 鲁科版高中化学选择性必修1第3章物质在水溶液中的行为3.3.1沉淀溶解平衡与溶度积(内嵌音频+视频).ppt VIP
- 2025年甘肃省高考物理试卷(含答案解析).docx VIP
原创力文档

文档评论(0)