Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/compute-homography.py @ 699:8dd738fc7375
improvement by Adrien Lessard to choose output homography filename
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 17 Jul 2015 14:28:59 -0400 |
| parents | fe34c0f79c32 |
| children | bf4a1790cfac |
comparison
equal
deleted
inserted
replaced
| 679:576d9ea4b41a | 699:8dd738fc7375 |
|---|---|
| 24 parser.add_argument('--tsai', dest = 'tsaiCameraFilename', help = 'name of the text file containing the camera parameter following the pinhole camera model (Lund format)') # caution, this is Aliaksei's format | 24 parser.add_argument('--tsai', dest = 'tsaiCameraFilename', help = 'name of the text file containing the camera parameter following the pinhole camera model (Lund format)') # caution, this is Aliaksei's format |
| 25 parser.add_argument('-i', dest = 'videoFrameFilename', help = 'filename of the video frame') | 25 parser.add_argument('-i', dest = 'videoFrameFilename', help = 'filename of the video frame') |
| 26 parser.add_argument('-w', dest = 'worldFilename', help = 'filename of the aerial photo/ground map') | 26 parser.add_argument('-w', dest = 'worldFilename', help = 'filename of the aerial photo/ground map') |
| 27 parser.add_argument('-n', dest = 'nPoints', help = 'number of corresponding points to input', default = 4, type = int) | 27 parser.add_argument('-n', dest = 'nPoints', help = 'number of corresponding points to input', default = 4, type = int) |
| 28 parser.add_argument('-u', dest = 'unitsPerPixel', help = 'number of units per pixel', default = 1., type = float) | 28 parser.add_argument('-u', dest = 'unitsPerPixel', help = 'number of units per pixel', default = 1., type = float) |
| 29 parser.add_argument('-o', dest = 'homographyFilename', help = 'filename of the homography matrix', default = 'homography.txt') | |
| 29 parser.add_argument('--display', dest = 'displayPoints', help = 'display original and projected points on both images', action = 'store_true') | 30 parser.add_argument('--display', dest = 'displayPoints', help = 'display original and projected points on both images', action = 'store_true') |
| 30 parser.add_argument('--intrinsic', dest = 'intrinsicCameraMatrixFilename', help = 'name of the intrinsic camera file') | 31 parser.add_argument('--intrinsic', dest = 'intrinsicCameraMatrixFilename', help = 'name of the intrinsic camera file') |
| 31 parser.add_argument('--distortion-coefficients', dest = 'distortionCoefficients', help = 'distortion coefficients', nargs = '*', type = float) | 32 parser.add_argument('--distortion-coefficients', dest = 'distortionCoefficients', help = 'distortion coefficients', nargs = '*', type = float) |
| 32 parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float) | 33 parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float) |
| 33 parser.add_argument('--undistort', dest = 'undistort', help = 'undistort the video (because features have been extracted that way', action = 'store_true') | 34 parser.add_argument('--undistort', dest = 'undistort', help = 'undistort the video (because features have been extracted that way', action = 'store_true') |
| 111 np.savetxt(f, worldPts.T) | 112 np.savetxt(f, worldPts.T) |
| 112 np.savetxt(f, videoPts.T) | 113 np.savetxt(f, videoPts.T) |
| 113 f.close() | 114 f.close() |
| 114 | 115 |
| 115 if homography.size>0: | 116 if homography.size>0: |
| 116 np.savetxt('homography.txt',homography) | 117 np.savetxt(args.homographyFilename,homography) |
| 117 | 118 |
| 118 if args.displayPoints and args.videoFrameFilename is not None and args.worldFilename is not None and homography.size>0 and args.tsaiCameraFilename is None: | 119 if args.displayPoints and args.videoFrameFilename is not None and args.worldFilename is not None and homography.size>0 and args.tsaiCameraFilename is None: |
| 119 worldImg = cv2.imread(args.worldFilename) | 120 worldImg = cv2.imread(args.worldFilename) |
| 120 videoImg = cv2.imread(args.videoFrameFilename) | 121 videoImg = cv2.imread(args.videoFrameFilename) |
| 121 if args.undistort: | 122 if args.undistort: |
