Filter löschen
Filter löschen

How to For Loop to merge two images each year in Matlab?

2 Ansichten (letzte 30 Tage)
reyadh Albarakat
reyadh Albarakat am 14 Nov. 2017
Bearbeitet: Akira Agata am 15 Nov. 2017
Hi Everybody,
I have a list of images for 3 years every two images represent a year. How can I for loop to merge two images (B3 and B4) for each year? All images have the same size
The list of images:
IQ_38_2000_B3
IQ_38_2000_B4
IQ_38_2001_B3
IQ_38_2001_B4
IQ_38_2002_B3
IQ_38_2002_B4
then the output should be like:
IQ_38_2000_Mereged
IQ_38_2001_Mereged
IQ_38_2002_Mereged
Please do reply
Thank you in advance

Antworten (1)

Akira Agata
Akira Agata am 15 Nov. 2017
Bearbeitet: Akira Agata am 15 Nov. 2017
Assuming all your images are '****.png' with the same size and stored in the current folder, the following script can do it.
for kk = 2000:2002
prefix = ['IQ_38_',num2str(kk)];
I1 = imread([prefix,'_B3.png']);
I2 = imread([prefix,'_B4.png']);
Imerged = [I1,I2];
imwrite(Imerged,[prefix,'_Merged.png']);
end

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by