File size: 5,161 Bytes
d131efd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515e3af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d131efd
515e3af
 
 
 
 
d131efd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8d8800
 
 
 
 
d131efd
e8d8800
 
 
 
 
 
 
 
 
 
 
d131efd
e8d8800
 
 
 
 
d131efd
 
 
 
 
47a6659
d131efd
 
47a6659
 
d131efd
 
47a6659
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import streamlit as st
import pandas as pd
import numpy as np

# Custom CSS for styling
custom_css = """
<style>
    html, body, [data-testid="stAppViewContainer"] {
        background-image: linear-gradient(
            rgba(0, 0, 0, 0.6), 
            rgba(0, 0, 0, 0.6)
        ), 
        url("https://www.istockphoto.com/photo/tech-or-space-background-abstract-3d-illustration-gm1367865109-437999705?utm_source=pixabay&utm_medium=affiliate&utm_campaign=SRP_photo_sponsored&utm_content=https%3A%2F%2Fpixabay.com%2Fphotos%2Fsearch%2Fbackground%2520datascience%2F&utm_term=background+datascience.jpg");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: fixed;
        color: white;  /* Ensures all text is readable */
    }
    h2, h3 {
        color: #FFD700; /* Gold color for headings */
    }
    p {
        color: #FFFFFF; /* White text for paragraphs */
    }
</style>
"""

# Inject the CSS into the app
st.markdown(custom_css, unsafe_allow_html=True)

st.markdown("<h2 style='text-align: left; color: Black;'>What is Video</h2>", unsafe_allow_html=True)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
   "A video is a series of images (frames) shown in quick succession to create the perception of motion. Each frame is a static image, and the frame rate (e.g., 24, 30, or 60 frames per second) specifies the number of frames displayed per second."
    "</p>", 
    unsafe_allow_html=True
)

# Features of an videos using opencv
st.markdown("<h2 style='text-align: left; color: Black;'>Featrures of video using opencv</h2>", unsafe_allow_html=True)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "OpenCV (Open Source Computer Vision Library) is a powerful tool for video processing. Using OpenCV, Python can perform a variety of operations on video files and streams."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown("<h2 style='text-align: left; color: Black;'>Common Methods Video Processing with OpenCV:</h2>", unsafe_allow_html=True)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
   "Reading Videos: cv2.VideoCapture: Opens and reads video files or streams."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
     "Writing Videos: cv2.VideoWriter: Saves video frames into a file."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
     "Displaying Video: Use cv2.imshow to display video frames as they are read."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Apply real-time frame manipulation, such as applying filters or transformations."
     "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Convert video frames to grayscale: cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)"
   "</p>", 
    unsafe_allow_html=True
)
st.markdown("<h2 style='text-align: left; color: Black;'>Accessing WebCam with OpenCV:</h2>", unsafe_allow_html=True)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Accessing a webcam in Python is simple and efficient using OpenCV. The library provides the cv2.VideoCapture() function, which allows you to capture live video feed from your webcam."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown("<h2 style='text-align: left; color: Black;'>Steps to Access Webcam:</h2>", unsafe_allow_html=True)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Import OpenCV: Ensure OpenCV is installed (pip install opencv-python) and import it."
      "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Initialize Webcam: Use cv2.VideoCapture(0) to access the default webcam (replace 0 with the device index for other cameras)."
    "</p>",
       unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
 "Read Frames: Use read() method to grab individual frames from the webcam feed."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Display Frames: Use cv2.imshow() to view the frames in a window."
    "</p>", 
    unsafe_allow_html=True
)
st.markdown(
    "<p style='font-size: 16px; color: White; font-style: italic;'>"
    "Close Webcam: Release the webcam and close all OpenCV windows using cv2.VideoCapture.release() and cv2.destroyAllWindows()."
    "</p>", 
    unsafe_allow_html=True
)

# Add links to the GitHub repositories
st.markdown(
    "<p style='font-size: 16px; color: White;'>"
    "You can explore the code examples on GitHub:<br>"
    "<a href='https://github.com/Sathwik4119/IMAGE/blob/main/video_using.cv2.ipynb target='_blank' style='color: #FFD700;'>Basic Operations on Video</a>"
    "</p>", 
    unsafe_allow_html=True
)