Beispiel #1
0
    def set_init_state(self):

        init_img = ".data/warp_init.png"
        init_img_zoom = ".data/warp_zoom.png"
        self.f0 = iwx.iFrame(init_img, -1)
        self.f1 = iwx.iFrame(init_img, -1)

        zoom_init_frame = iwx.iFrame(init_img_zoom, -1)

        self.over0.draw(self.f0.img())
        self.zoom0.draw(zoom_init_frame.img())

        self.over1.draw(self.f1.img())
        self.zoom1.draw(zoom_init_frame.img())
Beispiel #2
0
    def set_test_state(self, id0, id1):
        self.in_path.append("/media/Data/MEDIA/photography/2012-08-30-Berlin/100CANON/IMG_9942.JPG")
        self.in_path.append("/media/Data/MEDIA/photography/2012-08-30-Berlin/100CANON/IMG_9943.JPG")
        self.in_path.append("/media/Data/MEDIA/photography/2012-08-30-Berlin/100CANON/IMG_9944.JPG")
        self.in_path.append("/media/Data/MEDIA/photography/2012-08-30-Berlin/100CANON/IMG_9954.JPG")
        self.in_path.append("/media/Data/MEDIA/photography/2012-08-30-Berlin/100CANON/IMG_9955.JPG")

        self.f0 = iwx.iFrame(self.in_path[id0], id0)
        self.f1 = iwx.iFrame(self.in_path[id1], id1)

        self.over0.draw(self.f0.img())
        self.set_zoom(self.f0, self.zoom0, wx.Point(1000, 1000))

        self.over1.draw(self.f1.img())
        self.set_zoom(self.f1, self.zoom1, wx.Point(1000, 1000))

        # update navbar
        self.nav.SetSteps(len(self.in_path) - 1)
Beispiel #3
0
def process_sequence(in_path, o_path, T):
    tmp_path = "/tmp/frames"
    o_type = ".jpg"
    warp_frames = 100
    utils.assert_dir(tmp_path)
    ctr = 0
    w = warper()
    config = {"i_path": "", "o_path": o_path, "warp_frames": warp_frames, "o_type": o_type}
    w.UpdateConfig(config)
    for f in range(len(in_path) - 1):
        T_curr = T[ctr]
        if ctr == 0:

            # TODO: not right
            T_prev = (1, 0, 0, 0, 0, 1, 0, 0)
        else:
            T_prev = T[ctr - 1]
        # TODO: make this work
        # T_use=imgutils.trafo_combine(T_curr,T_prev)
        if ctr == 0:
            f0 = iwx.iFrame(in_path[ctr], ctr)
            f1 = iwx.iFrame(in_path[ctr + 1], ctr)
            img0 = f0.pil_img()
            img1 = f1.pil_img()
        else:
            img0 = mor
            f1 = iwx.iFrame(in_path[ctr + 1], ctr)
            img1 = f1.pil_img()
        m = morpher()
        m.SetInputFrames(f0, f1)
        if ctr > 0:
            m.Run(T_prev)
            mor = iwx.iFrame(m.GetImgM())
            m.SetInputFrames(f0, mor)
            m.Run(T_curr)
        else:
            m.Run(T_curr)
        mor = m.GetImgM()
        w.process_images(img0, mor, ctr=ctr * warp_frames)
        ctr += 1
Beispiel #4
0
    def set_state(self, id0, id1):
        # set frames f0 and f1
        if id0 == self.f1.id() and id1 <> self.f0.id() and id1 <> self.f1.id():
            self.f0 = self.f1
            self.f1 = iwx.iFrame(self.in_path[id1], id1)

        elif id0 == self.f0.id() and id1 <> self.f0.id() and id1 <> self.f1.id():
            self.f1 = iwx.iFrame(self.in_path[id1], id1)

        elif id1 == self.f0.id() and id0 <> self.f0.id() and id0 <> self.f1.id():
            self.f1 = self.f0
            self.f0 = iwx.iFrame(self.in_path[id0], id0)

        elif id1 == self.f1.id() and id0 <> self.f0.id() and id0 <> self.f1.id():
            self.f0 = iwx.iFrame(self.in_path[id0], id0)

        elif id0 == self.f0.id() and id1 == self.f1.id():
            self.f0 = self.f0
            self.f1 = self.f1

        else:
            if id0 < 0 or id1 < 0:
                return
            self.f0 = iwx.iFrame(self.in_path[id0], id0)
            self.f1 = iwx.iFrame(self.in_path[id1], id1)
        # update GUI
        self.over0.draw(self.f0.img())
        self.over1.draw(self.f1.img())
        # TODO: hard coded initial point of zoom --make middle of frame
        self.set_zoom(self.f0, self.zoom0, wx.Point(1000, 1000))
        self.set_zoom(self.f1, self.zoom1, wx.Point(1000, 1000))
        # check validity of state and draw points
        self.trafo_valid_check()
        self.draw_pts(self.f0, self.over0)
        self.draw_pts(self.f1, self.over1)

        # update bindings!
        self.make_bindings()
Beispiel #5
0
 def set_init_state(self):
     # TODO: make id -1 default value for frame
     self.img=iwx.iFrame(self.init_img)
     self.canvas.draw(self.img.img())
Beispiel #6
0
 def set_state(self,imageFile):   
     self.img=iwx.iFrame(imageFile)
     self.canvas.draw(self.img.img())
     self.make_bindings()