カメラ混合パラメータの算出
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_calib_calc_homography_matrix( F_CAMERA_PARAM camera, FMATRIX_PTR rotation, FVECTOR_PTR translation, FMATRIX_PTR homography ) |
Visual Basic |
---|
Public Shared Function fnFIE_calib_calc_homography_matrix ( camera As F_CAMERA_PARAM, rotation As FMATRIX_PTR, translation As FVECTOR_PTR, homography As FMATRIX_PTR ) As Integer |
Parameters
- camera
- Type: fvalgcli..::..F_CAMERA_PARAM
カメラ内部パラメータ構造体
- rotation
- Type: fvalgcli..::..FMATRIX_PTR
カメラ外部パラメータ(回転行列)
サイズ3x3の行列
- translation
- Type: fvalgcli..::..FVECTOR_PTR
カメラ外部パラメータ(並進ベクトル)
サイズ3のベクトル
- homography
- Type: fvalgcli..::..FMATRIX_PTR
カメラ混合パラメータ
サイズ3x3の行列
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_NOMEMORY | メモリ不足エラー |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常 |
F_ERR_INVALID_PARAM | パラメータ異常
|
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Remarks
Examples
C# | Copy |
---|---|
// $Revision: 1.1 $ using System; using System.Collections.Generic; using System.Text; using fvalgcli; namespace TC { public partial class FIE { /// <summary> /// カメラ混合パラメータの算出. /// </summary> [FvPluginExecute] public void fnFIE_calib_calc_homography_matrix() { int status = (int)f_err.F_ERR_NONE; // カメラ内部パラメータ. F_CAMERA_PARAM camera = F_CAMERA_PARAM.init(916.396023110107, 910.774803134449, 1.12644931840078, 331.36766487411, 227.057842377842, -0.215845914024188, 0.0707690551914399); FMATRIX_PTR rotation = FMATRIX_PTR.Zero; // 回転行列(3×3). FVECTOR_PTR translation = FVECTOR_PTR.Zero; // 並進ベクトル(サイズ3). FMATRIX_PTR homography = FMATRIX_PTR.Zero; // カメラ混合パラメータ(3×3). FMATRIX_PTR ans_homography = FMATRIX_PTR.Zero; // 正解 try { // 領域確保. rotation = FMATRIX_PTR.alloc(3, 3); translation = FVECTOR_PTR.alloc(3); homography = FMATRIX_PTR.alloc(3, 3); ans_homography = FMATRIX_PTR.alloc(3, 3); // 回転行列の設定. rotation[0, 0] = 0.701872649400947; rotation[0, 1] = 0.711149227959822; rotation[0, 2] = -0.0405161650842895; rotation[1, 0] = -0.45600054122869; rotation[1, 1] = 0.492293298893435; rotation[1, 2] = 0.741424854090932; rotation[2, 0] = 0.547209548913428; rotation[2, 1] = -0.501910433679923; rotation[2, 2] = 0.669811634820711; // 並進ベクトルの設定. translation[0] = -219.906613509532; translation[1] = -43.9758355889508; translation[2] = 534.901154220606; // 実行. status = api.fnFIE_calib_calc_homography_matrix(camera, rotation, translation, homography); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); // 正解値の設定. ans_homography[0, 0] = 1.54048497951311; ans_homography[0, 1] = 0.90845191790501; ans_homography[0, 2] = -45.4703378821082; ans_homography[1, 0] = -0.544148355806359; ans_homography[1, 1] = 0.625172762750728; ans_homography[1, 2] = 152.180301512599; ans_homography[2, 0] = 0.00102301059675863; ans_homography[2, 1] = -0.000938323706409594; ans_homography[2, 2] = 1.000; // 比較. ConsoleOut.WriteFunctionName(":\t"); Console.Write(" ..."); ConsoleOut.IsEqualMatrix(ans_homography, homography[0,0], homography[0,1], homography[0,2], homography[1,0], homography[1,1], homography[1,2], homography[2,0], homography[2,1], homography[2,2]); Console.Write("\n"); } finally { rotation.Dispose(); translation.Dispose(); homography.Dispose(); ans_homography.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE ''' <summary> ''' カメラ混合パラメータの算出. ''' </summary> <FvPluginExecute> _ Public Sub fnFIE_calib_calc_homography_matrix() Dim status As Integer = CInt(f_err.F_ERR_NONE) ' カメラ内部パラメータ. Dim camera As F_CAMERA_PARAM = F_CAMERA_PARAM.init(916.396023110107, 910.774803134449, 1.12644931840078, 331.36766487411, 227.057842377842, -0.215845914024188, _ 0.0707690551914399) Dim rotation As FMATRIX_PTR = FMATRIX_PTR.Zero ' 回転行列(3×3). Dim translation As FVECTOR_PTR = FVECTOR_PTR.Zero ' 並進ベクトル(サイズ3). Dim homography As FMATRIX_PTR = FMATRIX_PTR.Zero ' カメラ混合パラメータ(3×3). Dim ans_homography As FMATRIX_PTR = FMATRIX_PTR.Zero ' 正解 Try ' 領域確保. rotation = FMATRIX_PTR.alloc(3, 3) translation = FVECTOR_PTR.alloc(3) homography = FMATRIX_PTR.alloc(3, 3) ans_homography = FMATRIX_PTR.alloc(3, 3) ' 回転行列の設定. rotation(0, 0) = 0.701872649400947 rotation(0, 1) = 0.711149227959822 rotation(0, 2) = -0.0405161650842895 rotation(1, 0) = -0.45600054122869 rotation(1, 1) = 0.492293298893435 rotation(1, 2) = 0.741424854090932 rotation(2, 0) = 0.547209548913428 rotation(2, 1) = -0.501910433679923 rotation(2, 2) = 0.669811634820711 ' 並進ベクトルの設定. translation(0) = -219.906613509532 translation(1) = -43.9758355889508 translation(2) = 534.901154220606 ' 実行. status = api.fnFIE_calib_calc_homography_matrix(camera, rotation, translation, homography) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) ' 正解値の設定. ans_homography(0, 0) = 1.54048497951311 ans_homography(0, 1) = 0.90845191790501 ans_homography(0, 2) = -45.4703378821082 ans_homography(1, 0) = -0.544148355806359 ans_homography(1, 1) = 0.625172762750728 ans_homography(1, 2) = 152.180301512599 ans_homography(2, 0) = 0.00102301059675863 ans_homography(2, 1) = -0.000938323706409594 ans_homography(2, 2) = 1.0 ' 比較. ConsoleOut.WriteFunctionName(":" & vbTab) Console.Write(" ...") ConsoleOut.IsEqualMatrix(ans_homography, homography(0, 0), homography(0, 1), homography(0, 2), homography(1, 0), homography(1, 1), _ homography(1, 2), homography(2, 0), homography(2, 1), homography(2, 2)) Console.Write(vbLf) Finally rotation.Dispose() translation.Dispose() homography.Dispose() ans_homography.Dispose() End Try End Sub End Class |