How to perform algebraic operations on an hyper stack image?

3 views (last 30 days)
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)]

Accepted Answer

Yuvraj Singh
Yuvraj Singh on 22 Feb 2023
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.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!