You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Display error message in the video area in the following
cases (runtime error detection during frame reading):
a. Camera is unavailable
(at initialization or gets disconnected during use).
b. Prerecorded video can't be played
(file doesn't exist or video stream gets interrupted/corrupted).
Created a dedicated "display_error_message()" method
to display a visual error message in the exact same location
where the video would appear.
It uses a black background with a red border to match the UI styling.
Shows white text that's bold and centered for clear readability.
Maintains the exact same dimensions as the video area (321x331 pixels).
The error handling ensures the application won't crash and provides
a clear feedback to users about what went wrong,
making the dashboard much more user-friendly and robust.
2. Hardware consideration - a more reliable camera detection.
Added a small delay (0.1 seconds), to give camera time
to initialize properly. Cameras (especially USB cameras) often need
a brief moment to become fully operational
after a "cv2.VideoCapture()" call.
This ensures camera is ready before "view_video()" starts
getting called every 20ms, which reduces false negatives where
camera exists but isn't ready yet.
Documentation was updated accordingly and a screenshot displaying
the camera error was added to the "README.md" file.
Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>
0 commit comments