import cv2 from PIL import Image import sys import PIL def canny(filepathname, left=70, right=140): v = cv2.imread(filepathname) s = cv2.cvtColor(v, 1) s = cv2.Canny(s, left, right) #cv2.imshow('nier',s) cv2.waitKey(0) cv2.imwrite("canny lines.jpg", s) return s canny("hedley.jfif") ######################################################################### # Importing Image module from PIL package from PIL import Image import PIL def opensize(xx): im1 = Image.open(xx) global w global h w,h=im1.size print(w,h) opensize("canny lines.jpg") # creating a image object (main image) ####################################################### global alls alls=[] global w global h def getpixels(nam): im1 = Image.open(nam) w,h=im1.size for xx in range(w): for yy in range(h): cordinate=(xx,yy) rgb= im1.getpixel(cordinate); #print(xx,yy,rbg) allcords=((xx,yy),(rgb)) if rgb>10: alls.append(allcords) getpixels("canny lines.jpg") #print(alls) imx = PIL.Image.new(mode = "RGB", size = (w, h)) #print(alls) for ggt in alls: print(ggt) imx.putpixel(ggt[0],(0,255,0)) #rgb=ded[0][0][0] #imx.putpixel(ded[0],ded[0][0],(ded[0])) imx.show() imx = imx.save("Bhedley.jpg") #image.putpixel( (x, x), (0, 0, 0, 255) )