Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +10 -23
pages/Data Collection.py
CHANGED
|
@@ -163,36 +163,23 @@ elif page =="Converting Image to Black&White ,BGR & Gray SCale":
|
|
| 163 |
# Create images
|
| 164 |
white_img = np.full((500, 500), 255, dtype=np.uint8) # White image
|
| 165 |
black_img = np.zeros((500, 500), dtype=np.uint8) # Black image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
# Display images in Streamlit
|
| 168 |
-
st.subheader("White Image")
|
| 169 |
-
st.image(white_img, caption="White Image", use_column_width=True)
|
| 170 |
-
|
| 171 |
-
st.subheader("Black Image")
|
| 172 |
-
st.image(black_img, caption="Black Image", use_column_width=True)
|
| 173 |
-
"""
|
| 174 |
-
st.code(code, language="python")
|
| 175 |
-
|
| 176 |
-
# Create images
|
| 177 |
-
white_img = np.full((500, 500), 255, dtype=np.uint8) # White image
|
| 178 |
-
black_img = np.zeros((500, 500), dtype=np.uint8) # Black image
|
| 179 |
-
|
| 180 |
-
# Display images in Streamlit
|
| 181 |
-
st.subheader("White Image")
|
| 182 |
-
st.image(white_img, caption="White Image", use_column_width=True)
|
| 183 |
-
|
| 184 |
-
st.subheader("Black Image")
|
| 185 |
-
st.image(black_img, caption="Black Image", use_column_width=True)
|
| 186 |
-
|
| 187 |
-
st.header("Image Handling in OpenCV")
|
| 188 |
-
st.write("Explore Grayscale and BGR Image Creation and Display.")
|
| 189 |
|
| 190 |
# Section 1: Grayscale Image
|
| 191 |
st.header("Grayscale Image Creation")
|
| 192 |
st.code("""
|
| 193 |
# Grayscale image creation
|
| 194 |
gray_img = np.full((500, 500), 155, dtype=np.uint8)
|
| 195 |
-
gray_pil = Image.fromarray(gray_img)
|
| 196 |
|
| 197 |
# Display in OpenCV
|
| 198 |
cv2.imshow("Gray Image", gray_img)
|
|
|
|
| 163 |
# Create images
|
| 164 |
white_img = np.full((500, 500), 255, dtype=np.uint8) # White image
|
| 165 |
black_img = np.zeros((500, 500), dtype=np.uint8) # Black image
|
| 166 |
+
|
| 167 |
+
# Display in OpenCV
|
| 168 |
+
cv2.imshow("White image", white_img)
|
| 169 |
+
cv2.waitKey(0)
|
| 170 |
+
cv2.destroyAllWindows()
|
| 171 |
+
|
| 172 |
+
cv2.imshow("Black image", black_img)
|
| 173 |
+
cv2.waitKey(0)
|
| 174 |
+
cv2.destroyAllWindows()
|
| 175 |
+
""", language="python")
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
# Section 1: Grayscale Image
|
| 179 |
st.header("Grayscale Image Creation")
|
| 180 |
st.code("""
|
| 181 |
# Grayscale image creation
|
| 182 |
gray_img = np.full((500, 500), 155, dtype=np.uint8)
|
|
|
|
| 183 |
|
| 184 |
# Display in OpenCV
|
| 185 |
cv2.imshow("Gray Image", gray_img)
|