Astronomy Python - Webb's First Deep Field - Marking the Edges of the Galaxies
In Astronomy, the image taken by telescopes of deep space field, galaxies, planets may appear to be complex - it may be difficult to find boundaries of objects when objects are too near.
Or
simply one would like to know the shape of the object.
Edge detection technique is used in image processing for finding the boundaries of objects within the image.
Edge detection would be very useful while analyzing such difficult images.
Below is the sample image taken by James Webb telescope.
Image Credits:NASA, ESA, CSA, STScI
Below is grey image(left) and edge detection image(right)
An edge detection operator used in the above example is called as Canny edge detector
Below is the python code used.
**********************************************************************
import cv2
import numpy as np
import matplotlib.pyplot as plt
# read the image
image = cv2.imread("E:\\astronomy_related\\edge_detection\\webb_first_deep_field.jpeg")
# convert it to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# show the grayscale image
plt.imshow(gray, cmap="gray")
plt.show()
# perform the canny edge detector to detect image edges
edges = cv2.Canny(gray, threshold1=30, threshold2=100)
plt.imshow(edges, cmap="gray")
plt.show()
*******************************************************************
To know more about Canny Edge detection please visit below link
https://en.wikipedia.org/wiki/Canny_edge_detector
Credits-
Image Credit
IMAGE: NASA, ESA, CSA, STScI
Webb's First Deep Field (NIRCam Image)
https://webbtelescope.org/contents/media/images/2022/035/01G7DCWB7137MYJ05CSH1Q5Z1Z?Category=03-galaxies&Collection=First%20Images
Code Credit
https://www.thepythoncode.com/article/canny-edge-detection-opencv-python
Comments
Post a Comment