非極大値の抑制(エッジ勾配方向を利用)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_nms_dir( FHANDLE hmagx, FHANDLE hmagy, FHANDLE hthin, double thresh ) |
Visual Basic |
---|
Public Shared Function fnFIE_nms_dir ( hmagx As FHANDLE, hmagy As FHANDLE, hthin As FHANDLE, thresh As Double ) As Integer |
Parameters
- hmagx
- Type: fvalgcli..::..FHANDLE
X方向のエッジ強度画像(type:s16, double)
- hmagy
- Type: fvalgcli..::..FHANDLE
Y方向のエッジ強度画像(type:s16, double)
- hthin
- Type: fvalgcli..::..FHANDLE
細線化画像(type:uc8)
- thresh
- Type: System..::..Double
非常に小さい勾配を取り除くための閾値
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | 不正な画像が渡された |
F_ERR_INVALID_PARAM | 不正なパラメータが渡された
|
F_ERR_NOMEMORY | メモリ不足エラー |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
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_nms_dir() { string filepath = TestImageDir + "/TC/SampleCode/floppy_UC8.jpg"; FHANDLE hSrc = FHANDLE.Zero; FHANDLE hMagX = FHANDLE.Zero; FHANDLE hMagY = FHANDLE.Zero; FHANDLE hThin = FHANDLE.Zero; try { api.fnFIE_load_jpeg(filepath, ref hSrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8); double thresh = 64.0; hMagX = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_S16, 1, api.fnFIE_img_get_width(hSrc), api.fnFIE_img_get_height(hSrc)); hMagY = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_S16, 1, api.fnFIE_img_get_width(hSrc), api.fnFIE_img_get_height(hSrc)); hThin = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_UC8, 1, api.fnFIE_img_get_width(hSrc), api.fnFIE_img_get_height(hSrc)); api.fnFIE_sobel(hSrc, hMagX, f_sobel_mode.F_SOBEL_X_MODE, f_border_mode.F_BORDER_NONE, 0.0); api.fnFIE_sobel(hSrc, hMagY, f_sobel_mode.F_SOBEL_Y_MODE, f_border_mode.F_BORDER_NONE, 0.0); int status = api.fnFIE_nms_dir(hMagX, hMagY, hThin, thresh); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "fnFIE_nms_dir: エラーが発生しました。({0})", (f_err)status); Console.WriteLine("fnFIE_nms_dir"); } finally { hSrc.Dispose(); hMagX.Dispose(); hMagY.Dispose(); hThin.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE <FvPluginExecute> _ Public Sub fnFIE_nms_dir() Dim filepath As String = TestImageDir & "/TC/SampleCode/floppy_UC8.jpg" Dim hSrc As FHANDLE = FHANDLE.Zero Dim hMagX As FHANDLE = FHANDLE.Zero Dim hMagY As FHANDLE = FHANDLE.Zero Dim hThin As FHANDLE = FHANDLE.Zero Try api.fnFIE_load_jpeg(filepath, hSrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8) Dim thresh As Double = 64.0 hMagX = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_S16), 1, api.fnFIE_img_get_width(hSrc), api.fnFIE_img_get_height(hSrc)) hMagY = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_S16), 1, api.fnFIE_img_get_width(hSrc), api.fnFIE_img_get_height(hSrc)) hThin = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_UC8), 1, api.fnFIE_img_get_width(hSrc), api.fnFIE_img_get_height(hSrc)) api.fnFIE_sobel(hSrc, hMagX, f_sobel_mode.F_SOBEL_X_MODE, f_border_mode.F_BORDER_NONE, 0.0) api.fnFIE_sobel(hSrc, hMagY, f_sobel_mode.F_SOBEL_Y_MODE, f_border_mode.F_BORDER_NONE, 0.0) Dim status As Integer = api.fnFIE_nms_dir(hMagX, hMagY, hThin, thresh) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "fnFIE_nms_dir: エラーが発生しました。({0})", CType(status, f_err)) Console.WriteLine("fnFIE_nms_dir") Finally hSrc.Dispose() hMagX.Dispose() hMagY.Dispose() hThin.Dispose() End Try End Sub End Class |