save jsom project file
This commit is contained in:
@@ -5,6 +5,7 @@ import cv2 as cv
|
||||
import numpy as np
|
||||
import argparse
|
||||
import mimetypes
|
||||
import json
|
||||
from pathlib import Path
|
||||
from ar_tag_pose.utils import to_board_pose_euler
|
||||
from detector_board import BoardDetector
|
||||
@@ -213,28 +214,41 @@ def main():
|
||||
ap.add_argument("-o", "--output",
|
||||
action='store_true',
|
||||
help="Enable video output")
|
||||
args = vars(ap.parse_args())
|
||||
args = ap.parse_args()
|
||||
var_args = vars(args)
|
||||
|
||||
# save project file
|
||||
prj = {}
|
||||
for arg in var_args:
|
||||
value = getattr(args, arg)
|
||||
prj[arg] = value
|
||||
|
||||
with open(f"{RESULTS_FOLDER}/{var_args["name"]}.json", 'w') as fp:
|
||||
json.dump(prj, fp, indent=4)
|
||||
|
||||
# Create BoardDetector
|
||||
msg_size = 3
|
||||
board_detector = []
|
||||
bid_start = args["board_id"]
|
||||
if "Aruco" in args["type"]:
|
||||
for n in range(args["num_boards"]):
|
||||
bid_start = var_args["board_id"]
|
||||
if "Aruco" in var_args["type"]:
|
||||
for n in range(var_args["num_boards"]):
|
||||
board_id = f"{bid_start+n:0{msg_size}d}"
|
||||
det = BoardDetectorAruco(f"{args["name"]}-{n}", args["dict_type"], board_id, (args["board_width"], args["board_height"]))
|
||||
det = BoardDetectorAruco(f"{var_args["name"]}-{n}", var_args["dict_type"], board_id, (var_args["board_width"], var_args["board_height"]))
|
||||
board_detector.append(det)
|
||||
elif "Charuco" in args["type"]:
|
||||
for n in range(args["num_boards"]):
|
||||
elif "Charuco" in var_args["type"]:
|
||||
for n in range(var_args["num_boards"]):
|
||||
board_id = f"{bid_start+n:0{msg_size}d}"
|
||||
det = BoardDetectorCharuco(f"{args["name"]}-{n}", args["dict_type"], board_id, (args["board_width"], args["board_height"]))
|
||||
det = BoardDetectorCharuco(f"{var_args["name"]}-{n}", var_args["dict_type"], board_id, (var_args["board_width"], var_args["board_height"]))
|
||||
board_detector.append(det)
|
||||
|
||||
# Create output
|
||||
out_file = None
|
||||
if args["output"]:
|
||||
out_file = f"{args["name"]}.mp4"
|
||||
if var_args["output"]:
|
||||
out_file = f"{var_args["name"]}.mp4"
|
||||
|
||||
detector = Detector(args["source"], board_detector, out_file=out_file)
|
||||
detector.board_image_generate(margin_length=args["margin_length"])
|
||||
# Create Detector app
|
||||
detector = Detector(var_args["source"], board_detector, out_file=out_file)
|
||||
detector.board_image_generate(margin_length=var_args["margin_length"])
|
||||
detector.calibrate_load()
|
||||
detector.process()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user