[mocaptoolbox] Re: mc2frontal centering

  • From: "Burger, Birgitta" <birgitta.burger@xxxxxx>
  • To: "mocaptoolbox@xxxxxxxxxxxxx" <mocaptoolbox@xxxxxxxxxxxxx>
  • Date: Mon, 11 Jan 2021 18:23:34 +0000

Dear Juan, dear list,

Thanks for reaching out.

mc2frontal is indeed not intended to center the data at [0 0 0] or at a given 
point in space, but just to rotate the data to align at the axis spanned 
between the two markers. Sorry for the confusion in the manual.

However, we’ve developed a function some time ago to be included in the next 
release that localises the data (i.e. the marker given is set to [0 0 0] and 
the remaining markers are expressed in relation to that. Furthermore, the data 
can be aligned to frontal view (combining localising and mc2frontal with 
‘frame’ option). The function is attached to this email.

Best,
Birgitta






On 8. Jan 2021, at 16:58, Juan Ignacio Mendoza Garay 
<juigmend@xxxxxxxxxxxxxx<mailto:juigmend@xxxxxxxxxxxxxx>> wrote:

The Mocap Toolbox version 1.5 documentation for the function mc2frontal says 
that the option
"
'frame' rotates each frame separately to have a frontal view with respect to 
the instanta-neous locations of markers m1 and m2; with this method, each 
individual frame is cen- tered as well
"
However, centering is not done. There is a line in the code that suggests a 
previous version of "mccenter" was called to center to the centroid, because it 
has three inputs, but mccenter of version 1.5 has only one input.

Anyway, below there is a bit of code that I used to solve the centering problem.
It does not center to the centroid, though.

function d2 = mclocal(d,rm)
% Sets coordinates to reference marker at origin.
%
% syntax
% d2 = mclocal(d);
%
% input parameters
% d: MoCap structure
% rm: reference marker
%
% output
% d2: MoCap structure
%
%
% VERSION: 9 July 2020
%
% Juan Ignacio Mendoza
% University of Jyväskylä

d2 = d;

ref_cols = [0,0,0];
ref_cols(1:3) = ((rm - 1) * 3 ) + 1;
ref_cols = ref_cols + [0,1,2];

for i_row = 1:size(d.data,1)

    for i_dim = 1:3

        d2.data(i_row,i_dim:3:end) = d2.data(i_row,i_dim:3:end) - 
d.data(i_row,ref_cols(i_dim));
    end
end

d2.other.origin_marker = rm;




Sent by Juan Ignacio Mendoza,
who is a Doctoral Student
at the Department of Music, Art and Culture Studies
of the University of Jyväskylä.
There is more information about Juan in the website whose address is
http://users.jyu.fi/~juigmend/

Attachment: mc2local.m
Description: mc2local.m

Other related posts: