finding gait cycle estimation
12 views (last 30 days)
Show older comments
Hi
I have gait verification project that contain gait cycle estimation as main step. Gait cycle estimation is computed by using the aspect ratio of the silhouette bounding box to obtain the beginning and ending frames for a complete gait cycle. This step contain 5 sub step:
- Aspect ratio of silhouette bounding box
- Normalization of aspect ration followed by mean filtering.
- autocorrelation signals
- first-order derivative signals of autocorrelations
- Peak positions indicating the periods.
I am try to apply it by using matlab R2013b and this is my code:
clear
close all
clc
input_dir = 'C:\Users\HP\Desktop\gait\Mobo\moboBgSub\04022\slowWalk\vr17_7';
filenames = dir(fullfile(input_dir, '*.pbm'));
tot_ims1 = numel(filenames);
for n = 1:tot_ims1
filename = fullfile(input_dir, filenames(n).name);
img1_p1 = imread(filename);
img1_p1 = bwareaopen(img1_p1,50);
se = strel('square',5);
s_im= imdilate(img1_p1, se);
s_im= imclose(s_im, se);
% Label the 2 levels thresholded image
[LabeledImage, Num]=bwlabel(s_im);
% Calculate the area of different components in LabeledImage2
STATS = regionprops(s_im, 'Area');
% Get the label of the biggest area in LabeledImage. This will be the human
[MaxArea,MaxAreaLabel]=max([STATS(:).Area]);
% Binary detected breast region
BinaryRegion=LabeledImage==MaxAreaLabel;
labeledImage = bwconncomp(BinaryRegion,8);
measurements = regionprops(labeledImage,'BoundingBox','Centroid');
bb = measurements.BoundingBox;
bco = measurements.Centroid;
AR(n)= bb(4)/bb(3);
end
fgs=5;
subplot( fgs,1, 1)
plot(AR, '-o')
title('aspect ratio')
%Normalization of aspect ration followed by mean filtering
subplot( fgs,1, 2)
mean_sub= AR- mean(AR);
std_div= mean_sub/std(mean_sub);
smooth_wave= smooth(std_div, 17, 'moving');
plot( smooth_wave )
title('smoothed')
% * autocorrelation signals
subplot(fgs,1, 3)
autoc= xcorr(smooth_wave);
plot( autoc )
title('autoc')
% * first-order derivative signals of autocorrelations
% * Peak positions indicating the periods.
subplot(fgs,1, 4)
df= diff(autoc);
plot( autoc )
[PKS, LOCS]= findpeaks(df);
hold on
plot(LOCS, PKS, 'ro')
title('deriv')
Distance_Peaks = (max(diff(LOCS))+ mean(diff(LOCS)))/2;
gait_period= round(Distance_Peaks)
this is the output:

It not given the peak correctly and the value of gait cycle is not logic
How to solve this problem?
Thank you
0 Comments
Answers (1)
Image Analyst
on 15 Mar 2016
I don't understand the question. You asked it to find the part of the curve with the steepest slopes, and it did, and it plotted a red circle over the steepest slope part of the curve. So that part is right. What is the problem? Perhaps if you also plotted the slope curve itself, "df", it would help you realize that the circles are really at the peak of the derivative????
And I don't understand "the value of gait cycle is not logic" <== what does that mean?
0 Comments
See Also
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!