def processor(cls, *args, **kwargs): object_db = kwargs['object_db'] object_id = kwargs.get('object_id', None) subtype = kwargs['subtype'] # db_models = Models(db_params, [ object_id ], method, subtype) if object_id: # TODO these should be loaded from the database? json_K = kwargs['pipeline_params']['K'] json_D = kwargs['pipeline_params']['D'] imageWidth = kwargs['pipeline_params']['imageWidth'] imageHeight = kwargs['pipeline_params']['imageHeight'] document_ids = find_model_for_object(db_params_to_db( object_db.parameters()), object_id, model_type='mesh') print document_ids db_models = Documents(object_db, document_ids) print 'Found %d meshes:' % len(db_models) else: # TODO these should be loaded from the database? json_K = [] json_D = [] imageWidth = 640 imageHeight = 480 db_models = [] return TransparentObjectsProcessor( json_subtype=obj_to_cpp_json_str(subtype), json_K=obj_to_cpp_json_str(json_K), json_D=obj_to_cpp_json_str(json_D), imageWidth=imageWidth, imageHeight=imageHeight, db_models=db_models)
def processor(cls, *args, **kwargs): object_db = kwargs['object_db'] object_id = kwargs.get('object_id', None) subtype = kwargs['subtype'] # db_models = Models(db_params, [ object_id ], method, subtype) if object_id: # TODO these should be loaded from the database? json_K = kwargs['pipeline_params']['K'] json_D = kwargs['pipeline_params']['D'] imageWidth = kwargs['pipeline_params']['imageWidth'] imageHeight = kwargs['pipeline_params']['imageHeight'] document_ids = find_model_for_object(db_params_to_db(object_db.parameters()), object_id, model_type='mesh') print document_ids db_models = Documents(object_db, document_ids) print 'Found %d meshes:' % len(db_models) else: # TODO these should be loaded from the database? json_K = [] json_D = [] imageWidth = 640 imageHeight = 480 db_models = [] return TransparentObjectsProcessor(json_subtype=obj_to_cpp_json_str(subtype), json_K=obj_to_cpp_json_str(json_K), json_D=obj_to_cpp_json_str(json_D), imageWidth=imageWidth, imageHeight=imageHeight, db_models=db_models)
def __init__(self, detection_class, *args, **kwargs): self._detector = detection_class(*args, **kwargs) self._info = PipelineInfo(parameters=obj_to_cpp_json_str(kwargs)) ecto.BlackBox.__init__(self, *args, **kwargs)
def parse_args(): import argparse parser = argparse.ArgumentParser(description='Compute a LINE-MOD model and saves it to the DB.') scheduler_options(parser.add_argument_group('Scheduler')) options = parser.parse_args() return options if __name__ == '__main__': options = parse_args() plasm = ecto.Plasm() json_db_params = obj_to_cpp_json_str({'type': 'CouchDB', 'root': 'http://bwl.willowgarage.com:5984', 'collection': 'object_recognition'}) #setup the input source, grayscale conversion from ecto_openni import VGA_RES, FPS_30 source = create_source('image_pipeline','OpenNISource',image_mode=VGA_RES,image_fps=FPS_30) object_ids = obj_to_cpp_json_str(['whoolite', 'tilex']) detector = Detector(json_object_ids=object_ids, json_db=json_db_params, threshold=90, visualize=True) #connect up the pose_est plasm.connect(source['image'] >> detector['image'], source['depth'] >> detector['depth'] ) plasm.connect(source['image'] >> imshow(name='source')[:]) if 0: