Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

opencv shift image python

import cv2
import numpy as np

img = cv2.imread('images/input.jpg')
num_rows, num_cols = img.shape[:2]

#move 70 cols to right and 110 rows down
translation_matrix = np.float32([ [1,0,70], [0,1,110] ])
img_translation = cv2.warpAffine(img, translation_matrix, (num_cols, num_rows))
cv2.imshow('Translation', img_translation)
cv2.waitKey()
Source by subscription.packtpub.com #
 
PREVIOUS NEXT
Tagged: #opencv #shift #image #python
ADD COMMENT
Topic
Name
8+9 =