How to store multi images like a tensor?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everybody,
I have 50 images, each with size m * n. I want to store it as a tensor. has dimensions (m * n) x 50. Like a video.
please help me.
0 Kommentare
Antworten (1)
Rahul
am 21 Nov. 2024 um 6:35
To store multiple images as a tensor, you can either create a cell array and use the 'cat' function to concatenate the image matrices to the cell array. This is also mentioned in this Answer: https://www.mathworks.com/matlabcentral/answers/473924-creating-a-tensor-from-multiple-matrices
Another approach which can be considered is pre-defining a 3D array to store the image matrices. Here is an example:
num_images = 50;
image_tensor = zeros(m, n, num_images); % Defining 'image_tensor' as a 3D array
for i = 1:num_images:
img = imread(imagePath); % Here the 'imagePath' should be updated as required
image_tensor(:, :, i) = img;
end
Refer to the following MathWorks documentations to know more:
'Multidimensional Arrays': https://www.mathworks.com/help/releases/R2021a/matlab/math/multidimensional-arrays.html
Thanks.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Segmentation and Analysis 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!