def generateRowAdded(self): if self.GEN_ROW_ADDED: isUpTo = True demot = self.loadImageRow() points = getPointListFromPointPath(self.points_left_path) point = points[0] marker = SeamMarker(demot) before = 0 after = 62 rowslice = os.path.join(self.imagedir, 'rowslice.png') rowslice = np.array(Image.open(rowslice)) rowslicecp = rowslice.copy() rowslicehalf = rowslicecp.shape[0] // 2 rowslicecp[rowslicehalf:rowslicehalf + 3, :] = 255 addedimg = marker.addRowSlice2Image(demot, point, beforeAfterCoord=(before, after), imgSlice=rowslicecp, isUpTo=isUpTo) Image.fromarray(addedimg).save(self.rowAddedImagePath)
def test_seammarker_addRowSlice2ImageIsUpToTrue(self): isUpTo = True demot = self.loadImageRow() points = getPointListFromPointPath(self.points_left_path) point = points[0] marker = SeamMarker(demot) before = 0 after = 62 rowslice = os.path.join(self.imagedir, 'rowslice.png') rowslice = np.array(Image.open(rowslice)) rowslicecp = rowslice.copy() rowslicehalf = rowslicecp.shape[0] // 2 rowslicecp[rowslicehalf:rowslicehalf + 3, :] = 255 addedimg = marker.addRowSlice2Image(demot, point, beforeAfterCoord=(before, after), imgSlice=rowslicecp, isUpTo=isUpTo) compimg = os.path.join(self.imagedir, 'rowAddedImage.png') compimg = np.array(Image.open(compimg)) self.compareArrays(addedimg, compimg, "Added row does not give added image")