您现在的位置:首页 >> 三维重建 >> 内容

三维手臂动态matlab仿真,可以灵活控制手指运动

时间:2022/12/8 21:08:43 点击:

  核心提示:A100,包括程序操作录像...

1.完整项目描述和程序获取

>面包多安全交易平台:https://mbd.pub/o/bread/Y5mVlJZx

>如果链接失效,可以直接打开本站店铺搜索相关店铺:

点击店铺

>如果链接失效,程序调试报错或者项目合作可以加微信或者QQ联系。

2.部分仿真图预览



3.算法概述

三维手臂动态matlab仿真,可以灵活控制手指运动

4.部分源码

% Load the faces, vertices and weights

faces = csvread('handfaces.txt');

V0 = csvread('handverts.txt');

V0=V0';

N = size(V0,1);

weights = csvread('handweights.txt');

sk = loadbvh('HandBase.bvh');

wmap = [1 2 3 4 0 15 16 17 0 5 6 7 0 8 9 10 0 11 12 13 0 14 0];

wzero = wmap==0;

W = sparse(weights(:,1)+1,weights(:,2)+1,weights(:,3));

W = full(W);%W = W./repmat(sum(W,2),[1 size(W,2)]);

W = W(:,wmap+wzero);

W(:,wzero)=0;

cla

for displayWeightIndex=find(~wzero)

    h = trisurf(faces+1,V0(1,:),V0(2,:),V0(3,:),W(:,displayWeightIndex));

    axis equal; axis vis3d;

    shading interp;

    set(h,'FaceAlpha',0.5)

    axis([-200 200 -100 100 -100 500]);

    pause(0.2);

end

hold on

for j=2:258

    V=V0*0;

    cla

    for i=1:length(sk)

        % -------------------------------------------------------------------------

        % Display the bones

        if sk(i).parent

            s=sk(i).t_xyz(:,j); sp = sk(sk(i).parent).t_xyz(:,j);

            plot3([s(1) sp(1)],[s(2) sp(2)],[s(3) sp(3)],'r','LineWidth',5);

        end

        plot3(sk(i).t_xyz(1,j),sk(i).t_xyz(2,j),sk(i).t_xyz(3,j),'g.','MarkerSize',10);

        if sk(i).Nchannels

            plotax(sk(i).t_xyz(:,j)',sk(i).T(1:3,1:3,j)*sk(i).R0,15)

        end

        if sk(i).Nchannels

            % Takes a local bone coordinate and puts it into the new pose global position

            poseMatrix(:,:,i,j) = [(sk(i).T(1:3,1:3,j)*sk(i).R0) sk(i).t_xyz(:,j);0 0 0 1];

            % Takes a local bone coordinate and puts it into the base pose global position

            restMatrix(:,:,i) = [((sk(i).R0)) sk(i).head0 ;0 0 0 1];

            M(:,:,j) = poseMatrix(:,:,i,j)*inv(restMatrix(:,:,i));

            R = M(1:3,1:3,j);

            t = M(1:3,4,j);

            % We add the influence from every bone

            V = V + (R*V0 + repmat(t,1,length(V0))) * spdiags(W(:,i),0,length(V),length(V));

        end

    end

    h = trisurf(faces+1,V(1,:),V(2,:),V(3,:),W(:,2)*0);

    axis off;

    axis equal

    shading interp;

    light

    lighting phong

    set(h,'FaceAlpha',0.8)

    drawnow

end

i = 20; j=2;

T = poseMatrix(1:3,1:3,i,j); Tp = poseMatrix(1:3,1:3,i-1,j); T_0 = restMatrix(1:3,1:3,i); Tp_0 = restMatrix(1:3,1:3,i-1);

R = (T_0')*(Tp_0)*(Tp')*(T);

[Rx Ry Rz] = dcm2angle(R,'XYZ'); 

Rx = rad2deg(-Rx); Ry = rad2deg(-Ry); Rz = rad2deg(-Rz);

[Rx Ry Rz]

A_100

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关文章
  • 没有相关文章
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168