Ejemplo n.º 1
0
    def setup_cature(self):
        cyni.initialize()
        self.device = cyni.getAnyDevice()
        self.device.open()

        self.depthStream = self.device.createStream("depth", fps=30, width=640, height=480)
        self.irStream = self.device.createStream("ir", fps=30, width=640, height=480)
        # colorStream = device.createStream("color", fps=30)

        self.depthStream.start()
        self.irStream.start()
def get_streams(device_id="#1"):
    global CYNI_INITIALIZED
    if not CYNI_INITIALIZED:
        cyni.initialize()
        CYNI_INITIALIZED = True
        
    device = get_device(device_id)
    device.open()
    depthStream = device.createStream("depth", width=640, height=480, fps=30)
    colorStream = device.createStream("color", width=640, height=480, fps=30)
    device.setImageRegistrationMode("depth_to_color")
    device.setDepthColorSyncEnabled(on=True)
    
    return {"device": device, "depth": depthStream, "color": colorStream}
Ejemplo n.º 3
0
    def __init__(self, num_cameras=2):
        
        assert num_cameras > 0        
        # Corresponds to camera 1
        self.parent_frame = 'camera1_depth_optical_frame'
        
        if rospy.get_name() == '/unnamed':
            rospy.init_node('cam_calibrator')
        self.tf_listener = tf.TransformListener()
        
        cyni.initialize()
        self.allDevices = cyni.enumerateDevices()

        if len(self.allDevices) == 0:
            raise Exception("No devices found! Cyni not initialized properly or, devices actually not present.")
        if self.num_cameras > len(self.allDevices):
            redprint("Warning: Requesting more devices than available. Getting all devices.")

        self.num_cameras = min(num_cameras,len(self.allDevices))
Ejemplo n.º 4
0
 def __init__(self):
     cyni.initialize()
     self.device = cyni.getAnyDevice()
     self.device.open()
     self.depthStream = self.device.createStream(b"depth", fps=30)
     self.depthStream.start()
#g1 = cloudprocpy.CloudGrabber("#1")
#g1.startRGBD()
parser = argparse.ArgumentParser()
parser.add_argument('--name', help="Name of log file", required = True, type = str)
parser.add_argument('--n_tfm', help="Number of transforms to log", required = True, type=int)
args = parser.parse_args()

rospy.init_node('log_kinect_static')
getMarkers = rospy.ServiceProxy("getMarkers", MarkerPositions)


base_frame = 'base_link'
head_frame = 'head_plate_frame'
gripper_frame = 'r_gripper_tool_frame'

cyni.initialize()
device = cyni.getAnyDevice()
#subprocess.call("sudo killall XnSensorServer", shell=True)
device.open()
colorStream = device.createStream("color", width=640, height=480, fps=30)
colorStream.start()
depthStream = device.createStream("depth", width=640, height = 480, fps=30)
depthStream.start()
ar_tfms = []
tool_tfms = []
head_tfms = []
i = 0

listener = tf.TransformListener()
time.sleep(3)
while(i < args.n_tfm):
Ejemplo n.º 6
0
import cyni
import numpy as np
import PIL as Image

cyni.initialize()
device = cyni.getAnyDevice()
device.open()
depthStream = device.createStream("depth", fps=30, width=640, height=480)
#colorStream = device.createStream("color", fps=30, width=1280, height=960)
#colorStream = device.createStream("color", fps=30, width=640, height=480)
#device.setImageRegistrationMode("depth_to_color")
device.setDepthColorSyncEnabled(on=True)
depthStream.start()
# colorStream.start()
# colorFrame = colorStream.readFrame()
# colorFrame = colorStream.readFrame()
# colorFrame = colorStream.readFrame()
# colorFrame = colorStream.readFrame()
depthFrame = depthStream.readFrame()
# registered = cyni.registerColorImage(depthFrame.data, colorFrame.data, depthStream, colorStream)
# Image.fromarray(colorFrame.data).save("color.png")
# Image.fromarray(registered).save("registered.png")
Image.fromarray(cyni.depthMapToImage(depthFrame.data)).save("depth.png")