本文介绍了确定图像是否模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到很多关于此的话题,我理解了这个理论,但我无法对此进行编码。



我有一些图片,我想确定如果它们模糊或不模糊。我找到了一个图书馆(



我的代码在c#中:

  public Bitmap PerformFFT(Bitmap Picture)
{
// Loade Image
ComplexImage output = ComplexImage.FromBitmap(Picture);

//执行FFT
output.ForwardFourierTransform();

//返回图片
return = output.ToBitmap();
}

如何判断图像是否模糊?我对这个理论不太满意,我需要具体的例子。我看到,但我不知道该怎么做。



编辑:



我会澄清我的问题。当我有一个复杂的 ComplexImage输出的二维数组(图像FFT)时,我可以使用什么C#代码(或伪代码)来确定图像是否模糊?

解决方案

模糊图像具有FFT结果,在高频区域具有较小幅度。索引较低的数组元素( Result [0] [0] 附近)表示低频区域。



所以按照一些标准划分得到的数组,两个区域的总和大小并进行比较。例如,选择四分之一的结果数组(大小为M),其中索引< M / 2 indexy< M / 2



对于一系列越来越模糊的图像(对于相同的初始图像),您应该看到越来越高的比率总和(低)/总和(高)



结果是方阵NxN。它具有中心对称性( F(x,y)= F(-x,-y)因为源是纯实的),所以它足以处理数组的上半部分 y< N / 2



低频组件位于左上角和右上角附近数组的最小值(y的最小值,x的最小值和最大值)。所以数组元素的大小在范围内

  y的范围为0..N / 2 
,范围为x 0..N
amp = magnitude(y,x)
if(y low = low + amp
else
high = high + amp

请注意,您的图片显示了混乱的数组 - 这是在中心显示零组件的标准做法。


I saw a lot a topic about this, I understood the theory but I'm not able to code this.

I have some pictures and I want to determine if they are blurred or not. I found a library (aforge.dll) and I used it to compte a FFT for an image.

As an example, there is two images i'm working on :

My code is in c# :

public Bitmap PerformFFT(Bitmap Picture)
{
    //Loade Image
    ComplexImage output = ComplexImage.FromBitmap(Picture);

    // Perform FFT
    output.ForwardFourierTransform();

    // return image
    return = output.ToBitmap();
}

How can I determine if the image is blurred ? I am not very comfortable with the theory, I need concret example. I saw this post, but I have no idea how to do that.

EDIT:

I'll clarify my question. When I have a 2D array of complex ComplexImage output (image FFT), what is the C# code (or pseudo code) I can use to determine if image is blurred ?

解决方案

Blurred image has FFT result with smaller magnitude in high-frequency regions. Array elements with low indexes (near Result[0][0]) represent low-frequency region.

So divide resulting array by some criteria, sum magnitudes in both regions and compare them. For example, select a quarter of result array (of size M) with index<M/2 and indexy<M/2

For series of more and more blurred image (for the same initial image) you should see higher and higher ratio Sum(Low)/Sum(High)

Result is square array NxN. It has central symmetry (F(x,y)=F(-x,-y) because source is pure real), so it is enough to treat top half of array with y<N/2.

Low-frequency components are located near top-left and top-right corners of array (smallest values of y, smallest and highest values of x). So sum magnitudes of array elements in ranges

for y in range 0..N/2
   for x in range 0..N
      amp = magnitude(y,x)
      if (y<N/4) and ((x<N/4)or (x>=3*N/4))
          low = low + amp
      else
          high = high + amp

Note that your picture shows jumbled array pieces - this is standard practice to show zero component in the center.

这篇关于确定图像是否模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 05:45