generated from dopt-python/py311
45 lines
1021 B
Python
45 lines
1021 B
Python
import argparse
|
|
import dataclasses as dc
|
|
from typing import cast
|
|
|
|
from dopt_sensor_anomalies import _interface
|
|
|
|
|
|
@dc.dataclass()
|
|
class CliArgs:
|
|
img_path: str
|
|
calib_value_x: float
|
|
calib_value_y: float
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(
|
|
description=("simple CLI tool to analyse single sensor images for anomalies")
|
|
)
|
|
parser.add_argument(
|
|
"img_path",
|
|
help="file path to the image which is to be analysed",
|
|
type=str,
|
|
)
|
|
parser.add_argument(
|
|
"calib_value_x",
|
|
help="calibration value in pixels per mcm for x axis, type: float",
|
|
type=float,
|
|
)
|
|
parser.add_argument(
|
|
"calib_value_y",
|
|
help="calibration value in pixels per mcm for y axis, type: float",
|
|
type=float,
|
|
)
|
|
args = cast(CliArgs, parser.parse_args())
|
|
|
|
return _interface.sensor_anomalies_detection(
|
|
args.img_path,
|
|
args.calib_value_x,
|
|
args.calib_value_y,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|