Spaces:
Sleeping
Sleeping
Update pages/Info _of_Image.py
Browse files- pages/Info _of_Image.py +139 -0
pages/Info _of_Image.py
CHANGED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
# Custom CSS for styling
|
6 |
+
custom_css = """
|
7 |
+
<style>
|
8 |
+
html, body, [data-testid="stAppViewContainer"] {
|
9 |
+
background-image: linear-gradient(
|
10 |
+
rgba(0, 0, 0, 0.6),
|
11 |
+
rgba(0, 0, 0, 0.6)
|
12 |
+
),
|
13 |
+
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");
|
14 |
+
background-size: cover;
|
15 |
+
background-position: center;
|
16 |
+
background-repeat: no-repeat;
|
17 |
+
background-attachment: fixed;
|
18 |
+
color: white; /* Ensures all text is readable */
|
19 |
+
}
|
20 |
+
h2, h3 {
|
21 |
+
color: #FFD700; /* Gold color for headings */
|
22 |
+
}
|
23 |
+
p {
|
24 |
+
color: #FFFFFF; /* White text for paragraphs */
|
25 |
+
}
|
26 |
+
.stButton>button {
|
27 |
+
background-color: #4CAF50; /* Green */
|
28 |
+
color: white;
|
29 |
+
padding: 10px 24px;
|
30 |
+
border: none;
|
31 |
+
border-radius: 5px;
|
32 |
+
text-align: center;
|
33 |
+
font-size: 16px;
|
34 |
+
margin: 4px 2px;
|
35 |
+
transition-duration: 0.4s;
|
36 |
+
cursor: pointer;
|
37 |
+
}
|
38 |
+
.stButton>button:hover {
|
39 |
+
background-color: #45a049; /* Darker Green on hover */
|
40 |
+
color: white;
|
41 |
+
}
|
42 |
+
.stButton>div:nth-child(1)>button {
|
43 |
+
background-color: #2196F3; /* Blue */
|
44 |
+
}
|
45 |
+
.stButton>div:nth-child(2)>button {
|
46 |
+
background-color: #f44336; /* Red */
|
47 |
+
}
|
48 |
+
.stButton>div:nth-child(3)>button {
|
49 |
+
background-color: #FF9800; /* Orange */
|
50 |
+
}
|
51 |
+
</style>
|
52 |
+
"""
|
53 |
+
|
54 |
+
# Inject the CSS into the app
|
55 |
+
st.markdown(custom_css, unsafe_allow_html=True)
|
56 |
+
|
57 |
+
# Page content
|
58 |
+
st.markdown("<h2 style='text-align: left; color: Black;'>What is IMAGE</h2>", unsafe_allow_html=True)
|
59 |
+
st.markdown(
|
60 |
+
"<p style='font-size: 16px; color: White; font-style: italic;'>"
|
61 |
+
"An image is a visual depiction of a subject, such as a person, object, scene, or idea, created or captured through means like photography, drawing, painting, or digital tools. It can take various forms, including photographs, illustrations, artworks, or computer-generated visuals."
|
62 |
+
"</p>",
|
63 |
+
unsafe_allow_html=True
|
64 |
+
)
|
65 |
+
|
66 |
+
st.markdown("<h2 style='text-align: left; color: Black;'>Features of IMAGE</h2>", unsafe_allow_html=True)
|
67 |
+
st.markdown(
|
68 |
+
"<p style='font-size: 16px; color: White; font-style: italic;'>"
|
69 |
+
"Pixels: Images are composed of small dots called pixels, each containing color data that together create the overall image."
|
70 |
+
"</p>",
|
71 |
+
unsafe_allow_html=True
|
72 |
+
)
|
73 |
+
st.markdown(
|
74 |
+
"<p style='font-size: 16px; color: White; font-style: italic;'>"
|
75 |
+
"File Formats: Images can be stored in different formats,"
|
76 |
+
"JPEG/JPG: Widely used for photographs and online images due to their efficient balance between quality and file size."
|
77 |
+
"PNG: Preferred for high-quality visuals or images requiring transparency, such as logos."
|
78 |
+
"GIF: Commonly utilized for basic animations or compact graphics."
|
79 |
+
"</p>",
|
80 |
+
unsafe_allow_html=True
|
81 |
+
)
|
82 |
+
|
83 |
+
st.markdown("<h2 style='text-align: left; color: Black;'>Basic Operations in IMAGE</h2>", unsafe_allow_html=True)
|
84 |
+
st.markdown(
|
85 |
+
"<p style='font-size: 16px; color: White; font-style: italic;'>"
|
86 |
+
"For performing this Basic Operations we use cv2 function from opencv library"
|
87 |
+
"cv2 is the Python module for OpenCV (Open Source Computer Vision Library), a powerful library used for computer vision and image processing tasks. It provides a wide range of tools and algorithms for analyzing and manipulating images and videos."
|
88 |
+
"</p>",
|
89 |
+
unsafe_allow_html=True
|
90 |
+
)
|
91 |
+
|
92 |
+
st.markdown("<h3 style='text-align: left; color: Black;'>Why cv2 is Used</h3>", unsafe_allow_html=True)
|
93 |
+
st.markdown(
|
94 |
+
"<p style='font-size: 16px; color: White; font-style: italic;'>"
|
95 |
+
"cv2 is used for various ways like:"
|
96 |
+
"1. Image Processing"
|
97 |
+
"2. Video Analysis"
|
98 |
+
"3. Feature Detection"
|
99 |
+
"4. Image Transformations"
|
100 |
+
"</p>",
|
101 |
+
unsafe_allow_html=True
|
102 |
+
)
|
103 |
+
|
104 |
+
st.markdown("<h3 style='text-align: left; color: Black;'>Operations Used</h3>", unsafe_allow_html=True)
|
105 |
+
st.markdown("1. imread()")
|
106 |
+
st.markdown("2. imshow()")
|
107 |
+
st.markdown("3. imwrite()")
|
108 |
+
st.markdown("4. cv2.waitkey()")
|
109 |
+
st.markdown("5. destroyAllWindows()")
|
110 |
+
|
111 |
+
# Buttons for each stage
|
112 |
+
st.markdown("###")
|
113 |
+
col1, col2, col3 = st.columns(3)
|
114 |
+
|
115 |
+
with col1:
|
116 |
+
if st.button("Color Space"):
|
117 |
+
st.markdown("<h2 style='text-align: left; color: Black;'>What is Colour Space?</h2>", unsafe_allow_html=True)
|
118 |
+
st.markdown("Color space refers to the specific organization of colors, which helps in the reproduction of color in both physical and digital environments.")
|
119 |
+
st.markdown("Common color spaces include RGB, CMYK, and HSV. Each color space has different uses and is based on distinct principles.")
|
120 |
+
st.markdown("<h3 style='text-align: left; color: Black;'>RGB (Red, Green, Blue):</h3>", unsafe_allow_html=True)
|
121 |
+
st.markdown("This color model is based on the way human vision perceives light. In RGB, colors are created by combining different intensities of red, green, and blue light. It is primarily used for screens and digital displays like monitors and televisions.")
|
122 |
+
st.markdown("<h3 style='text-align: left; color: Black;'>CMYK (Cyan, Magenta, Yellow, Key/Black):</h3>", unsafe_allow_html=True)
|
123 |
+
st.markdown("The CMYK color space is used in color printing. It relies on the subtractive model, where colors are created by subtracting light through layers of ink. When combined in various proportions, CMYK creates a wide range of colors.")
|
124 |
+
st.markdown("<h3 style='text-align: left; color: Black;'>HSV (Hue, Saturation, Value):</h3>", unsafe_allow_html=True)
|
125 |
+
st.markdown("This model is often used in graphic design and image processing, as it aligns more closely with how humans perceive color. It allows for easier manipulation of color through hue (the type of color), saturation (the intensity), and value (brightness).")
|
126 |
+
st.markdown("Each color space is suited for different applications, depending on the medium and technology used. Choosing the correct color space is crucial for ensuring that colors appear as intended, whether you're working with digital graphics, web design, or printed materials.")
|
127 |
+
st.markdown("<h2 style='text-align: left; color: Black;'>Splitting and Merging the Image Colors</h2>", unsafe_allow_html=True)
|
128 |
+
|
129 |
+
if st.button("Video Creation"):
|
130 |
+
st.markdown("Video creation is used to generate a video from images or frames")
|
131 |
+
|
132 |
+
# Add a link to the code
|
133 |
+
st.markdown(
|
134 |
+
"<p style='font-size: 16px; color: White;'>"
|
135 |
+
"You can view and run the code in Colab: "
|
136 |
+
"<a href='https://colab.research.google.com/drive/1fvP-k70HJnp1iCN7Vs-tkfFs8vq--WGc?usp=sharing' target='_blank' style='color: #FFD700;'>Colab Notebook</a>"
|
137 |
+
"</p>",
|
138 |
+
unsafe_allow_html=True
|
139 |
+
)
|