Get Numpy Array From Pygame
I want to access my Webcam via python. Unfortunately openCV is not working because of the webcam. Pygame.camera works like a charm with this code: from pygame import camera,display
Solution 1:
get_image
returns a Surface
. According to http://www.pygame.org/docs/ref/surfarray.html, you can use pygame.surfarray.array2d
(or one of the other functions in the surfarray
module) to convert the Surface to a numpy array. E.g.
img = webcam.get_image()
data = pygame.surfarray.array2d(img)
Post a Comment for "Get Numpy Array From Pygame"