領域の境界点列を利用したエッジ検出

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

Syntax

C#
public static int fnFIE_edge_binary_boundary(
	FHANDLE hsrc,
	int smooth_size,
	DPNT_T offset,
	ref F_DEDGE_PTR edges,
	ref int edge_num
)
Visual Basic
Public Shared Function fnFIE_edge_binary_boundary ( 
	hsrc As FHANDLE,
	smooth_size As Integer,
	offset As DPNT_T,
	ByRef edges As F_DEDGE_PTR,
	ByRef edge_num As Integer
) As Integer

Parameters

hsrc
Type: fvalgcli..::..FHANDLE
入力FIEオブジェクト
  • リージョン
  • 2値画像( type : bin, ch : 1 )
smooth_size
Type: System..::..Int32
移動平均フィルタサイズ
offset
Type: fvalgcli..::..DPNT_T
オフセット量
edges
Type: fvalgcli..::..F_DEDGE_PTR%
取得したエッジ
edge_num
Type: System..::..Int32%
取得したエッジ数

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_NOMEMORYメモリ不足
F_ERR_INVALID_IMAGE不正な画像が渡された
F_ERR_INVALID_OBJECT不正なオブジェクトが入力されました
F_ERR_INVALID_PARAM不正なパラメータが入力されました
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Examples

C# Copy imageCopy
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        [FvPluginExecute]
        public void fnFIE_edge_binary_boundary()
        {
            string filepath = TestImageDir + "/testdata/bin_ellipse30.bmp";

            int status = (int)f_err.F_ERR_NONE;
            var hsrc = FHANDLE.Zero;
            var edges = F_DEDGE_PTR.Zero;
            int edge_num = 0;

            try
            {
                api.fnFIE_load_img_file(filepath, ref hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8);

                int smooth_size = 7;
                var offset = DPNT_T.init(0, 0);
                status = api.fnFIE_edge_binary_boundary(hsrc, smooth_size, offset, ref edges, ref edge_num);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "fnFIE_edge_binary_boundary: エラーが発生しました。({0})", (f_err)status);
                Console.WriteLine("fnFIE_edge_binary_boundary");
                Console.WriteLine("edge_num = {0}", edge_num);
                for (int i = 0; i < edge_num; i++)
                {
                    if ((0 <= i && i < 5) || (edge_num - 5 <= i && i < edge_num))
                        Console.WriteLine("edges[{0}]={1},{2}", i, edges[i].x, edges[i].y);
                }
            }
            finally
            {
                hsrc.Dispose();
                edges.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_edge_binary_boundary()
        Dim filepath As String = TestImageDir & "/testdata/bin_ellipse30.bmp"

        Dim status As Integer = CInt(f_err.F_ERR_NONE)
        Dim hsrc As FHANDLE = FHANDLE.Zero
        Dim edges As F_DEDGE_PTR = F_DEDGE_PTR.Zero
        Dim edge_num As Integer = 0

        Try
            api.fnFIE_load_img_file(filepath, hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8)

            Dim smooth_size As Integer = 7
            Dim offset As DPNT_T = DPNT_T.init(0, 0)
            status = api.fnFIE_edge_binary_boundary(hsrc, smooth_size, offset, edges, edge_num)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "fnFIE_edge_binary_boundary: エラーが発生しました。({0})", CType(status, f_err))
            Console.WriteLine("fnFIE_edge_binary_boundary")
            Console.WriteLine("edge_num = {0}", edge_num)
            For i As Integer = 0 To edge_num - 1
                If (0 <= i AndAlso i < 5) OrElse (edge_num - 5 <= i AndAlso i < edge_num) Then
                    Console.WriteLine("edges[{0}]={1},{2}", i, edges(i).x, edges(i).y)
                End If
            Next
        Finally
            hsrc.Dispose()
            edges.Dispose()
        End Try
    End Sub
End Class

See Also