2012-12-27 116 views
2

Two images得到圖像模糊

嗨的百分比,所以我必須做出一個腳本(不管什麼編程語言,但我會在這裏使用Java爲例),比較兩個黑色和白色的腳本圖像,並告訴哪一個模糊最多。

所以我必須做出這樣的功能:

function int getImageBlurPercentage() 
{ 
    ArrayList<Integer> ColorList = new ArrayList<Integer>(); 

    //Part 1: fill ColorList with color values (0=black, 255=white) 

    go through Y axis 
     go through X axis 
      ColorList -> add colorValue of each pixel; [ie: 0 to 255] 


    //Part 2: process (This is the part where I need help !) 

    int lastColor = 0; 

    for(int color : ColorList) 
    { 
     // Something has to be done here 
     // To compare pixel by pixel 
     // and get noise result or difference result 
     // and convert it to a percentage (0% - 100%) 
     // This is where I need your help ! 
    } 
} 

因此,這是我需要你的幫助球員,我真的不知道該如何處理這個問題。 我認爲這需要一些我吸取的數學公式。

如果有人幫忙或給我提示可能會導致我走向正確的道路,我將不勝感激。謝謝。

+0

FFT和比較頻率最高?如果模糊後沒有添加噪音,這將工作。 –

+0

FFT和比較所有頻率(加權)?這應該是可靠的。 –

+0

@JanDvorak我不知道這是什麼意思,你能舉個例子嗎? – Reacen

回答

0

當你模糊一個圖像(假設你使用高斯模糊)時,你實際上對圖像的像素做了一些「平均化」,這意味着你的邊緣「更平滑」。

因此,要檢查一幅圖像是否具有「更平滑」的邊緣,那麼您可以像Jan Dvorak所建議的那樣查看圖像的漸變,但不要忘記將圖像中的像素數量歸一化更大的圖像會得到更大的結果)。

如果您要檢查兩個完全不同的圖像,測試會更加複雜,因爲不同的場景自然有不同的平滑