Skip to content Skip to sidebar Skip to footer

Convert A Kivy Texture To Opencv Image

I am trying to convert my kivy texture to an image format so that i can process it using opencv (cv2). I tried reading the texture using read() and using cv2.imread() but neither w

Solution 1:

You must reshape "newvalue"

height, width = camera.texture.height, camera.texture.width

newvalue = np.frombuffer(camera.texture.pixels, np.uint8)
newvalue = newvalue.reshape(height, width, 4)
gray = cv2.cvtColor(newvalue, cv2.COLOR_RGBA2GRAY)

Post a Comment for "Convert A Kivy Texture To Opencv Image"