예제 #1
0
 def research(self):
     params = ClusterParams(eval(self.distance_limit.get()),
                      eval(self.angle_limit.get()),
                      eval(self.min_line_length.get()),
                      eval(self.anglevar_weight.get()),
                      eval(self.distvar_weight.get()),
                      1,
                      self.allow_intersection.get(),
                      eval(self.beam_width.get()),
                     self.attempt_dnc.get()
                      
                      )
     self.c.delete("line")
     searchMe = []
     for o in self.c.find_all():
         #this needs to create a landmark now
         searchMe.append(Landmark('purple_prism',
                 RectangleRepresentation(rect=BoundingBox([Vec2(self.c.coords(o)[0],self.c.coords(o)[1]), Vec2(self.c.coords(o)[2],self.c.coords(o)[3])]), landmarks_to_get=[]),
                 None,
                 ObjectClass.PRISM,
                 Color.PURPLE))
     print searchMe
     results = SceneEval.sceneEval(searchMe,params)
     if len(results)>0:
         self.chainViz(results)
예제 #2
0
파일: adapter.py 프로젝트: wrightjb/bolt
def adapt(scene):
    '''takes a scene object and returns a list of lists of objects that form groups'''
    for l in scene.landmarks:
        o =PhysicalObject(scene.landmarks[l].uuid,
                       np.array(scene.landmarks[l].representation.middle),
                        np.array(scene.landmarks[l].representation.rect.min_point),
                        np.array(scene.landmarks[l].representation.rect.max_point))
        objects.append(o)
    results = SceneEval.sceneEval(objects)
    return  results
예제 #3
0
파일: adapter.py 프로젝트: echan3/bolt
def adapt(scene):
    '''takes a scene object and returns a list of lists of objects that form groups'''
    for l in scene.landmarks:
        o =PhysicalObject(scene.landmarks[l].uuid,
                       np.array(scene.landmarks[l].representation.middle),
                        np.array(scene.landmarks[l].representation.rect.min_point),
                        np.array(scene.landmarks[l].representation.rect.max_point))
        objects.append(o)
    results = SceneEval.findChains(objects)[0:-1]#trim the score from the end of the list
    for r in range(len(results)):
        for s in range(len(results[r])):
            results[r][s] = scene.fetch_landmark(results[r][s])
    return results
 def research(self):
     params = ClusterParams(eval(self.distance_limit.get()),
                      eval(self.angle_limit.get()),
                      eval(self.min_line_length.get()),
                      eval(self.anglevar_weight.get()),
                      eval(self.distvar_weight.get()),
                      1,
                      self.allow_intersection.get()
                      
                      )
     self.c.delete("line")
     searchMe = []
     for o in self.c.find_all():
         searchMe.append(PhysicalObject(o,np.array(self.c.coords(o)[0:2]),np.array(self.c.coords(o)[0:2]),np.array(self.c.coords(o)[2:4])))
     results = SceneEval.sceneEval(searchMe,params)
     if len(results)>0:
         self.chainViz(results)
예제 #5
0
def adapt(landmarks):
    '''takes a scene object and returns a list of lists of objects that form groups'''
    landmarkDict = dict()

    for l in landmarks:
        landmarkDict[l.uuid] = l
        o = PhysicalObject(l.uuid, np.array(l.representation.middle),
                           np.array(l.representation.rect.min_point),
                           np.array(l.representation.rect.max_point), l.uuid)
        objects.append(o)

    bundles = SceneEval.sceneEval(objects)

    for i in bundles:
        print i.convert(landmarkDict)

    results = [bundle.convert(landmarkDict) for bundle in bundles]
    return results
예제 #6
0
def adapt(landmarks):
    '''takes a scene object and returns a list of lists of objects that form groups'''
    landmarkDict = dict()

    for l in landmarks:
        landmarkDict[l.uuid]=l
        o = PhysicalObject(l.uuid,
                           np.array(l.representation.middle),
                           np.array(l.representation.rect.min_point),
                           np.array(l.representation.rect.max_point),
                           l.uuid)
        objects.append(o)
        
    bundles = SceneEval.sceneEval(objects)

    for i in bundles:
       print i.convert(landmarkDict)

    results = [bundle.convert(landmarkDict) for bundle in bundles]
    return  results
예제 #7
0
 def research(self):
     params = ClusterParams(eval(self.distance_limit.get()),
                            eval(self.angle_limit.get()),
                            eval(self.min_line_length.get()),
                            eval(self.anglevar_weight.get()),
                            eval(self.distvar_weight.get()), 1,
                            self.allow_intersection.get(),
                            eval(self.beam_width.get()),
                            self.attempt_dnc.get())
     self.c.delete("line")
     searchMe = []
     for o in self.c.find_all():
         searchMe.append(
             PhysicalObject(o,
                            self.c.coords(o)[0:2],
                            self.c.coords(o)[0:2],
                            self.c.coords(o)[2:4]))
     results = SceneEval.sceneEval(searchMe, params)
     if len(results) > 0:
         self.chainViz(results)
예제 #8
0
파일: run.py 프로젝트: colinwinslow/bolt
                    ObjectClass.PRISM,
                    Color.ORANGE)

    scene.add_landmark(table)

    for obj in (obj1, obj2, obj3, obj4, obj5,obj6):
        obj.representation.alt_representations = []
        scene.add_landmark(obj)

    return scene, speaker

if __name__ == '__main__':
    scene, speaker = construct_training_scene()
    
    lmks = [lmk for lmk in scene.landmarks.values() if not lmk.name == 'table']
    groups = SceneEval.sceneEval(lmks)
    print groups
    
    for i,g in enumerate(groups):
        try: scene.add_landmark(Landmark('ol%d'%i, g, None, Landmark.LINE))
        except: scene.add_landmark(Landmark('ol%d'%i, g.representation, None, Landmark.LINE))
    #perspectives = [ Vec2(5.5,4.5), Vec2(6.5,6.0)]
    #speaker.talk_to_baby(scene, perspectives, how_many_each=10)

    dozen = 1
    couple = 1
    while True:
        for i in range(couple * dozen):
            location = Landmark( 'point', PointRepresentation(Vec2(random()*0.8-0.4,random()*0.6+0.4)), None, Landmark.POINT)
            trajector = location#obj2
            speaker.describe(trajector, scene, True, 1)