判別分析法による画像2値化
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_discrimination_threshold2(
FHANDLE hSrc,
FHANDLE hDst,
INT_PTR ipThresh
) |
Visual Basic |
---|
Public Shared Function fnFIE_discrimination_threshold2 (
hSrc As FHANDLE,
hDst As FHANDLE,
ipThresh As INT_PTR
) As Integer |
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_NOMEMORY | メモリ不足エラー |
F_ERR_INVALID_IMAGE | 不正な画像が渡された |
F_ERR_INVALID_PARAM | パラメータ不正 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_discrimination_threshold2()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc1 = FHANDLE.Zero;
FHANDLE hdst = FHANDLE.Zero;
try
{
api.fnFIE_load_img_file(TestImageDir + "/testdata/gray_04.bmp", ref hsrc1, f_color_img_type.F_COLOR_IMG_TYPE_UC8);
int width = api.fnFIE_img_get_width(hsrc1);
int height = api.fnFIE_img_get_height(hsrc1);
int channels = api.fnFIE_img_get_channels(hsrc1);
hdst = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_BIN, channels, width, height);
status = api.fnFIE_discrimination_threshold2(hsrc1, hdst, INT_PTR.Zero);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
api.fnFIE_save_png(ResultDir + "/fnFIE_discrimination_threshold2.png", hdst, -1);
}
finally
{
hsrc1.Dispose();
hdst.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_discrimination_threshold2()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc1 As FHANDLE = FHANDLE.Zero
Dim hdst As FHANDLE = FHANDLE.Zero
Try
api.fnFIE_load_img_file(TestImageDir & "/testdata/gray_04.bmp", hsrc1, f_color_img_type.F_COLOR_IMG_TYPE_UC8)
Dim width As Integer = api.fnFIE_img_get_width(hsrc1)
Dim height As Integer = api.fnFIE_img_get_height(hsrc1)
Dim channels As Integer = api.fnFIE_img_get_channels(hsrc1)
hdst = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_BIN), channels, width, height)
status = api.fnFIE_discrimination_threshold2(hsrc1, hdst, INT_PTR.Zero)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
api.fnFIE_save_png(ResultDir & "/fnFIE_discrimination_threshold2.png", hdst, -1)
Finally
hsrc1.Dispose()
hdst.Dispose()
End Try
End Sub
End Class |
See Also