ループを使用して回転行列をブルート フォースしようとしています。基本的に、2 つの異なる座標系に一連のポイント (正確には 6 つ) があり、ポイント間の一致を見つけるために、オイラー角の値が異なる一連の回転行列を試してみたいと考えています。私の大きな問題は、この座標変換に関連する変換もあるということです。それが私を行き詰まらせている部分です。これが私の試みです
%Point 1 (Between two front teeth)
Vector_Endo1 = [-8.9329*voxTommConversion;8.5058*voxTommConversion;117.7193*voxTommConversion];
voxPoint1 = [418.7801;41.3845;231.3922];
%Point 2 (Mid-left skull, portruding bone on bottom)
Vector_Endo2 = [-11.2102*voxTommConversion;112.4456*voxTommConversion;61.3865*voxTommConversion];
voxPoint2 = [444;275.3698;99.7672];
%Point 3 (Cavity on top, front, middle, right of head, pointed section)
Vector_Endo3 = [140.0249*voxTommConversion;95.0548*voxTommConversion;148.9631*voxTommConversion];
voxPoint3 = [79.6156;255.4725;259.3405];
%Point 4 (Between two molars on left side)
Vector_Endo4 = [-9.4742*voxTommConversion;42.4474*voxTommConversion;87.0998*voxTommConversion];
voxPoint4 = [428.7617;118.7252;158.994];
%Point 5 (Left large stub inside of head)
Vector_Endo5 = [42.2453*voxTommConversion;85.6763*voxTommConversion;105.5044*voxTommConversion];
voxPoint5 = [309.3354;221.2764;187.5172];
%Point 6 (Thin portruding point underneath right side of skull)
Vector_Endo6 = [1.3304*voxTommConversion;101.7924*voxTommConversion;157.7978*voxTommConversion];
voxPoint6 = [390.7929;259.3982;311.4098];
allPoints=[Vector_Endo1,Vector_Endo2,Vector_Endo3,Vector_Endo4,Vector_Endo5,Vector_Endo6];
%testVector is used to compare difference between computed offset and real offset
for Rx=0:pi/180:2*pi,
for Ry=0:pi/180:2*pi,
for Rz=0:pi/180:2*pi,
for points = 1:length(allPoints)
testVector=euler2rotmat(Rx,Ry,Rz)*allPoints(:,points);
allTestVectors(:,i)=testVector;
これで、必要なすべての回転行列が得られるはずです(ある程度の近似値まで)。テスト ベクトルと実際の点 (allPointsVox) の間で最も小さな大きさの差を与える回転行列を見つけるコードを作成することで先に進みました。これは、回転行列の後に達成する必要があります。唯一の問題は、私が持っているものとその値を決定する間に変換の中間ステップがあることです。
座標系間のおおよその変換値を見つける方法についてのアイデアはありますか? 平均的な翻訳を得るためにすべての値を平均することを考えていましたが、それを行う方法がわかりません。
他のヒントは大歓迎です、ありがとう!