I want to creat the loop of background substraction.

6 views (last 30 days)
Hi,
I am using the simple code line to substract one picture from another as given below.
k=image1-image2;
then I will need to subtract 10 more pictures from image 1 to see the difference.
for example:
k=image1-image2;
k1=image1-image3;
k2=image1-image4;
Is there a way that I can make a loop in which all the Images (2,3,4,5,6,7....) I want will be subtracted from image1.

Accepted Answer

David Hill
David Hill on 16 Jul 2020
Place all images into a cell array.
for m=2:length(image)
k{m-1}=image{1}-image{m};
end
  3 Comments
muhammad choudhry
muhammad choudhry on 17 Jul 2020
Great that works, and if I want to save them images into a folder what should I do?

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox 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!

Translated by