2010-01-05 211 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/