Question: Use an image, dogs.jpeg and implement k-means clustering for image segmentation and identify dominant color in the image. Objective: Use k-means clustering for image segmentation
Use an image, dogs.jpeg and implement k-means clustering for image segmentation and identify dominant color in the image.
Objective:
Use k-means clustering for image segmentation and to identify dominant color in the image.
Question:
1.Open and display the image "dog.jpeg". Convert the image in to numpy array,
so that i can be used in further processing.
[Hint: Use PIL module from python]
2. Find out the dimensions of the image and convert it in to a two-dimensional array.
3.Use kmeans clustering with k set to 3 and cluster the image.
[Hint: Refer to k-means module of scikit learn]
4. Predict the cluster label of every pixel in the image and plot it back as an image.
5. Find out the three dominant color in the image.
[Hint: The cluster centers should correspond to three dominant colors]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
