Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/compute-homography.py @ 773:bf4a1790cfac dev
minor bug and improvements
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 01 Feb 2016 16:10:26 -0500 |
| parents | 0421a5a0072c |
| children | 1fdafa9f6bf4 |
comparison
equal
deleted
inserted
replaced
| 772:e92a96f2bdd3 | 773:bf4a1790cfac |
|---|---|
| 98 [map1, map2] = cvutils.computeUndistortMaps(videoImg.shape[1], videoImg.shape[0], args.undistortedImageMultiplication, np.loadtxt(args.intrinsicCameraMatrixFilename), args.distortionCoefficients) | 98 [map1, map2] = cvutils.computeUndistortMaps(videoImg.shape[1], videoImg.shape[0], args.undistortedImageMultiplication, np.loadtxt(args.intrinsicCameraMatrixFilename), args.distortionCoefficients) |
| 99 videoImg = cv2.remap(videoImg, map1, map2, interpolation=cv2.INTER_LINEAR) | 99 videoImg = cv2.remap(videoImg, map1, map2, interpolation=cv2.INTER_LINEAR) |
| 100 print('Click on {0} points in the video frame'.format(args.nPoints)) | 100 print('Click on {0} points in the video frame'.format(args.nPoints)) |
| 101 plt.figure() | 101 plt.figure() |
| 102 plt.imshow(videoImg) | 102 plt.imshow(videoImg) |
| 103 plt.tight_layout() | |
| 103 videoPts = np.array(plt.ginput(args.nPoints, timeout=3000)) | 104 videoPts = np.array(plt.ginput(args.nPoints, timeout=3000)) |
| 104 print('Click on {0} points in the world image'.format(args.nPoints)) | 105 print('Click on {0} points in the world image'.format(args.nPoints)) |
| 105 plt.figure() | 106 plt.figure() |
| 106 plt.imshow(worldImg) | 107 plt.imshow(worldImg) |
| 108 plt.tight_layout() | |
| 107 worldPts = args.unitsPerPixel*np.array(plt.ginput(args.nPoints, timeout=3000)) | 109 worldPts = args.unitsPerPixel*np.array(plt.ginput(args.nPoints, timeout=3000)) |
| 108 plt.close('all') | 110 plt.close('all') |
| 109 homography, mask = cv2.findHomography(videoPts, worldPts) | 111 homography, mask = cv2.findHomography(videoPts, worldPts) |
| 110 # save the points in file | 112 # save the points in file |
| 111 f = open('point-correspondences.txt', 'a') | 113 f = open('point-correspondences.txt', 'a') |
