Exemplo n.º 1
0
def draw(probs,
         xmin,
         xmax,
         ymin,
         ymax,
         xstart,
         ystart,
         agent,
         landmark,
         output_fname=None,
         title=None):
    figure = mpl.figure()
    axes = figure.gca()

    axes.imshow(probs,
                origin="lower",
                extent=(xmin, xmax, ymin, ymax),
                cmap=mpl.cm.jet)
    drawUtils.drawGrounding(axes, agent)
    drawUtils.drawGrounding(axes, landmark)

    if title:
        figure.suptitle(title)

    axes.axis([xmin, xmax, ymin, ymax])
    figure.canvas.draw()
    if output_fname is not None:
        mpl.savefig(output_fname)
Exemplo n.º 2
0
    def draw(self):
        self.axes.clear()
        artists = []
        annotation = self.annotationModel.selectedAnnotation()
        for groundings in annotation.groundings:
            for g in groundings:
                artists.extend(
                    drawGrounding(self.axes, g, plotArgs={"color": "black"}))
        esdc = self.esdcModel.selectedEsdc()
        if esdc != None:
            for grounding in annotation.getGroundings(esdc):
                print "esdc grounding", repr(grounding.points_pts)
                print "path", hasattr(grounding, "path")
                if hasattr(grounding, "path"):
                    print "path", grounding.path.points_xy
                    print "path len", len(grounding.path.points_xy)

                artists.extend(
                    drawGrounding(self.axes,
                                  grounding,
                                  plotArgs={
                                      "color": "yellow",
                                      "zorder": 100,
                                  }))

        self.restoreLimits()
        self.figure.canvas.draw()
Exemplo n.º 3
0
    def draw(self):
        self.axes.clear()
        #self.axes.set_xticks([])
        #self.axes.set_yticks([])

        if self.costImage:
            self.axes.imshow(
                self.costImage.costs,
                origin="lower",
                extent=(self.costImage.xmin, self.costImage.xmax,
                        self.costImage.ymin, self.costImage.ymax),
                #                             cmap=mpl.cm.gray)
                cmap=mpl.cm.jet)
            #norm=matplotlib.colors.Normalize(vmin=0.0, vmax=1.0))

        for grounding in self.groundingsModel.selectedGroundings():
            drawGrounding(self.axes,
                          grounding,
                          shouldDrawIcon=self.shouldDrawIcons,
                          shouldDrawText=self.shouldDrawText,
                          plotArgs=dict(color="black", lw=4))

        if self.shouldDrawAgent:
            for candidate in self.candidateModel.selectedEntries():
                if candidate.ggg.context != None:
                    agent = candidate.ggg.context.agent
                    if agent != None:
                        ax, ay, az, ath = agent.path.locationAtT(0)
                        drawRobot(self.axes, ax, ay, ath)
                        drawObject(self.axes, agent, shouldDrawPath=True)
        self.restoreLimits()
        self.figure.canvas.draw()
Exemplo n.º 4
0
    def describe(self, thing):
        drawGrounding(self.axes, thing, plotArgs={"color": "red"})
        self.describer.describe(thing)

        factor_to_cost = []
        for c in self.describer.cf.factor_to_cost.values():
            factor_to_cost.extend(c)

        self.crfFeatureWeights.load(self.describer.cf.lccrf, factor_to_cost)
Exemplo n.º 5
0
    def drawContext(self):
        artists = []
        for grounding in self.contextModel.selectedGroundings():
            artists.extend(drawGrounding(self.axes, grounding,
                                         plotArgs={"color":"purple"}))

        return artists
Exemplo n.º 6
0
    def drawGrounding(self):
        artists = []
        esdc = self.esdcModel.selectedEsdc()

        if esdc != None:
            annotation = self.annotationModel.selectedAnnotation()
            for grounding in annotation.getGroundings(esdc):
                artists.extend(drawGrounding(self.axes, grounding,
                                             plotArgs={"color":"yellow"}))

        #sgrounding = self.groundingsModel.selectedGrounding()
        sgrounding = None
        if sgrounding != None:
            artists.extend(drawGrounding(self.axes, sgrounding,
                                         plotArgs={"color":"red"}))

        return artists
Exemplo n.º 7
0
 def drawState(self):
     artists = []
     if self.state != None:
         for obj in self.state.get_objects():
             self.artists.extend(drawGrounding(self.axes, obj,
                                               plotArgs=dict(color="blue")))
         
     return artists
Exemplo n.º 8
0
    def draw(self):
        self.axes.clear()

        for grounding in self.gsModel.selectedGroundings():
            drawGrounding(self.axes,
                          grounding,
                          plotArgs=dict(color="purple", lw=4))

        for grounding in self.ggg.context.groundings:
            drawGrounding(self.axes, grounding, plotArgs=dict(color="green"))

        selected_nodes = self.nodeForFactorModel.selectedNodes()
        for e in self.nodeForFactorModel.entries:

            if e.node.is_gamma and e.ggg.is_grounded(e.node):
                evidences = self.ggg.evidence_for_node(e.node)
                for g in evidences:
                    if e.node in selected_nodes:
                        plotArgs = dict(color="yellow", lw="4")
                    else:
                        plotArgs = dict(color="black")
                    drawGrounding(self.axes, g, plotArgs=plotArgs)

        self.restoreLimits()
        self.figure.canvas.draw()
Exemplo n.º 9
0
 def draw(self):
     self.axes.clear()
     for g in self.describer.groundings:
         drawGrounding(self.axes, g)
Exemplo n.º 10
0
 def drawPathSegments(self):
     artists = []
     for path in self.pathSegmentsModel.selectedGroundings():
         artists.extend(drawGrounding(self.axes, path,
                                      plotArgs=dict(color="orange", lw=2)))
     return artists