Exemple #1
0
 def generateBacktrackSliceMatrix(self):
     if self.GEN_SLICE_BACKTRACK_MAT:
         vietcp = self.loadImageCol()
         vietslice = vietcp[:, 550:600]
         carver = SeamMarker(img=vietcp)
         emap = carver.calc_energy(vietslice.copy())
         mat, backtrack = carver.minimum_seam(img=vietslice, emap=emap)
         np.save(self.slicemat_backtrack_path, backtrack)
Exemple #2
0
 def generateSliceMatrix(self):
     if self.GEN_SLICE_MAT:
         img = self.loadImageCol()
         viet = np.array(img.copy(), dtype=np.uint8)
         vietslice = viet[:, 550:600]
         carver = SeamMarker(img=None)
         emap = carver.calc_energy(viet.copy())
         mat, backtrack = carver.minimum_seam(img=vietslice.copy(),
                                              emap=emap)
         np.save(self.slicemat_path, mat)
Exemple #3
0
    def test_seammarker_minimum_seam_backtrack(self):
        backtrackPath = os.path.join(self.npdir, 'vietSliceBacktrack.npy')
        compBacktrack = np.load(backtrackPath)

        vietcp = self.loadImageCol()
        vietslice = vietcp[:, 550:600]
        carver = SeamMarker(img=vietcp)
        mat, backtrack = carver.minimum_seam(img=vietslice)
        self.compareArrays(
            backtrack, compBacktrack,
            "Point carver minimum seam function emap not given, "
            "checking backtrack")
Exemple #4
0
 def test_seammarker_minimum_seam_emap_matrix(self):
     "tests the minimum seam function of pointcarver"
     matrixPath = os.path.join(self.npdir, "vietSliceMatrix.npy")
     compmatrix = np.load(matrixPath)
     vietImcp = self.loadImageCol()
     vietslice = vietImcp[:, 550:600]
     carver = SeamMarker(img=vietImcp)
     emap = carver.calc_energy(vietslice)
     mat, backtrack = carver.minimum_seam(img=vietslice, emap=emap)
     self.compareArrays(
         mat, compmatrix,
         "Point carver minimum seam function emap given, checking matrix")