Created
March 12, 2019 20:20
-
-
Save ahmedbilal/ca5015d6630769e3bba8d4b8acb2758c to your computer and use it in GitHub Desktop.
Verify annotation[.txt] obtained from cvat_xml_to_txt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import os | |
import argparse | |
arg_parser = argparse.ArgumentParser() | |
arg_parser.add_argument("--input", type=str, help="Input annotation[.txt] file path", | |
dest="input_file", required=True) | |
args = arg_parser.parse_args() | |
with open(args.input_file, "r") as f: | |
for line in f.readlines(): | |
filename, xa, ya, xb, yb, label = line.split(",") | |
xa = int(xa) | |
ya = int(ya) | |
xb = int(xb) | |
yb = int(yb) | |
frame = cv2.imread(filename) | |
frame = cv2.imread(filename) | |
frame = cv2.rectangle(frame, (xa, ya), (xb, yb), (0, 100, 223), 5) | |
cv2.imshow(filename, frame) | |
if cv2.waitKey(25) & 0xFF == ord('q'): | |
break | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment