cellfun of a cell array of rgb images

1 visualización (últimos 30 días)
Thomas Johansson
Thomas Johansson el 21 de Abr. de 2020
Respondida: Thomas Johansson el 23 de Abr. de 2020
Hi,
I have a cell array of several rgb images, so each cell is an rgb image of size x*y.
I want to calculate the mean of each image separated in r,g and b and it would be rather simple to do it with cellfun. (to compare the mean of the images)
In pseudo code r = Img{:}mean((:,:,1)) where r shall be an array of the mean value per image (r-channel).
But I cannot figure out how to do it with cellfun.
r = cellfun(@mean c(:,:,1),Img) does not work.
BR
Thomas

Respuestas (1)

Thomas Johansson
Thomas Johansson el 23 de Abr. de 2020
I found it myself.
r = cellfun(@(x) mean(x(:,:,1),'all'), Img);
/thomas

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by