Machine Learning for Beginners in Python: How to Detect Edges

Hits: 5 Detect Edges Preliminaries import cv2 import numpy as np from matplotlib import pyplot as plt Load image image_gray = cv2.imread(‘images/plane_256x256.jpg’, cv2.IMREAD_GRAYSCALE) Detect Edges median_intensity = np.median(image_gray) lower_threshold = int(max(0, (1.0 – 0.33) * median_intensity)) upper_threshold = int(min(255, (1.0 + 0.33) * median_intensity)) image_canny = cv2.Canny(image_gray, lower_threshold, upper_threshold) View Edges plt.imshow(image_canny, cmap=’gray’), plt.axis(“off”) plt.show() … Continue reading Machine Learning for Beginners in Python: How to Detect Edges