1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()
|