summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Miller2017-04-03 09:51:42 -0500
committerMartin Miller2017-04-03 09:51:42 -0500
commit05a04acf46a0a5624e019e4dc947cd3cd587a80b (patch)
tree1e2e6a6fda94d1a64c9f7bed5f160ae15da32e12 /tests
parent997967da8e01216b3c655613d875af30fdf2d0c8 (diff)
downloadrefslam-05a04acf46a0a5624e019e4dc947cd3cd587a80b.zip
refslam-05a04acf46a0a5624e019e4dc947cd3cd587a80b.tar.gz
Add drawMatches
Diffstat (limited to 'tests')
-rwxr-xr-xtests/drawMatches.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/drawMatches.py b/tests/drawMatches.py
new file mode 100755
index 0000000..d369e16
--- /dev/null
+++ b/tests/drawMatches.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python2.7
+# drawMatches.py
+# Martin Miller
+# Created: 2017/04/02
+"""Reads in a file of matches and plots them onto the image
+Usage: drawMatches image matches
+"""
+import cv2
+import sys
+
+def main():
+ imbayer = cv2.imread(sys.argv[1],-1)
+ im = cv2.cvtColor(imbayer, cv2.cv.CV_BayerBG2BGR,3)
+
+ with open(sys.argv[2],'r') as fin:
+ for line in fin:
+ id,xs,ys,xr,yr = map(int,line.strip().split(','))
+ cv2.circle(im,(xs,ys),4,(0,255,0),-1)
+ cv2.circle(im,(xr,yr),4,(0,0,255),-1)
+ cv2.imshow("Matches", im)
+ cv2.waitKey(0)
+ cv2.imwrite("matches.jpg",im)
+
+if __name__=='__main__':
+ main()
+