LakshmiHarika commited on
Commit
700197a
·
verified ·
1 Parent(s): 00c4627

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +52 -55
pages/Data Collection.py CHANGED
@@ -492,64 +492,61 @@ elif st.session_state.current_page == "explore_images_video":
492
  if st.button("Explore Image Operations with OpenCV"):
493
  navigate_to("opencv_operations")
494
 
495
- # Navigation for OpenCV Operations Page
496
- elif st.session_state.current_page == "opencv_operations":
497
- # Page Title
498
- st.markdown("""
499
- <h2 style="color: #BB3385;">Image Operations with OpenCV</h2>
500
- """, unsafe_allow_html=True)
501
-
502
- # Introduction to OpenCV
503
- st.write("""
504
- OpenCV (Open Source Computer Vision Library) is a powerful library used for image processing and computer vision tasks.
505
- It provides various methods for handling images, such as reading, displaying, and modifying them.
506
- """)
507
-
508
- # Basic OpenCV Methods
509
- st.markdown("""
510
- <h3 style="color: #e25822;">Basic Operations:</h3>
511
- """, unsafe_allow_html=True)
512
-
513
- st.write("""
514
- - **`cv2.imread()`**: Reads an image from a file and returns it as a NumPy array.
515
- - **`cv2.imshow()`**: Displays an image in a window.
516
- - **`cv2.imwrite()`**: Saves an image to a specified file.
517
- - **`cv2.resize()`**: Resizes an image to the desired dimensions.
518
- - **`cv2.cvtColor()`**: Converts an image from one color space to another.
519
- """)
520
-
521
- # Example Code
522
- st.markdown("""
523
- <h3 style="color: #5b2c6f;">Example Code:</h3>
524
- """)
525
-
526
- st.code("""
527
- import cv2
528
-
529
- # Read an image
530
- image = cv2.imread("path/to/your/image.jpg")
531
-
532
- # Display the image
533
- cv2.imshow("Image", image)
534
- cv2.waitKey(0)
535
- cv2.destroyAllWindows()
536
-
537
- # Save the image
538
- cv2.imwrite("output_image.jpg", image)
539
-
540
- # Resize the image
541
- resized_image = cv2.resize(image, (100, 100))
542
-
543
- # Convert to grayscale
544
- gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
545
- """, language="python")
546
-
547
- # Go Back Button
548
- if st.button("Go Back to Home Page"):
549
- navigate_to("main")
550
 
 
 
 
 
 
551
 
 
 
 
 
552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
 
554
 
555
 
 
492
  if st.button("Explore Image Operations with OpenCV"):
493
  navigate_to("opencv_operations")
494
 
495
+ # Navigation for OpenCV Operations Page
496
+ elif st.session_state.current_page == "opencv_operations":
497
+ # Page Title
498
+ st.markdown("""
499
+ <h2 style="color: #BB3385;">Image Operations with OpenCV</h2>
500
+ """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
 
502
+ # Introduction to OpenCV
503
+ st.write("""
504
+ OpenCV (Open Source Computer Vision Library) is a powerful library used for image processing and computer vision tasks.
505
+ It provides various methods for handling images, such as reading, displaying, and modifying them.
506
+ """)
507
 
508
+ # Basic OpenCV Methods
509
+ st.markdown("""
510
+ <h3 style="color: #e25822;">Basic Operations:</h3>
511
+ """, unsafe_allow_html=True)
512
 
513
+ st.write("""
514
+ - **`cv2.imread()`**: Reads an image from a file and returns it as a NumPy array.
515
+ - **`cv2.imshow()`**: Displays an image in a window.
516
+ - **`cv2.imwrite()`**: Saves an image to a specified file.
517
+ - **`cv2.resize()`**: Resizes an image to the desired dimensions.
518
+ - **`cv2.cvtColor()`**: Converts an image from one color space to another.
519
+ """)
520
+
521
+ # Example Code
522
+ st.markdown("""
523
+ <h3 style="color: #5b2c6f;">Example Code:</h3>
524
+ """)
525
+
526
+ st.code("""
527
+ import cv2
528
+
529
+ # Read an image
530
+ image = cv2.imread("path/to/your/image.jpg")
531
+
532
+ # Display the image
533
+ cv2.imshow("Image", image)
534
+ cv2.waitKey(0)
535
+ cv2.destroyAllWindows()
536
+
537
+ # Save the image
538
+ cv2.imwrite("output_image.jpg", image)
539
+
540
+ # Resize the image
541
+ resized_image = cv2.resize(image, (100, 100))
542
+
543
+ # Convert to grayscale
544
+ gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
545
+ """, language="python")
546
+
547
+ # Go Back Button
548
+ if st.button("Go Back to Home Page"):
549
+ navigate_to("main")
550
 
551
 
552