Spaces:
Running
Running
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 | |
) |