コード例 #1
0
 def generateRowAdded(self):
     if self.GEN_ROW_ADDED:
         isUpTo = True
         demot = self.loadImageRow()
         points = getPointListFromPointPath(self.points_left_path)
         point = points[0]
         slicer = PointSlicer(point, 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 = slicer.addRowSlice2Image(beforeAfterCoord=(before,
                                                               after),
                                             imgSlice=rowslicecp,
                                             isUpTo=isUpTo)
         Image.fromarray(addedimg).save(self.rowAddedImagePath)
コード例 #2
0
 def test_seammarker_addRowSlice2ImageIsUpToTrue(self):
     isUpTo = True
     demot = self.loadImageRow()
     points = getPointListFromPointPath(self.points_left_path)
     point = points[0]
     slicer = PointSlicer(point, 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 = slicer.addRowSlice2Image(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")