構造要素オブジェクトの確保と構造要素の設定

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

Syntax

C#
public static FHANDLE fnFIE_morphology_se_alloc(
	UCHAR_PTR ucpMask,
	int size_x,
	int size_y,
	int step_x,
	int anchor_x,
	int anchor_y
)
Visual Basic
Public Shared Function fnFIE_morphology_se_alloc ( 
	ucpMask As UCHAR_PTR,
	size_x As Integer,
	size_y As Integer,
	step_x As Integer,
	anchor_x As Integer,
	anchor_y As Integer
) As FHANDLE

Parameters

ucpMask
Type: fvalgcli..::..UCHAR_PTR
構造要素の値を指定するマスクの先頭ポインタ
size_x
Type: System..::..Int32
マスク幅(1以上)
size_y
Type: System..::..Int32
マスク高さ(1以上)
step_x
Type: System..::..Int32
マスクメモリ横幅(UCHAR単位)
anchor_x
Type: System..::..Int32
構造要素のX方向アンカー位置( 0 ≦ anchor_x < size_x )
anchor_y
Type: System..::..Int32
構造要素のY方向アンカー位置( 0 ≦ anchor_y < size_y )

Return Value

Type: FHANDLE
確保された構造要素のハンドル メモリ不足で確保に失敗した場合や ライセンスエラーが発生した場合は IntPtr.Zero を返します。

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_se_alloc()
        {   
            FHANDLE hse = FHANDLE.Zero;        // 構造要素.
            UCHAR_PTR ptrn = UCHAR_PTR.Zero;
            int size_x = 3;
            int size_y = 3;
            int step_x = 3;
            int anchor_x = 1;
            int anchor_y = 1;

            try
            {
                //    ptrn = {
                //            0,0,0,
                //            0,1,0,
                //            0,0,0
                //            };

                ptrn = UCHAR_PTR.alloc(size_x * size_y);
                for (int i = 0; i < size_x * size_y; i++)
                {
                    if (i == 4)
                        ptrn[i] = 1;
                    else
                        ptrn[i] = 0;
                }

                // 処理の実行.
                hse = api.fnFIE_morphology_se_alloc(ptrn, size_x, size_y, step_x, anchor_x, anchor_y);

                // エラー判定.
                Assert.IsTrue( FHANDLE.Zero != hse, "エラーが発生しました.");
            }
            finally
            {
                // オブジェクトの開放.
                hse.Dispose();
                ptrn.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_se_alloc()
        Dim hse As FHANDLE = FHANDLE.Zero
        ' 構造要素.
        Dim ptrn As UCHAR_PTR = UCHAR_PTR.Zero
        Dim size_x As Integer = 3
        Dim size_y As Integer = 3
        Dim step_x As Integer = 3
        Dim anchor_x As Integer = 1
        Dim anchor_y As Integer = 1

        Try
            '    ptrn = {
            '            0,0,0,
            '            0,1,0,
            '            0,0,0
            '            };

            ptrn = UCHAR_PTR.alloc(size_x * size_y)
            For i As Integer = 0 To size_x * size_y - 1
                If i = 4 Then
                    ptrn(i) = 1
                Else
                    ptrn(i) = 0
                End If
            Next

            ' 処理の実行.
            hse = api.fnFIE_morphology_se_alloc(ptrn, size_x, size_y, step_x, anchor_x, anchor_y)

            ' エラー判定.
            Assert.IsTrue(FHANDLE.Zero <> hse, "エラーが発生しました.")
        Finally
            ' オブジェクトの開放.
            hse.Dispose()
            ptrn.Dispose()
        End Try
    End Sub
End Class

See Also