1 # -*- coding: utf-8 -*-
3 Affichage vidéo (et autres) de la kinect pour expérimentations / debug.
14 SCREEN_SIZE
= 640, 480
15 SCREEN_TITLE
= "Kinect debug"
18 def capture_rgb(imgGene
):
19 rgb_frame
= numpy
.fromstring(imgGene
.get_raw_image_map_bgr(), dtype
=numpy
.uint8
).reshape(480, 640, 3)
20 image
= cv
.fromarray(rgb_frame
)
21 cv
.CvtColor(cv
.fromarray(rgb_frame
), image
, cv
.CV_BGR2RGB
)
22 pyimage
= pygame
.image
.frombuffer(image
.tostring(), cv
.GetSize(image
), 'RGB')
33 screen
= pygame
.display
.set_mode(SCREEN_SIZE
)
34 pygame
.display
.set_caption(SCREEN_TITLE
)
36 imgGene
= ImageGenerator()
37 imgGene
.create(context
)
38 imgGene
.set_resolution_preset(RES_VGA
)
41 context
.start_generating_all()
44 sur
= pygame
.Surface((640, 480))
45 sur
.fill((255, 255, 255))
48 for event
in pygame
.event
.get():
51 context
.wait_one_update_all(imgGene
)
53 rgbImg
= capture_rgb(imgGene
)
54 sur
.blit(rgbImg
, (0, 0))
55 screen
.blit(sur
, (0, 0))
58 if __name__
== "__main__" :