構造要素のアンカー位置変更
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_morphology_set_anchor(
FHANDLE hse,
int anchor_x,
int anchor_y
) |
Visual Basic |
---|
Public Shared Function fnFIE_morphology_set_anchor (
hse As FHANDLE,
anchor_x As Integer,
anchor_y As Integer
) As Integer |
Parameters
- hse
- Type: fvalgcli..::..FHANDLE
構造要素のハンドル
- anchor_x
- Type: System..::..Int32
構造要素のX方向アンカー位置( 0 ≦ anchor_x < 構造要素のX方向サイズ )
- anchor_y
- Type: System..::..Int32
構造要素のY方向アンカー位置( 0 ≦ anchor_y <構造要素のY方向サイズ )
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_OBJECT | 不正なハンドルが渡されたため異常終了 |
F_ERR_INVALID_PARAM | パラメータ異常 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_morphology_set_anchor()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hse = FHANDLE.Zero;
UCHAR_PTR ptrn = UCHAR_PTR.Zero;
try
{
ptrn = UCHAR_PTR.alloc(9);
for (int i = 0; i < 9; i++)
{
if (i == 4)
ptrn[i] = 1;
else
ptrn[i] = 0;
}
hse = api.fnFIE_morphology_se_alloc(ptrn, 3, 3, 3, 1, 1);
status = api.fnFIE_morphology_set_anchor(hse, 2, 2);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
int size_x = 0;
int size_y = 0;
int anchor_x = 0;
int anchor_y = 0;
status = api.fnFIE_morphology_get_params(hse, ref size_x, ref size_y, ref anchor_x, ref anchor_y);
Assert.IsTrue(anchor_x == 2 && anchor_y == 2, "期待値と一致しません.");
}
finally
{
hse.Dispose();
ptrn.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_morphology_set_anchor()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hse As FHANDLE = FHANDLE.Zero
Dim ptrn As UCHAR_PTR = UCHAR_PTR.Zero
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
hse = api.fnFIE_morphology_se_alloc(ptrn, 3, 3, 3, 1, 1)
status = api.fnFIE_morphology_set_anchor(hse, 2, 2)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
Dim size_x As Integer = 0
Dim size_y As Integer = 0
Dim anchor_x As Integer = 0
Dim anchor_y As Integer = 0
status = api.fnFIE_morphology_get_params(hse, size_x, size_y, anchor_x, anchor_y)
Assert.IsTrue(anchor_x = 2 AndAlso anchor_y = 2, "期待値と一致しません.")
Finally
hse.Dispose()
ptrn.Dispose()
End Try
End Sub
End Class |
See Also