python opencv Sharpened

python opencv Sharpened

 

import cv2
import numpy as np

# Load the image
img = cv2.imread('20230222100736979.jpg')

# Define the sharpening kernel
kernel = np.array([[-1,-1,-1],[-1,9,-1],[-1,-1,-1]])

# Apply the kernel to the image
sharpened = cv2.filter2D(img, -1, kernel)

# Display the original and sharpened images
cv2.imshow('Original', img)
cv2.imshow('Sharpened', sharpened)
cv2.waitKey(0)

  

 

####################

posted @ 2023-04-22 15:24  西北逍遥  阅读(24)  评论(0编辑  收藏  举报