Astronomy Python - Crab Nebula - Combine RGB channel images into One Image
In Astronomy, Image taken by cameras would be based on specific filters(channels)-Red, Green, Blue.
Below are the the images taken across 3 channels. Red(Left), Green(Centre), Blue(Right)
Original image credit(single image which is not shown here)-
Credits: NASA, ESA, J. Hester and A. Loll (Arizona State University)
Below is result after combining above 3 channel images
Below is the python code used. Original Carb Nebula image is spitted into 3 channels(as shown 3 gray images above)
***************************************************
from PIL import Image
# Open the red, green, and blue channel images
red_channel = Image.open('E:\\astronomy_related\\rbg_one\\red.png')
green_channel=Image.open('E:\\astronomy_related\\rbg_one\\green.png')
blue_channel =Image.open('E:\\astronomy_related\\rbg_one\\blue.png')
# Create a new RGB image
result = Image.merge("RGB", (red_channel, green_channel, blue_channel))
# Save the result image
result.save('E:\\astronomy_related\\rbg_one\\rbg_crab_nebula.png')
*****************************************************
Credits
Code Credit-
https://chat.openai.com
Original image credit-
Credits: NASA, ESA, J. Hester and A. Loll (Arizona State University)
https://www.nasa.gov/feature/goddard/2017/messier-1-the-crab-nebula
save image-
https://pythonexamples.org/python-opencv-cv2-imwrite-save-image/
code to split one image to 3 channel images-
https://www.tutorialspoint.com/how-to-split-an-image-into-different-color-channels-in-opencv-python
cv2. split() is used to split multi-channel or colored image into separate single-channel images.
Comments
Post a Comment