2010-01-05 208 views
2

如何根据像素差异找到两幅图像之间的差异?基于像素比较的2幅图像之间的差异

+1

东西,可以帮助人们帮助你:什么编程语言,我们谈论的,是如何图像代表,你只是想知道图像是不同的(结果是一个布尔值)或以某种方式计算比bool更微妙的东西是否表示图像有多像? – 2010-01-05 09:48:50

+3

你想实现什么? – 2010-01-05 09:51:22

+0

Bidimmentional Fourrier Transform可以帮助解决这种情况。 – alemjerus 2010-01-05 09:56:41

回答

5

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

你可以试试:

  1. 像素级别的差异,即image matrix A - image matrix B

  2. 颜色直方图的区别。您还可以将图像分成几个小窗口,并在每个窗口中聚合直方图差异。

  3. 确切的功能,如Gist,筛选等这是最先进的/研究方法。

0

您可以使用compare工具,ImageMagick的一部分实现这样的一个Sobel Filter

可以实现过滤器。

compare -metric MSE image1.png image2.png difference.png 

它会突出显示第三个文件的差异,并输出差异的数值估计。

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

0

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

笔记记录>http://php.net/manual/en/book.image.php包含针对图像处理所需的所有功能,我必须说,他们代表非常仔细地和美丽。

// 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); 
+0

希望这段代码能帮助你..... – 2012-10-27 07:23:33

0

打开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"); 
     } 
    } 
} 

按F5

看到https://www.raymond.cc/blog/how-to-compare-the-difference-between-two-identical-looking-images/