How to find the gait energy image(GEI) in matlab from a sequence of gait images saved in a folder?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ankit sharma
el 30 de Ag. de 2017
Respondida: Image Analyst
el 27 de Nov. de 2024 a las 17:06
this is the gait sequence attached here
4 comentarios
Walter Roberson
el 31 de Ag. de 2017
Those images appear to already be grayscale to me. However, on the chance they are not, you could use rgb2gray() on the image.
Put all the images into a 3D array with the third dimension being the image number. Then take mean(The3DArray, 3) to take the mean between the images. Note that the result will be floating point not uint8 so you might want to uint8() the result if you plan to display it.
Respuestas (2)
Gautam
el 27 de Nov. de 2024 a las 4:21
Editada: Gautam
el 27 de Nov. de 2024 a las 4:23
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 comentarios
Image Analyst
el 27 de Nov. de 2024 a las 17:06
See attached demo for averaging together all the images in a folder. It will probably work for grayscale images too.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!