REGION特徴量:外接長方形の頂点
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_region_calc_rect2pos( FHANDLE hreg, DPNT_T_PTR points ) |
Visual Basic |
---|
Public Shared Function fnFIE_region_calc_rect2pos ( hreg As FHANDLE, points As DPNT_T_PTR ) As Integer |
Parameters
- hreg
- Type: fvalgcli..::..FHANDLE
REGIONハンドル
- points
- Type: fvalgcli..::..DPNT_T_PTR
外接長方形の4頂点の点列。サイズ4
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_PARAM | 不正なパラメータが指定された
|
F_ERR_INVALID_OBJECT | 不正なハンドル |
F_ERR_CALC_IMPOSSIBLE | 計算不能 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Remarks
Examples
C# | Copy |
---|---|
// $Revision: 1.1 $ using System; using System.Collections.Generic; using System.Text; using fvalgcli; namespace TC { public partial class FIE { [FvPluginExecute] public void fnFIE_region_calc_rect2pos() { FHANDLE himage = FHANDLE.Zero; FHANDLE hreg = FHANDLE.Zero; DPNT_T_PTR points = IntPtr.Zero; try { // 2値画像を読み込む. 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 = PNT_T.init(0, 0); // --- 作成. hreg = api.fnFIE_region_encode(himage, offset); // リージョン特徴量:外接長方形の頂点. points = DPNT_T_PTR.alloc(4); int status = api.fnFIE_region_calc_rect2pos(hreg, points); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "calc_rect2posでエラーが発生しました。({0})", (f_err)status); // 値の確認. Console.WriteLine("point.x1={0}, point.x2={1}, point.x3={2}, point.x4={3}", points[0].x, points[1].x, points[2].x, points[3].x); } finally { himage.Dispose(); hreg.Dispose(); points.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE <FvPluginExecute> _ Public Sub fnFIE_region_calc_rect2pos() Dim himage As FHANDLE = FHANDLE.Zero Dim hreg As FHANDLE = FHANDLE.Zero Dim points As DPNT_T_PTR = IntPtr.Zero Try ' 2値画像を読み込む. 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 PNT_T = PNT_T.init(0, 0) ' --- 作成. hreg = api.fnFIE_region_encode(himage, offset) ' リージョン特徴量:外接長方形の頂点. points = DPNT_T_PTR.alloc(4) Dim status As Integer = api.fnFIE_region_calc_rect2pos(hreg, points) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "calc_rect2posでエラーが発生しました。({0})", CType(status, f_err)) ' 値の確認. Console.WriteLine("point.x1={0}, point.x2={1}, point.x3={2}, point.x4={3}", points(0).x, points(1).x, points(2).x, points(3).x) Finally himage.Dispose() hreg.Dispose() points.Dispose() End Try End Sub End Class |