Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +22 -0
pages/Data Collection.py
CHANGED
|
@@ -526,6 +526,9 @@ def image_details_page():
|
|
| 526 |
ax.set_xlabel("Width(pixels)", fontsize=8) # Set smaller font size
|
| 527 |
ax.set_ylabel("Height(pixels)", fontsize=8) # Set smaller font size
|
| 528 |
|
|
|
|
|
|
|
|
|
|
| 529 |
|
| 530 |
st.header("Color Spaces")
|
| 531 |
|
|
@@ -858,7 +861,26 @@ def image_details_page():
|
|
| 858 |
""", language="python")
|
| 859 |
|
| 860 |
st.image("https://huggingface.co/spaces/hari3485/DiveIntoML/resolve/main/Images/BGR%20to%20Split.jpg")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
|
| 863 |
if st.button("Go Back"):
|
| 864 |
st.experimental_set_query_params(page="Introduction")
|
|
|
|
| 526 |
ax.set_xlabel("Width(pixels)", fontsize=8) # Set smaller font size
|
| 527 |
ax.set_ylabel("Height(pixels)", fontsize=8) # Set smaller font size
|
| 528 |
|
| 529 |
+
# Render the Plot
|
| 530 |
+
st.pyplot(fig)
|
| 531 |
+
|
| 532 |
|
| 533 |
st.header("Color Spaces")
|
| 534 |
|
|
|
|
| 861 |
""", language="python")
|
| 862 |
|
| 863 |
st.image("https://huggingface.co/spaces/hari3485/DiveIntoML/resolve/main/Images/BGR%20to%20Split.jpg")
|
| 864 |
+
|
| 865 |
+
# Title of the app
|
| 866 |
+
st.markdown("""
|
| 867 |
+
<h3 style="color: #9400d3;">Converting colour spaces</h3>
|
| 868 |
+
""", unsafe_allow_html=True)
|
| 869 |
+
|
| 870 |
+
st.write("""
|
| 871 |
+
When working with image arrays, we might need to convert or modify their color spaces.
|
| 872 |
+
OpenCV provides the `cv2.cvtColor()` method to achieve this. It allows us to change an image's color space to a desired format **BGR to Grayscale**.
|
| 873 |
+
""")
|
| 874 |
+
|
| 875 |
+
st.code("""
|
| 876 |
+
# Convert from BGR to Grayscale
|
| 877 |
|
| 878 |
+
img_gray = cv2.cvtColor(BGR_img, cv2.COLOR_BGR2GRAY)
|
| 879 |
+
""")
|
| 880 |
+
|
| 881 |
+
|
| 882 |
+
|
| 883 |
+
|
| 884 |
|
| 885 |
if st.button("Go Back"):
|
| 886 |
st.experimental_set_query_params(page="Introduction")
|