in projects/vision-ai-edge-platform/camera-client/camera_client.py [0:0]
def parse_args():
"""Parses arguments.
Returns:
Parsed arguments.
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--log",
default="warning",
choices=["debug", "info", "warning", "error", "critical"],
help="Provide logging level. Example --log debug, default=warning",
)
parser.add_argument(
"--protocol",
default="genicam",
choices=["genicam", "onvif", "rtsp", "usb", "file"],
help="Camera or image source connectivity method",
)
parser.add_argument("--device_id", help="Camera ID string", default="1")
parser.add_argument(
"--address",
default=None,
type=str,
help="Camera address to connect to. For Genicam, integer from 0-n",
)
parser.add_argument(
"--cam_user", default="", type=str, help="Camera access username"
)
parser.add_argument(
"--cam_passwd", default="", type=str, help="Camera access password"
)
parser.add_argument(
"--gentl",
default="GenTL/FLIR_GenTL_Ubuntu_20_04_x86_64.cti",
type=str,
help="Camera Gen_TL file path",
)
parser.add_argument(
"--background_acquisition",
help="True: GenTL background acquisition. False: Buffer from camera",
default=True,
type=bool,
)
parser.add_argument(
"--mode",
default="none",
choices=[
"none",
"single",
"continuous",
"interactive",
"mqtt_sub",
"batch",
],
help="Imaging acquisition mode. None for camera config read or write",
)
parser.add_argument(
"--width",
default=0,
type=int,
help="Image width in pixels. Resized to this value if needed.",
)
parser.add_argument(
"--height",
default=0,
type=int,
help="Image height in pixels. Resized to this value if needed.",
)
parser.add_argument(
"--count",
default=0,
type=int,
help="Number of images to generate. 0 for indefinite.",
)
parser.add_argument(
"--sleep",
type=int,
default=0,
help="Sleep interval in seconds between loops. Default: 0",
)
parser.add_argument(
"--pubsub",
default="none",
choices=["none", "results"],
help="Whether to transmit ML inference results or none to Pub/Sub",
)
parser.add_argument(
"--topic_id",
default="camera-integration-telemetry",
help="GCP Pub/Sub topic name",
)
parser.add_argument(
"--ml",
action="store_true",
help="Whether to run ML inference on image feed",
)
parser.add_argument(
"--raw_write",
action="store_true",
help="Whether to save raw IR sensor array data",
)
parser.add_argument(
"--raw_write_path",
default="raw/",
help="Path where to write binary IR sensor array files",
)
parser.add_argument(
"--img_write", action="store_true", help="Whether to save IR images"
)
parser.add_argument(
"--img_write_path",
default="images/",
help="Path where to write IR image files",
)
parser.add_argument(
"--cfg_read",
action="store_true",
help="Whether to read camera runtime configs and output to a file",
)
parser.add_argument(
"--cfg_read_file",
default="camera.cfg",
help="Name of configuration file to output",
)
parser.add_argument(
"--cfg_write",
action="store_true",
help="Whether to write user-defined configs from a file to the camera ",
)
parser.add_argument(
"--cfg_write_file",
help="Name of user-defined configuration file to apply",
)
parser.add_argument(
"--temp_format",
default="C",
choices=["K", "C", "F"],
help="Radiometric temperature format: K, C or F",
)
parser.add_argument(
"--range_min",
default=0,
type=int,
help="Raw data value to map to 8bit (0-254)",
)
parser.add_argument(
"--range_max",
default=0,
type=int,
help="Raw data value to map to 8bit (0-254)",
)
parser.add_argument(
"--cloud_region", default="us-central1", help="GCP cloud region"
)
parser.add_argument("--project_id", help="GCP cloud project ID")
parser.add_argument(
"--credentials",
default="./credentials.json",
type=str,
help="Service account JSON key. Default: ./credentials.json",
)
parser.add_argument(
"--ml_host",
default="127.0.0.1",
type=str,
help="IP address where the ML model inference service is running",
)
parser.add_argument(
"--ml_port", default=8602, type=int, help="ML inference service port"
)
parser.add_argument(
"--ml_write",
action="store_true",
help="Whether to save ML inference results JSON files",
)
parser.add_argument(
"--ml_write_path",
default="output/",
help="Path where to write ML inference result JSON files",
)
parser.add_argument(
"--mqtt",
action="store_true",
help="Whether to publish ML results to a local MQTT broker",
)
parser.add_argument(
"--mqtt_host",
default="localhost",
type=str,
help="Local network MQTT connection host address",
)
parser.add_argument(
"--mqtt_port",
default=1883,
type=int,
help="Local network MQTT connection host address",
)
parser.add_argument(
"--mqtt_topic_commands",
default="viai/commands",
type=str,
help="MQTT topic where to listen to commends",
)
parser.add_argument(
"--mqtt_topic_results",
default="viai/results",
type=str,
help="MQTT topic where to post ML results",
)
parser.add_argument(
"--health_check",
action="store_true",
help="Test camera connection health. Exits with True|False",
)
parser.add_argument(
"--stdout",
default="print",
choices=["none", "print", "protobuf"],
help="STDOUT mode: none, print or protobuf",
)
parser.add_argument(
"--scan",
action="store_true",
help="If enabled, scan for cameras of type --protocol only.",
)
parser.add_argument(
"--stream_delay",
type=int,
help="Delay in ms before taking frame, to sync with stream latency.",
)
parser.add_argument(
"--crop_left",
default=-1,
type=int,
help="Crop coordinates left edge pixel.",
)
parser.add_argument(
"--crop_top",
default=-1,
type=int,
help="Crop coordinates top edge pixel.",
)
parser.add_argument(
"--crop_right",
default=-1,
type=int,
help="Crop coordinates right edge pixel.",
)
parser.add_argument(
"--crop_bottom",
default=-1,
type=int,
help="Crop coordinates bottom edge pixel.",
)
parser.add_argument(
"--client_cfg_file",
default=None,
type=str,
help="Name of configuration file to output",
)
return parser.parse_args()