Mercurial > hg > nsaunier > traffic-intelligence
diff 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 |
line wrap: on
line diff
--- a/trafficintelligence/cvutils.py Wed Mar 22 22:01:12 2023 -0400 +++ b/trafficintelligence/cvutils.py Wed Mar 22 23:29:09 2023 -0400 @@ -535,6 +535,12 @@ [map1, map2] = computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients) return cv2.remap(img, map1, map2, interpolation=interpolation) +def cartesian2Homogeneous(m): + 'Transforms n x m matrix to n x (m+1) by adding last column of 1s' + homoM = ones((m.shape[0], m.shape[1]+1)) + homoM[:,:-1] = m + return homoM + def homographyProject(points, homography, output3D = False): '''Returns the coordinates of the points (2xN array) projected through homography''' if points.shape[0] != 2:
