Astronomy Python - Creating Histogram of the Asteroid

 Histogram of Image help us to understand distribution of color values in the image.

In the below images, left image is of asteroid Bennu and right image is of Histogram.




Below is the Python code used to create Histogram.

****************************************************************************

from PIL import Image
import numpy as np
import matplotlib.pyplot as plt

# Open the image file
img = Image.open("E:\\astronomy_related\\image_to_histogram\\asteroid_bennu.jpg")

# Convert the image to grayscale
img = img.convert("L")

# Convert the image data to a numpy array
data = np.array(img)

# Plot the histogram
plt.hist(data.ravel(), bins=256, range=(0, 256), fc='k', ec='k')
plt.show()

*****************************************************************************

Credits and Information-

Code Credit-(Some modification is done in original code as per the need)
https://chat.openai.com

Image Cedit and Information
https://www.nasa.gov/image-feature/osiris-rex-bids-farewell-to-asteroid-bennu
mage Credits: NASA/Goddard/University of Arizona; Writer Daniel Stolte, University of Arizona
On April 9, 2021, NASA's Origins, Spectral Interpretation, Resource Identification, Security, Regolith Explorer (OSIRIS-REx) spacecraft took one last look at Bennu.

Comments

Popular posts from this blog

Astronomy Python - Webb's First Deep Field - Marking the Edges of the Galaxies

Online Observatory for Meteor Scatter Detection - Radio Astronomy.

Astronomy Python - Mars Planet Surface - Creating Sharpen Image from Blur Image