Last active
February 23, 2017 11:38
-
-
Save cosmo0920/acc3f9d104a6eccf15ab94d324dc8259 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, matplotlib | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import os | |
filename='yuudachi.png' | |
filename_base, ext = os.path.splitext(filename) | |
img = cv2.imread(filename, 1) | |
kernel = np.ones((3,3),np.uint8) | |
dilate_img=cv2.dilate(img,kernel,iterations=1) | |
dilate_diff_img=cv2.absdiff(img, dilate_img) | |
gray = cv2.cvtColor(dilate_diff_img, cv2.COLOR_RGB2GRAY) | |
cv2.imwrite(filename_base + '-linedraw-gray' + ext, 255 - gray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment