コード例 #1
0
 def generateColumnAdded(self):
     if self.GEN_COL_ADDED:
         isUpTo = False
         viet = self.loadImageCol()
         points = getPointListFromPointPath(self.points_down_path)
         point = points[0]
         slicer = PointSlicer(point, viet)
         before = 138
         after = 180
         compcolslice = os.path.join(self.imagedir, 'colslice.png')
         compimg = np.array(Image.open(compcolslice))
         compcp = compimg.copy()
         compcphalf = compcp.shape[1] // 2
         compcp[:, compcphalf:compcphalf + 3] = 255
         # pdb.set_trace()
         addedimg = slicer.addColumnSlice2Image(beforeAfterCoord=(before,
                                                                  after),
                                                imgSlice=compcp,
                                                isUpTo=isUpTo)
         Image.fromarray(addedimg).save(self.columnAddedImagePath)
コード例 #2
0
 def test_pointslicer_addColumnSlice2ImageIsUpToFalse(self):
     isUpTo = False
     viet = self.loadImageCol()
     points = getPointListFromPointPath(self.points_down_path)
     point = points[0]
     slicer = PointSlicer(point, viet)
     before = 138
     after = 180
     compcolslice = os.path.join(self.imagedir, 'colslice.png')
     compimg = np.array(Image.open(compcolslice))
     compcp = compimg.copy()
     compcphalf = compcp.shape[1] // 2
     compcp[:, compcphalf:compcphalf + 3] = 255
     # pdb.set_trace()
     addedimg = slicer.addColumnSlice2Image(beforeAfterCoord=(before,
                                                              after),
                                            imgSlice=compcp,
                                            isUpTo=isUpTo)
     compimg = os.path.join(self.imagedir, 'columnAddedImage.png')
     compimg = np.array(Image.open(compimg))
     self.compareArrays(
         addedimg, compimg,
         "Added column does not give the expected added image")