def processor(cls, *args, **kwargs):
        object_db = kwargs["object_db"]
        object_id = kwargs.get("object_id", None)
        submethod = kwargs["submethod"]

        # db_models = Models(db_params, [ object_id ], method, submethod)
        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_submethod=dict_to_cpp_json_str(submethod),
            json_K=dict_to_cpp_json_str(json_K),
            json_D=dict_to_cpp_json_str(json_D),
            imageWidth=imageWidth,
            imageHeight=imageHeight,
            db_models=db_models,
        )
コード例 #2
0
    def processor(cls, *args, **kwargs):
        object_db = kwargs['object_db']
        object_id = kwargs.get('object_id', None)
        submethod = kwargs['submethod']

        #db_models = Models(db_params, [ object_id ], method, submethod)
        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_submethod=dict_to_cpp_json_str(submethod),
            json_K=dict_to_cpp_json_str(json_K),
            json_D=dict_to_cpp_json_str(json_D),
            imageWidth=imageWidth,
            imageHeight=imageHeight,
            db_models=db_models)
コード例 #3
0
 def detector(self, *args, **kwargs):
     visualize = kwargs.pop('visualize', False)
     submethod = kwargs.pop('subtype')
     parameters = kwargs.pop('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(), json_helper.dict_to_cpp_json_str(submethod))
     return PBDDetector(object_db, object_ids, visualize, *args, **parameters['extra'])
コード例 #4
0
ファイル: detector.py プロジェクト: mtamburrano/linemod
 def detector(self, *args, **kwargs):
     #visualize = args.get('visualize', False)
     submethod = kwargs.get('submethod')
     parameters = kwargs.get('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(), json_helper.dict_to_cpp_json_str(submethod))
     threshold = parameters.get('threshold', 90)
     return ecto_linemod.Detector(model_documents=model_documents, db=object_db, threshold=threshold)
コード例 #5
0
 def detector(self, *args, **kwargs):
     visualize = kwargs.pop('visualize', False)
     submethod = kwargs.pop('submethod')
     parameters = kwargs.pop('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(), json_helper.dict_to_cpp_json_str(submethod))
     model_file = parameters['extra'].get('model_file')
     return object_recognition_by_parts_cells.Detector(model_file=model_file, visualize=visualize)
コード例 #6
0
 def detector(self, *args, **kwargs):
     visualize = kwargs.pop('visualize', False)
     submethod = kwargs.pop('subtype')
     parameters = kwargs.pop('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(),
                              json_helper.dict_to_cpp_json_str(submethod))
     return PBDDetector(object_db, object_ids, visualize, *args,
                        **parameters['extra'])
 def detector(self, *args, **kwargs):
     visualize = kwargs.pop('visualize', False)
     submethod = kwargs.pop('submethod')
     parameters = kwargs.pop('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(), json_helper.dict_to_cpp_json_str(submethod))
     registrationMaskFilename = parameters.get('registrationMaskFilename')
     return transparent_objects_cells.Detector(model_documents=model_documents, object_db=object_db,
                                         registrationMaskFilename=registrationMaskFilename, visualize=visualize)
コード例 #8
0
ファイル: detector.py プロジェクト: huiyugan/linemod
 def detector(self, *args, **kwargs):
     #visualize = args.get('visualize', False)
     submethod = kwargs.get('submethod')
     parameters = kwargs.get('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(),
                              json_helper.dict_to_cpp_json_str(submethod))
     threshold = parameters.get('threshold', 90)
     return ecto_linemod.Detector(model_documents=model_documents,
                                  db=object_db,
                                  threshold=threshold)
コード例 #9
0
 def detector(self, *args, **kwargs):
     visualize = kwargs.pop('visualize', False)
     submethod = kwargs.pop('submethod')
     parameters = kwargs.pop('parameters')
     object_ids = parameters['object_ids']
     object_db = ObjectDb(parameters['db'])
     model_documents = Models(object_db, object_ids, self.type_name(),
                              json_helper.dict_to_cpp_json_str(submethod))
     registrationMaskFilename = parameters.get('registrationMaskFilename')
     return transparent_objects_cells.Detector(
         model_documents=model_documents,
         object_db=object_db,
         registrationMaskFilename=registrationMaskFilename,
         visualize=visualize)
コード例 #10
0
ファイル: training.py プロジェクト: MichaelBBTiger/linemod
    options = parser.parse_args()

    return options


if __name__ == '__main__':
    options = parse_args()

    plasm = ecto.Plasm()

    #setup the input source, grayscale conversion
    trainer = Trainer(path='/wg/stor2a/vrabaud/workspace/recognition_kitchen_groovy/build/buildspace/lib/object_recognition_reconstruction')
    model_filler = ModelFiller()

    #connect up the pose_est
    plasm.connect(trainer['detector'] >>  model_filler['detector'])

    object_id = 'whoolite'
    writer = ModelWriter(session_ids=list_to_cpp_json_str([]),
                        object_id=object_id, db_params=ObjectDbParameters({'type': 'CouchDB',
                                                                              'root': 'http://bwl.willowgarage.com:5984',
                                                                              'collection': 'object_recognition'}),
                        method=LinemodDetectionPipeline.type_name(),
                        json_submethod=dict_to_cpp_json_str({}),
                        json_params=dict_to_cpp_json_str({}))

    plasm.connect(model_filler["db_document"] >> writer["db_document"])

    options.niter = 1
    run_plasm(options, plasm, locals=vars())
コード例 #11
0
ファイル: trainer.py プロジェクト: mtamburrano/linemod
 def incremental_model_builder(cls, *args, **kwargs):
     submethod = kwargs.get('submethod')
     return ecto_linemod.Trainer(json_submethod=dict_to_cpp_json_str(submethod))
コード例 #12
0
ファイル: detection.py プロジェクト: abdullah38rcc/linemod
if __name__ == '__main__':
    options = parse_args()

    plasm = ecto.Plasm()

    db_params = ObjectDbParameters({'type': 'CouchDB', 'root': 'http://bwl.willowgarage.com:5984',
                                        'collection': 'object_recognition'})
    object_db = ObjectDb(db_params)

    #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)

    print LinemodDetectionPipeline.type_name()
    object_ids = ['whoolite', 'tilex']
    model_documents = Models(object_db, object_ids, LinemodDetectionPipeline.type_name(), json_helper.dict_to_cpp_json_str({}))
    print len(model_documents)
    detector = Detector(model_documents=model_documents, db=object_db, threshold=90)

    #connect up the pose_est
    plasm.connect(source['image'] >> detector['image'],
                  source['depth'] >> detector['depth']
                  )
    plasm.connect(source['image'] >> imshow(name='source')[:])

    if 0:
        import ecto_ros
        import ecto_ros.ecto_sensor_msgs
        import sys
        ecto_ros.init(sys.argv, "image_pub")
        mat2image = ecto_ros.Mat2Image(frame_id='base', encoding='bgr8')
コード例 #13
0
ファイル: detection.py プロジェクト: hris2003/linemod
        'collection': 'object_recognition'
    })
    object_db = ObjectDb(db_params)

    #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)

    print LinemodDetectionPipeline.type_name()
    object_ids = ['whoolite', 'tilex']
    model_documents = Models(object_db, object_ids,
                             LinemodDetectionPipeline.type_name(),
                             json_helper.dict_to_cpp_json_str({}))
    print len(model_documents)
    detector = Detector(model_documents=model_documents,
                        db=object_db,
                        threshold=90)

    #connect up the pose_est
    plasm.connect(source['image'] >> detector['image'],
                  source['depth'] >> detector['depth'])
    plasm.connect(source['image'] >> imshow(name='source')[:])

    if 0:
        import ecto_ros
        import ecto_ros.ecto_sensor_msgs
        import sys
        ecto_ros.init(sys.argv, "image_pub")
コード例 #14
0
ファイル: trainer.py プロジェクト: huiyugan/linemod
 def incremental_model_builder(cls, *args, **kwargs):
     submethod = kwargs.get('submethod')
     return ecto_linemod.Trainer(
         json_submethod=dict_to_cpp_json_str(submethod))
コード例 #15
0
    #setup the input source, grayscale conversion
    trainer = Trainer(
        path=
        '/wg/stor2a/vrabaud/workspace/recognition_kitchen_groovy/build/buildspace/lib/object_recognition_reconstruction'
    )
    model_filler = ModelFiller()

    #connect up the pose_est
    plasm.connect(trainer['detector'] >> model_filler['detector'])

    object_id = 'whoolite'
    writer = ModelWriter(session_ids=list_to_cpp_json_str([]),
                         object_id=object_id,
                         db_params=ObjectDbParameters({
                             'type':
                             'CouchDB',
                             'root':
                             'http://bwl.willowgarage.com:5984',
                             'collection':
                             'object_recognition'
                         }),
                         method=LinemodDetectionPipeline.type_name(),
                         json_submethod=dict_to_cpp_json_str({}),
                         json_params=dict_to_cpp_json_str({}))

    plasm.connect(model_filler["db_document"] >> writer["db_document"])

    options.niter = 1
    run_plasm(options, plasm, locals=vars())