r9y9/pylibfreenect2

Extracting 3 channels in a colour stream

aegorfk opened this issue · 0 comments

I am trying to extract 3 channels from an image coming from Kinect2 stream. So, first I ream the color stream with the pylibfreenect2 package.

color = frames["color"]
So I have the following shape

print(color.asarray().shape) #(1080, 1920, 4)
As I understood, 4 is rather the number of bytes per pixel or the alpha-channel. I want the image to have 3 channels (RGB) and have a shape of (1080, 1920, 3). I tried to do it like:

image_c = cv2.cvtColor(c, cv2.COLOR_RGBA2RGB)
But had an error from PIL package:

TypeError: Cannot handle this data type