hxiaofengk 发表于 2008-1-18 09:34

请教matlab图象恢复的问题

怎么用matlab 恢复 理想图象与函数h=sqrt(x*x+y*y)*1/240 卷积后的模糊图象
明天要交了~~~还搞不出来~~哪位大侠帮个忙~~感激
~~

[ 本帖最后由 eight 于 2008-1-22 17:36 编辑 ]

adminftp 发表于 2008-1-18 09:41

参考http://forum.vibunion.com/forum/thread-48079-1-1.html

hxiaofengk 发表于 2008-1-18 09:49

谢谢拉~~~~

hxiaofengk 发表于 2008-1-18 10:00

回复 2楼 的帖子

有错误……我很菜 初学的……

sigma665 发表于 2008-1-18 10:17

回复 4楼 的帖子

请说清楚问题
有什么样的错误

hxiaofengk 发表于 2008-1-18 10:20

clear all
I = imread('1.bmp');
Img = double(I);
alf=3;
n=10;%定义模板大小
n1=floor((n+1)/2);%计算中心
for i=1:n
for j=1:n
b(i,j) =exp(-((i-n1)^2+(j-n1)^2)/(4*alf))/(4*pi*alf);
end
end
Img_n = uint8(conv2(Img,b,'same'));
K=uint8(imfilter(Img,b));
Img_n2=uint8(imfilter(Img,b,'conv'));
J=(Img_n2)-Img_n;
flag=mean(J(:))
subplot(131),imshow(I);title('原图')
subplot(132),imshow(Img_n);title('卷积运算图')
subplot(133),imshow(K);title('相关运算图')
figure(2),surf(b);
??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d re

hxiaofengk 发表于 2008-1-18 10:24

先求图像的傅立叶变换再求函数的傅立叶变换 两者相除 再求反变换

这是老师提示的~~但是怎么实现啊~~~太郁闷了~我很菜

花如月 发表于 2008-1-18 12:25

回复 6楼 的帖子

根据错误提示

将double转成成uint8就可以了

hxiaofengk 发表于 2008-1-18 14:29

回复 8楼 的帖子

很感激~但是~~~
改后……
>> clear all
I = imread('1.bmp');
Img = unit8(I);
alf=3;
n=10;%定义模板大小
n1=floor((n+1)/2);%计算中心
for i=1:n
for j=1:n
b(i,j) =exp(-((i-n1)^2+(j-n1)^2)/(4*alf))/(4*pi*alf);
end
end
Img_n = uint8(conv2(Img,b,'same'));
K=uint8(imfilter(Img,b));
Img_n2=uint8(imfilter(Img,b,'conv'));
J=(Img_n2)-Img_n;
flag=mean(J(:))
subplot(131),imshow(I);title('原图')
subplot(132),imshow(Img_n);title('卷积运算图')
subplot(133),imshow(K);title('相关运算图')
figure(2),surf(b);
??? Undefined command/function 'unit8'.

hxiaofengk 发表于 2008-1-18 14:31

回复 8楼 的帖子

刚才发现uint写错了,但是还是有错切磋我错误
>> clear all
I = imread('1.bmp');
Img = uint8(I);
alf=3;
n=10;%定义模板大小
n1=floor((n+1)/2);%计算中心
for i=1:n
for j=1:n
b(i,j) =exp(-((i-n1)^2+(j-n1)^2)/(4*alf))/(4*pi*alf);
end
end
Img_n = uint8(conv2(Img,b,'same'));
K=uint8(imfilter(Img,b));
Img_n2=uint8(imfilter(Img,b,'conv'));
J=(Img_n2)-Img_n;
flag=mean(J(:))
subplot(131),imshow(I);title('原图')
subplot(132),imshow(Img_n);title('卷积运算图')
subplot(133),imshow(K);title('相关运算图')
figure(2),surf(b);
Warning: CONV2 on values of class UINT8 is obsolete.
         Use CONV2(DOUBLE(A),DOUBLE(B)) or CONV2(SINGLE(A),SINGLE(B)) instead.
> In uint8.conv2 at 11
??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'.

Error in ==> uint8.conv2 at 20
y = conv2(varargin{:});

sigma665 发表于 2008-1-18 16:05

回复 10楼 的帖子

Warning: CONV2 on values of class UINT8 is obsolete.
         Use CONV2(DOUBLE(A),DOUBLE(B)) or CONV2(SINGLE(A),SINGLE(B)) instead.

运行的时候还是用double代替了
页: [1]
查看完整版本: 请教matlab图象恢复的问题