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:
These are the outputs:
Part B:
Attempt #1:
Attempt #2 (taken from here) (don't get why it outputs like this though):
Part C:
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
?