How to count each colour pixel of an image?

1 次查看(过去 30 天)
I am trying to quantify the value of of each matter of the brain using matlab. I have segmented the image and result as shown below.
  2 个评论
Akira Agata
Akira Agata 2018-9-30
编辑:Akira Agata 2018-9-30

Is it a result of k-means clustering? If so, you can count each color pixel easily by using the output variable of kmeans function.

muhaimin mahfudz
muhaimin mahfudz 2018-10-1
编辑:muhaimin mahfudz 2018-10-1
yes it is. I see, in conclusion i can just obtain the values from there as it is the value of each segmented color?

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2018-9-30

Take the histogram of your segmented/classified image

counts = imhist(classifiedImage);

Each class will have a certain value, like gray matter is 1, background is 0, white material is 2, etc. imhist() simply counts the pixels in each class.

  3 个评论
Image Analyst
Image Analyst 2018-10-1
imhist() will do it. You pass in the classified image, not an RGB image, but the image you got from kmeans. See attached demo.
Image Analyst
Image Analyst 2018-10-2
Do you still not understand? If so, give me the script you used to create that image along with the original image.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by