Mercurial Hosting > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
158:2d7c6d767a39 | 159:115f7f90286d |
---|---|
41 #draw.line([p1.x, p1.y, p2.x, p2.y], pen) | 41 #draw.line([p1.x, p1.y, p2.x, p2.y], pen) |
42 del draw | 42 del draw |
43 | 43 |
44 #out = utils.openCheck(resultFilename) | 44 #out = utils.openCheck(resultFilename) |
45 img.save(resultFilename) | 45 img.save(resultFilename) |
46 | |
47 def matlab2PointCorrespondences(filename): | |
48 '''Loads and converts the point correspondences saved | |
49 by the matlab camera calibration tool''' | |
50 from numpy.lib.io import loadtxt, savetxt | |
51 from numpy.lib.function_base import append | |
52 points = loadtxt(filename, delimiter=',') | |
53 savetxt(utils.removeExtension(filename)+'-point-correspondences.txt',append(points[:,:2].T, points[:,3:].T, axis=0)) | |
46 | 54 |
47 def computeHomography(srcPoints, dstPoints, method=0, ransacReprojThreshold=0.0): | 55 def computeHomography(srcPoints, dstPoints, method=0, ransacReprojThreshold=0.0): |
48 '''Returns the homography matrix mapping from srcPoints to dstPoints (dimension Nx2)''' | 56 '''Returns the homography matrix mapping from srcPoints to dstPoints (dimension Nx2)''' |
49 #cvSrcPoints = arrayToCvMat(srcPoints); | 57 #cvSrcPoints = arrayToCvMat(srcPoints); |
50 #cvDstPoints = arrayToCvMat(dstPoints); | 58 #cvDstPoints = arrayToCvMat(dstPoints); |