Skip to content

Instantly share code, notes, and snippets.

@ChongyeWang
Created March 15, 2019 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChongyeWang/491affa7b4662adf87de387ff6609f46 to your computer and use it in GitHub Desktop.
Save ChongyeWang/491affa7b4662adf87de387ff6609f46 to your computer and use it in GitHub Desktop.
import cv2
import numpy as np
image = cv2.imread('images/input.jpg')
cv2.imshow('Original', image)
# Create our shapening kernel, we don't normalize since the
# the values in the matrix sum to 1
kernel_sharpening = np.array([[-1,-1,-1],
[-1,9,-1],
[-1,-1,-1]])
# applying different kernels to the input image
sharpened = cv2.filter2D(image, -1, kernel_sharpening)
cv2.imshow('Image Sharpening', sharpened)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment