急求几个MATLAB程序

来源:百度知道 编辑:UC知道 时间:2024/05/06 18:00:20
1. 读取图像,保存处理后的图像;
2. 直方图均衡化;
3. 对图像进行FFT和DCT变换;
4. 对图像添加高斯噪声,进行均值降噪(图像数目可设置);
5. 对图像进行频域增强(可选一种滤波器对图像平滑或者锐化都行);
6. 采用阈值法对图像进行二值化;(阈值可设置)。

所用的图像名称为:“lena512gray.tif”谢谢,

图像读取:
global I
% dialog for opening files

[imagefile , pathname]= uigetfile('*.tif');
if imagefile ~= 0
filename=[pathname imagefile];
[X,map]=imread(filename);
I=X;
show_Callback(hObject, eventdata, handles)
set(handles.save,'enable','on')
end;
图像保存:
global I
[imagefile , pathname, filterindex]= uiputfile({'*.tif','tif';'*.*','All Files'},'Image Save As');
if (imagefile ~= 0 & filterindex==1)
filename=[pathname imagefile '.tif'];
imwrite(I,filename);
else (imagefile ~= 0)
filename=[pathname imagefile];
imwrite(I,filename);
end;
频域增强:
global I
J=imnoise(I,'salt & pepper',0.02);
%gei tuxiang tianjia yanjiao zaosheng
subplot(121),imshow(J)
title('han you zaosheng de yuan tuxiang')
J=double(J);
f=fft2(J);
g=fftshift(