REGION特徴量:凸包生成
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_region_calc_convex2d(
FHANDLE hreg,
ref PNT_T_PTR ppHull,
ref uint verNum
) |
Visual Basic |
---|
Public Shared Function fnFIE_region_calc_convex2d (
hreg As FHANDLE,
ByRef ppHull As PNT_T_PTR,
ByRef verNum As UInteger
) As Integer |
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_PARAM | 不正なパラメータが指定された
- ppHull が IntPtr.Zero ではない
|
F_ERR_INVALID_OBJECT | 不正なハンドル |
F_ERR_CALC_IMPOSSIBLE | 計算不能 |
F_ERR_NOMEMORY | メモリ不足 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Remarks
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_region_calc_convex2d()
{
FHANDLE hreg = FHANDLE.Zero;
FHANDLE himage = FHANDLE.Zero;
PNT_T_PTR vertex = IntPtr.Zero;
try
{
api.fnFIE_load_img_file(TestImageDir + "/TC/SampleCode/blob_BIN.png", ref himage, f_color_img_type.F_COLOR_IMG_TYPE_UC8);
Assert.IsTrue(himage != FHANDLE.Zero, "himage が異常です.");
PNT_T offset = new PNT_T();
hreg = api.fnFIE_region_encode(himage, offset);
uint num = 0;
int status = api.fnFIE_region_calc_convex2d(hreg, ref vertex, ref num);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "calc_convex2dでエラーが発生しました。({0})", (f_err)status);
Console.WriteLine("num={0}", num);
for (int i = 0; i < num; i++)
{
Console.WriteLine("vertex[{0}]={1}", i, vertex[i].x, vertex[i].y);
}
}
finally
{
hreg.Dispose();
himage.Dispose();
vertex.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_region_calc_convex2d()
Dim hreg As FHANDLE = FHANDLE.Zero
Dim himage As FHANDLE = FHANDLE.Zero
Dim vertex As PNT_T_PTR = IntPtr.Zero
Try
api.fnFIE_load_img_file(TestImageDir & "/TC/SampleCode/blob_BIN.png", himage, f_color_img_type.F_COLOR_IMG_TYPE_UC8)
Assert.IsTrue(himage <> FHANDLE.Zero, "himage が異常です.")
Dim offset As New PNT_T()
hreg = api.fnFIE_region_encode(himage, offset)
Dim num As UInteger = 0
Dim status As Integer = api.fnFIE_region_calc_convex2d(hreg, vertex, num)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "calc_convex2dでエラーが発生しました。({0})", CType(status, f_err))
Console.WriteLine("num={0}", num)
For i As Integer = 0 To CType(num, Integer) - 1
Console.WriteLine("vertex[{0}]={1}", i, vertex(i).x, vertex(i).y)
Next
Finally
hreg.Dispose()
himage.Dispose()
vertex.Dispose()
End Try
End Sub
End Class |
See Also