Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +70 -0
pages/Data Collection.py
CHANGED
|
@@ -475,11 +475,81 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 475 |
st.image(
|
| 476 |
"https://huggingface.co/spaces/LakshmiHarika/MachineLearning/resolve/main/Images/rgb_3.jpg",
|
| 477 |
use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
|
| 479 |
# Go Back Button
|
| 480 |
if st.button("Go Back"):
|
| 481 |
navigate_to("main")
|
| 482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
|
| 484 |
|
| 485 |
|
|
|
|
| 475 |
st.image(
|
| 476 |
"https://huggingface.co/spaces/LakshmiHarika/MachineLearning/resolve/main/Images/rgb_3.jpg",
|
| 477 |
use_container_width=True)
|
| 478 |
+
|
| 479 |
+
st.write("""
|
| 480 |
+
In the next section, we'll dive into the exciting world of **image processing using OpenCV**. We'll cover how to:
|
| 481 |
+
- **Load, view, and edit images** using code.
|
| 482 |
+
- Learn the **basic tools and techniques** used in computer vision.
|
| 483 |
+
- Discover ways to **transform images and extract useful information**. 🖼️✨
|
| 484 |
+
|
| 485 |
+
Curious to see how?👇Click here to start your journey into OpenCV Basics!🚀
|
| 486 |
+
""")
|
| 487 |
|
| 488 |
# Go Back Button
|
| 489 |
if st.button("Go Back"):
|
| 490 |
navigate_to("main")
|
| 491 |
|
| 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 |
|