adding pixels of each binary image in time series

1 view (last 30 days)
I have time series of classified binary images with same number of rows and columns, I would like to add the values for each cell (eg. (1,1)) of every image. then divide addition for a cell with number of images to get percentage.
idea is to get the percentage for each cell in this time series 1.tif, 2.tif,......10.tif
then plot this percentage for each cell on a 3D graph with varying colors.
hints or suggestions will be helpful. Thanks in advance!!
Ravindra

Accepted Answer

Image Analyst
Image Analyst on 4 Sep 2014
Inside the loop over images, have this
if k == 1
% It's the first image. Create the sum image.
sumImage = double(binaryImage);
else
% It's the second or later. Add it.
sumImage = sumImage + double(binaryImage);
end
Then after the loop divide sumImage by the number of images to get the percentage image.
percentageImage = 100 * sumImage / numberOfImages;
imshow(percentageImage, []); % Display scaled to 0-255 with the [] option.
  2 Comments
Ravindra
Ravindra on 4 Sep 2014
Thank you very much for your help!
I used the following for loop from another thread answer from you.
im=geotiffread(filename{1,1}); imshow(im)
for i=2:no_of_files
im=imadd(int32(im),int32(geotiffread(sprintf('try%d_georefrenced.tif',i))));
end
is this also correct? I checked the output for two images it seems correct!
Also can you please give some hints to plot this prcentage to a 3D graph?
Image Analyst
Image Analyst on 4 Sep 2014
Not very robust since you don't check that the files exist, but it looks like it should work. I have no idea how to make a graph out of the percentage image - maybe you could use surf() if you don't want to use imshow().

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!