Exemple #1
0
        // <summary>
        /// Calculate Mean G-SSIM by pixels of two images
        /// </summary>
        /// <param name="lumaReference">value of pixels in reference image</param>
        /// <param name="lumaDistorted">value of pixels in distorted image</param>
        /// <returns>Mean G-SSIM</returns>
        public double CalcMeanGssim(double[,] lumaReference, double[,] lumaDistorted)
        {
            if (lumaReference == null)
            {
                throw new ArgumentNullException("lumaReference");
            }
            if (lumaDistorted == null)
            {
                throw new ArgumentNullException("lumaDistorted");
            }

            int width  = lumaReference.GetLength(0);
            int height = lumaReference.GetLength(1);

            BaseAuxis = new SsimAuxiliaries(lumaReference, lumaDistorted, Params.WindowWidth, Params.WindowHeight);
            GradAuxis = new SsimAuxiliaries(GetGradient(lumaReference), GetGradient(lumaDistorted), Params.WindowWidth, Params.WindowHeight);

            double quality = 0.0;

            for (int x = 0; x <= width - Params.WindowWidth; x++)
            {
                for (int y = 0; y <= height - Params.WindowHeight; y++)
                {
                    quality += CalcWindowGssim(x, y);
                }
            }
            return(quality / (width - Params.WindowWidth + 1) / (height - Params.WindowHeight + 1));
        }
        // <summary>
        /// Calculate Mean G-SSIM by pixels of two images 
        /// </summary>
        /// <param name="lumaReference">value of pixels in reference image</param>
        /// <param name="lumaDistorted">value of pixels in distorted image</param>
        /// <returns>Mean G-SSIM</returns>
        public double CalcMeanGssim(double[,] lumaReference, double[,] lumaDistorted)
        {
            if (lumaReference == null)
            {
                throw new ArgumentNullException("lumaReference");
            }
            if (lumaDistorted == null)
            {
                throw new ArgumentNullException("lumaDistorted");
            }

            int width = lumaReference.GetLength(0);
            int height = lumaReference.GetLength(1);
            BaseAuxis = new SsimAuxiliaries(lumaReference, lumaDistorted, Params.WindowWidth, Params.WindowHeight);
            GradAuxis = new SsimAuxiliaries(GetGradient(lumaReference), GetGradient(lumaDistorted), Params.WindowWidth, Params.WindowHeight);

            double quality = 0.0;
            for (int x = 0; x <= width - Params.WindowWidth; x++)
            {
                for (int y = 0; y <= height - Params.WindowHeight; y++)
                {
                    quality += CalcWindowGssim(x, y);
                }
            }
            return quality / (width - Params.WindowWidth + 1) / (height - Params.WindowHeight + 1);
        }