How to extract RGB matrices from stacked TIFF file?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
iontrap
el 13 de Ag. de 2020
Comentada: hosein Javan
el 14 de Ag. de 2020
I have a (512x512x3xN) image array where 3 corresponds to the R,G,B channels, and N corresponds to the number of images. How can I extract the R,G,B channels from each image?
I will eventually want to compute mean and stdev for each R,G,B channel of each of the N images and put these into a txt file.
Thanks
0 comentarios
Respuesta aceptada
Walter Roberson
el 13 de Ag. de 2020
Editada: Walter Roberson
el 13 de Ag. de 2020
squeeze(mean(YourArray, [1 2]))
squeeze(std(YourArray, [], [1 2]))
These should give you a 3 x N array of values that are the means or std over each color plane in each image . There is no need to extract each color plane individually.
If your MATLAB is too old to support multiple dimensions, then you can always do
squeeze( mean(reshape(YourArray, [], 3, size(YourArray,4))) )
squeeze( std(reshape(YourArray, [], 3, size(YourArray,4))) )
This reshapes each color plane of each image into a single column and processes each column.
3 comentarios
Más respuestas (1)
hosein Javan
el 13 de Ag. de 2020
Editada: hosein Javan
el 13 de Ag. de 2020
not sure.
% A = your matrix after reading the image file
im = cell(1,n);
for i = 1:N
im{i} = A(:,:,:,i) % im{i} = individual image number(i)
end
6 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!