How to find the gait energy image(GEI) in matlab from a sequence of gait images saved in a folder?

16 ビュー (過去 30 日間)
ankit sharma
ankit sharma 2017 年 8 月 30 日
回答済み: Image Analyst 2024 年 11 月 27 日 17:06
this is the gait sequence attached here
  4 件のコメント
Walter Roberson
Walter Roberson 2017 年 8 月 31 日
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.
ankit sharma
ankit sharma 2017 年 9 月 4 日
No.. you are not getting me. Actually let's say i have 10 images in a folder, now i have to convert these images to a single image by averaging the images so that it have features of all 10 images. this is what we call gait energy image. And yeah..Thank you for replying sir

サインインしてコメントする。

回答 (2 件)

Gautam
Gautam 2024 年 11 月 27 日 4:21
編集済み: Gautam 2024 年 11 月 27 日 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:

Image Analyst
Image Analyst 2024 年 11 月 27 日 17:06
See attached demo for averaging together all the images in a folder. It will probably work for grayscale images too.

Community Treasure Hunt

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

Start Hunting!

Translated by