소스 뷰어
import cv2, numpy as np, matplotlib.pyplot as plt

# 이미지 불러오기
img = cv2.imread('blurred.jpg', cv2.IMREAD_GRAYSCALE)

# 가우시안 블러를 사용해 블러 처리
blurred_img = cv2.GaussianBlur(img, (7, 7), 0)

# 샤프닝: 원본 이미지와 블러 이미지의 차이를 이용
alpha = 1.5  # 샤프닝 강도
img_sharpened = (1 + alpha) * img - alpha * blurred_img

# 원본 이미지와 샤프닝 이미지 비교 출력
plt.figure(figsize=(10, 5))

# 원본 이미지 출력
plt.subplot(1, 2, 1)
plt.imshow(img, cmap="gray")
plt.title('Original Image')
plt.axis('off')

# 샤프닝 이미지 출력
plt.subplot(1, 2, 2)
plt.imshow(img_sharpened, cmap="gray")
plt.title('Sharpened Image (Unsharp Mask)')
plt.axis('off')

plt.tight_layout()
plt.show()
No description has been provided for this image