martedì 15 aprile 2014

RGB con PyOpenNi Kinect

Non si tratta di una funzione molto bene documentata (anche perche' non presente nella cartella degli esempi) ma con PyOpenNi e' possibile acquisire immagini RBG da Kinect





il codice di riferimento (sostanzialmente autoesplicativo) e' il seguente
----------------------------------------------

from openni import *
from PIL import Image

ctx = Context()
ctx.init()

depth = DepthGenerator()
rgb = ImageGenerator()
depth.create(ctx)
rgb.create(ctx)

depth.set_resolution_preset(RES_VGA)
depth.fps = 30

rgb.set_resolution_preset(RES_VGA)
rgb.fps = 30

ctx.start_generating_all()

ctx.wait_one_update_all(rgb)
im = Image.fromstring('RGB',(640,480),rgb.get_raw_image_map())
im.save("rgb.jpg")

ctx.wait_one_update_all(depth)
de = Image.fromstring('L',(640,480),depth.get_raw_depth_map_8())
de.save("depth.jpg")

Nessun commento:

Posta un commento

Nvidia Dev Env con Docker e Visual Code

Mi sono comprato un vecchio portatile MSI con una NVidia GeForce GTX 860M che supporta i driver 580.178.04 Cuda 13 La scheda video e' mo...