1import numpy as np
2import cv2 as cv
3### For "image.jpg"
4img = cv.imread('image.jpg',0)
5edges = cv.Canny(img, 100, 200)
6### For "2D array"
7img = np.copy(array_2d)
8# Need to normalize 0 - 255
9img = np.uint8((255 * (img - np.min(img)) / np.ptp(img)).astype(int))
10edges = cv2.Canny(img, 100, 200)