资源简介
图像复原、模糊的matlab代码,有良好的GUI和测试图片。在matlab7上测试过,能用。
代码片段和文件信息
function [absdiff snr psnr imfid mse] = compare(originalimg restoredimg)
%Function to compare the original image with the
%restored image using some predefined methods
%Inputs: originalimg restoredimg
%Returns: absdiff snr psnr imfid mse
%
%originalimg: It is the original unblurred image
%restoredimg: It is the restored image
%absdiff: Average Absolute Difference
%snr: Signal to Noise Ratio (dB)
%psnr: Peak Signal to Noise Ratio (dB)
%imfid: Image Fidelity
%mse: Mean Square Error
%
%Example:
% [absdiff snr psnr imfid mse] = compare(originalimg restoredimg);
% This call takes original image and the restored image and returns
% the comparison of both the images using some predefined methods.
%Average absolute difference
%{
md = originalimg - restoredimg;
mdsize = size(md);
summation = 0;
for i = 1:mdsize(1);
for j = 1:mdsize(2);
summation = summation + abs(md(ij));
end
end
absdiff = summation/(mdsize(1)*mdsize(2));
%}
%Signal to Noise Ratio (SNR)
%{
md = (originalimg - restoredimg).^2;
mdsize = size(md);
summation = 0;
sumsq=0;
for i = 1:mdsize(1);
for j = 1:mdsize(2);
summation = summation + abs(md(ij));
sumsq = sumsq + (originalimg(ij)^2);
end
end
snr = sumsq/summation;
snr = 10 * log10(snr);
%}
%Peak Signal to Noise Ratio (PSNR)
%{
md = (originalimg - restoredimg).^2;
mdsize = size(md);
summation = 0;
sumsq=0;
for i = 1:mdsize(1);
for j = 1:mdsize(2);
summation = summation + abs(md(ij));
end
end
psnr = size(originalimg 1) * size(originalimg 2) * max(max(originalimg.^2))/summation;
psnr = 10 * log10(psnr);
%}
%Image Fidelity
md = (originalimg - restoredimg).^2;
mdsize = size(md);
summation = 0;
sumsq = 0;
for i = 1:mdsize(1);
for j = 1:mdsize(2);
summation = summation + abs(md(ij));
sumsq = sumsq + (originalimg(ij)^2);
end
end
imfid = (1-summation)/sumsq;
%}
%Mean Square Error
%{
diff = originalimg - restoredimg;
diff1 = diff.^2;
mse = mean(mean(diff1));
%}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 43632 2004-09-18 06:42 GUIWelcome.fig
文件 12276 2005-04-18 12:51 GUIWelcome.m
文件 1582 2005-05-05 00:50 Hough(old).m
文件 828 2005-04-16 19:12 Hough.m
文件 1365 2005-04-23 17:42 Inverse.m
文件 2030 2005-05-05 03:00 Lucy.m
文件 418 2005-04-23 18:46 my_closereq.m
文件 1733 2005-05-05 02:49 Wiener.m
目录 0 2005-12-16 12:42 Help\
目录 0 2005-12-16 12:31 Help\about_us\
文件 17189 2005-04-13 21:34 Help\about_us\akshata.jpg
文件 49064 2005-04-12 03:48 Help\about_us\oursnap.jpg
文件 14410 2005-04-13 21:39 Help\about_us\prateek.jpg
文件 18662 2005-04-14 22:30 Help\about_us\wilson.jpg
文件 5311 2005-04-13 21:33 Help\about_us\wilson2.jpg
文件 1766 2005-12-16 12:48 Help\About_Us.html
目录 0 2005-12-16 12:29 Help\basics\
文件 4375 2005-04-12 01:34 Help\basics\degradation_model.jpg
文件 7661 2005-04-12 02:15 Help\basics\degraded_dot_psf.jpg
文件 860 2005-04-12 01:49 Help\basics\dot.jpg
文件 1251 2005-04-12 01:59 Help\basics\dot_blur_angle.jpg
文件 1251 2005-04-12 01:56 Help\basics\dot_blur_len.jpg
文件 6363 2005-04-12 02:19 Help\basics\gaussian.jpg
文件 6883 2005-04-12 02:14 Help\basics\original_dot_psf.jpg
文件 746 2005-04-12 02:22 Help\basics\poisson.jpg
文件 7759 2005-04-12 02:19 Help\basics\salt_&_pepper.jpg
文件 7850 2005-04-12 02:19 Help\basics\speckle.jpg
文件 6702 2005-12-16 12:48 Help\Basics.html
文件 2455 2005-12-16 12:52 Help\Degrade.html
目录 0 2005-12-16 12:31 Help\getting_started\
文件 7915 2005-04-12 17:58 Help\getting_started\degrade_menu.jpg
............此处省略53个文件信息
评论
共有 条评论