How to select every 10 images corresponding to one image?

1 view (last 30 days)
Ammy on 20 Sep 2021
Commented: Ammy on 21 Sep 2021
Suppose we have two folders A and B , both contain images.
Let folder A have 6 images:a1,a2,...,a6
folder B have 60 images: b1,b2,...,b60.
I want to select 10 images in B for each image in A, in the following way
for a1 select b1,b2,...,b10
for a2 select b11,b12,...,b20
.
.
.
for a6 select b51,b52,...,b60

Kevin Holly on 20 Sep 2021
%Select image folder A
A_dir = uigetdir();
%Select image folder B
B_dir = uigetdir();
%Identify files of interest
A_files=dir(fullfile(A_dir,'*.tif')); %Here, I am assuming the images are TIFF files and all file types are the same. Change this to .png, .jpg, or .bpm...etc if needed.
B_files=dir(fullfile(B_dir,'*.tif')); % * is a wildcard
for i = 1:length(A_files)
if i == 1
for ii = 1:10
end
else
for ii = 1:10
end
end
end
Kevin Holly on 21 Sep 2021
Edited: Kevin Holly on 21 Sep 2021
A = [];
for i = 1:length(A_files)
if i == 1
for ii = 1:10
A = [A; {A_image} {B_images(ii,:,:)}]
end
else
for ii = 1:10
A = [A; {A_image} {B_images(ii,:,:)}]
end
end
end
Ammy on 21 Sep 2021
Thank you very much.