opening filter
Namespace: fvalgcliAssembly: fvalgcli_fga (in fvalgcli_fga.dll) Version: 3.1.0.0 (3.1.0.3)
Syntax
C# |
---|
public static int fnFGA_opening( FHANDLE hsrc_img, FHANDLE hdst_img, int filter_num, int iMode ) |
Visual Basic |
---|
Public Shared Function fnFGA_opening ( hsrc_img As FHANDLE, hdst_img As FHANDLE, filter_num As Integer, iMode As Integer ) As Integer |
Parameters
- hsrc_img
- Type: fvalgcli..::..FHANDLE
処理対象画像( type: bin, uc8, s16, us16, double )
- hdst_img
- Type: fvalgcli..::..FHANDLE
処理結果画像( type: bin, uc8, s16, us16, double )
- filter_num
- Type: System..::..Int32
erosion/dilation実行回数
- iMode
- Type: System..::..Int32
近傍モード(0:8近傍 1:4近傍)
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | 不正な画像ハンドルが渡されたため、異常終了 |
F_ERR_NOMEMORY | メモリ不足で確保に失敗した |
F_ERR_INVALID_PARAM | パラメータ異常 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|---|
// $Revision: 1.3 $ using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using fvalgcli; namespace TC { public partial class FIE { /// <summary> /// opening filter. /// </summary> [FvPluginExecute] public void fnFGA_opening() { int status = (int)f_err.F_ERR_NONE; FHANDLE hfie_src = FHANDLE.Zero; // 入力画像. FHANDLE hfie_dst = FHANDLE.Zero; // 出力画像. FHANDLE hfga_src = FHANDLE.Zero; // 入力画像.(FGA 用) FHANDLE hfga_dst = FHANDLE.Zero; // 出力画像.(FGA 用) try { // 入力画像ファイルのロード. api.fnFIE_load_img_file(Defs.TestImageDir + "/testdata/gray_04.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); // 入出力画像の生成. hfga_src = fga.fnFGA_img_root_alloc(type, channels, width, height); // FGA 用. hfga_dst = fga.fnFGA_img_root_alloc(type, channels, width, height); // FGA 用. hfie_dst = api.fnFIE_img_root_alloc(type, channels, width, height); // FIE 画像オブジェクトから FGA 画像オブジェクトへコピー. fga.fnFGA_img_copy(hfie_src, hfga_src); // 処理の実行. status = fga.fnFGA_opening(hfga_src, hfga_dst, 5, 0); if (status != (int)f_err.F_ERR_NONE) throw new FvException(status, "エラーが発生しました。"); // FGA 画像オブジェクトから FIE 画像オブジェクトへコピー. fga.fnFGA_img_copy(hfga_dst, hfie_dst); // 出力画像の保存. api.fnFIE_save_png(Defs.ResultDir + "/fnFGA_opening.png", hfie_dst, -1); } finally { // オブジェクトの開放. hfie_src.Dispose(); hfie_dst.Dispose(); hfga_src.Dispose(); hfga_dst.Dispose(); } } } } |
Exceptions
Exception | Condition |
---|---|
System.IO..::..FileNotFoundException |
実行環境に NVIDIA CUDA Runtime が存在しない場合、FGA ライブラリのロードが失敗し、この例外が発行されます。 必要な環境については FGA ライブラリ説明書 をご参照ください。 例外メッセージの例 (32bit 日本語 O/S の場合): DLL 'fgamt.x86.3.0.0.dll' を読み込めません: 指定されたモジュールが見つかりません。 (HRESULT からの例外: 0x8007007E) |