How to create two different sets of images from one set of images using indexing?
2 次查看(过去 30 天)
显示 更早的评论
I have a set of 100 images with dimensions 1000×500×100 where 100 is pixel per A- line, 500 lines per frame. Lets say I index them in code using i = 1:100. So I need to make two stacks of images one having i=1,2 is in stack 1 then i=3,4 goes in stack 2. Then again i =5,6 goes in stack 1 and then i=7,8 goes in stack 2. This way i want to distribuyte the hundred images. The code I use to aquire the images is shared below.
Thank You for helping me.
tic, clear all; close all; clc;
Adrs=uigetdir('\.','Select Folder for Phase image');
file_name=dir(fullfile(Adrs,'*.bmp'));
total_num=numel(file_name);
h = waitbar(0,'Reading Phase image files.... Please Wait');
for I=1:total_num
file1=fullfile(Adrs,file_name(I).name);
img_phs(:,:,I)=(imread(file1));
waitbar(I/total_num,h);
end
close(h)
0 个评论
采纳的回答
Rohit
2022-8-8
Example:
I am assuming the “data” to be consisting of 10 frames of 5*5 black and white images and then I distribute them into 2 sets (“set1”, ”set2”) based on indexing. The code for the same is below:
Code:
data=randi(20,5,5,10);
frame=data(:,:,1);
Indexing frames
index1=[1,2,5,6,9,10];
set1=data(:,:,index1);
index2=[3,4,7,8];
set2=data(:,:,index2);
Below is the documentation to help with array and matrices creation and manipulation:
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!