Skip to content

Commit 5bae82a

Browse files
committed
feat: fix size
1 parent 1279694 commit 5bae82a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

main.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
parser.add_argument("-cam", "--camera", action="store_true", help="Use DepthAI 4K RGB camera for inference (conflicts with -vid)")
1919
parser.add_argument("-vid", "--video", type=argparse.FileType("r", encoding="UTF-8"), help="Path to video file to be used for inference (conflicts with -cam)")
2020
parser.add_argument("-nn", "--nn-blob-model", type=argparse.FileType("r", encoding="UTF-8"), default=DEFAULT_MODEL_LP_VENEZUELA, help="Set path of the blob (NN model)")
21+
parser.add_argument("-nnt", "--nn-threshold", type=float, default=0.5, help="Neural Networks Confidence Thresholds")
22+
2123
args = parser.parse_args()
2224

2325
if not args.camera and not args.video:
@@ -67,7 +69,7 @@ def create_pipeline():
6769
if args.camera:
6870
print("Creating Color Camera...")
6971
cam = pipeline.create(dai.node.ColorCamera)
70-
cam.setPreviewSize(640, 640)
72+
cam.setPreviewSize(LP_NN_IMG_SIZE)
7173
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
7274
cam.setInterleaved(False)
7375
cam.setBoardSocket(dai.CameraBoardSocket.CAM_A)
@@ -78,7 +80,7 @@ def create_pipeline():
7880

7981
# NeuralNetwork
8082
print("Creating License Plates Detection Neural Network...")
81-
lp_nn = set_neural_network("lp_nn", pipeline, 0.6, args.nn_blob_model)
83+
lp_nn = set_neural_network("lp_nn", pipeline, args.nn_threshold, args.nn_blob_model)
8284

8385
if args.camera:
8486
manip = pipeline.create(dai.node.ImageManip)
@@ -344,12 +346,12 @@ def get_frame():
344346
lp_in.send(lic_frame)
345347

346348
veh_frame = dai.ImgFrame()
347-
veh_frame.setData(to_planar(frame, (300, 300)))
349+
veh_frame.setData(to_planar(frame, LP_NN_IMG_SIZE))
348350
veh_frame.setTimestamp(tstamp)
349351
veh_frame.setSequenceNum(frame_det_seq)
350352
veh_frame.setType(dai.RawImgFrame.Type.BGR888p)
351-
veh_frame.setWidth(300)
352-
veh_frame.setHeight(300)
353+
veh_frame.setWidth(LP_NN_IMG_SIZE[0])
354+
veh_frame.setHeight(LP_NN_IMG_SIZE[1])
353355
veh_frame.setData(to_planar(frame, LP_NN_IMG_SIZE))
354356
veh_frame.setWidth(LP_NN_IMG_SIZE[0])
355357
veh_frame.setHeight(LP_NN_IMG_SIZE[1])

0 commit comments

Comments
 (0)