Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/cvutils.py @ 1205:3905b393ade0
kitti loading code seems to be working
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 22 Mar 2023 23:29:09 -0400 |
| parents | 2f89dc3d99e5 |
| children | 4cd8ace3552f |
comparison
equal
deleted
inserted
replaced
| 1204:a12d126346ff | 1205:3905b393ade0 |
|---|---|
| 533 width = img.shape[1] | 533 width = img.shape[1] |
| 534 height = img.shape[0] | 534 height = img.shape[0] |
| 535 [map1, map2] = computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients) | 535 [map1, map2] = computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients) |
| 536 return cv2.remap(img, map1, map2, interpolation=interpolation) | 536 return cv2.remap(img, map1, map2, interpolation=interpolation) |
| 537 | 537 |
| 538 def cartesian2Homogeneous(m): | |
| 539 'Transforms n x m matrix to n x (m+1) by adding last column of 1s' | |
| 540 homoM = ones((m.shape[0], m.shape[1]+1)) | |
| 541 homoM[:,:-1] = m | |
| 542 return homoM | |
| 543 | |
| 538 def homographyProject(points, homography, output3D = False): | 544 def homographyProject(points, homography, output3D = False): |
| 539 '''Returns the coordinates of the points (2xN array) projected through homography''' | 545 '''Returns the coordinates of the points (2xN array) projected through homography''' |
| 540 if points.shape[0] != 2: | 546 if points.shape[0] != 2: |
| 541 raise Exception('points of dimension {}'.format(points.shape)) | 547 raise Exception('points of dimension {}'.format(points.shape)) |
| 542 | 548 |
