Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import matplotlib as plt
- import numpy as np
- pic = plt.imread("Unknown.jpg")
- sobelx = cv2.Sobel(cv2.cvtColor(pic, cv2.COLOR_RGB2GRAY),cv2.CV_64F,1,0,ksize=11)
- sobely = cv2.Sobel(cv2.cvtColor(pic, cv2.COLOR_RGB2GRAY),cv2.CV_64F,0,1,ksize=11)
- edges = np.sqrt(sobelx ** 2 + sobely ** 2) > 5000000
- pic2 = pic.astype(np.float)
- pic2[edges] /= 255
- pic2[edges] **= 1/3
- pic2[edges] *= 255
- pic2 = pic2.astype(np.uint8)
- plt.imsave("bridge_light.png", pic2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement