How to perform algebraic operations on an hyper stack image?

1 次查看(过去 30 天)
I have sets of images in folders A,B, ... containing images of dimension (n x m).
How do I group the images and then perform one operation to get outputs A',B',.. where A' = (A-X)/X [X is another image of dimensions (n x m)]

采纳的回答

Yuvraj Singh
Yuvraj Singh 2023-2-22
Hi,
Below mentioned code takes all the files from a folder and save it to a matrix for matrix opeartion.
%chanage directory to the folder of your interest
cd /path_to_folder_of_interest
%lists all files/folders in the diretory
x = dir;
%iteerate over all files/folders inside a folder
for idx = 1:numel(x)
element = x(idx);
%checks if its not a directoey it will read from excel file and make it
%a matric for operation
if(~element.isdir)
if(exist("A","var"))
A = [A;table2array(readtable(element.name))];
else
A = table2array(readtable(element.name));
end
end
end
A1 = (A-X)/X;
It assumes all the file are excel files in the folder.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by