0

I am doing an assignment that asked me the following:

Take a (blurry) image with your phone (or a camera) and transfer it to your computer. Perform some basic image analysis steps to enhance the image:

a) Histogram equalization (with comments and plots)

b) De-blurring (de-noising) of the image by application of a suitable filter (either on space/frequency filed) and experiment with different choices and provide comments.

c) Edge detection using one (or more) technique.

I managed to complete all three tasks (for c I used Canny edge detection). My problem is that the deblurring part of the task doesn't produce an image 'nice' enough to feed in the edge detection:

This the code:

# Task a
equ = cv2.equalizeHist(gray) 

# Task b (attempt #1)
kernel = np.array([[-1,-1,-1], [-1,50,-1], [-1,-1,-1]])
im = cv2.filter2D(equ, -1, kernel)

# Task b (attempt #2)
psf = np.ones((5, 5)) / 25
equ = convolve2d(equ, psf, 'same')
im, _ = restoration.unsupervised_wiener(equ, psf)

# Task c
equCopy = np.uint8(im)
edges = cv2.Canny(equCopy,300,500)

This is the equalized image:

enter image description here

These are the outputs:

Part B:

Attempt #1:

enter image description here

Attempt #2 (taken from here) (don't get why it outputs like this though):

enter image description here

Part C:

enter image description here

Is this the best I can get from such a blurred image or are there other ways? Could anyone help me fix my second attempt to part b?

Community
  • 1
  • 1
Stefano Pozzi
  • 529
  • 2
  • 10
  • 26
  • The background is severely blurred and there is little that you can restore. Try supervised deblurring with Gaussian psf of various sizes. And do that BEFORE equalization. –  Jul 13 '18 at 16:45
  • Possible duplicate of [Deblurring an image in order to perform edge detection](https://stackoverflow.com/questions/51320446/deblurring-an-image-in-order-to-perform-edge-detection) –  Jul 18 '18 at 08:04

0 Answers0