Commit 53df7b8
committed
core: improved handling of camera & video errors
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.
Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>1 parent 37f0ec3 commit 53df7b8
3 files changed
+37
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
693 | 694 | | |
694 | 695 | | |
695 | 696 | | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
696 | 722 | | |
697 | 723 | | |
698 | 724 | | |
| |||
709 | 735 | | |
710 | 736 | | |
711 | 737 | | |
| 738 | + | |
712 | 739 | | |
713 | 740 | | |
714 | 741 | | |
| |||
719 | 746 | | |
720 | 747 | | |
721 | 748 | | |
722 | | - | |
| 749 | + | |
| 750 | + | |
723 | 751 | | |
724 | 752 | | |
725 | 753 | | |
726 | | - | |
| 754 | + | |
| 755 | + | |
727 | 756 | | |
728 | 757 | | |
729 | 758 | | |
| |||
767 | 796 | | |
768 | 797 | | |
769 | 798 | | |
| 799 | + | |
| 800 | + | |
770 | 801 | | |
771 | 802 | | |
772 | 803 | | |
| |||
Loading
0 commit comments