Converting CGImage to python image (pil/opencv)
问题 I want to do some pattern recognition on my screen and will use the Quartz/PyObjc libraries to get the screenshots. I get the screenshot as a CGImage. I want to search for a pattern in it using the openCV library, but can't seem to find how to convert the data to be readable by opencv. So what I want to do is this: #get screenshot and reference pattern img = getScreenshot() # returns CGImage instance, custom function, using Quartz reference = cv2.imread('ref/reference_start.png') #get the