def debugMatches():
# Debug module.
# from matplotlib import pyplot as plt
markImage = cv2.imread('./clock.png')
sceneImage = cv2.imread('./clock_in_scene.png')
# Init PM.
pm = GetPMatrix(markImage)
# Get kp1, kp2, dst, goodMatches, [draw_params].
dst = pm.getMatches(sceneImage)
if dst is None:
exit()
# Draw circles and lines.
img3 = pm.drawMatches(markImage, sceneImage)
# # Get ret, mtx, dist, rvecs, tvecs
tmp = None
for i in range(30):
tmp = pm.getP(dst)
if tmp is None:
exit()
print i
mtx, dist, rvec, tvec = tmp
# Draw Box
h,w = markImage.shape[:2]
img3[:,w:] = pm.drawBox(img3[:,w:])
h2,w2 = sceneImage.shape[:2]
glP = pm.getGLP(w2, h2)
glM = pm.getGLM()
print 'mtx -------------'
print mtx
print 'dist ------------'
print dist
print 'rvec -----------'
print rvec
print 'tvec -----------'
print tvec
print 'glP ------------'
print glP
print 'glM ------------'
print glM
img3 = cv2.cvtColor(img3, cv2.COLOR_BGR2RGB)
plt.figure('Matches test.'), plt.imshow(img3)
评论列表
文章目录