Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +5 -5
pages/Data Collection.py
CHANGED
|
@@ -296,7 +296,7 @@ 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 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.
|
|
@@ -315,17 +315,17 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 315 |
|
| 316 |
# Visualization for Grid-Like Structure
|
| 317 |
st.markdown("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
|
| 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)
|
|
|
|
| 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.
|
|
|
|
| 315 |
|
| 316 |
# Visualization for Grid-Like Structure
|
| 317 |
st.markdown("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
|
| 318 |
+
height, width = 3,3
|
| 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=(1, 1)) # Even smaller figure size
|
| 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=2) # 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=2) # Adjust the font size of the color bar
|
| 343 |
|
| 344 |
# Display the plot
|
| 345 |
st.pyplot(fig)
|