adpmedfilt3.m为自适应中值滤波器函数; adpmedfilt3_test.m为利用上述自

  • 虫虫123456
    了解作者
  • matlab
    开发工具
  • 3.1MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 5 积分
    下载积分
  • 0
    下载次数
  • 2022-07-05 00:48
    上传日期
adpmedfilt3.m为自适应中值滤波器函数; adpmedfilt3_test.m为利用上述自适应中值滤波器函数进行中值滤波,同时与普通中值滤波器滤波结果对比; 其余为基础图像处理函数; image文件中为实验图像kl.jpg;(adaptive median filter to filt images)
5f6af32e2b667.zip
  • image
  • kl.jpg
    2.9MB
  • kl1.JPG
    246KB
  • jiaoyan_junzhi.m
    932B
  • noise.m
    1.1KB
  • www.imdn.cn.html
    66B
  • linear.m
    477B
  • adpmedfilt3_test.m
    735B
  • test.m
    456B
  • saltpepper.m
    394B
  • xianxing.m
    1.2KB
  • medminmax.m
    2.4KB
  • ssim.m
    6.2KB
  • Untitled4.m
    759B
  • www.imdn.cn.txt
    366B
  • jiaoyan_junzhi_kl.m
    930B
  • test3.m
    337B
  • adpmedfilt.m
    1.1KB
  • adpmedfilt3.m
    1.4KB
  • test_adpmed.m
    220B
  • ssim_index.m
    5.8KB
  • test2.m
    466B
  • d_ssim_sp_med.m
    741B
内容介绍
function [mssim, ssim_map] = ssim(img1, img2, K, window, L) % ======================================================================== % SSIM Index with automatic downsampling, Version 1.0 % Copyright(c) 2009 Zhou Wang % All Rights Reserved. % % ---------------------------------------------------------------------- % Permission to use, copy, or modify this software and its documentation % for educational and research purposes only and without fee is hereby % granted, provided that this copyright notice and the original authors' % names appear on all copies and supporting documentation. This program % shall not be used, rewritten, or adapted as the basis of a commercial % software or hardware product without first obtaining permission of the % authors. The authors make no representations about the suitability of % this software for any purpose. It is provided "as is" without express % or implied warranty. %---------------------------------------------------------------------- % % This is an implementation of the algorithm for calculating the % Structural SIMilarity (SSIM) index between two images % % Please refer to the following paper and the website with suggested usage % % Z. Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli, "Image % quality assessment: From error visibility to structural similarity," % IEEE Transactios on Image Processing, vol. 13, no. 4, pp. 600-612, % Apr. 2004. % % http://www.ece.uwaterloo.ca/~z70wang/research/ssim/ % % Note: This program is different from ssim_index.m, where no automatic % downsampling is performed. (downsampling was done in the above paper % and was described as suggested usage in the above website.) % % Kindly report any suggestions or corrections to zhouwang@ieee.org % %---------------------------------------------------------------------- % %Input : (1) img1: the first image being compared % (2) img2: the second image being compared % (3) K: constants in the SSIM index formula (see the above % reference). defualt value: K = [0.01 0.03] % (4) window: local window for statistics (see the above % reference). default widnow is Gaussian given by % window = fspecial('gaussian', 11, 1.5); % (5) L: dynamic range of the images. default: L = 255 % %Output: (1) mssim: the mean SSIM index value between 2 images. % If one of the images being compared is regarded as % perfect quality, then mssim can be considered as the % quality measure of the other image. % If img1 = img2, then mssim = 1. % (2) ssim_map: the SSIM index map of the test image. The map % has a smaller size than the input images. The actual size % depends on the window size and the downsampling factor. % %Basic Usage: % Given 2 test images img1 and img2, whose dynamic range is 0-255 % % [mssim, ssim_map] = ssim(img1, img2); % %Advanced Usage: % User defined parameters. For example % % K = [0.05 0.05]; % window = ones(8); % L = 100; % [mssim, ssim_map] = ssim(img1, img2, K, window, L); % %Visualize the results: % % mssim %Gives the mssim value % imshow(max(0, ssim_map).^4) %Shows the SSIM index map %======================================================================== if (nargin < 2 || nargin > 5) mssim = -Inf; ssim_map = -Inf; return; end if (size(img1) ~= size(img2)) mssim = -Inf; ssim_map = -Inf; return; end [M N] = size(img1); if (nargin == 2) if ((M < 11) || (N < 11)) mssim = -Inf; ssim_map = -Inf; return end window = fspecial('gaussian', 11, 1.5); % K(1) = 0.01; % default settings K(2) = 0.03; % L = 255; % end if (nargin == 3) if ((M < 11) || (N < 11)) mssim = -Inf; ssim_map = -Inf; return end window = fspecial('gaussian', 11, 1.5); L = 255; if (length(K) == 2) if (K(1) < 0 || K(2) < 0) mssim = -Inf; ssim_map = -Inf; return; end else mssim = -Inf; ssim_map = -Inf; return; end end if (nargin == 4) [H W] = size(window); if ((H*W) < 4 || (H > M) || (W > N)) mssim = -Inf; ssim_map = -Inf; return end L = 255; if (length(K) == 2) if (K(1) < 0 || K(2) < 0) mssim = -Inf; ssim_map = -Inf; return; end else mssim = -Inf; ssim_map = -Inf; return; end end if (nargin == 5) [H W] = size(window); if ((H*W) < 4 || (H > M) || (W > N)) mssim = -Inf; ssim_map = -Inf; return end if (length(K) == 2) if (K(1) < 0 || K(2) < 0) mssim = -Inf; ssim_map = -Inf; return; end else mssim = -Inf; ssim_map = -Inf; return; end end img1 = double(img1); img2 = double(img2); % automatic downsampling f = max(1,round(min(M,N)/256)); %downsampling by f %use a simple low-pass filter if(f>1) lpf = ones(f,f); lpf = lpf/sum(lpf(:)); img1 = imfilter(img1,lpf,'symmetric','same'); img2 = imfilter(img2,lpf,'symmetric','same'); img1 = img1(1:f:end,1:f:end); img2 = img2(1:f:end,1:f:end); end C1 = (K(1)*L)^2; C2 = (K(2)*L)^2; window = window/sum(sum(window)); mu1 = filter2(window, img1, 'valid'); mu2 = filter2(window, img2, 'valid'); mu1_sq = mu1.*mu1; mu2_sq = mu2.*mu2; mu1_mu2 = mu1.*mu2; sigma1_sq = filter2(window, img1.*img1, 'valid') - mu1_sq; sigma2_sq = filter2(window, img2.*img2, 'valid') - mu2_sq; sigma12 = filter2(window, img1.*img2, 'valid') - mu1_mu2; if (C1 > 0 && C2 > 0) ssim_map = ((2*mu1_mu2 + C1).*(2*sigma12 + C2))./((mu1_sq + mu2_sq + C1).*(sigma1_sq + sigma2_sq + C2)); else numerator1 = 2*mu1_mu2 + C1; numerator2 = 2*sigma12 + C2; denominator1 = mu1_sq + mu2_sq + C1; denominator2 = sigma1_sq + sigma2_sq + C2; ssim_map = ones(size(mu1)); index = (denominator1.*denominator2 > 0); ssim_map(index) = (numerator1(index).*numerator2(index))./(denominator1(index).*denominator2(index)); index = (denominator1 ~= 0) & (denominator2 == 0); ssim_map(index) = numerator1(index)./denominator1(index); end mssim = mean2(ssim_map); return
评论
    相关推荐
    • 图像滤波处理.rar
      图像进行频域的低通滤波(包括理想低通、布特沃斯低通、高斯斯通)滤波)、高频强调滤波,并给出滤波后的图像和频谱
    • 图像滤波.rar
      图像空域滤波的一些简单例子,可以帮助学习图像增强的一些知识
    • 图像滤波.zip
      基于Matlab的图像处理实验图像滤波器:空域滤波、中值滤波、Laplacian滤波器、频率域滤波器。
    • 图像滤波.zip
      用不同模板对图像进行高斯噪声、椒盐噪声进行中值滤波均值滤波
    • matlab图像滤波
      包含空间和频域滤波(预处理、均值、中值、高通、低通),带界面。
    • 3图像滤波.zip
      利用opencv实现图像滤波,可直接运行
    • 图像滤波模型,可用于图像滤波
      图像滤波模型,可用于图像滤波图像滤波模型,可用于图像滤波
    • 图像滤波算法
      图像滤波算法,实现了中值滤波、均值滤波,频率域的高通滤波和低通滤波。matlab实现。
    • matlab 图像滤波
      常用图象滤波器的设计方法 matlab实现一个通用的高通、低通滤波器函数,其中又分别实现理想、巴特沃思和高斯滤波形式并用实现的函数对图象进行高通处理,将所给图象增加噪声后再进行低通处理,处理后分别进行伪彩色...
    • 图像滤波常用算法
      本文件夹提供了常用的均值滤波、中值滤波、维纳滤波等常用的滤波方法,实现语言为c++或matlab,可供研究生或本科生课下练习参考。