what does this code mean ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
function PV=Get_Pivot_Point(PP)
% PP dimension: (no. of observation X 4 [no. of markers] X 3[x,y,z 3-d coordinate of marker] )
pv_tool = squeeze(PP(1,:,:));
%pv_tool=[0 0 0 ; 0 0 50; 0 25 100 ; 0 -25 135];
p_pairs=nchoosek(1:size(PP,1),2);
num_exapmple=10;
whos
pivot_points=[]
for k=1:10
P1=[];
P2=[];
rp=randperm(size(p_pairs,1),num_exapmple)
rp_a=p_pairs(rp,1);
rp_b=p_pairs(rp,2);
for i=1:10
P1=[P1 ; squeeze(PP(rp_a(i),:,:))'];
P2=[P2 ; squeeze(PP(rp_b(i),:,:))'];
end
X=compute_pivot_point(P1,P2);
tmp_pivot_points=[];
for j=1:size(PP,1)
[T, Eps] = estimateRigidTransform(pv_tool', squeeze(PP(j,:,:))); % (target, source)
tmp_pivot_points=[tmp_pivot_points ; transformPoint3d(X',T)];
end
pivot_points=[pivot_points ; mean(tmp_pivot_points)];
end
plot3(pv_tool(:,1),pv_tool(:,2),pv_tool(:,3),'r*')
hold on
plot3(pivot_points(:,1), pivot_points(:,2), pivot_points(:,3),'b*')
grid on
axis equal
PV.pv_point=median(pivot_points);
PV.pv_tool=pv_tool;
end
function X=compute_pivot_point(P1,P2)
[X, R] = linsolve([P2-P1],sum([P2.^2-P1.^2], 2)/2);
end
7 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!