Changing the screen size and detection zone issues

Alright I am having issues with the detection of the objects in a certain zone after I change the size of the window using the openCV.
The default size of the screen is 640 by 640 I want the image /video stream to be the size of my window or make it dynamic.

If I increase the image size by hardcoding the values eg 1080 by 920 the object detection zone points are not scaled .
What is the possible solution for this?
Same is the case with the drawing of the polygon zones

I am using supervision and have a very basic setup

def main(
    weight_path: str,
    rtsp_url: str,
    zone_configuration_path: str,
    model_id: str,
    confidence: float,
    iou: float,
    classes: List[int],
) -> None:
    sink = CustomSink(weights_path=weight_path ,zone_configuration_path=zone_configuration_path, classes=classes)

    pipeline = InferencePipeline.init_with_custom_logic(
        video_reference=rtsp_url,
        on_video_frame=sink.infer,
        on_prediction=sink.on_prediction,
        # confidence=confidence,
        # iou_threshold=iou,
    )

    try:
        pipeline.start()
        pipeline.join()
    except (KeyboardInterrupt, SystemExit):
        pipeline.terminate()
        print("Program terminated.")

Is there a demo which basically increase the window size and appropriately scale the object detection zones.

The main goal was to have the inference stream window be resizeable using mouse similar to how we can change the chrome window size using mouse and the video streams adjust as well.

If I don’t hardcode the screen size the video stream is too large and the edges of the video are cut

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.