リージョン内の画像ヒストグラム作成
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_img_histogram(
FHANDLE hImg,
FHANDLE hreg,
int iChaNo,
ref UINT_PTR unppHist,
ref int ipHistLen
) |
Visual Basic |
---|
Public Shared Function fnFIE_img_histogram (
hImg As FHANDLE,
hreg As FHANDLE,
iChaNo As Integer,
ByRef unppHist As UINT_PTR,
ByRef ipHistLen As Integer
) As Integer |
Parameters
- hImg
- Type: fvalgcli..::..FHANDLE
入力画像のハンドル (type: uc8, s16, us16)
- hreg
- Type: fvalgcli..::..FHANDLE
リージョンのハンドル
- iChaNo
- Type: System..::..Int32
処理したいチャネルの番号
- unppHist
- Type: fvalgcli..::..UINT_PTR%
ヒストグラムのメモリ (外部で確保したメモリのアドレス、または IntPtr.Zero を指定します。)
- ipHistLen
- Type: System..::..Int32%
- メモリ確保した場合はそのメモリの量を入力(UINT数単位)
- メモリ確保しなかった場合は関数内部確保のメモリの量を出力(UINT数単位)
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_NOMEMORY | メモリ不足エラー |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常 |
F_ERR_INVALID_OBJECT | リージョンオブジェクトの異常 |
F_ERR_INVALID_PARAM | パラメータ異常 |
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_img_histogram()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc = FHANDLE.Zero;
FHANDLE hreg = FHANDLE.Zero;
int iChaNo = 0;
UINT_PTR unHist = UINT_PTR.Zero;
int iHistLen = 0;
try
{
api.fnFIE_load_img_file(TestImageDir + "/testdata/colorg.bmp", ref hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8);
hreg = api.fnFIE_create_region_rect(97, 56, 330, 343);
status = api.fnFIE_img_histogram(hsrc, hreg, iChaNo, ref unHist, ref iHistLen);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
Console.WriteLine("fnFIE_img_histogram");
for (int i = 0; i < iHistLen; i++)
{
Console.Write("{0},", unHist[i]);
if (((i + 1) % 16) == 0)
Console.WriteLine("");
}
Console.WriteLine("");
Console.WriteLine("iHistLen={0}", iHistLen);
}
finally
{
hsrc.Dispose();
hreg.Dispose();
unHist.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_img_histogram()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc As FHANDLE = FHANDLE.Zero
Dim hreg As FHANDLE = FHANDLE.Zero
Dim iChaNo As Integer = 0
Dim unHist As UINT_PTR = UINT_PTR.Zero
Dim iHistLen As Integer = 0
Try
api.fnFIE_load_img_file(TestImageDir & "/testdata/colorg.bmp", hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8)
hreg = api.fnFIE_create_region_rect(97, 56, 330, 343)
status = api.fnFIE_img_histogram(hsrc, hreg, iChaNo, unHist, iHistLen)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
Console.WriteLine("fnFIE_img_histogram")
For i As Integer = 0 To iHistLen - 1
Console.Write("{0},", unHist(i))
If ((i + 1) Mod 16) = 0 Then
Console.WriteLine("")
End If
Next
Console.WriteLine("")
Console.WriteLine("iHistLen={0}", iHistLen)
Finally
hsrc.Dispose()
hreg.Dispose()
unHist.Dispose()
End Try
End Sub
End Class |
See Also