0

We need to detect whether the images produced by our tunable lens are blurred or not.

We want to find a proxy measure for blurriness.

My current thinking is to first apply Sobel along the x direction because the jumps or the stripes are mostly along this direction. Then computing the x direction marginal means and finally compute the standard deviation of these marginal means.

We expect this Std is bigger for a clear image and smaller for a blurred one because clear images shall have a large intensity or more bigger jumps of pixel values.

But we get the opposite results. How could we improve this blurriness measure?

def sobel_image_central_std(PATH):
    # use the blue channel
    img = cv2.imread(PATH)[:,:,0]

    # extract the central part of the image
    hh, ww = img.shape
    hh2 = hh // 2 
    ww2 = ww// 2
    hh4 = hh // 4
    ww4 = hh //4
    img_center = img[hh4:(hh2+hh4), ww4:(ww2+ww4)]

    # Sobel operator
    sobelx = cv2.Sobel(img_center, cv2.CV_64F, 1, 0, ksize=3)
    x_marginal = sobelx.mean(axis = 0)

    plt.plot(x_marginal)
    return(x_marginal.std())

Blur #1

enter image description here

Blur #2

enter image description here

Clear #1

enter image description here

Clear #2

enter image description here

John
  • 1,779
  • 3
  • 25
  • 53
  • Does this answer your question? [Is there a way to detect if an image is blurry?](https://stackoverflow.com/questions/7765810/is-there-a-way-to-detect-if-an-image-is-blurry) – Joe May 07 '20 at 05:23

1 Answers1

0

In general:

Is there a way to detect if an image is blurry?

You can combine calculation this with your other question where you are searching for the central angle.

Once you have the angle (and the center, maybe outside of the image) you can make an axis transformation to remove the circular component of the cone. Instead you get x (radius) and y (angle) where y would run along the circular arcs.

Maybe you can get the center of the image from the camera set-up. Then you don't need to calculate it using the intersection of the edges from the central angle. Or just do it manually once if it is fixed for all images.

Look at polar coordinate systems.

Due to the shape of the cone the image will be more dense at the peak but this should be a fixed factor. But this will probably bias the result when calculation the blurriness along the transformed image.

So what you could to correct this is create a synthetic cone image with circular lines and do the transformation on it. Again, requires some try-and-error. But it should deliver some mask that you could use to correct the "blurriness bias".

Joe
  • 6,758
  • 2
  • 26
  • 47