Borrar filtros
Borrar filtros

How to take summation of different bins of histogram

2 visualizaciones (últimos 30 días)
anu
anu el 22 de Jul. de 2016
Comentada: Image Analyst el 25 de Jul. de 2016
I am new to Matlab. I have created three separate arrays rarray,garray,barray to store RGB values of an image. After this I have created histogram for these three channels. How take addition of different bins for every channel?

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Jul. de 2016
I don't know what you mean by "different" bins, but to add up corresponding bins, just add
redCounts = imhist(rgbImage(:,:,1));
greenCounts = imhist(rgbImage(:,:,2));
blueCounts = imhist(rgbImage(:,:,3));
overallCounts = redCounts + greenCounts + blueCounts ;
Of course it's even easier to do it all in one step:
overallCounts = imhist(rgbImage(:));
  4 comentarios
anu
anu el 25 de Jul. de 2016
Thanks. But I tried for 10-11 images. I am getting different values for 256 bins. But when I take the summation of redCounts, greenCounts, blueCounts separately getting the same values for all three channels. I dont why I am getting same addition for all three channels even though I tested on 5-6 images.
Image Analyst
Image Analyst el 25 de Jul. de 2016
Neither can we, until we see your code and you upload at least two images.

Iniciar sesión para comentar.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 22 de Jul. de 2016
Editada: Azzi Abdelmalek el 22 de Jul. de 2016
A=randi(10,5,4,3)
B=squeeze(sum(sum(A,1)))

Community Treasure Hunt

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

Start Hunting!

Translated by