How to find the gait energy image(GEI) in matlab from a sequence of gait images saved in a folder?
16 ビュー (過去 30 日間)
古いコメントを表示
this is the gait sequence attached here
4 件のコメント
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.
回答 (2 件)
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:
0 件のコメント
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!