精华内容
下载资源
问答
  • SSIM

    千次阅读 2016-08-02 23:46:39
    SSIM(structural similarity index),结构相似性,是一种衡量两幅图像相似度的指标。 结构相似度指数从图像组成的角度将结构信息定义为独立于亮度、对比度的,反映场景中物体结构的属性。将失真建模为亮度、对比度...

    SSIM(structural similarity index),结构相似性,是一种衡量两幅图像相似度的指标。
    结构相似度指数从图像组成的角度将结构信息定义为独立于亮度、对比度的,反映场景中物体结构的属性。将失真建模为亮度、对比度和结构三个不同因素的组合。用均值作为亮度的估计,标准差作为对比度的估计,协方差作为结构相似程度的度量。
    结构相似性的范围为 -1 到 1 。当两张图像一模一样时,SSIM的值等于1。
    这里写图片描述

    CvScalar getMSSIM(IplImage*i1, IplImage*i2)
    {
        const double C1 = 6.5025, C2 = 58.5225;
        /***************************** INITS **********************************/
        if (i1 == NULL || i2 == NULL)
            return -1;
    
        IplImage *I1 = cvCreateImage(cvGetSize(i1), IPL_DEPTH_32F, i1->nChannels);
        IplImage *I2 = cvCreateImage(cvGetSize(i2), IPL_DEPTH_32F, i2->nChannels);
        cvConvert(i1, I1);           // cannot calculate on one byte large values
        cvConvert(i2, I2);
    
    
        IplImage *I1_2 = cvCreateImage(cvGetSize(I1), IPL_DEPTH_32F, I1->nChannels);
        IplImage *I2_2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        IplImage *I1_I2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
    
        cvPow(I1, I1_2,2);        // I1^2
        cvPow(I2, I2_2, 2);        // I2^2
        cvMul(I1,I2,I1_I2,1);        // I1 * I2
    
        /*************************** END INITS **********************************/
    
        IplImage *mu1 = cvCreateImage(cvGetSize(I1), IPL_DEPTH_32F, I1->nChannels);
        IplImage *mu2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        cvSmooth(I1, mu1,CV_GAUSSIAN, 11,11,1.5);
        cvSmooth(I2, mu2, CV_GAUSSIAN, 11, 11, 1.5);
    
        IplImage *mu1_2 = cvCreateImage(cvGetSize(I1), IPL_DEPTH_32F, I1->nChannels);
        IplImage *mu2_2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        IplImage *mu1_mu2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        cvPow(mu1, mu1_2, 2);        // mu1^2
        cvPow(mu2, mu2_2, 2);        // mu2^2
        cvMul(mu1, mu2, mu1_mu2, 1);        // mu1 * mu2
    
        IplImage *sigma1_2 = cvCreateImage(cvGetSize(I1), IPL_DEPTH_32F, I1->nChannels);
        IplImage *sigma2_2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        IplImage *sigma12 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
    
        cvSmooth(I1_2, sigma1_2,CV_GAUSSIAN,11, 11, 1.5);
        cvAddWeighted(sigma1_2, 1, I1_2, -1, 0,sigma1_2);
    
        cvSmooth(I2_2, sigma2_2, CV_GAUSSIAN, 11, 11, 1.5);
        cvAddWeighted(sigma2_2, 1, I2_2, -1, 0, sigma2_2);
    
        cvSmooth(I1_I2, sigma12, CV_GAUSSIAN, 11, 11, 1.5);
        cvAddWeighted(sigma12, 1, I1_I2, -1, 0, sigma12);
    
        ///////////////////////////////// FORMULA ////////////////////////////////
        IplImage *t1 = cvCreateImage(cvGetSize(I1), IPL_DEPTH_32F, I1->nChannels);
        IplImage *t2 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        IplImage *t3 = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
    
        cvScale(mu1_mu2, t1, 2);
        cvAddS(t1, cvScalarAll(C1), t1);
        cvScale(sigma12, t2, 2);
        cvAddS(t2, cvScalarAll(C2), t2);
        cvMul(t1, t2, t3, 1);// t3 = ((2*mu1_mu2 + C1).*(2*sigma12 + C2))
    
        cvAdd(mu1_2, mu2_2, t1);
        cvAddS(t1, cvScalarAll(C1), t1);
        cvAdd(sigma1_2, sigma2_2, t2);
        cvAddS(t2, cvScalarAll(C2), t2);
        cvMul(t1, t2, t1, 1);   // t1 =((mu1_2 + mu2_2 + C1).*(sigma1_2 + sigma2_2 + C2))
    
        IplImage *ssim_map = cvCreateImage(cvGetSize(I2), IPL_DEPTH_32F, I2->nChannels);
        cvDiv(t3, t1, ssim_map,1);      // ssim_map =  t3./t1;
    
        CvScalar mssim =cvAvg(ssim_map); // mssim = average of ssim map
        cvReleaseImage(&i2);
        cvReleaseImage(&I1);
        cvReleaseImage(&I2);
        cvReleaseImage(&I1_2);
        cvReleaseImage(&I2_2);
        cvReleaseImage(&I1_I2);
        cvReleaseImage(&mu1);
        cvReleaseImage(&mu2);
        cvReleaseImage(&mu1_2);
        cvReleaseImage(&mu2_2);
        cvReleaseImage(&mu1_mu2);
        cvReleaseImage(&sigma1_2);
        cvReleaseImage(&sigma2_2);
        cvReleaseImage(&sigma12);
        cvReleaseImage(&t1);
        cvReleaseImage(&t2);
        cvReleaseImage(&t3);
        cvReleaseImage(&ssim_map);
        return mssim;
    }
    
    展开全文
  • ms_ssim_pytorch 该代码是从修改的。 部分代码已被修改以使其更快,占用更少的VRAM并与pytorch jit兼容。 动态频道版本可以在这里找到。 使用起来更方便,但性能损失很小。 感谢找到并修复了ms_ssim向后移动时会...
  • 基于pytorch计算ssim和ms-ssim

    千次阅读 2019-11-02 14:49:29
    使用pytorch计算两组图片的ssim和ms-ssim 首先是SSIM和MS-SSIM类(ssim.py) import torch import torch.nn.functional as F def _fspecial_gauss_1d(size, sigma): coords = torch.arange(size).to(dtype=torch....

    使用pytorch计算两组图片的ssim和ms-ssim

    首先是SSIM和MS-SSIM类(ssim.py)
    import torch
    import torch.nn.functional as F
    
    def _fspecial_gauss_1d(size, sigma):
        coords = torch.arange(size).to(dtype=torch.float)
        coords -= size//2
        g = torch.exp(-(coords**2) / (2*sigma**2))
        g /= g.sum()
        return g.unsqueeze(0).unsqueeze(0)
        
    def gaussian_filter(input, win):
        N, C, H, W = input.shape
        out = F.conv2d(input, win, stride=1, padding=0, groups=C)
        out = F.conv2d(out, win.transpose(2, 3), stride=1, padding=0, groups=C)
        return out
    
    
    def _ssim(X, Y, win, data_range=1023, size_average=True, full=False):
        K1 = 0.01
        K2 = 0.03
        batch, channel, height, width = X.shape
        compensation = 1.0
    
        C1 = (K1 * data_range)**2
        C2 = (K2 * data_range)**2
    
        win = win.to(X.device, dtype=X.dtype)
    
        mu1 = gaussian_filter(X, win)
        mu2 = gaussian_filter(Y, win)
    
        mu1_sq = mu1.pow(2)
        mu2_sq = mu2.pow(2)
        mu1_mu2 = mu1 * mu2
    
        sigma1_sq = compensation * ( gaussian_filter(X * X, win) - mu1_sq )
        sigma2_sq = compensation * ( gaussian_filter(Y * Y, win) - mu2_sq )
        sigma12   = compensation * ( gaussian_filter(X * Y, win) - mu1_mu2 )
    
        cs_map = (2 * sigma12 + C2) / (sigma1_sq + sigma2_sq + C2)
        ssim_map = ((2 * mu1_mu2 + C1) / (mu1_sq + mu2_sq + C1)) * cs_map
    
        if size_average:
            ssim_val = ssim_map.mean()
            cs = cs_map.mean()
        else:
            ssim_val = ssim_map.mean(-1).mean(-1).mean(-1)  # reduce along CHW
            cs = cs_map.mean(-1).mean(-1).mean(-1)
    
        if full:
            return ssim_val, cs
        else:
            return ssim_val
    
    
    def ssim(X, Y, win_size=11, win_sigma=10, win=None, data_range=1, size_average=True, full=False):
    
        if len(X.shape) != 4:
            raise ValueError('Input images must 4-d tensor.')
    
        if not X.type() == Y.type():
            raise ValueError('Input images must have the same dtype.')
    
        if not X.shape == Y.shape:
            raise ValueError('Input images must have the same dimensions.')
    
        if not (win_size % 2 == 1):
            raise ValueError('Window size must be odd.')
    
        win_sigma = win_sigma
        if win is None:
            win = _fspecial_gauss_1d(win_size, win_sigma)
            win = win.repeat(X.shape[1], 1, 1, 1)
        else:
            win_size = win.shape[-1]
    
        ssim_val, cs = _ssim(X, Y,
                             win=win,
                             data_range=data_range,
                             size_average=False,
                             full=True)
        if size_average:
            ssim_val = ssim_val.mean()
            cs = cs.mean()
    
        if full:
            return ssim_val, cs
        else:
            return ssim_val
    
    
    def ms_ssim(X, Y, win_size=11, win_sigma=10, win=None, data_range=1, size_average=True, full=False, weights=None):
        if len(X.shape) != 4:
            raise ValueError('Input images must 4-d tensor.')
    
        if not X.type() == Y.type():
            raise ValueError('Input images must have the same dtype.')
    
        if not X.shape == Y.shape:
            raise ValueError('Input images must have the same dimensions.')
    
        if not (win_size % 2 == 1):
            raise ValueError('Window size must be odd.')
    
        if weights is None:
            weights = torch.FloatTensor(
                [0.0448, 0.2856, 0.3001, 0.2363, 0.1333]).to(X.device, dtype=X.dtype)
    
        win_sigma = win_sigma
        if win is None:
            win = _fspecial_gauss_1d(win_size, win_sigma)
            win = win.repeat(X.shape[1], 1, 1, 1)
        else:
            win_size = win.shape[-1]
    
        levels = weights.shape[0]
        mcs = []
        for _ in range(levels):
            ssim_val, cs = _ssim(X, Y,
                                 win=win,
                                 data_range=data_range,
                                 size_average=False,
                                 full=True)
            mcs.append(cs)
    
            padding = (X.shape[2] % 2, X.shape[3] % 2)
            X = F.avg_pool2d(X, kernel_size=2, padding=padding)
            Y = F.avg_pool2d(Y, kernel_size=2, padding=padding)
    
        mcs = torch.stack(mcs, dim=0)  # mcs, (level, batch)
        # weights, (level)
        msssim_val = torch.prod((mcs[:-1] ** weights[:-1].unsqueeze(1))
                                * (ssim_val ** weights[-1]), dim=0)  # (batch, )
    
        if size_average:
            msssim_val = msssim_val.mean()
        return msssim_val
    
    
    # Classes to re-use window
    class SSIM(torch.nn.Module):
        def __init__(self, win_size=11, win_sigma=1.5, data_range=255, size_average=True, channel=3):
            super(SSIM, self).__init__()
            self.win = _fspecial_gauss_1d(
                win_size, win_sigma).repeat(channel, 1, 1, 1)
            self.size_average = size_average
            self.data_range = data_range
    
        def forward(self, X, Y):
            return ssim(X, Y, win=self.win, data_range=self.data_range, size_average=self.size_average)
    
    
    class MS_SSIM(torch.nn.Module):
        def __init__(self, win_size=11, win_sigma=1.5, data_range=255, size_average=True, channel=3, weights=None):
            super(MS_SSIM, self).__init__()
            self.win = _fspecial_gauss_1d(
                win_size, win_sigma).repeat(channel, 1, 1, 1)
            self.size_average = size_average
            self.data_range = data_range
            self.weights = weights
    
        def forward(self, X, Y):
            return ms_ssim(X, Y, win=self.win, size_average=self.size_average, data_range=self.data_range, weights=self.weights)
    
    

    上面的工具类我在pytorch中当做损失函数使用

    使用

    这里还用到几个方法,我在下面给出

    import argparse
    from tqdm import tqdm
    import torch
    from torch.utils.data import DataLoader
    from util import (map_range, cv2torch, random_tone_map,
                      DirectoryDataset, str2bool)、
    #这里我把上面的ssim.py放到了一个文件夹中,所以需要这样导入
    from pytorch_msssim import ssim, ms_ssim, SSIM, MS_SSIM
    
    def parse_args():
        parser = argparse.ArgumentParser()
        parser.add_argument(
            '--batch_size', type=int, default=1, help='Batch size.')
        parser.add_argument(
            '-d', '--data_root_path_label', default='D:/project_hdr/hdr-expandnet/test_data_hdr', help='Path to hdr data.')
        parser.add_argument(
            '-v', '--data_root_path_pre', default='D:/project_hdr/myGan_same_size_wights_noexpand _minD/test_data_ldr/981',
            help='Path to hdr data.')
        parser.add_argument(
            '--num_workers',
            type=int,
            default=1,
            help='Number of data loading workers.')
    
        return parser.parse_args()
    
    
    
    def transformh(hdr):
        hdr = map_range(hdr)
        return cv2torch(hdr)
    
    def train(opt):
    
        # 加载训练集
        dataset1 = DirectoryDataset(
            data_root_path=opt.data_root_path_label, preprocess=transformh)
        loader1 = DataLoader(
            dataset1,
            batch_size=opt.batch_size,
            num_workers=opt.num_workers,)
        # 加载训练集
        dataset2 = DirectoryDataset(
            data_root_path=opt.data_root_path_pre, preprocess=transformh)
        loader2 = DataLoader(
            dataset2,
            batch_size=opt.batch_size,
            num_workers=opt.num_workers,)
    
        
        for (ldr_in, hdr_target) in zip(loader2, loader1):
            if torch.cuda.is_available():
                ldr_in = ldr_in.cuda()
                hdr_target = hdr_target.cuda()
            pre = ldr_in
            real_B = hdr_target
    
            ssim_val = ssim(real_B, pre, data_range=1, size_average=True,  )  # return (N,)
            ms_ssim_val = ms_ssim(real_B, pre, data_range=1, size_average=True,)  # (N,)
    
            rep = (f'ssim_val: {ssim_val},'
                   f'ms_ssim_val: {ms_ssim_val},')
            tqdm.write(rep)
    
    
    if __name__ == '__main__':
        opt = parse_args()
        train(opt)
    
    

    下面是使用到的几个方法

    def map_range(x, low=0, high=1):
        return np.interp(x, [x.min(), x.max()], [low, high]).astype(x.dtype)
    var foo = 'bar';
    
    def cv2torch(np_img):
        rgb = np_img[:, :, (2, 1, 0)]
        return torch.from_numpy(rgb.swapaxes(1, 2).swapaxes(0, 1))
    

    下面这个类需要opencv

    class DirectoryDataset(Dataset):
        def __init__(self,
                     data_root_path='hdr_data',
                     data_extensions=['.hdr', '.exr'],
                     load_fn=None,
                     preprocess=None):
            super(DirectoryDataset, self).__init__()
            data_root_path = process_path(data_root_path)
            self.file_list = []
            for root, _, fnames in sorted(os.walk(data_root_path)):
                for fname in fnames:
                    if any(fname.lower().endswith(extension)
                           for extension in data_extensions):
                        self.file_list.append(os.path.join(root, fname))
            if len(self.file_list) == 0:
                msg = 'Could not find any files with extensions:\n[{0}]\nin\n{1}'
                raise RuntimeError(
                    msg.format(', '.join(data_extensions), data_root_path))
    
            self.preprocess = preprocess
    
        def __getitem__(self, index):
            dpoint = cv2.imread(
                self.file_list[index],
                flags=cv2.IMREAD_ANYDEPTH + cv2.IMREAD_COLOR)
            if self.preprocess is not None:
                dpoint = self.preprocess(dpoint)
            return dpoint
    
        def __len__(self):
            return len(self.file_list)
    
    
    def process_path(directory, create=False):
        directory = os.path.expanduser(directory)
        directory = os.path.normpath(directory)
        directory = os.path.abspath(directory)
        if create:
            try:
                os.makedirs(directory)
            except:
                pass
        return directory
    
    

    大概就是这些,msssim代码来源于github : https://github.com/VainF/pytorch-msssim
    当然,计算ssim还有一些其他更加简便的方法,比如

    from skimage.measure import compare_ssim
    (score, diff) = compare_ssim(X, Y, full=True)
    diff = (diff * 255).astype("float32")
    

    但是python计算msssim的就没有了,所以我用的这个单独的方法去计算的
    在这里插入图片描述

    展开全文
  • SSIM MATLAB代码

    2018-01-15 19:09:43
    这是一个SSIM代码,亲测可用的,只要改图片的位置即可。
  • pytorch MS-SSIM 适用于pytorch 1.0+的快速且可区分的MS-SSIMSSIM 结构相似度(SSIM): 多尺度结构相似性(MS-SSIM): 更新 2020.08.21 (v0.2.1) 3D图像支持! 2020.04.30 (v0.2) 现在(v0.2), ssim...
  • SSIM损失

    2020-06-06 14:51:04
    通常在计算两幅图像的...SSIM(x,y)=l(x,y)⋅c(x,y)⋅s(x,y)SSIM(x,y)=l(x,y)·c(x,y)·s(x,y)SSIM(x,y)=l(x,y)⋅c(x,y)⋅s(x,y) 其中, l(x,y)=2μxμy+C1μx2+μy2+C1C1=(K1L)2l(x,y)=\frac{2\mu_x\mu_y+C_1}{\mu_x

    通常在计算两幅图像的差异时,使用MSE损失容易受到光照的干扰。相比之下,2004年提出的SSIM损失具有更好的性能,提升了训练效果。
    对于两幅图像xxyy,SSIM的定义如下:
    SSIM(x,y)=l(x,y)c(x,y)s(x,y)SSIM(x,y)=l(x,y)·c(x,y)·s(x,y)
    其中,
    l(x,y)=2μxμy+C1μx2+μy2+C1C1=(K1L)2l(x,y)=\frac{2\mu_x\mu_y+C_1}{\mu_x^2+\mu_y^2+C_1} \qquad C_1=(K_1L)^2
    K1<<1K_1<<1,LL为灰度动态范围。
    c(x,y)=2σxσy+C2σx2+σy2+C2C2=(K2L)2c(x,y)=\frac{2\sigma_x\sigma_y+C_2}{\sigma_x^2+\sigma_y^2+C_2} \qquad C_2=(K_2L)^2
    K2<<1K_2<<1,LL为灰度动态范围。
    s(x,y)=σxy+C3σxσy+C3C3=C2/2s(x,y) = \frac{\sigma_{xy}+C_3}{\sigma_x\sigma_y+C_3} \qquad C_3 = C_2/2
    整理得:
    SSIM(x,y)=(2μxμy+C1)(2σxy+C2)(μx2+μy2+C1)(σx2+σy2+C2)SSIM(x,y)= \frac{(2\mu_x\mu_y+C_1)(2\sigma_{xy}+C_2)}{(\mu_x^2+\mu_y^2+C_1)(\sigma_x^2+\sigma_y^2+C_2)}

    SSIM具有下面三个性质:
    1、对称性:SSIM(x,y)=SSIM(y,x)SSIM(x,y)=SSIM(y,x)
    2、有界性:SSIM(x,y)1SSIM(x,y)\leq 1
    3、极值唯一: SSIM(x,y)=1SSIM(x,y)=1 当且仅当x=yx=y

    参考:
    https://zhuanlan.zhihu.com/p/67199699

    展开全文
  • </li><li>SSIM and MS-SSIM were upgraded to support 5D input images of (N,C,H,W,2)</code> size, where the last dimension is responsible for complex values;</li><li>Tests to validate 5D support.</li></...
  • ssim 这是一个小型且快速的库,其唯一的目的是计算两个图像的(结构相似性)。 与(峰值信噪比)相比,SSIM旨在更紧密地模拟人类感知。 可移植性 该库是用C ++ 98编写的,以使其尽可能具有可移植性,并且不依赖于...
  • python实现计算SSIM的,并介绍SSIM原理

    万次阅读 2019-05-13 14:12:21
    由于最近有用到SSIM,自己写了个python代码版本的SSIM放在文章最后。 SSIM算法简单介绍 其中ux、uy分别表示图像X和Y的均值,σX、σY分别表示图像X和Y的方差,σXY表示图像X和Y的协方差,即 C1、C2、C3为常数,...

    在超分辨率问题中,一直存在着两个经典的图像质量评价算法。其中一个是PSNR(峰值性噪比),还一个便是SSIM(结构相似性评价)。由于最近有用到SSIM,自己写了个python代码版本的SSIM放在文章最后。

    SSIM算法简单介绍

     
    其中ux、uy分别表示图像X和Y的均值,σX、σY分别表示图像X和Y的方差,σXY表示图像X和Y的协方差,即 


    C1、C2、C3为常数,为了避免分母为0的情况,通常取C1=(K1*L)^2, C2=(K2*L)^2, C3=C2/2, 一般地K1=0.01, K2=0.03, L=255. 则 


    SSIM取值范围[0,1],值越大,表示图像失真越小.

    在实际应用中,可以利用滑动窗将图像分块,令分块总数为N,考虑到窗口形状对分块的影响,采用高斯加权计算每一窗口的均值、方差以及协方差,然后计算对应块的结构相似度SSIM,最后将平均值作为两图像的结构相似性度量,即平均结构相似性MSSIM:

    上述这些描述转载于: 
    https://www.cnblogs.com/vincent2012/archive/2012/10/13/2723152.html 

    SSIM算法python实现

    import numpy as np
    from PIL import Image 
    from scipy.signal import convolve2d
    
    def matlab_style_gauss2D(shape=(3,3),sigma=0.5):
        """
        2D gaussian mask - should give the same result as MATLAB's
        fspecial('gaussian',[shape],[sigma])
        """
        m,n = [(ss-1.)/2. for ss in shape]
        y,x = np.ogrid[-m:m+1,-n:n+1]
        h = np.exp( -(x*x + y*y) / (2.*sigma*sigma) )
        h[ h < np.finfo(h.dtype).eps*h.max() ] = 0
        sumh = h.sum()
        if sumh != 0:
            h /= sumh
        return h
    
    def filter2(x, kernel, mode='same'):
        return convolve2d(x, np.rot90(kernel, 2), mode=mode)
    
    def compute_ssim(im1, im2, k1=0.01, k2=0.03, win_size=11, L=255):
    
        if not im1.shape == im2.shape:
            raise ValueError("Input Imagees must have the same dimensions")
        if len(im1.shape) > 2:
            raise ValueError("Please input the images with 1 channel")
    
        M, N = im1.shape
        C1 = (k1*L)**2
        C2 = (k2*L)**2
        window = matlab_style_gauss2D(shape=(win_size,win_size), sigma=1.5)
        window = window/np.sum(np.sum(window))
    
        if im1.dtype == np.uint8:
            im1 = np.double(im1)
        if im2.dtype == np.uint8:
            im2 = np.double(im2)
    
        mu1 = filter2(im1, window, 'valid')
        mu2 = filter2(im2, window, 'valid')
        mu1_sq = mu1 * mu1
        mu2_sq = mu2 * mu2
        mu1_mu2 = mu1 * mu2
        sigma1_sq = filter2(im1*im1, window, 'valid') - mu1_sq
        sigma2_sq = filter2(im2*im2, window, 'valid') - mu2_sq
        sigmal2 = filter2(im1*im2, window, 'valid') - mu1_mu2
    
        ssim_map = ((2*mu1_mu2+C1) * (2*sigmal2+C2)) / ((mu1_sq+mu2_sq+C1) * (sigma1_sq+sigma2_sq+C2))
    
        return np.mean(np.mean(ssim_map))
    
    
    if __name__ == "__main__":
        im1 = Image.open("1.png")
        im2 = Image.open("2.png")
    
        print(compute_ssim(np.array(im1),np.array(im2)))

     

    展开全文
  • 这是用于计算两个图像之间的结构相似性(SSIM)索引的算法的实现。 这是Christiaan Boersma博士()的IDL实现,已从出版物中可用并在出版物中使用的Matlab版本移植而来: --- Boersma,C.,Bregman,J.,Allamandola...
  • yuv_ssim.zip

    2020-04-17 13:48:14
    C++实现yuv视频的ssim计算。.c和.h函数调用即可。SSIM也称为结构相似性,是一种衡量两幅图像相似度的指标。
  • SSIM算法的matlab代码

    2021-05-18 16:29:17
    matlab,SSIM算法
  • SSIM的Python实现

    2018-10-30 12:22:32
    Python实现的图像结构相似性度量( Structural Similarity Image Metric,SSIM)。
  • SSIM算法代码

    2017-10-27 19:03:06
    The above (ssim_index.m) is a single scale version of the SSIM indexing measure, which is most effective if used at the appropriate scale. The precisely “right” scale depends on both the image ...
  • ssim评价MALTAB

    2012-08-16 11:29:10
    ssim评价 MALTAB Zhou Wang的SSIM算法matlab代码
  • PSNR和SSIM

    2021-01-20 13:00:45
    PSNR和SSIM解释 解释 PSNR 全称 Peak Signal-to-Noise Ratio,峰值信噪比,与两张图片的均方误差成反比,因此两张图片差距越小,PSNR 越大。 SSIM 全称 Structural SIMilarity,结构相似性,基于两张图片的亮度、...
  • SSIM与MS-SSIM图像评价函数

    万次阅读 多人点赞 2018-12-04 18:35:48
    SSIM的全称为structural similarity index,即为结构相似性,是一种衡量两幅图像相似度的指标。该指标首先由德州大学奥斯丁分校的图像和视频工程实验室(Laboratory for Image and Video Engineering)提出。而如果...
  • MatLab计算SSIM

    2014-09-11 12:37:51
    MatLab计算SSIM,代码易读,并有详细注释
  • from skimage.measure import compare_ssim as sk_cpt_ssim error。 从skimage.measure导入compare_ssim出错 解决方法 将 from skimage.measure import compare_ssim as sk_cpt_ssim 改为 from skimage.metrics ...
  • SSIM源代码

    2015-03-16 16:50:31
    经过改正的SSIM源代码,需要先读取文件,不能处理JPG类型的图片。
  • SSIM源码及测试

    2017-10-29 11:09:22
    ssim图像评价指标的matlab实现,附带详细的解释说明,并测试函数
  • 图像质量评估指标 SSIM / PSNR / MSE

    万次阅读 多人点赞 2017-12-09 00:25:21
    图像质量评估指标 SSIM / PSNR / MSE
  • SSIM网络-源码

    2021-02-15 06:25:32
    SSIM网络 该存储库包含Amirshahi,Pedersen和Beghdadi提出的SSIM-CNN的重新实现。 该源代码在研究论文“基于卷积激活图的组合全参考图像质量评估方法”中使用。 如果使用此代码,请引用以下论文: @inproceedings {...
  • ssim matlan code

    2014-04-02 21:29:15
    可实现SSIM 的Matlab 代码,做图像的同志快拿去
  • ms_ssim_pytorch The code was modified from https://github.com/VainF/pytorch-msssim. Part of the code has been modified to make it faster, takes up less VRAM, and is compatible with pytorch jit. The ...
  • ssim_index.m

    2019-05-30 15:36:43
    SSIM(结构相似性) 在视频图像加密领域,为判断加密图像、解密图像与原图像的关系,或者验证加密效果,可有通过计算图像PSNR(峰值信噪比)、SSIM的值得到加密算法的量化指标。
  • ssim算法matlab代码

    2018-01-25 22:38:18
    图像质量评价ssim算法的matlab完整版代码,将待评价的两幅图放在程序目录下,输入图像后进行评价

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 5,338
精华内容 2,135
关键字:

ssim