From 36b4e8b8af04b59ba2874a76e8b21e4c7dc7b78f Mon Sep 17 00:00:00 2001 From: olivier R-D Date: Wed, 20 Jul 2016 10:22:32 +0200 Subject: [PATCH] update 2 examples to work with python3 and python2 --- examples/cloud.py | 19 ++++++++++--------- examples/simple.py | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/cloud.py b/examples/cloud.py index 3d9e6b2..4243b8a 100644 --- a/examples/cloud.py +++ b/examples/cloud.py @@ -1,17 +1,18 @@ import cyni import numpy as np -import Image +from PIL import Image cyni.initialize() device = cyni.getAnyDevice() device.open() -depthStream = device.createStream("depth", fps=30) -colorStream = device.createStream("color", fps=30) +depthStream = device.createStream(b"depth", fps=30) +#colorStream = device.createStream(b"color", fps=30) depthStream.start() -colorStream.start() -colorFrame = colorStream.readFrame() +#colorStream.start() +#colorFrame = colorStream.readFrame() depthFrame = depthStream.readFrame() -cloud = cyni.depthMapToPointCloud(depthFrame.data, depthStream, colorFrame.data) -cyni.writePCD(cloud, "cloud.pcd") -readCloud = cyni.readPCD("cloud.pcd") -cyni.writePCD(readCloud, "cloud2.pcd", ascii=True) +cloud = cyni.depthMapToPointCloud(depthFrame.data, depthStream) +#cloud = cyni.depthMapToPointCloud(depthFrame.data, depthStream, colorFrame.data) +cyni.writePCD(cloud, "cloud.pcd", ascii=True) +#readCloud = cyni.readPCD("cloud.pcd") +#cyni.writePCD(readCloud, "cloud2.pcd", ascii=True) diff --git a/examples/simple.py b/examples/simple.py index 9cb2af4..3aa8c99 100644 --- a/examples/simple.py +++ b/examples/simple.py @@ -1,6 +1,6 @@ import cyni import numpy as np -import Image +from PIL import Image cyni.initialize() device = cyni.getAnyDevice()