Determining gait cycle from heel marker motion capture data
55 views (last 30 days)
Show older comments
I have motion capture data of participants walking, jogging and running on a treadmill. Participants had a marker on each heel. I need to determine each gait cycle from this data so that I can then calculate breast range of motion, velocity and acceleration for each gait cycle.
0 Comments
Answers (3)
William Rose
on 30 Jul 2024
Post some example data if you wish.
Here is a paper I co-authored on the topic of identifying gait cycle during teadmill running and overground running.
The subjects ran on a treadmill that had a force plate, and they also ran over ground across a force plate. The vertical ground reaction force was used as the "gold standard" for determining foot strike and toe off. We compared that gold standard to five methods that did not use the force recording. The two methods that worked best for identifying foot strike accurately were the minimum height of the heel marker, and the time that heel marker vertical velocity changed from negative to positive. These methods were the best, and about equal in accuracy to one another, for both treadmill and overground. Toe off was best determined as time of peak knee extension, for treadmill and for overground.
Once you have the foot strike times identified accurately, you can scale each cycle to 100% and thn overage them, or do other analyses as dictated by your study gioals.
I have used the phrase foot strike instead of heel strike since some subjects may be mid- to forefoot strikers.
Good luck with your research.
4 Comments
William Rose
on 31 Jul 2024
Once I have the 15 left heel strike times (in vector tsL), I use those times to divide the recording into M=14 compete stride cycles. Then I can look at any other marker (I chose left upper arm) and plot how that marker moves over each stride cycle. That is what is shown in the second plot: 14 traces of left upper arm marker height. The traces aer not all the same length because the stride cycle duraiton varies somewhat.
Details
I want to know the duration of each cycle, in seconds (for plotting) and in points (for extracting the data into separate cycles). Therefore I compute tc=vector of cycle durations (s), and tcI=vector of cycle durations (in points). For the duration in points, I multiply the time in seconds by the frames per seocnd, and round to the nearest integer. If I don't round, some of the numbers in tcI are slightly non-integer, which causes problems later.
M=length(tsL)-1; % number of complete cycles
tc = diff(tsL); % cycle durations (s)
tcI=round(tc*fps,0); % cycle durations (Integer: points in each cycle)
Next , I want to make an array to contain the cycle-by-cycle data of interest. Arrays must be exactly rectangular, but the cycles have varying length. Therefore I allocate an array big enough to hold the longest cycle. Shorter cycles will have some unused array elements. I allocate an array, "UpaLy" (left upper arm, y-coordinate), of NaNs, with M columns, i.e. one column per cycle. The number of rows equals the length (in points) of the longest cycle. I use NaNs, because NaNs in the unused elements (for less than maximal-length cycles) cannot be confused with recorded data. Once the data for each cycle has been copied into array UpaLy, the columns for less-than-maximal length cycles will have NaNs at the ends.
The next thing is to copy the left upper arm data from the big array, data, into the array UpaLy. You may recall that data has 1377 rows by 213 columns. To do the copying, I use the heel strike times (vector tsL), and I use logical array indexing. See here for more on this useful concept. And see here. The basic idea is that cycle 1 is all the points from tsL(1) up to but not including tsl(2). Cycle 2 is all the points from tsl(2) up to but not including tsL(3). And so on.
for j=1:M
UpaLy(1:tcI(j),j)=UpaL(t>=tsL(j) & t<tsL(j+1),2);
end
Then I plot the data from all M cycles on a single plot.
I recommend that you average the data of interest across the cycles, to get the average waveform for one cycle. Tis is standard in biomechanical analysis of data from walking or running. It is not comletely trivial, since the cyce lengths vary. That is why it is useful to interpolate to a common time base befofe averaging. If you want to do this and are unsure how to do it, please email.
If you would like to dicuss further, please email me securely by clicking on the envelope icon, which you will see at top right of the pop-up window that appears when you click on the "WR" circle next to my posts. Include your email address, so I can reply directly.
recent works
on 30 Jul 2024
Edited: Walter Roberson
on 30 Jul 2024
Obtain the position data (typically x, y, z coordinates) for each heel marker from the motion capture system. Assume you have the heel marker data in a matrix where each row corresponds to a frame and columns represent x, y, and z coordinates for the left and right heel markers.
% Load your heel marker data (assuming the data is in a variable called 'heelData')
% heelData should be an Nx6 matrix where N is the number of frames
% Columns are [Lx, Ly, Lz, Rx, Ry, Rz] for left and right heels
% Example: load data
% load('heelData.mat'); % Load your data file here
% Extract z-coordinate (vertical) data for left and right heels
Lz = heelData(:, 3); % Left heel vertical position
Rz = heelData(:, 6); % Right heel vertical position
% Define a threshold to detect heel strike (customize based on your data)
% This threshold might need to be adjusted depending on the data characteristics
threshold = 0.05;
% Find heel strike (HS) events based on local minima and threshold crossing
[~, LHS] = findpeaks(-Lz, 'MinPeakHeight', threshold); % Inverted peaks
[~, RHS] = findpeaks(-Rz, 'MinPeakHeight', threshold);
% Find toe-off (TO) events if needed (local maxima or sharp increase)
% [~, LTO] = findpeaks(Lz, 'MinPeakHeight', threshold); % Example for toe-off detection
% Plotting to visualize
figure;
plot(Lz, 'b'); hold on;
plot(Rz, 'r');
plot(LHS, Lz(LHS), 'bo'); % Mark HS events for left heel
plot(RHS, Rz(RHS), 'ro'); % Mark HS events for right heel
xlabel('Frame');
ylabel('Vertical Position (z)');
title('Heel Marker Vertical Position and Gait Events');
legend('Left Heel', 'Right Heel', 'Left HS', 'Right HS');
hold off;
% Example output: displaying detected events
disp('Detected Heel Strikes for Left Heel:');
disp(LHS);
disp('Detected Heel Strikes for Right Heel:');
disp(RHS);
% Further analysis can include calculating parameters like velocity, acceleration, ROM, etc.
% Calculate velocity (simple finite difference approach)
L_velocity = diff(Lz) ./ diff((1:length(Lz))'); % Approximate velocity
R_velocity = diff(Rz) ./ diff((1:length(Rz))');
% Calculating acceleration (second derivative)
L_acceleration = diff(L_velocity) ./ diff((1:length(L_velocity))');
R_acceleration = diff(R_velocity) ./ diff((1:length(R_velocity))');
0 Comments
Ayesha
on 25 Sep 2024
Is this dataset available for the generl public? I wish to use it for my research in marker based mocap systems.
2 Comments
William Rose
on 25 Sep 2024
There is free-for-researchers mocap data at the Carnegie Mellon site:
See Also
Categories
Find more on Biomechanics 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!