图像变换实验.

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

1:灰度变换:

%matlab软件中,imadjust函数可以实现图像的灰度变换,用matlab语言编写的灰度变换例程如下所示:

%GRAY TRANSFORM

clc;

I=imread('C:/Documents and Settings/Administrator/桌面/cameraman.bmp');

imshow(I);

J=imadjust(I,[0.3 0.7],[0 1],1);%transform the values in the intensity images I to values in J 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 is weighted toward highter (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 is weighted toward lower (darker) output values;

figure;

imshow(J);

%Gradient Sharpen

clc;

[I,map]=imread('C:/Documents and Settings/Administrator/桌面/cameraman.bmp');

imshow(I,map);

I=double(I);

[IX,IY]=gradient(I);%return the numerical gradient of the matrix F ,FX corresponds to dF/dx,the differences in the x column direction ,FY corresponds to dF/dy ,the differences in the y(row ) directions.

GM=sqrt(IX.*IX+IY.*IY);

OUT1=GM;

figure;

imshow(OUT1,map);

OUT2=I;

J=find(GM>=10);

OUT2(J)=GM(J);

figure;

imshow(OUT2,map);

OUT3=I;

J=find(GM>=10); OUT3(J)=255; figure;

imshow(OUT3,map); OUT4=I;

J=find(GM<=10); OUT4(J)=255; figure;

imshow(OUT4,map); OUT5=I;

J=find(GM>=10); OUT5(J)=255;

Q=find(GM<10); OUT5(Q)=0; figure;

imshow(OUT5,map);

相关文档
最新文档