I'm trying to restore and enhance image details on several photos. I've tried to bring out details by increasing sharpness with cv2.filter2D() and simple kernels.
I've tried an edge detection kernel
[-1 -1 -1]
[-1 9 -1]
[-1 -1 -1]
and a sharpen kernel
[ 0 -1 0]
[-1 5 -1]
[ 0 -1 0]
but the results look grainy and unnatural. To smooth out the noise, I've tried blurring techniques such as cv2.medianBlur() and cv2.GaussianBlur() but the results don't come out that great. The images have hazy backgrounds or are dark which makes the features hard to distinguish. Is there a better way to bring out more details especially in the background? Open to both Python or C++
Input images
import numpy as np
import cv2
img = cv2.imread('people.jpg')
grayscale = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# edge_kernel = np.array([[-1,-1,-1], [-1,9,-1], [-1,-1,-1]])
sharpen_kernel = np.array([[0,-1,0], [-1,5,-1], [0,-1,0]])
img = cv2.filter2D(grayscale, -1, sharpen_kernel)
# Smooth out image
# blur = cv2.medianBlur(img, 3)
blur = cv2.GaussianBlur(img, (3,3), 0)
cv2.imshow('img',img)
cv2.imwrite('img.png',img)
cv2.imshow('blur',blur)
cv2.waitKey(0)












