How to extract RGB matrices from stacked TIFF file?
Show older comments
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
Accepted Answer
More Answers (1)
hosein Javan
on 13 Aug 2020
Edited: hosein Javan
on 13 Aug 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 Comments
iontrap
on 13 Aug 2020
hosein Javan
on 13 Aug 2020
A = imread('My TIFF.tiff');
ndims(a) % check if it is 4
N = size(a,4) % number of frames
im = cell(1,N);
for i = 1:N
im{i} = A(:,:,:,i) % im{i} = individual image number(i)
end
iontrap
on 13 Aug 2020
hosein Javan
on 13 Aug 2020
sorry it's A
iontrap
on 14 Aug 2020
hosein Javan
on 14 Aug 2020
you're welcome, good luck.
Categories
Find more on Image Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!