reg_shift.py 405 B

1234567891011121314151617181920
  1. #!/usr/bin/python
  2. import cv2 as cv
  3. import numpy as np
  4. import sys
  5. img1 = cv.imread(sys.argv[1])
  6. img1 = img1.astype(np.float32)
  7. shift = np.array([5., 5.])
  8. mapTest = cv.reg_MapShift(shift)
  9. img2 = mapTest.warp(img1)
  10. mapper = cv.reg_MapperGradShift()
  11. mappPyr = cv.reg_MapperPyramid(mapper)
  12. resMap = mappPyr.calculate(img1, img2)
  13. mapShift = cv.reg.MapTypeCaster_toShift(resMap)
  14. print(mapShift.getShift())