Mercurial Hosting > traffic-intelligence
changeset 897:f5a49b603e8b
minor
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 14 Jun 2017 01:11:56 -0400 |
parents | 6624484c0d55 |
children | 1fc901d983ed |
files | python/cvutils.py scripts/compute-homography.py |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/python/cvutils.py Thu Jun 01 17:55:40 2017 -0400 +++ b/python/cvutils.py Wed Jun 14 01:11:56 2017 -0400 @@ -434,17 +434,18 @@ def cameraIntrinsicCalibration(path, checkerBoardSize=[6,7], secondPassSearch=False, display=False): ''' Camera calibration searches through all the images (jpg or png) located - in _path_ for matches to a checkerboard pattern of size checkboardSize. - These images should all be of the same camera with the same resolution. + in _path_ for matches to a checkerboard pattern of size checkboardSize. + These images should all be of the same camera with the same resolution. + + For best results, use an asymetric board and ensure that the image has + very high contrast, including the background. - For best results, use an asymetric board and ensure that the image has - very high contrast, including the background. Suitable checkerboard: - http://ftp.isr.ist.utl.pt/pub/roswiki/attachments/camera_calibration(2f)Tutorials(2f)StereoCalibration/check-108.png - - The code below is based off of: - https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html - Modified by Paul St-Aubin - ''' + cherckerBoardSize is the number of internal corners (7x10 squares have 6x9 internal corners) + + The code below is based off of: + https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html + Modified by Paul St-Aubin + ''' import glob, os # termination criteria
--- a/scripts/compute-homography.py Thu Jun 01 17:55:40 2017 -0400 +++ b/scripts/compute-homography.py Wed Jun 14 01:11:56 2017 -0400 @@ -92,12 +92,12 @@ if args.undistort: [map1, map2] = cvutils.computeUndistortMaps(videoImg.shape[1], videoImg.shape[0], args.undistortedImageMultiplication, np.loadtxt(args.intrinsicCameraMatrixFilename), args.distortionCoefficients) videoImg = cv2.remap(videoImg, map1, map2, interpolation=cv2.INTER_LINEAR) - print('Click on {0} points in the video frame'.format(args.nPoints)) + print('Click on {} points in the video frame'.format(args.nPoints)) plt.figure() plt.imshow(videoImg) plt.tight_layout() videoPts = np.array(plt.ginput(args.nPoints, timeout=3000)) - print('Click on {0} points in the world image'.format(args.nPoints)) + print('Click on {} points in the world image'.format(args.nPoints)) plt.figure() plt.imshow(worldImg) plt.tight_layout()