hari3485 commited on
Commit
0da414a
·
verified ·
1 Parent(s): b847e0d

Update pages/video.py

Browse files
Files changed (1) hide show
  1. pages/video.py +53 -53
pages/video.py CHANGED
@@ -4,56 +4,56 @@ import matplotlib.pyplot as plt
4
  import seaborn as sns
5
 
6
  # Title
7
- st.title("Understanding Video Data and Processing with OpenCV")
8
-
9
- # Subheader 1: What is Video Data?
10
- st.markdown("### What is Video Data?")
11
- st.markdown("""
12
- - **Video** is a collection of images known as **frames**.
13
- - Frames are visualized sequentially, creating the perception of motion.
14
- - **Frame Rate (FPS)** determines smoothness:
15
- - **30 FPS**: 30 frames per second.
16
- - **60 FPS**: 60 frames per second.
17
- - More FPS = smoother video.
18
- """)
19
-
20
- # Subheader 2: How to Play a Video Using OpenCV
21
- st.markdown("### :blue[How to Play a Video Using OpenCV]")
22
- st.markdown("""
23
- 1. **Break the Video into Frames**:
24
- - A video is essentially a sequence of images (frames).
25
- - Use a `while` loop to iterate through frames, as the total frame count may not be known.
26
- 2. **Key Functions**:
27
- - `cv2.VideoCapture(path)`: Captures the video and extracts frames.
28
- - `cv2.imshow()`: Displays a frame in a pop-up window.
29
- - `cv2.waitKey(1)`: Waits for 1 millisecond before moving to the next frame.
30
- 3. **Exit Condition**:
31
- - Exit the loop when frames are exhausted or a specific key is pressed.
32
- """)
33
-
34
- # Subheader 3: Frame Handling Details
35
- st.markdown("### Frame Handling Details")
36
- st.markdown("""
37
- - Each frame contains:
38
- 1. **Images**: Represented as 3D arrays (height, width, and color channels).
39
- 2. **Boolean Values**:
40
- - `True`: Frame is present.
41
- - `False`: No frame, signaling the loop to terminate.
42
- """)
43
-
44
- # Subheader 4: Converting Video to Tabular Data
45
- st.markdown("### :green[Converting Video to Tabular Data]")
46
- st.markdown("""
47
- 1. Use `cv2.VideoCapture()` to capture frames.
48
- 2. Convert the frames into tabular data, where each frame's pixel values are rows or columns.
49
- """)
50
-
51
- # Subheader 5: Color Space Conversion
52
- st.markdown("### Color Space Conversion")
53
- st.markdown("""
54
- - OpenCV allows color space changes with `cv2.cvtColor()`.
55
- - **Syntax**: `cv2.cvtColor(img, cv2.COLOR_<source>2<destination>)`
56
- - Example:
57
- ```python
58
- img = cv2.imread("path/to/image")
59
- gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
 
4
  import seaborn as sns
5
 
6
  # Title
7
+ st.title("Understanding Video Data and Processing with OpenCV")
8
+
9
+ # Subheader 1: What is Video Data?
10
+ st.markdown("### What is Video Data?")
11
+ st.markdown("""
12
+ - **Video** is a collection of images known as **frames**.
13
+ - Frames are visualized sequentially, creating the perception of motion.
14
+ - **Frame Rate (FPS)** determines smoothness:
15
+ - **30 FPS**: 30 frames per second.
16
+ - **60 FPS**: 60 frames per second.
17
+ - More FPS = smoother video.
18
+ """)
19
+
20
+ # Subheader 2: How to Play a Video Using OpenCV
21
+ st.markdown("### :blue[How to Play a Video Using OpenCV]")
22
+ st.markdown("""
23
+ 1. **Break the Video into Frames**:
24
+ - A video is essentially a sequence of images (frames).
25
+ - Use a `while` loop to iterate through frames, as the total frame count may not be known.
26
+ 2. **Key Functions**:
27
+ - `cv2.VideoCapture(path)`: Captures the video and extracts frames.
28
+ - `cv2.imshow()`: Displays a frame in a pop-up window.
29
+ - `cv2.waitKey(1)`: Waits for 1 millisecond before moving to the next frame.
30
+ 3. **Exit Condition**:
31
+ - Exit the loop when frames are exhausted or a specific key is pressed.
32
+ """)
33
+
34
+ # Subheader 3: Frame Handling Details
35
+ st.markdown("### Frame Handling Details")
36
+ st.markdown("""
37
+ - Each frame contains:
38
+ 1. **Images**: Represented as 3D arrays (height, width, and color channels).
39
+ 2. **Boolean Values**:
40
+ - `True`: Frame is present.
41
+ - `False`: No frame, signaling the loop to terminate.
42
+ """)
43
+
44
+ # Subheader 4: Converting Video to Tabular Data
45
+ st.markdown("### :green[Converting Video to Tabular Data]")
46
+ st.markdown("""
47
+ 1. Use `cv2.VideoCapture()` to capture frames.
48
+ 2. Convert the frames into tabular data, where each frame's pixel values are rows or columns.
49
+ """)
50
+
51
+ # Subheader 5: Color Space Conversion
52
+ st.markdown("### Color Space Conversion")
53
+ st.markdown("""
54
+ - OpenCV allows color space changes with `cv2.cvtColor()`.
55
+ - **Syntax**: `cv2.cvtColor(img, cv2.COLOR_<source>2<destination>)`
56
+ - Example:
57
+ ```python
58
+ img = cv2.imread("path/to/image")
59
+ gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)