Last active
April 29, 2020 05:01
-
-
Save inaniwa3/87074eed239ded1b2113d73eb15accca 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
#!/usr/bin/env python | |
# ref. | |
# 伝説の超古代文明「ムー」 | |
# http://www.nazotoki.com/mu.html | |
import cv2 | |
import numpy as np | |
kernel7 = np.array([ | |
[0, 0, 1, 1, 1, 0, 0], | |
[0, 1, 1, 1, 1, 1, 0], | |
[1, 1, 1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1, 1, 1], | |
[0, 1, 1, 1, 1, 1, 0], | |
[0, 0, 1, 1, 1, 0, 0], | |
], np.uint8) | |
kernel5 = np.array([ | |
[0, 1, 1, 1, 0], | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], | |
[0, 1, 1, 1, 0], | |
], np.uint8) | |
mu = cv2.imread('mu.png', cv2.IMREAD_GRAYSCALE) | |
pacific = cv2.imread('pacific.png', cv2.IMREAD_COLOR) | |
dilation = cv2.dilate(mu, kernel7, iterations = 6) | |
gradient = cv2.morphologyEx(dilation, cv2.MORPH_GRADIENT, kernel5) | |
idx = gradient[...] == 255 | |
pacific[idx] = [0, 0, 255] | |
cv2.imwrite('eez.png', pacific) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment