Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

I am trying to construct a matlab code that will identify marker switching in motion capture, then search through the other markers in the same frame and identify the other switched marker, then switch them back.

Asked by Ian on 15 Nov 2012

Here's what I have so far (the data set I'm looking at is called static)

%check for marker switching

for i=1:42 %for all columns

    for j=1:size(static, i)     %for all rows
        if abs(static (i,j)-static(i,j-1))>5        %if difference is greater then 5
            temp=100;                                %establish temp
            for ii=i:3:42     %for all columns of the same coordinate
                    if abs(static (ii,j)-static(i,j-1))<temp      %search for difference lower then temp
                         temp=abs(static (ii,j)-static(i,j-1));    %if lower replace temp with difference
                         temp_val=static(ii,j);     %if lower save value
                         temp_i=ii;                 %if lower save location
                    end
            end
            static(temp_i,j)=static(i,j);           %swap values
            static(i,j)=temp_val;                   %swap values
        end
    end
end

1 Comment

Image Analyst on 16 Nov 2012

OK. Good luck with that. But you don't need to announce your work here unless you have a question.

Ian

Products

No products are associated with this question.

0 Answers

Contact us