Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +14 -19
pages/Data Collection.py
CHANGED
|
@@ -915,14 +915,9 @@ def image_details_page():
|
|
| 915 |
# Unstructured Data - Video Page
|
| 916 |
def video_details_page():
|
| 917 |
|
| 918 |
-
st.title("Unstructured Data - Video Details")
|
| 919 |
-
|
| 920 |
-
# Title
|
| 921 |
-
st.markdown("<h3 style='text-align: left; color: #FF00FF;'>Understanding Video and Frame Rates</h3>", unsafe_allow_html=True)
|
| 922 |
-
|
| 923 |
|
| 924 |
# Definition of Video
|
| 925 |
-
st.markdown("<h3 style= color: #FF00FF;'>What is video?</h3>", unsafe_allow_html=True)
|
| 926 |
|
| 927 |
|
| 928 |
st.write("""
|
|
@@ -936,20 +931,20 @@ def video_details_page():
|
|
| 936 |
The higher the number of frames per second, the smoother the video will look. Fewer frames per second can make the video appear less smooth or choppy.
|
| 937 |
""")
|
| 938 |
|
| 939 |
-
st.markdown("<h3 style='text-align:
|
| 940 |
|
| 941 |
st.write("""
|
| 942 |
**Load the Video**
|
| 943 |
-
-
|
| 944 |
-
|
| 945 |
**Read Frames**
|
| 946 |
-
-
|
| 947 |
|
| 948 |
**Display Frames**
|
| 949 |
-
-
|
| 950 |
|
| 951 |
**Exit Playback**
|
| 952 |
-
-
|
| 953 |
""")
|
| 954 |
|
| 955 |
st.code("""
|
|
@@ -976,7 +971,7 @@ def video_details_page():
|
|
| 976 |
|
| 977 |
# Use st.markdown to display the explanation
|
| 978 |
|
| 979 |
-
st.markdown("<h3 style='text-align:
|
| 980 |
|
| 981 |
|
| 982 |
st.markdown("""
|
|
@@ -988,7 +983,7 @@ def video_details_page():
|
|
| 988 |
2. **`img`**: The actual frame (image) from the video, which is in the form of a NumPy array. This image can then be processed just like any regular picture.
|
| 989 |
""")
|
| 990 |
|
| 991 |
-
st.markdown("<h3 style='text-align:
|
| 992 |
|
| 993 |
st.markdown("""
|
| 994 |
|
|
@@ -1051,7 +1046,7 @@ def video_details_page():
|
|
| 1051 |
cv2.destroyAllWindows() # Removing all the temporary memory (RAM)
|
| 1052 |
""", language="python")
|
| 1053 |
|
| 1054 |
-
st.markdown("<h3 style='text-align:
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
|
@@ -1098,7 +1093,7 @@ def video_details_page():
|
|
| 1098 |
cv2.destroyAllWindows() # Remove temporary windows
|
| 1099 |
""", language="python")
|
| 1100 |
|
| 1101 |
-
st.markdown("<h3 style='text-align:
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
|
@@ -1140,7 +1135,7 @@ def video_details_page():
|
|
| 1140 |
""", language="python")
|
| 1141 |
|
| 1142 |
|
| 1143 |
-
st.markdown("<h3 style='text-align:
|
| 1144 |
|
| 1145 |
st.markdown("""
|
| 1146 |
- 1. The first webcam displays the original video feed from the camera.
|
|
@@ -1169,7 +1164,7 @@ def video_details_page():
|
|
| 1169 |
cv2.destroyAllWindows()
|
| 1170 |
""",language = "python")
|
| 1171 |
|
| 1172 |
-
st.markdown("<h3 style='text-align: center;
|
| 1173 |
|
| 1174 |
|
| 1175 |
|
|
@@ -1208,7 +1203,7 @@ def video_details_page():
|
|
| 1208 |
|
| 1209 |
""",language="python")
|
| 1210 |
|
| 1211 |
-
st.markdown("<h3 style='text-align:
|
| 1212 |
|
| 1213 |
|
| 1214 |
|
|
|
|
| 915 |
# Unstructured Data - Video Page
|
| 916 |
def video_details_page():
|
| 917 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 918 |
|
| 919 |
# Definition of Video
|
| 920 |
+
st.markdown("<h3 style='text-align: left; color: #FF00FF;'>What is video?</h3>", unsafe_allow_html=True)
|
| 921 |
|
| 922 |
|
| 923 |
st.write("""
|
|
|
|
| 931 |
The higher the number of frames per second, the smoother the video will look. Fewer frames per second can make the video appear less smooth or choppy.
|
| 932 |
""")
|
| 933 |
|
| 934 |
+
st.markdown("<h3 style='text-align: left; color: #FF00FF;'>Understanding Video Processing with OpenCV</h3>", unsafe_allow_html=True)
|
| 935 |
|
| 936 |
st.write("""
|
| 937 |
**Load the Video**
|
| 938 |
+
- Load Video: Use `cv2.VideoCapture()` with the video file path to load and open the video.
|
| 939 |
+
|
| 940 |
**Read Frames**
|
| 941 |
+
- Read Frames: OpenCV reads each video frame in a loop using the read() function until the video ends.
|
| 942 |
|
| 943 |
**Display Frames**
|
| 944 |
+
- Frames are displayed sequentially with cv2.imshow(), simulating video playback.
|
| 945 |
|
| 946 |
**Exit Playback**
|
| 947 |
+
- Press a key (e.g., 'q') to stop playback and exit the loop.
|
| 948 |
""")
|
| 949 |
|
| 950 |
st.code("""
|
|
|
|
| 971 |
|
| 972 |
# Use st.markdown to display the explanation
|
| 973 |
|
| 974 |
+
st.markdown("<h3 style='text-align: left; color: #FF00FF;'>Understanding `vid.read()`</h3>", unsafe_allow_html=True)
|
| 975 |
|
| 976 |
|
| 977 |
st.markdown("""
|
|
|
|
| 983 |
2. **`img`**: The actual frame (image) from the video, which is in the form of a NumPy array. This image can then be processed just like any regular picture.
|
| 984 |
""")
|
| 985 |
|
| 986 |
+
st.markdown("<h3 style='text-align: left; color: #FF00FF;'>Understanding `cv2.waitkey()`</h3>", unsafe_allow_html=True)
|
| 987 |
|
| 988 |
st.markdown("""
|
| 989 |
|
|
|
|
| 1046 |
cv2.destroyAllWindows() # Removing all the temporary memory (RAM)
|
| 1047 |
""", language="python")
|
| 1048 |
|
| 1049 |
+
st.markdown("<h3 style='text-align: left; color: #FF00FF;'>Splitting video into 3 Different channels (B,G,R)</h3>", unsafe_allow_html=True)
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
|
|
|
| 1093 |
cv2.destroyAllWindows() # Remove temporary windows
|
| 1094 |
""", language="python")
|
| 1095 |
|
| 1096 |
+
st.markdown("<h3 style='text-align: left; color: #ffa500;'>Live Streaming with Webcam</h3>", unsafe_allow_html=True)
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
|
|
|
| 1135 |
""", language="python")
|
| 1136 |
|
| 1137 |
|
| 1138 |
+
st.markdown("<h3 style='text-align: left; color: #ffa500;'>Dual Webcam Stream `Color vs Grayscale Capture`</h3>", unsafe_allow_html=True)
|
| 1139 |
|
| 1140 |
st.markdown("""
|
| 1141 |
- 1. The first webcam displays the original video feed from the camera.
|
|
|
|
| 1164 |
cv2.destroyAllWindows()
|
| 1165 |
""",language = "python")
|
| 1166 |
|
| 1167 |
+
st.markdown("<h3 style='text-align: center; left: #ffa500;'> Webcam Stream with RGB Channel Separation</h3>", unsafe_allow_html=True)
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
|
|
|
| 1203 |
|
| 1204 |
""",language="python")
|
| 1205 |
|
| 1206 |
+
st.markdown("<h3 style='text-align: left; color: #ffa500;'>Webcam Frame Capture and Save</h3>", unsafe_allow_html=True)
|
| 1207 |
|
| 1208 |
|
| 1209 |
|