LakshmiHarika commited on
Commit
6d6d68e
·
verified ·
1 Parent(s): 38a418f

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +25 -0
pages/Data Collection.py CHANGED
@@ -314,6 +314,31 @@ elif st.session_state.current_page == "explore_images_video":
314
  </p>
315
  </div>
316
  """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
  # Go Back Button
319
  if st.button("Go Back"):
 
314
  </p>
315
  </div>
316
  """, unsafe_allow_html=True)
317
+ # Visualization for Grid-Like Structure
318
+ st.markdown("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
319
+ height, width = 6, 6
320
+ grid = np.random.rand(height, width)
321
+ fig, ax = plt.subplots()
322
+ cax = ax.imshow(grid, cmap='viridis')
323
+
324
+ # Annotate the grid with pixel labels
325
+ for i in range(height):
326
+ for j in range(width):
327
+ ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', color='white', fontsize=6)
328
+
329
+ # Set axis labels and title
330
+ ax.set_title("Image as a Grid-Like Structure", fontsize=12)
331
+ ax.set_xlabel("Width (Pixels)", fontsize=10)
332
+ ax.set_ylabel("Height (Pixels)", fontsize=10)
333
+ ax.set_xticks(range(width))
334
+ ax.set_yticks(range(height))
335
+ ax.set_xticklabels([f'Col {j+1}' for j in range(width)])
336
+ ax.set_yticklabels([f'Row {i+1}' for i in range(height)])
337
+ ax.grid(color='white', linestyle='-', linewidth=1)
338
+ fig.colorbar(cax, ax=ax, orientation='vertical', label='Pixel Value')
339
+
340
+ st.pyplot(fig)
341
+
342
 
343
  # Go Back Button
344
  if st.button("Go Back"):