Commit f63c779c authored by dmMaze's avatar dmMaze
Browse files

fix #269

parent fd9c56e4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ class DeleteBlkItemsCommand(QUndoCommand):

            if mode == 1:
                is_empty = False
                msk, (x1, y1, x2, y2) = get_block_mask(blkitem.absBoundingRect(), mask_array, blkitem.rotation())
                msk, xyxy = get_block_mask(blkitem.absBoundingRect(), mask_array, blkitem.rotation())
                if msk is None:
                    is_empty = True
                if is_empty:
@@ -96,6 +96,7 @@ class DeleteBlkItemsCommand(QUndoCommand):
                    self.inpaint_rect_lst.append(None)
                    self.mask_pnts.append(None)
                else:
                    x1, y1, x2, y2 = xyxy
                    self.mask_pnts.append(np.where(msk))
                    self.undo_img_list.append(np.copy(img_array[y1: y2, x1: x2]))
                    self.redo_img_list.append(np.copy(original_array[y1: y2, x1: x2]))
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ def get_block_mask(xywh: List, mask_array: np.ndarray, angle: int):
            itmsk = np.zeros((y2 - y1, x2 - x1), np.uint8)
            
            cv2.fillPoly(itmsk, poly.reshape(-1, 4, 2), color=(255))
            px1, px2, py1, py2 = 0, im_w, 0, im_h
            px1, px2, py1, py2 = 0, itmsk.shape[1], 0, itmsk.shape[0]
            if x1 < 0:
                px1 = -x1
                x1 = 0