diff --git a/docs/trans/transform1.py b/docs/trans/transform1.py new file mode 100644 index 0000000..2087be7 --- /dev/null +++ b/docs/trans/transform1.py @@ -0,0 +1,19 @@ +"""Translation of image using trackbar""" +import cv2 as cv +import numpy as np + + +def trackbar(x): + M = np.float32([[1, 0, x], [0, 1, x]]) + shifted = cv.warpAffine(img, M, (w, h)) + cv.imshow('window', shifted) + +img = cv.imread('fish.jpg') +h, w = img.shape[:2] + +cv.imshow('window', img) +cv.createTrackbar('x', 'window', 0, 180, trackbar) + + +cv.waitKey(0) +cv.destroyAllWindows()