画像情報取得
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_params( FHANDLE himg, ref int channels, ref int type, ref SIZE_T step, ref int width, ref int height ) |
Visual Basic |
---|
Public Shared Function fnFGA_img_get_params ( himg As FHANDLE, ByRef channels As Integer, ByRef type As Integer, ByRef step As SIZE_T, ByRef width As Integer, ByRef height As Integer ) As Integer |
Parameters
- himg
- Type: fvalgcli..::..FHANDLE
情報を取得する画像のハンドル
- channels
- Type: System..::..Int32%
画像メモリのチャネル数 (省略時は NULL を指定)
- type
- Type: System..::..Int32%
画像メモリの種別 (省略時は NULL を指定)
- step
- Type: fvalgcli..::..SIZE_T%
画像メモリの行ステップ(画素単位) (省略時は NULL を指定)
- width
- Type: System..::..Int32%
領域幅 (省略時は NULL を指定)
- height
- Type: System..::..Int32%
領域高さ (省略時は NULL を指定)
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常 |
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_params() { int status = (int)f_err.F_ERR_NONE; FHANDLE hroot = IntPtr.Zero; int type = (int)f_imgtype.F_IMG_UC8; int channels = 3; int width = 640; int height = 480; int exp = 4; int exp_init = 3; try { // パディングサイズの設定. fga.fnFGA_img_set_padding_size(exp); // 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: エラーが発生しました。"); // 画像情報取得. int _channels = 0; int _type = 0; int _width = 0; int _height = 0; SIZE_T _step = new fvalgcli.SIZE_T(0); status = fga.fnFGA_img_get_params(hroot, ref _channels, ref _type, ref _step, ref _width, ref _height); if (status != (int)f_err.F_ERR_NONE) throw new FvException(status, "エラーが発生しました。"); if (_channels != channels) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "チャネル数:期待値と一致しません."); if (_type != type) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "種別:期待値と一致しません."); if (_width != width) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "幅:期待値と一致しません."); if (_height != height) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "高さ:期待値と一致しません."); if (_step == 0) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "ステップ:取得できていません."); // パディングサイズの復元. fga.fnFGA_img_set_padding_size(exp_init); } finally { // オブジェクトの開放. hroot.Dispose(); } } } } |
Exceptions
Exception | Condition |
---|---|
System.IO..::..FileNotFoundException |
実行環境に NVIDIA CUDA Runtime が存在しない場合、FGA ライブラリのロードが失敗し、この例外が発行されます。 必要な環境については FGA ライブラリ説明書 をご参照ください。 例外メッセージの例 (32bit 日本語 O/S の場合): DLL 'fgamt.x86.3.0.0.dll' を読み込めません: 指定されたモジュールが見つかりません。 (HRESULT からの例外: 0x8007007E) |