Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 159:115f7f90286d
updated calibration-translation and added function to convert point correspondences
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 12 Sep 2011 16:38:47 -0400 |
parents | 2eef5620c0b3 |
children | b0719b3ad3db |
line wrap: on
line diff
--- a/python/cvutils.py Fri Sep 09 19:23:11 2011 -0400 +++ b/python/cvutils.py Mon Sep 12 16:38:47 2011 -0400 @@ -44,6 +44,14 @@ #out = utils.openCheck(resultFilename) img.save(resultFilename) +def matlab2PointCorrespondences(filename): + '''Loads and converts the point correspondences saved + by the matlab camera calibration tool''' + from numpy.lib.io import loadtxt, savetxt + from numpy.lib.function_base import append + points = loadtxt(filename, delimiter=',') + savetxt(utils.removeExtension(filename)+'-point-correspondences.txt',append(points[:,:2].T, points[:,3:].T, axis=0)) + def computeHomography(srcPoints, dstPoints, method=0, ransacReprojThreshold=0.0): '''Returns the homography matrix mapping from srcPoints to dstPoints (dimension Nx2)''' #cvSrcPoints = arrayToCvMat(srcPoints);