Spaces:
Sleeping
Sleeping
Update pages/7_Unstructured_data.py
Browse files- pages/7_Unstructured_data.py +21 -0
pages/7_Unstructured_data.py
CHANGED
|
@@ -309,6 +309,27 @@ if file_type == "IMAGE":
|
|
| 309 |
- Red channel is taken and kept at depth of 3 --> depth always represents color
|
| 310 |
- The combination of 3 chnnels give 3D array where depth represents color and it is always constant
|
| 311 |
''')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
|
| 313 |
|
| 314 |
|
|
|
|
| 309 |
- Red channel is taken and kept at depth of 3 --> depth always represents color
|
| 310 |
- The combination of 3 chnnels give 3D array where depth represents color and it is always constant
|
| 311 |
''')
|
| 312 |
+
|
| 313 |
+
st.subheader("**Color Space Conversion with `cv2.cvtColor()`**")
|
| 314 |
+
st.markdown("""
|
| 315 |
+
- OpenCV provides the `cv2.cvtColor()` function to converts one colorspace to any colospace.
|
| 316 |
+
|
| 317 |
+
**Example: Displaying the Grayscale Image**
|
| 318 |
+
|
| 319 |
+
```python
|
| 320 |
+
import cv2
|
| 321 |
+
img = cv2.imread('image path')
|
| 322 |
+
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
| 323 |
+
cv2.imwrite('gray_image.jpg', gray_img)
|
| 324 |
+
```
|
| 325 |
+
- The grayscale image is saved to a file gray_image.jpg.
|
| 326 |
+
""")
|
| 327 |
+
|
| 328 |
+
st.subheader("**Types of Color Space Conversions**")
|
| 329 |
+
st.markdown("""
|
| 330 |
+
- **RGB to Grayscale**: `cv2.COLOR_RGB2GRAY` converts a color image to grayscale
|
| 331 |
+
- **Grayscale to RGB**: `cv2.COLOR_GRAY2RGB` converts a grayscale image back to a 3-channel RGB image
|
| 332 |
+
""")
|
| 333 |
|
| 334 |
|
| 335 |
|