r9y9 / pylibfreenect2

A python interface for libfreenect2
http://r9y9.github.io/pylibfreenect2/latest/
Other
135 stars 53 forks source link

Extracting 3 channels in a colour stream #54

Open aegorfk opened 6 years ago

aegorfk commented 6 years ago

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