Image processing 基于像素比较的两幅图像之间的差异

Image processing 基于像素比较的两幅图像之间的差异,image-processing,Image Processing,如何根据像素差异找出两幅图像之间的差异?有很多方法,从几行代码到一个大项目 您可以尝试: 像素级差异,即图像矩阵A-图像矩阵B 颜色直方图的差异。您还可以将图像分割为几个小窗口,并聚合每个窗口中的直方图差异 精确的特征,如Gist、Sift等。这是最先进的/研究方法 你可以实现一个 您可以使用框架在C#中快速实现类似的过滤器您可以使用作为ImageMagick一部分的compare工具 compare -metric MSE image1.png image2.png difference.pn

如何根据像素差异找出两幅图像之间的差异?

有很多方法,从几行代码到一个大项目

您可以尝试:

  • 像素级差异,即
    图像矩阵A-图像矩阵B

  • 颜色直方图的差异。您还可以将图像分割为几个小窗口,并聚合每个窗口中的直方图差异

  • 精确的特征,如Gist、Sift等。这是最先进的/研究方法

  • 你可以实现一个


    您可以使用框架在C#中快速实现类似的过滤器

    您可以使用作为ImageMagick一部分的
    compare
    工具

    compare -metric MSE image1.png image2.png difference.png
    
    它将突出显示第三个文件中的差异,并输出差异的数值估计


    如果您有兴趣找到更接近人类感知的图像之间的差异,请寻找SSIM/DSSIM工具。

    没有任何特定的像素比较方法,但我会尽力帮助您

    注->包含所有关于图像处理的必需函数,我必须说它们非常仔细和漂亮地表示

    // Setup the true color and palette images
    $im1 = imagecreatefrompng('orginal_image.png');
    $im2 = imagecreate(imagesx($im1), imagesy($im1));
    
    // Add some colors to $im2
    $colors   = Array();
    $colors[] = imagecolorallocate($im2, 255, 36, 74);
    $colors[] = imagecolorallocate($im2, 40, 0, 240);
    $colors[] = imagecolorallocate($im2, 82, 100, 255);
    $colors[] = imagecolorallocate($im2, 84, 63, 44);
    
    // Match these colors with the true color image
    imagecolormatch($im1, $im2);
    
    // Free from memory
    imagedestroy($im1);
    imagedestroy($im2);
    

    打开Visual Studio。=>新项目

    选择Visual C#=>控制台应用程序

    工具=>Nuget软件包管理器=>解决方案的Nuget包管理器

    在“浏览并安装”下找到EmguCV

    在Program.cs下

    using Emgu.CV;
    using Emgu.CV.Structure;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace diffOfImages
    {
        class Program
        {
            static void Main(string[] args)
            {
                Image<Bgr, byte> img1 = new Image<Bgr, byte>(@"d:\temp\temp1.jpg");
                Image<Bgr, byte> img2 = new Image<Bgr, byte>(@"d:\temp\temp2.jpg");
                var theDiff = img1.AbsDiff(img2);
                theDiff.Save(@"d:\temp\theDiff.jpg");
            }
        }
    }
    
    使用Emgu.CV;
    使用Emgu.CV.Structure;
    使用制度;
    使用System.Collections.Generic;
    使用System.Linq;
    使用系统文本;
    使用System.Threading.Tasks;
    命名空间diffOfImages
    {
    班级计划
    {
    静态void Main(字符串[]参数)
    {
    图像img1=新图像(@“d:\temp\temp1.jpg”);
    Image img2=新映像(@“d:\temp\temp2.jpg”);
    var theDiff=img1.AbsDiff(img2);
    theDiff.Save(@“d:\temp\theDiff.jpg”);
    }
    }
    }
    
    按F5


    请参阅可以帮助他人帮助您的内容:我们谈论的是什么编程语言,图像是如何表示的,您是否只想知道图像是不同的(结果是布尔值)或者以某种方式计算出比布尔值更微妙的东西来指示图像的相似程度?在类似这样的情况下,双整数Fourier变换有很大帮助。