REGION特徴量:最大フェレ径、最小フェレ径

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

Syntax

C#
public static int fnFIE_region_calc_feret_diameter_maxmin(
	FHANDLE hreg,
	ref double feretmax,
	ref double fmax_theta,
	ref double feretmin,
	ref double fmin_theta
)
Visual Basic
Public Shared Function fnFIE_region_calc_feret_diameter_maxmin ( 
	hreg As FHANDLE,
	ByRef feretmax As Double,
	ByRef fmax_theta As Double,
	ByRef feretmin As Double,
	ByRef fmin_theta As Double
) As Integer

Parameters

hreg
Type: fvalgcli..::..FHANDLE
REGIONハンドル
feretmax
Type: System..::..Double%
最大フェレ径
fmax_theta
Type: System..::..Double%
最大フェレ径の角度
feretmin
Type: System..::..Double%
最小フェレ径
fmin_theta
Type: System..::..Double%
最小フェレ径の角度

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_PARAM不正なパラメータが指定された
  • feretmax, fmax_theta, feretmin, fmin_theta に IntPtr.Zero が指定された
F_ERR_INVALID_OBJECT不正なハンドル
F_ERR_CALC_IMPOSSIBLE 計算不能
F_ERR_NOMEMORYメモリ不足
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Remarks

Examples

C# Copy imageCopy
//    $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_feret_diameter_maxmin()
        {
            FHANDLE himage = FHANDLE.Zero;
            FHANDLE hreg = FHANDLE.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 = new PNT_T();
                offset.x = 0;
                offset.y = 0;
                // --- 作成.
                hreg = api.fnFIE_region_encode(himage, offset);

                // リージョン特徴量:最大フェレ径、最小フェレ径.
                double feretmax = 0;
                double fmax_theta = 0;
                double feretmin = 0;
                double fmin_theta = 0;
                int status = api.fnFIE_region_calc_feret_diameter_maxmin(hreg, ref feretmax, ref fmax_theta, ref feretmin, ref fmin_theta);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "calc_feret_diameter_maxminでエラーが発生しました。({0})", (f_err)status);

                // 値の確認.
                Console.WriteLine("feretmax={0},fmax_theta={1},feretmin={2},fmin_theta={3}", feretmax, fmax_theta, feretmin, fmin_theta);
            }
            finally
            {
                himage.Dispose();
                hreg.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

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

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_region_calc_feret_diameter_maxmin()
        Dim himage As FHANDLE = FHANDLE.Zero
        Dim hreg As FHANDLE = FHANDLE.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 New PNT_T()
            offset.x = 0
            offset.y = 0
            ' --- 作成.
            hreg = api.fnFIE_region_encode(himage, offset)

            ' リージョン特徴量:最大フェレ径、最小フェレ径.
            Dim feretmax As Double = 0
            Dim fmax_theta As Double = 0
            Dim feretmin As Double = 0
            Dim fmin_theta As Double = 0
            Dim status As Integer = api.fnFIE_region_calc_feret_diameter_maxmin(hreg, feretmax, fmax_theta, feretmin, fmin_theta)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "calc_feret_diameter_maxminでエラーが発生しました。({0})", CType(status, f_err))

            ' 値の確認.
            Console.WriteLine("feretmax={0},fmax_theta={1},feretmin={2},fmin_theta={3}", feretmax, fmax_theta, feretmin, fmin_theta)
        Finally
            himage.Dispose()
            hreg.Dispose()
        End Try
    End Sub
End Class

See Also