diff --git a/BoundingBoxAugmenters.py b/BoundingBoxAugmenters.py index 9a5ac16..76e461c 100755 --- a/BoundingBoxAugmenters.py +++ b/BoundingBoxAugmenters.py @@ -382,12 +382,14 @@ def horizontalFlip(self, frame = None, boundingBoxes = None): raise TypeError("ERROR: Bounding boxes parameter has to be of type list.") # Local variables localFrame = frame[:, :, :] + # Copy of Local variables + tmpFrame = localFrame.copy() # Flip only the pixels inside the bounding boxes for bndbox in boundingBoxes: # Decode bounding box ix, iy, x, y = bndbox # Flip ROI - roi = cv2.flip(localFrame[iy:y, ix:x, :], 1) + roi = cv2.flip(tmpFrame[iy:y, ix:x, :], 1) localFrame[iy:y, ix:x, :] = roi return localFrame @@ -410,12 +412,14 @@ def verticalFlip(self, frame = None, boundingBoxes = None): raise TypeError("ERROR: Bounding boxes parameter has to be of type list.") # Local variables localFrame = frame[:, :, :] + # Copy of Local variables + tmpFrame = localFrame.copy() # Flip only the pixels inside the bounding boxes for bndbox in boundingBoxes: # Decode bounding box ix, iy, x, y = bndbox - # Flip ROI - roi = cv2.flip(localFrame[iy:y, ix:x, :], 0) + # Flip ROI in Local variables + roi = cv2.flip(tmpFrame[iy:y, ix:x, :], 0) localFrame[iy:y, ix:x, :] = roi return localFrame diff --git a/BoundingBoxAugmenters_test.py b/BoundingBoxAugmenters_test.py index afe9c62..36ddaa2 100755 --- a/BoundingBoxAugmenters_test.py +++ b/BoundingBoxAugmenters_test.py @@ -179,7 +179,7 @@ def test_horizontal_flip(self): def test_vertical_flip(self): if (self.visualize): - # Perform horizontal flip. + # Perform vertical flip. frame = self.augmenter.verticalFlip(frame = self.frame.copy(), boundingBoxes = self.bndboxes) # Visualization.