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