構造要素取得

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static int fnFIE_morphology_get_mask(
	FHANDLE hse,
	UCHAR_PTR mask,
	int step_x
)
Visual Basic
Public Shared Function fnFIE_morphology_get_mask ( 
	hse As FHANDLE,
	mask As UCHAR_PTR,
	step_x As Integer
) As Integer

Parameters

hse
Type: fvalgcli..::..FHANDLE
情報を取得する構造要素のハンドル
mask
Type: fvalgcli..::..UCHAR_PTR
構造要素のマスクパターンのコピー先
step_x
Type: System..::..Int32
maskのメモリ幅(byte単位、構造要素のX方向サイズ以上)

Return Value

Type: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_OBJECT 不正なハンドルが渡されたため異常終了
F_ERR_INVALID_PARAMパラメータ異常
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Examples

C# Copy imageCopy
//    $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_mask()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE hse = FHANDLE.Zero;        // 構造要素.
            UCHAR_PTR ptrn = UCHAR_PTR.Zero;
            UCHAR_PTR mask = 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);

                // 構造要素のサイズ取得.
                int size_x = 0;
                int size_y = 0;
                int anchor_x = 0;
                int anchor_y = 0;
                api.fnFIE_morphology_get_params(hse, ref size_x, ref size_y, ref anchor_x, ref anchor_y);

                mask = UCHAR_PTR.alloc(size_x * size_y);

                // 処理の実行.
                status = api.fnFIE_morphology_get_mask(hse, mask, 3);

                // エラー判定.
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

            }
            finally
            {
                // オブジェクトの開放.
                hse.Dispose();
                ptrn.Dispose();
                mask.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    ''' <summary>
    ''' 構造要素取得.
    ''' </summary>
    <FvPluginExecute> _
    Public Sub fnFIE_morphology_get_mask()
        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 mask 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)

            ' 構造要素のサイズ取得.
            Dim size_x As Integer = 0
            Dim size_y As Integer = 0
            Dim anchor_x As Integer = 0
            Dim anchor_y As Integer = 0
            api.fnFIE_morphology_get_params(hse, size_x, size_y, anchor_x, anchor_y)

            mask = UCHAR_PTR.alloc(size_x * size_y)

            ' 処理の実行.
            status = api.fnFIE_morphology_get_mask(hse, mask, 3)

            ' エラー判定.

            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
        Finally
            ' オブジェクトの開放.
            hse.Dispose()
            ptrn.Dispose()
            mask.Dispose()
        End Try
    End Sub
End Class

See Also