diff options
Diffstat (limited to 'tests/drawMatches.py')
-rwxr-xr-x | tests/drawMatches.py | 26 |
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() + |