Spaces:
Sleeping
Sleeping
Update pages/7_Unstructured_data.py
Browse files332 unmodified lines333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401332 unmodified lines - **Splitting Channels**: Use `cv2.split()` to separate the image into individual channels (B, G, R). ```python import cv2 blue, green, red = cv2.split(image) ``` - **Merging Channels**: Combine individual channels back into a single image using `cv2.merge()`. ```python import cv2 merged_image = cv2.merge((blue, green, red)) ``` """, unsafe_allow_html=True)
st.markdown(""" **1. Read the image** ```python image = cv2.imread('input_image.jpg') if image is None: print("Error: Image not found") exit() ``` **2. Convert RGB to Grayscale** ```python gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) ``` **3. Convert Grayscale back to RGB** ```python rgb_image = cv2.cvtColor(gray_image, cv2.COLOR_GRAY2BGR) ``` **4. Split channels (B, G, R)** ```python blue, green, red = cv2.split(image) ```
**5. Merge channels back** ```python merged_image = cv2.merge((blue, green, red)) ``` **6. Save the processed image** ```python cv2.imwrite('processed_image.jpg', merged_image) ``` """, unsafe_allow_html=True)
st.markdown(""" - Explanation : - **Step 1**: Read the image using `cv2.imread()`. Terminates if the image file is not found. - **Step 2**: Convert the image to Grayscale using `cv2.cvtColor()`. This simplifies the image to a single channel. - **Step 3**: Convert the Grayscale image back to RGB to enable further processing. - **Step 4**: Use `cv2.split()` to separate the image into individual color channels. - **Step 5**: Combine the channels back into a single image using `cv2.merge()`. - **Step 6**: Save the final loaded image with `cv2.imwrite()`. """, unsafe_allow_html=True)
pages/7_Unstructured_data.py+54