comparison scripts/compute-homography.py @ 443:51810d737d86

timeout in compute-homography.py for Paul
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 27 Jan 2014 01:21:56 -0500
parents 5f75d6c23ed5
children 6551a3cf1750
comparison
equal deleted inserted replaced
442:eb8baa080470 443:51810d737d86
83 worldImg = plt.imread(options['-w']) 83 worldImg = plt.imread(options['-w'])
84 videoImg = plt.imread(options['-i']) 84 videoImg = plt.imread(options['-i'])
85 print('Click on {0} points in the video frame'.format(nPoints)) 85 print('Click on {0} points in the video frame'.format(nPoints))
86 plt.figure() 86 plt.figure()
87 plt.imshow(videoImg) 87 plt.imshow(videoImg)
88 videoPts = np.array(plt.ginput(nPoints)) 88 videoPts = np.array(plt.ginput(nPoints, timeout=3000))
89 print('Click on {0} points in the world image'.format(nPoints)) 89 print('Click on {0} points in the world image'.format(nPoints))
90 plt.figure() 90 plt.figure()
91 plt.imshow(worldImg) 91 plt.imshow(worldImg)
92 worldPts = unitsPerPixel*np.array(plt.ginput(nPoints)) 92 worldPts = unitsPerPixel*np.array(plt.ginput(nPoints, timeout=3000))
93 plt.close('all') 93 plt.close('all')
94 homography, mask = cv2.findHomography(videoPts, worldPts) 94 homography, mask = cv2.findHomography(videoPts, worldPts)
95 # save the points in file 95 # save the points in file
96 f = open('point-correspondences.txt', 'a') 96 f = open('point-correspondences.txt', 'a')
97 np.savetxt(f, worldPts.T) 97 np.savetxt(f, worldPts.T)