Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +12 -12
pages/Data Collection.py
CHANGED
|
@@ -271,7 +271,7 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 271 |
<h3 style="color: #5b2c6f;">What is an Image?πβ¨</h3>
|
| 272 |
<p style="font-size: 16px; color: #333;">
|
| 273 |
An image is a two-dimensional representation of the visible light spectrum, often captured
|
| 274 |
-
using devices like cameras or scanners. It can store details such as colors
|
| 275 |
enabling us to visually interpret and analyze information.
|
| 276 |
Common formats include JPEG, PNG, and BMP.
|
| 277 |
</p>
|
|
@@ -296,13 +296,13 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 296 |
<div style="text-align: left; margin-top: 20px;">
|
| 297 |
<h3 style="color: #5b2c6f;">Why is an Image Called a Grid-Like Structure?π²β¨</h3>
|
| 298 |
<p style="font-size: 16px; color: #333;">
|
| 299 |
-
Images are called **grid-like structures
|
| 300 |
-
forming a rectangular grid. Each pixel contains information about **shape**, **color**, and **patterns**, which
|
| 301 |
together define the image's content.
|
| 302 |
-
The total number of pixels is determined by the image's height and width (resolution), and a higher resolution provides better clarity.
|
| 303 |
</p>
|
| 304 |
<p style="font-size: 16px; color: #333;">
|
| 305 |
-
In images, **pixels act as features
|
| 306 |
of features and data points gives images their grid-like nature.
|
| 307 |
</p>
|
| 308 |
<p style="font-size: 16px; color: #333;">
|
|
@@ -314,18 +314,18 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 314 |
|
| 315 |
|
| 316 |
# Visualization for Grid-Like Structure
|
| 317 |
-
st.
|
| 318 |
-
height, width =
|
| 319 |
grid = np.random.rand(height, width)
|
| 320 |
|
| 321 |
# Adjust the figure size to make the plot very small
|
| 322 |
-
fig, ax = plt.subplots(figsize=(
|
| 323 |
-
cax = ax.imshow(grid, cmap='viridis')
|
| 324 |
-
|
| 325 |
# Annotate the grid with pixel labels
|
| 326 |
for i in range(height):
|
| 327 |
for j in range(width):
|
| 328 |
-
ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', color='white', fontsize=
|
| 329 |
|
| 330 |
# Set axis labels and title
|
| 331 |
ax.set_title("Image as a Grid-Like Structure", fontsize=6) # Smaller title size
|
|
@@ -339,7 +339,7 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 339 |
|
| 340 |
# Color bar setup without fontsize argument
|
| 341 |
cbar = fig.colorbar(cax, ax=ax, orientation='vertical', label='Pixel Value')
|
| 342 |
-
cbar.ax.tick_params(labelsize=
|
| 343 |
|
| 344 |
# Display the plot
|
| 345 |
st.pyplot(fig)
|
|
|
|
| 271 |
<h3 style="color: #5b2c6f;">What is an Image?πβ¨</h3>
|
| 272 |
<p style="font-size: 16px; color: #333;">
|
| 273 |
An image is a two-dimensional representation of the visible light spectrum, often captured
|
| 274 |
+
using devices like cameras or scanners. It can store details such as **colors**, **shapes**, and **textures**,
|
| 275 |
enabling us to visually interpret and analyze information.
|
| 276 |
Common formats include JPEG, PNG, and BMP.
|
| 277 |
</p>
|
|
|
|
| 296 |
<div style="text-align: left; margin-top: 20px;">
|
| 297 |
<h3 style="color: #5b2c6f;">Why is an Image Called a Grid-Like Structure?π²β¨</h3>
|
| 298 |
<p style="font-size: 16px; color: #333;">
|
| 299 |
+
Images are called **grid-like structures because they are composed of **pixels** arranged in rows and columns,
|
| 300 |
+
forming a rectangular grid. Each **pixel** contains information about **shape**, **color**, and **patterns**, which
|
| 301 |
together define the image's content.
|
| 302 |
+
The total number of **pixels** is determined by the image's height and width (resolution), and a higher resolution provides better clarity.
|
| 303 |
</p>
|
| 304 |
<p style="font-size: 16px; color: #333;">
|
| 305 |
+
In images, **pixels** act as features, and the entire grid represents a single data point. This combination
|
| 306 |
of features and data points gives images their grid-like nature.
|
| 307 |
</p>
|
| 308 |
<p style="font-size: 16px; color: #333;">
|
|
|
|
| 314 |
|
| 315 |
|
| 316 |
# Visualization for Grid-Like Structure
|
| 317 |
+
st.write("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
|
| 318 |
+
height, width = 6,6
|
| 319 |
grid = np.random.rand(height, width)
|
| 320 |
|
| 321 |
# Adjust the figure size to make the plot very small
|
| 322 |
+
fig, ax = plt.subplots(figsize=(3, 3)) # Even smaller figure size
|
| 323 |
+
cax = ax.imshow(grid, cmap='viridis', interpolation='nearest')
|
| 324 |
+
|
| 325 |
# Annotate the grid with pixel labels
|
| 326 |
for i in range(height):
|
| 327 |
for j in range(width):
|
| 328 |
+
ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', color='white', fontsize=4) # Smaller fontsize
|
| 329 |
|
| 330 |
# Set axis labels and title
|
| 331 |
ax.set_title("Image as a Grid-Like Structure", fontsize=6) # Smaller title size
|
|
|
|
| 339 |
|
| 340 |
# Color bar setup without fontsize argument
|
| 341 |
cbar = fig.colorbar(cax, ax=ax, orientation='vertical', label='Pixel Value')
|
| 342 |
+
cbar.ax.tick_params(labelsize=4) # Adjust the font size of the color bar
|
| 343 |
|
| 344 |
# Display the plot
|
| 345 |
st.pyplot(fig)
|