cv3.transform.yshift
- cv3.transform.yshift(img, y, border=0, value=None, rel=None)[source]
Shift image vertically by y pixels.
- Parameters:
img (numpy.ndarray) – Input image.
y (int or float) – Shift in y direction.
border (int or str, optional) – Border type. Can be one of: ‘constant’, ‘replicate’, ‘reflect’, ‘wrap’, ‘default’ or OpenCV flags. Defaults to cv2.BORDER_CONSTANT.
value – Border color value for constant border type. Defaults to None.
rel (bool, optional) – Whether to interpret y as relative value. Defaults to None.
- Returns:
Vertically shifted image.
- Return type:
numpy.ndarray
Example
>>> import cv3 >>> import numpy as np >>> # Create a simple image >>> img = np.zeros((100, 100, 3), dtype=np.uint8) >>> img[25:75, 25:75] = [255, 255, 255] # White square >>> # Shift by 10 pixels in y direction >>> shifted = cv3.yshift(img, 10)