画像のルート情報取得
Namespace: fvalgcliAssembly: fvalgcli_fga (in fvalgcli_fga.dll) Version: 3.1.0.0 (3.1.0.3)
Syntax
C# |
---|
public static int fnFGA_img_get_root_params( FHANDLE himg, ref FHANDLE hroot, ref int channel, ref int offset_x, ref int offset_y ) |
Visual Basic |
---|
Public Shared Function fnFGA_img_get_root_params ( himg As FHANDLE, ByRef hroot As FHANDLE, ByRef channel As Integer, ByRef offset_x As Integer, ByRef offset_y As Integer ) As Integer |
Parameters
- himg
- Type: fvalgcli..::..FHANDLE
情報を取得する画像
- hroot
- Type: fvalgcli..::..FHANDLE%
himg の割り当てられているルート画像のハンドル
himg がルート画像のときは himg を返す(つまり *hroot = himg )
関数エントリー時 *hroot == NULL でなければなりません。
- channel
- Type: System..::..Int32%
*hroot のうち himg の割り当てられているチャネル番号
himg がルート画像の場合、または himg が hroot の全チャネルに 割り当てられている場合は -1 を返す
- offset_x
- Type: System..::..Int32%
himg の左上X座標(ルート画像の左上画素を(0,0)としたときの座標)
- offset_y
- Type: System..::..Int32%
himg の左上Y座標(ルート画像の左上画素を(0,0)としたときの座標)
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常 |
F_ERR_INVALID_PARAM | パラメータ異常
|
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|---|
// $Revision: 1.2 $ using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using fvalgcli; namespace TC { public partial class FIE { /// <summary> /// 画像のルート情報取得. /// </summary> [FvPluginExecute] public void fnFGA_img_get_root_params() { int status = (int)f_err.F_ERR_NONE; FHANDLE hroot = FHANDLE.Zero; FHANDLE hchild = FHANDLE.Zero; FHANDLE _hroot = FHANDLE.Zero; int type = (int)f_imgtype.F_IMG_UC8; int channels = 3; int width = 640; int height = 480; int offset_x = 10; int offset_y = 20; int child_width = 128; int child_height = 64; try { // root 画像生成. hroot = fga.fnFGA_img_root_alloc(type, channels, width, height); if (hroot == IntPtr.Zero) throw new FvException(f_err.F_ERR_NOMEMORY, "fnFGA_img_root_alloc: エラーが発生しました。"); // child 画像生成. hchild = fga.fnFGA_img_child_alloc(hroot, offset_x, offset_y, child_width, child_height); if (hroot == IntPtr.Zero) throw new FvException(f_err.F_ERR_NOMEMORY, "fnFGA_img_child_alloc: エラーが発生しました。"); // 画像情報取得. int _channel = 0; int _offset_x = 0; int _offset_y = 0; status = fga.fnFGA_img_get_root_params(hchild, ref _hroot, ref _channel, ref _offset_x, ref _offset_y); if (status != (int)f_err.F_ERR_NONE) throw new FvException(status, "エラーが発生しました。"); if (_hroot != hroot) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "ルート画像:一致しません。"); if (_offset_x != offset_x) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "オフセット(x):一致しません."); if (_offset_y != offset_y) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "オフセット(y):一致しません."); } finally { hroot.Dispose(); // _hroot は hroot を開放すれば、開放されます. hchild.Dispose(); } } } } |
Exceptions
Exception | Condition |
---|---|
System.IO..::..FileNotFoundException |
実行環境に NVIDIA CUDA Runtime が存在しない場合、FGA ライブラリのロードが失敗し、この例外が発行されます。 必要な環境については FGA ライブラリ説明書 をご参照ください。 例外メッセージの例 (32bit 日本語 O/S の場合): DLL 'fgamt.x86.3.0.0.dll' を読み込めません: 指定されたモジュールが見つかりません。 (HRESULT からの例外: 0x8007007E) |