how to take average from the gait energy image or from silhouette?
3 views (last 30 days)
Show older comments
average of gait energy image
0 Comments
Answers (1)
Gautam
on 27 Nov 2024
Hello Ankit
An easy way to accomplish this task is to read all the images you have in the folder and append them into an array and then take the average along the 3rd dimension.
Assuming that all the images are of the same dimension, here’s the code that demonstrates this:
% Reading the images into an array
folderPath = 'path/to/your/folder';
imageFiles = dir(fullfile(folderPath, '*.png'));
imageArray = [];
for k = 1:length(imageFiles)
imagePath = fullfile(folderPath, imageFiles(k).name);
img = imread(imagePath);
% Convert the image to grayscale if it's RGB
if size(img, 3) == 3
img = rgb2gray(img);
end
% Append the image to the array
if isempty(imageArray)
imageArray = img;
else
imageArray = cat(3, imageArray, img);
end
end
% Calculating the average image along the third dimension
averageImage = mean(imageArray, 3);
imshow(uint8(averageImage));
If your images are not of the same size, you can resize them using the “imresize” function
Here are some useful documents that you can refer to:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!