画像比較
Namespace: fvalgcliAssembly: fvalgcli_fga (in fvalgcli_fga.dll) Version: 3.1.0.0 (3.1.0.3)
Syntax
C# |
---|
public static int fnFGA_img_compare( FHANDLE hsrc1, FHANDLE hsrc2, ref bool result ) |
Visual Basic |
---|
Public Shared Function fnFGA_img_compare ( hsrc1 As FHANDLE, hsrc2 As FHANDLE, ByRef result As Boolean ) As Integer |
Parameters
- hsrc1
- Type: fvalgcli..::..FHANDLE
入力画像( FGA 画像オブジェクト / type: bin, uc8, s16, us16, rgbq, double )
- hsrc2
- Type: fvalgcli..::..FHANDLE
入力画像( FGA 画像オブジェクト / type: bin, uc8, s16, us16, rgbq, double )
- 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_NOMEMORY | メモリ不足エラー |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|---|
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using fvalgcli; namespace TC { public partial class FIE { [FvPluginExecute] public void fnFGA_img_compare() { int status = (int)f_err.F_ERR_NONE; FHANDLE hfie_src = FHANDLE.Zero; // 入力画像. FHANDLE hfga_src1 = FHANDLE.Zero; // 入力画像1(FGA用) FHANDLE hfga_src2 = FHANDLE.Zero; // 入力画像2(FGA用) bool result = false; // 比較結果. try { // 入力画像1 の確保. api.fnFIE_load_bmp(Defs.TestImageDir + "/testdata/lena256.bmp", ref hfie_src, f_color_img_type.F_COLOR_IMG_TYPE_UC8); // 入力画像の情報取得. int width = api.fnFIE_img_get_width(hfie_src); int height = api.fnFIE_img_get_height(hfie_src); int channels = api.fnFIE_img_get_channels(hfie_src); int type = api.fnFIE_img_get_type(hfie_src); // 入力画像の生成.(FGA用) hfga_src1 = fga.fnFGA_img_root_alloc(type, channels, width, height); if (hfga_src1 == IntPtr.Zero) throw new FvException(f_err.F_ERR_NOMEMORY); // FIE 画像オブジェクトから FGA 画像オブジェクトへコピー. status = fga.fnFGA_img_copy(hfie_src, hfga_src1); if (status != (int)f_err.F_ERR_NONE) throw new FvException(status); // 入力画像の生成.(FGA用) hfga_src2 = fga.fnFGA_img_root_alloc(type, channels, width, height); if (hfga_src2 == IntPtr.Zero) throw new FvException(f_err.F_ERR_NOMEMORY); // FIE 画像オブジェクトから FGA 画像オブジェクトへコピー. status = fga.fnFGA_img_copy(hfie_src, hfga_src2); if (status != (int)f_err.F_ERR_NONE) throw new FvException(status); // 処理の実行. status = fga.fnFGA_img_compare(hfga_src1, hfga_src2, ref result); if (status != (int)f_err.F_ERR_NONE) throw new FvException(status, "エラーが発生しました。"); // 比較結果を出力する. Console.WriteLine("fnFGA_img_compare"); Console.WriteLine("result = {0} ...", result); if (result != true) throw new FvException(status, "値が一致しません。"); } finally { // オブジェクトの開放. hfie_src.Dispose(); hfga_src1.Dispose(); hfga_src2.Dispose(); } } } } |