Last active
February 10, 2020 20:52
-
-
Save vardanagarwal/a51c78bffecd4c7d8023bdf42c9fb5ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
img = cv2.imread('Paris.jpg') | |
dst = cv2.detailEnhance(img, sigma_s=10, sigma_r=0.15) | |
#sigma_s controls how much the image is smoothed - the larger its value, | |
#the more smoothed the image gets, but it's also slower to compute. | |
#sigma_r is important if you want to preserve edges while smoothing the image. | |
#Small sigma_r results in only very similar colors to be averaged (i.e. smoothed), while colors that differ much will stay intact. | |
kernel_sharpening = np.array([[-1,-1,-1], | |
[-1, 9,-1], | |
[-1,-1,-1]]) | |
dst2 = cv2.filter2D(img, -1, kernel_sharpening) | |
cv2.imshow("Image", img) | |
cv2.imshow("Detail_Enhance", dst) | |
cv2.imshow("Kernel", dst2) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment