Python cv2.BORDER_REFLECT101 Examples
The following are 2
code examples of cv2.BORDER_REFLECT101().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cv2
, or try the search function
.
Example #1
Source File: tiles.py From segmentation-networks-benchmark with MIT License | 6 votes |
def split(self, image, borderType=cv2.BORDER_REFLECT101, value=0): assert image.shape[0] == self.image_height assert image.shape[1] == self.image_width orig_shape_len = len(image.shape) image = cv2.copyMakeBorder(image, self.margin_top, self.margin_bottom, self.margin_left, self.margin_right, borderType=borderType, value=value) # This check recovers possible lack of last dummy dimension for single-channel images if len(image.shape) != orig_shape_len: image = np.expand_dims(image,axis=-1) tiles = [] for x, y, tile_width, tile_height in self.crops: tile = image[y:y + tile_height, x:x + tile_width].copy() assert tile.shape[0] == self.tile_size assert tile.shape[1] == self.tile_size tiles.append(tile) return tiles
Example #2
Source File: tiles.py From segmentation-networks-benchmark with MIT License | 6 votes |
def cut_patch(self, image, slice_index, borderType=cv2.BORDER_REFLECT101, value=0): assert image.shape[0] == self.image_height assert image.shape[1] == self.image_width orig_shape_len = len(image.shape) image = cv2.copyMakeBorder(image, self.margin_top, self.margin_bottom, self.margin_left, self.margin_right, borderType=borderType, value=value) # This check recovers possible lack of last dummy dimension for single-channel images if len(image.shape) != orig_shape_len: image = np.expand_dims(image,axis=-1) x, y, tile_width, tile_height = self.crops[slice_index] tile = image[y:y + tile_height, x:x + tile_width].copy() assert tile.shape[0] == self.tile_size assert tile.shape[1] == self.tile_size return tile