ptsB = numpy.float32([kp2[m.trainIdx].pt for m in goodMatch]).reshape(-1, 1, 2)
ransacReprojThreshold = 4
print ‘findHomography_begin’
H, status =cv2.findHomography(ptsA,ptsB,cv2.RANSAC,ransacReprojThreshold);
print(H)
print ‘findHomography’
imgOut = cv2.warpPerspective(img2, HT, (img1.shape[1],img1.shape[0]),flags=cv2.INTER_LINEAR + cv2.WARP_INVERSE_MAP)
print ‘warpPerspective’
return imgOut,H,status
print ‘begin’
image_dir = image_file(‘/Users/xxx/downloads/data’)
save_path = “/Users/xxx/downloads/results”
numbers = 0
K = numpy.array([[3.95, 0, 2.4], [0, 3.95, 1.8], [0, 0, 1]])
result = cv2.imread(image_dir[0])
for numbers in range(len(image_dir)-1):
print “this is the circle %d of image_dir” %(numbers)
if len(image_dir) < 1:
print "not enough images"
else :
img1 = result;
img2 = cv2.imread(image_dir[numbers+1])
result, H, _ = siftImageAlignment(img1, img2)
save_file(image_dir[numbers+1],result,save_path)
print 'result'
print(“final end”)
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-63299-2.html
那不是对你秀的
备好导弹时刻准备着