Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +10 -11
pages/Data Collection.py
CHANGED
|
@@ -575,9 +575,7 @@ elif st.session_state.current_page == "opencv_operations":
|
|
| 575 |
""")
|
| 576 |
|
| 577 |
# Code example
|
| 578 |
-
st.code("""
|
| 579 |
-
import cv2
|
| 580 |
-
|
| 581 |
# Read the image
|
| 582 |
img = cv2.imread('path_to_image.jpg') # Replace 'path_to_image.jpg' with the image file path
|
| 583 |
|
|
@@ -593,7 +591,6 @@ elif st.session_state.current_page == "opencv_operations":
|
|
| 593 |
|
| 594 |
# Code example for Grayscale Conversion
|
| 595 |
st.code("""
|
| 596 |
-
import cv2
|
| 597 |
|
| 598 |
# Read the image in grayscale
|
| 599 |
gray_img = cv2.imread('path_to_image.jpg', 0) # Replace 'path_to_image.jpg' with your image file path
|
|
@@ -662,7 +659,6 @@ elif st.session_state.current_page == "opencv_operations":
|
|
| 662 |
|
| 663 |
# Code example
|
| 664 |
st.code("""
|
| 665 |
-
import cv2
|
| 666 |
|
| 667 |
# Example: Save an image
|
| 668 |
cv2.imwrite('saved_image.jpg', image_array) # 'saved_image.jpg' is the name of the output file
|
|
@@ -748,7 +744,7 @@ elif st.session_state.current_page == "image_operations":
|
|
| 748 |
cv2.waitKey(0) # 0 means infinite delay
|
| 749 |
cv2.destroyAllWindows()
|
| 750 |
""", language="python")
|
| 751 |
-
|
| 752 |
# Heading for cv2.merge() function
|
| 753 |
st.markdown("""
|
| 754 |
<h3 style="color: #9400d3;">Merging Color Channels</h3>
|
|
@@ -760,10 +756,13 @@ elif st.session_state.current_page == "image_operations":
|
|
| 760 |
This function merges individual color channels into a complete color image.
|
| 761 |
""")
|
| 762 |
|
| 763 |
-
# Syntax example
|
| 764 |
-
|
|
|
|
|
|
|
|
|
|
| 765 |
""", language="python")
|
| 766 |
-
|
| 767 |
# Heading for Creating RGB Image
|
| 768 |
st.markdown("""
|
| 769 |
<h3 style="color: #9400d3;">Creating a Colored RGB Image</h3>
|
|
@@ -796,8 +795,8 @@ elif st.session_state.current_page == "image_operations":
|
|
| 796 |
cv2.imshow("Blue", b_img)
|
| 797 |
cv2.imshow("Green", g_img)
|
| 798 |
cv2.imshow("Red", r_img)
|
| 799 |
-
cv2.waitKey(0)
|
| 800 |
-
cv2.destroyAllWindows()
|
| 801 |
""", language="python")
|
| 802 |
|
| 803 |
|
|
|
|
| 575 |
""")
|
| 576 |
|
| 577 |
# Code example
|
| 578 |
+
st.code("""
|
|
|
|
|
|
|
| 579 |
# Read the image
|
| 580 |
img = cv2.imread('path_to_image.jpg') # Replace 'path_to_image.jpg' with the image file path
|
| 581 |
|
|
|
|
| 591 |
|
| 592 |
# Code example for Grayscale Conversion
|
| 593 |
st.code("""
|
|
|
|
| 594 |
|
| 595 |
# Read the image in grayscale
|
| 596 |
gray_img = cv2.imread('path_to_image.jpg', 0) # Replace 'path_to_image.jpg' with your image file path
|
|
|
|
| 659 |
|
| 660 |
# Code example
|
| 661 |
st.code("""
|
|
|
|
| 662 |
|
| 663 |
# Example: Save an image
|
| 664 |
cv2.imwrite('saved_image.jpg', image_array) # 'saved_image.jpg' is the name of the output file
|
|
|
|
| 744 |
cv2.waitKey(0) # 0 means infinite delay
|
| 745 |
cv2.destroyAllWindows()
|
| 746 |
""", language="python")
|
| 747 |
+
|
| 748 |
# Heading for cv2.merge() function
|
| 749 |
st.markdown("""
|
| 750 |
<h3 style="color: #9400d3;">Merging Color Channels</h3>
|
|
|
|
| 756 |
This function merges individual color channels into a complete color image.
|
| 757 |
""")
|
| 758 |
|
| 759 |
+
# Syntax example for cv2.merge()
|
| 760 |
+
st.code("""
|
| 761 |
+
# Merging individual color channels (Blue, Green, Red)
|
| 762 |
+
merged_image = cv2.merge([blue_channel, green_channel, red_channel])
|
| 763 |
+
# blue_channel, green_channel, red_channel are single-channel images representing individual color channels (Blue, Green, Red)
|
| 764 |
""", language="python")
|
| 765 |
+
|
| 766 |
# Heading for Creating RGB Image
|
| 767 |
st.markdown("""
|
| 768 |
<h3 style="color: #9400d3;">Creating a Colored RGB Image</h3>
|
|
|
|
| 795 |
cv2.imshow("Blue", b_img)
|
| 796 |
cv2.imshow("Green", g_img)
|
| 797 |
cv2.imshow("Red", r_img)
|
| 798 |
+
cv2.waitKey(0) # Wait until a key is pressed
|
| 799 |
+
cv2.destroyAllWindows() # Close all OpenCV windows
|
| 800 |
""", language="python")
|
| 801 |
|
| 802 |
|