画像比較
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_img_compare(
FHANDLE hsrc1,
FHANDLE hsrc2,
ref bool result
) |
Visual Basic |
---|
Public Shared Function fnFIE_img_compare (
hsrc1 As FHANDLE,
hsrc2 As FHANDLE,
ByRef result As Boolean
) As Integer |
Parameters
- hsrc1
- Type: fvalgcli..::..FHANDLE
入力画像ハンドル( type: bin, uc8, s16, us16, i32, ui32, i64, float, double, rgbq, rgbtri )
- hsrc2
- Type: fvalgcli..::..FHANDLE
入力画像ハンドル( type: bin, uc8, s16, us16, i32, ui32, i64, float, double, rgbq, rgbtri )
- result
- Type: System..::..Boolean%
比較結果
- true: 画像が等しい
- false: 画像が異なる
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常 |
F_ERR_INVALID_PARAM | パラメータ異常 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|
#define COMPARE_OK
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_img_compare()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc1 = FHANDLE.Zero;
FHANDLE hsrc2 = FHANDLE.Zero;
bool result = new bool();
bool ans_result;
try
{
api.fnFIE_load_bmp(TestImageDir + "/testdata/lena256.bmp", ref hsrc1, f_color_img_type.F_COLOR_IMG_TYPE_UC8);
hsrc2 = api.fnFIE_img_root_alloc
(
api.fnFIE_img_get_type(hsrc1), 1,
api.fnFIE_img_get_width(hsrc1),
api.fnFIE_img_get_height(hsrc1)
);
#if COMPARE_OK
api.fnFIE_img_copy(hsrc1, hsrc2);
ans_result = true;
#else
api.fnFIE_img_clear(hsrc2, 0);
ans_result = false;
#endif
status = api.fnFIE_img_compare(hsrc1, hsrc2, ref result);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
ConsoleOut.WriteFunctionName(":\t");
Console.Write("result = {0} ...", result);
ConsoleOut.IsTrue(ans_result == result);
}
finally
{
hsrc1.Dispose();
hsrc2.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
#Const COMPARE_OK = True
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_img_compare()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc1 As FHANDLE = FHANDLE.Zero
Dim hsrc2 As FHANDLE = FHANDLE.Zero
Dim result As New Boolean()
Dim ans_result As Boolean
Try
api.fnFIE_load_bmp(TestImageDir & "/testdata/lena256.bmp", hsrc1, f_color_img_type.F_COLOR_IMG_TYPE_UC8)
hsrc2 = api.fnFIE_img_root_alloc(api.fnFIE_img_get_type(hsrc1), 1, api.fnFIE_img_get_width(hsrc1), api.fnFIE_img_get_height(hsrc1))
#If COMPARE_OK Then
api.fnFIE_img_copy(hsrc1, hsrc2)
ans_result = True
#Else
api.fnFIE_img_clear(hsrc2, 0)
ans_result = False
#End If
status = api.fnFIE_img_compare(hsrc1, hsrc2, result)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
ConsoleOut.WriteFunctionName(":" & vbTab)
Console.Write("result = {0} ...", result)
ConsoleOut.IsTrue(ans_result = result)
Finally
hsrc1.Dispose()
hsrc2.Dispose()
End Try
End Sub
End Class |
See Also