• 大小: 18KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-16
  • 语言: Matlab
  • 标签: IQA  

资源简介

该源代码是针对《FSIM: A Feature Similarity Index for Image Quality Assessment》使用文中的PC和GM计算方式。FSIM是一种常用的进行图像质量评估的工具

资源截图

代码片段和文件信息

function [FSIM FSIMc] = FeatureSIM(imageRef imageDis)
% ========================================================================
% FSIM Index with automatic downsampling Version 1.0
% Copyright(c) 2010 Lin ZHANG Lei Zhang Xuanqin Mou and David Zhang
% All Rights Reserved.
%
% ----------------------------------------------------------------------
% Permission to use copy or modify this software and its documentation
% for educational and research purposes only and without fee is here
% 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
% Feature SIMilarity (FSIM) index between two images.
%
% Please refer to the following paper
%
% Lin Zhang Lei Zhang Xuanqin Mou and David Zhang“FSIM: a feature similarity
% index for image qualtiy assessment“ IEEE Transactions on Image Processing vol. 20 no. 8 pp. 2378-2386 2011.

%----------------------------------------------------------------------
%
%Input : (1) imageRef: the first image being compared
%        (2) imageDis: the second image being compared
%
%Output: (1) FSIM: is the similarty score calculated using FSIM algorithm. FSIM
%      only considers the luminance component of images. For colorful images 
%            they will be converted to the grayscale at first.
%        (2) FSIMc: is the similarity score calculated using FSIMc algorithm. FSIMc
%            considers both the grayscale and the color information.
%Note: For grayscale images the returned FSIM and FSIMc are the same.
%        
%-----------------------------------------------------------------------
%
%Usage:
%Given 2 test images img1 and img2. For gray-scale images their dynamic range should be 0-255.
%For colorful images the dynamic range of each color channel should be 0-255.
%
%[FSIM FSIMc] = FeatureSIM(img1 img2);
%-----------------------------------------------------------------------

[rows cols] = size(imageRef(::1));
I1 = ones(rows cols);
I2 = ones(rows cols);
Q1 = ones(rows cols);
Q2 = ones(rows cols);

if ndims(imageRef) == 3 %images are colorful
    Y1 = 0.299 * double(imageRef(::1)) + 0.587 * double(imageRef(::2)) + 0.114 * double(imageRef(::3));
    Y2 = 0.299 * double(imageDis(::1)) + 0.587 * double(imageDis(::2)) + 0.114 * double(imageDis(::3));
    I1 = 0.596 * double(imageRef(::1)) - 0.274 * double(imageRef(::2)) - 0.322 * double(imageRef(::3));
    I2 = 0.596 * double(imageDis(:

评论

共有 条评论

相关资源