ラプラシアンフィルタ

V2.4.11, V3.0.0
In [3]:
# -*- coding: utf-8 -*-
import cv2

#Ipythonで表示用の設定
import matplotlib.pyplot as plt
%matplotlib inline

#画像読込
in_img = cv2.imread("lena.jpg")

#GRAY画像に変換
gray  = cv2.cvtColor(in_img, cv2.COLOR_BGR2GRAY)

#ぼかし処理
gauss = cv2.GaussianBlur(gray,(3,3),0)

#ラプラシアンフィルタリング
laplacian = cv2.Laplacian(gauss,cv2.CV_64F)

#画像表示
plt.subplot(121)
plt.imshow(gray,cmap = 'gray')
plt.subplot(122)
plt.imshow(laplacian,cmap = 'gray')
Out[3]:
<matplotlib.image.AxesImage at 0xa9316f0>
inserted by FC2 system