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 numpy as np | |
import cv2 | |
import glob | |
import yaml | |
#import pathlib | |
# termination criteria | |
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) | |
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) | |
objp = np.zeros((7*7,3), np.float32) |
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 | |
import matplotlib.pyplot as plt | |
# Open the image | |
img = cv2.imread('dancing-spider.jpg') | |
# Apply Canny | |
edges = cv2.Canny(img, 100, 200, 3, L2gradient=True) | |
plt.figure() |
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 | |
import matplotlib.pyplot as plt | |
# Open the image | |
img = cv2.imread('shapes.jpg') | |
# Apply gray scale | |
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
# Apply gaussian blur |
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 numpy as np | |
from PIL import Image | |
import matplotlib.pyplot as plt | |
# Open the image | |
img = np.array(Image.open('dancing-spider.jpg')).astype(np.uint8) | |
# Apply gray scale | |
gray_img = np.round(0.299 * img[:, :, 0] + | |
0.587 * img[:, :, 1] + |
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 numpy as np | |
from PIL import Image | |
import matplotlib.pyplot as plt | |
# Open the image | |
img = np.array(Image.open('dancing-spider.jpg')).astype(np.uint8) | |
# Sobel Operator | |
h, w, d = img.shape |
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 numpy as np | |
from PIL import Image | |
import matplotlib.pyplot as plt | |
# Open the image | |
img = np.array(Image.open('dancing-spider.jpg')).astype(np.uint8) | |
# Apply gray scale | |
gray_img = np.round(0.299 * img[:, :, 0] + | |
0.587 * img[:, :, 1] + |
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 math | |
from matplotlib import pyplot as plt | |
# Let's initialize two lists with the real | |
# and imaginary numbers. | |
real_list = [36, 22, 45, 15] | |
imag_list = [0, 0, 0, 0] | |
results_f = [] # Forward | |
results_i = [] # Inverse |