Skip to content

RoI Extraction Fails When Lecture Slide Fills Entire Frame

Issue Description

This bug originates from the implementation of extract_roi_from_image_for_slide(), which was introduced in #1 (closed). While the function successfully isolates lecture slides in mixed-content frames, it does not handle cases where the slide fills the entire image (without additional elements like a professor, chat window, or overlays), leading to detection failures.

Because the slide covers the entire frame, there are no distinguishable edges, causing the contour extraction to not detect the slide as a rectangle.

Steps to Reproduce

Use an image where the lecture slide completely fills the frame.

Apply the extract_roi_from_image_for_slide() function.

Exmaple:

Step Image Description
Original Image (Full-Screen Slide) The lecture slide completely fills the frame, leaving no visible edges for detection.
Canny Edge Detection Failure Since the slide covers the entire image, the edge detection does not find clear edges around the slide.
Contour Extraction Issues The function fails to extract contours around the slide, because no sharp edges exist.
Failed RoI Extraction The expected Region of Interest (RoI) is not properly identified, therefore the biggest rectangle gets choosen as the RoI, leading to incorrect extraction.

Expected Behavior

The algorithm should still detect the boundaries of the slide and correctly extract the Region of Interest (RoI), even if no additional elements are present in the frame.

Actual Behavior

The Canny edge detection fails to highlight meaningful edges.

The contour extraction step does not return usable results.

The algorithm cannot determine a valid bounding rectangle for the slide.

Potential Solutions

Use template matching to identify the slide content boundaries.

Add padding to the image to ensure the slide has visible edges.