構造要素情報取得
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_morphology_get_params( FHANDLE hse, ref int size_x, ref int size_y, ref int anchor_x, ref int anchor_y ) |
Visual Basic |
---|
Public Shared Function fnFIE_morphology_get_params ( hse As FHANDLE, ByRef size_x As Integer, ByRef size_y As Integer, ByRef anchor_x As Integer, ByRef anchor_y As Integer ) As Integer |
Parameters
- hse
- Type: fvalgcli..::..FHANDLE
情報を取得する構造要素のハンドル
- size_x
- Type: System..::..Int32%
構造要素のX方向サイズ
- size_y
- Type: System..::..Int32%
構造要素のY方向サイズ
- anchor_x
- Type: System..::..Int32%
構造要素のX方向アンカー位置
- anchor_y
- Type: System..::..Int32%
構造要素のY方向アンカー位置
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_OBJECT | 不正なハンドルが渡されたため異常終了 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
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_morphology_get_params() { int status = (int)f_err.F_ERR_NONE; FHANDLE hse = FHANDLE.Zero; // 構造要素. UCHAR_PTR ptrn = UCHAR_PTR.Zero; int size_x = 0; int size_y = 0; int anchor_x = 0; int anchor_y = 0; try { ptrn = UCHAR_PTR.alloc(9); for (int i = 0; i < 9; i++) { if (i == 4) ptrn[i] = 1; else ptrn[i] = 0; } // 構造要素の生成 int val_size_x = 3, val_size_y = 3, val_anchor_x = 1, val_anchor_y = 1; hse = api.fnFIE_morphology_se_alloc(ptrn, val_size_x, val_size_y, 3, val_anchor_x, val_anchor_y); // 処理の実行. status = api.fnFIE_morphology_get_params(hse, ref size_x, ref size_y, ref anchor_x, ref anchor_y); // エラー判定. Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); Assert.IsTrue(size_x == val_size_x && size_y == val_size_y, "期待値と一致しません."); Assert.IsTrue(anchor_x == val_anchor_x && anchor_y == val_anchor_y, "期待値と一致しません."); } finally { // オブジェクトの開放. hse.Dispose(); ptrn.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_morphology_get_params() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim hse As FHANDLE = FHANDLE.Zero ' 構造要素. Dim ptrn As UCHAR_PTR = UCHAR_PTR.Zero Dim size_x As Integer = 0 Dim size_y As Integer = 0 Dim anchor_x As Integer = 0 Dim anchor_y As Integer = 0 Try ptrn = UCHAR_PTR.alloc(9) For i As Integer = 0 To 8 If i = 4 Then ptrn(i) = 1 Else ptrn(i) = 0 End If Next ' 構造要素の生成 Dim val_size_x As Integer = 3, val_size_y As Integer = 3, val_anchor_x As Integer = 1, val_anchor_y As Integer = 1 hse = api.fnFIE_morphology_se_alloc(ptrn, val_size_x, val_size_y, 3, val_anchor_x, val_anchor_y) ' 処理の実行. status = api.fnFIE_morphology_get_params(hse, size_x, size_y, anchor_x, anchor_y) ' エラー判定. Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) Assert.IsTrue(size_x = val_size_x AndAlso size_y = val_size_y, "期待値と一致しません.") Assert.IsTrue(anchor_x = val_anchor_x AndAlso anchor_y = val_anchor_y, "期待値と一致しません.") Finally ' オブジェクトの開放. hse.Dispose() ptrn.Dispose() End Try End Sub End Class |