Mercurial > hg > nsaunier > traffic-intelligence
comparison python/cvutils.py @ 897:f5a49b603e8b
minor
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 14 Jun 2017 01:11:56 -0400 |
| parents | 739acd338cc0 |
| children | 81ee5aaf213d |
comparison
equal
deleted
inserted
replaced
| 896:6624484c0d55 | 897:f5a49b603e8b |
|---|---|
| 432 invMap2[y,x] = res[1] | 432 invMap2[y,x] = res[1] |
| 433 return invMap1, invMap2 | 433 return invMap1, invMap2 |
| 434 | 434 |
| 435 def cameraIntrinsicCalibration(path, checkerBoardSize=[6,7], secondPassSearch=False, display=False): | 435 def cameraIntrinsicCalibration(path, checkerBoardSize=[6,7], secondPassSearch=False, display=False): |
| 436 ''' Camera calibration searches through all the images (jpg or png) located | 436 ''' Camera calibration searches through all the images (jpg or png) located |
| 437 in _path_ for matches to a checkerboard pattern of size checkboardSize. | 437 in _path_ for matches to a checkerboard pattern of size checkboardSize. |
| 438 These images should all be of the same camera with the same resolution. | 438 These images should all be of the same camera with the same resolution. |
| 439 | 439 |
| 440 For best results, use an asymetric board and ensure that the image has | 440 For best results, use an asymetric board and ensure that the image has |
| 441 very high contrast, including the background. Suitable checkerboard: | 441 very high contrast, including the background. |
| 442 http://ftp.isr.ist.utl.pt/pub/roswiki/attachments/camera_calibration(2f)Tutorials(2f)StereoCalibration/check-108.png | 442 |
| 443 | 443 cherckerBoardSize is the number of internal corners (7x10 squares have 6x9 internal corners) |
| 444 The code below is based off of: | 444 |
| 445 https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html | 445 The code below is based off of: |
| 446 Modified by Paul St-Aubin | 446 https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html |
| 447 ''' | 447 Modified by Paul St-Aubin |
| 448 ''' | |
| 448 import glob, os | 449 import glob, os |
| 449 | 450 |
| 450 # termination criteria | 451 # termination criteria |
| 451 criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) | 452 criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) |
| 452 | 453 |
