show.m 1.41 KB

%your motion_patch location
ori = imread('/home/rfj/바탕화면/actionGAN/DCGAN/new_motionpatch/sample_111.png');
ori = im2double(ori);
ori = ori(:,:,:);

dx = [];
dy = [];
dz = [];

for f = 1:numel(ori(:,1,1))
    for j = 1:25
        dx = [dx;ori(f,j,1)];
        dy = [dy;ori(f,j,2)];
        dz = [dz;ori(f,j,3)];
    end
end

a = [1 0 0]; % Red 척추 1,2,3,4,20
b = [0 0 1]; % Blue 오른팔 8,9,10,11,23,24
c = [0 1 0]; % Green왼팔 5,6,7,21,22 (여기서 5번이 빠짐. 넣고싶으면 나중에 24 joint가 아니라 25 joint로 추가)
d = [1 1 0]; % Yellow 오른다리 16,17,18,19
e = [0 1 1]; % Skyblue 왼다리 12,13,14,15
colors = [a;a;a;a;c;c;c;c;b;b;b;b;e;e;e;e;d;d;d;d;a;c;c;b;b];

scatter3(dx,dy,dz,100,'filled');


connecting_joints= ...
    [2 1 21 3 21 5 6 7 21 9 10 11 1 13 14 15 1 17 18 19 2 8 8 12 12];

for jj=1:25:numel(dx)% 1부터 8개씩 numel = 열갯수..?
    current = [];
    current(:,1) = dy(jj:jj+24) ;
    current(:,2) = dz(jj:jj+24) ;
    current(:,3) = dx(jj:jj+24) ;
    
    scatter3(current(:,1),current(:,2),current(:,3),100,colors(:,:),'filled');
    
    for j =1:25
        k=connecting_joints(j);
        line([current(j,1) current(k,1)], [current(j,2) current(k,2)] , [current(j,3) current(k,3)])
    end
    
    set(gca,'Xdir','reverse','Ydir','reverse')
    xlim([0 1]);
    xlabel('x')
    ylim([0 1]);
    ylabel('y')
    zlim([0 1]);
    zlabel('z')
    drawnow
    pause(0.01)
end