예제 #1
0
    def __init__(self):
        self.regionFilter = hirop_perception.RegionFilters("regionFilter",
                                                           maxZ=2)
        self.pclFunsion = hirop_perception.PclFusion("pclFusion")
        self.rosSource = hirop_perception.PointCloudRos(
            'source',
            topic_name="/kinect2/qhd/points",
            world_frame='base_link')
        self.pclViewer = ecto_pcl.CloudViewer("viewer",
                                              window_name="PCD Viewer")
        self.saver = ecto_pcl.PCDWriter(
            "saver", filename_format="/home/eima/test_%04u.pcd", binary=True)
        self.loader = ecto_pcl.PCDReader("Reader",
                                         filename="/home/eima/test_0000.pcd")
        self.publisher = hirop_perception.PointCloudPublish(
            "publisher", topic_name="/filter_points", frame_id="base_link")
        self.objectFilter = hirop_perception.ObjectFilter("objectFilter",
                                                          frame_id="base_link",
                                                          hight=0.20,
                                                          width=0.13,
                                                          length=0.15)
        self.voxelFilter = hirop_perception.VoxelFilter("voxelFilter")

        self.lookPlasm = ecto.Plasm()
        self.lookPlasm.connect(self.rosSource["output"] >> self.regionFilter["input"], self.regionFilter["output"] >> self.voxelFilter["input"],\
                self.rosSource["R"] >> self.pclFunsion["R"], self.rosSource["T"] >> self.pclFunsion["T"],\
                self.voxelFilter["output"] >> self.pclFunsion["input"], self.pclFunsion["output"] >> self.objectFilter["input"], \
                self.objectFilter["output"] >> self.publisher["input"])

        self.savePlasm = ecto.Plasm()
        self.savePlasm.connect(self.rosSource["output"] >> self.pclFunsion["input"],\
         self.rosSource["T"] >>self.pclFunsion["T"], self.rosSource["R"] >>self.pclFunsion["R"], \
         self.pclFunsion["output"] >> self.saver["input"])

        self.loadPlasm = ecto.Plasm()
        self.loadPlasm.connect(self.loader["output"] >> self.pclFunsion["input"], \
         self.pclFunsion["output"] >> self.pclViewer["input"])

        self.testPlasm = ecto.Plasm()
        self.testPlasm.connect(self.rosSource["output"] >> self.pclFunsion["input"], self.pclFunsion["output"] >>  self.regionFilter["input"],\
           self.pclFunsion["output"] >>  self.pclViewer["input"])

        self.cleanPlasm = ecto.Plasm()
        self.cleanPlasm.connect(
            self.rosSource["output"] >> self.pclFunsion["input"],
            self.pclFunsion["output"] >> self.objectFilter["input"])

        self.keepRun = True
예제 #2
0
import hirop_perecption.hirop_perception as hirop_perception
import ecto, ecto_pcl
import sys
import time
import os

plasm = ecto.Plasm()
pcdfile = os.path.join(os.path.dirname(__file__), 'test.pcd')

if len(sys.argv) > 1:
    pcdfile = sys.argv[1]

reader = ecto_pcl.PCDReader("Reader", filename=pcdfile)

filters = hirop_perception.RegionFilters("tester", maxZ=1)

fusion = hirop_perception.PclFusion()

viewer = ecto_pcl.CloudViewer("viewer", window_name="PCD Viewer")

saver = ecto_pcl.PCDWriter("Saver")

plasm.connect(reader["output"] >> fusion["input"],
              fusion["output"] >> viewer["input"])

if __name__ == "__main__":
    sched = ecto.Scheduler(plasm)
    sched.execute(niter=1)
    #sleep 10 seconds and exit.
    time.sleep(10)
예제 #3
0
import tempfile
import os
import math
import subprocess

import couchdb

import ecto
from ecto_opencv import calib, highgui, imgproc
import object_recognition
from object_recognition import tools as dbtools, models, capture
from ecto_object_recognition import reconstruction, conversion
import ecto_pcl
from tempfile import NamedTemporaryFile

cloud_view = ecto_pcl.CloudViewer("Cloud Display", window_name="PCD Viewer")[:]
imshows = dict(image=highgui.imshow('Image Display', name='image')[:],
               mask=highgui.imshow('Mask Display', name='mask')[:],
               depth=highgui.imshow('Depth Display', name='depth')[:])


def generate_pointclouds_in_object_space(dbs, session, args):
    object_name = dbs[session.object_id]['object_name']
    if not os.path.exists(object_name):
        os.mkdir(object_name)
    obs_ids = models.find_all_observations_for_session(dbs, session.id)
    if len(obs_ids) == 0:
        raise RuntimeError("There are no observations available.")
    db_reader = capture.ObservationReader(
        'Database Source', db_params=dbtools.args_to_db_params(args))
예제 #4
0
#!/usr/bin/env python

import ecto, ecto_pcl, ecto_openni
from ecto_image_pipeline import conversion
from ecto.opts import run_plasm, scheduler_options
from ecto_openni import OpenNICapture, DEPTH_RGB

capture = OpenNICapture(stream_mode=DEPTH_RGB, registration=True, sync=False)

mat2pcl = conversion.MatToPointCloudXYZRGBOrganized('mat2pcl')
pcl2ecto = ecto_pcl.PointCloudT2PointCloud('pcl2ecto')

viewer = ecto_pcl.CloudViewer("viewer", window_name="Clouds!")

graph = [
    capture['image'] >> mat2pcl['image'],
    capture['depth'] >> mat2pcl['points'], mat2pcl[:] >> pcl2ecto[:],
    pcl2ecto[:] >> viewer[:]
]

plasm = ecto.Plasm()
plasm.connect(graph)

if __name__ == "__main__":
    from ecto.opts import doit
    doit(plasm, description='Execute test kinect.')