Skip to content

Commit 4c020d6

Browse files
committed
reg: add python sample
1 parent 9608d31 commit 4c020d6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

modules/reg/samples/reg_shift.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/python
2+
3+
import cv2
4+
import numpy as np
5+
import sys
6+
7+
img1 = cv2.imread(sys.argv[1])
8+
img1 = img1.astype(np.float32)
9+
shift = np.array([5., 5.])
10+
mapTest = cv2.reg.MapShift(shift)
11+
12+
img2 = mapTest.warp(img1)
13+
14+
mapper = cv2.reg.MapperGradShift()
15+
mappPyr = cv2.reg.MapperPyramid(mapper)
16+
17+
resMap = mappPyr.calculate(img1, img2)
18+
mapShift = cv2.reg.MapTypeCaster_toShift(resMap)
19+
20+
print(mapShift.getShift())

0 commit comments

Comments
 (0)