コード例 #1
0
ファイル: selectionsim.py プロジェクト: ezod/visionplatform
def create_error_model(model, vectors=None, terror=0.0, rerror=0.0):
    emodel = A.Model(task_params=model._task_params)
    convert = {}
    if not vectors:
        vectors = {}
    for camera in model.cameras:
        emodel[camera] = A.Camera(camera, model[camera]._params,
            pose=model[camera]._pose, mount=model[camera].mount)
        if not camera in vectors:
            vectors[camera] = (A.random_unit_vector(), A.random_unit_vector())
        emodel[camera].set_absolute_pose(\
            A.pose_error(model[camera].pose, vectors[camera][0], terror,
                vectors[camera][1], rerror))
        convert[camera] = -model[camera].pose + emodel[camera].pose
    for sceneobj in model.keys():
        if not sceneobj in model.cameras:
            emodel[sceneobj] = model[sceneobj]
    return emodel, convert, vectors
コード例 #2
0
ファイル: selectionsim.py プロジェクト: ezod/visionplatform
 if experiment.exit:
     break
 current_frames += 1
 normal = (f(t / float(opts.interpolate)) - \
     f((t - 1) / float(opts.interpolate))).normal
 angle = A.Point((0, -1, 0)).angle(normal)
 axis = A.Point((0, -1, 0)) ** normal
 R = A.Rotation.from_axis_angle(angle, axis)
 experiment.model[targetobj].set_absolute_pose(\
     A.Pose(T=f(t / float(opts.interpolate)), R=R))
 if opts.visualize:
     experiment.model[targetobj].update_visualization()
 current = best
 if opts.terror:
     etarget.set_absolute_pose(A.pose_error(experiment.relevance_models[\
         targetrm].pose, A.random_unit_vector(), opts.terror[0],
         A.random_unit_vector(), opts.terror[1]))
 elif opts.posetrack and emodel:
     etarget.set_absolute_pose(experiment.relevance_models[targetrm].pose)
 if current and score and opts.posetrack and emodel:
     etarget.set_absolute_pose(etarget.pose + convert[current])
 best, score = (emodel or experiment.model).best_view(etarget or \
     experiment.relevance_models[targetrm], current=(current and \
     frozenset([current]) or None), threshold=opts.threshold,
     candidates=((vision_graph and score) and [frozenset(c) for c in \
     vision_graph.neighbors(current) | set([current])] or None))
 if emodel or etarget:
     score = experiment.model.performance(\
         experiment.relevance_models[targetrm], subset=best)
 if not optcached:
     optperf += experiment.model.best_view(\