チャイルド画像の確保
Namespace: fvalgcliAssembly: fvalgcli_fga (in fvalgcli_fga.dll) Version: 3.1.0.0 (3.1.0.3)
Syntax
C# |
---|
public static FHANDLE fnFGA_img_child_alloc( FHANDLE hroot, int offset_x, int offset_y, int width, int height ) |
Visual Basic |
---|
Public Shared Function fnFGA_img_child_alloc ( hroot As FHANDLE, offset_x As Integer, offset_y As Integer, width As Integer, height As Integer ) As FHANDLE |
Parameters
- hroot
- Type: fvalgcli..::..FHANDLE
ルート画像のハンドル(チャイルド画像でも可)
- offset_x
- Type: System..::..Int32
ルート座標系における、チャイルド領域左上x座標 (0≦ offset_x ≦ (ルート画像の幅 -1 - width ))
- offset_y
- Type: System..::..Int32
ルート座標系における、チャイルド領域左上y座標 (0≦ offset_y ≦ (ルート画像の高さ -1 - height ))
- width
- Type: System..::..Int32
チャイルド領域幅 (1≦ width ≦(ルート画像の幅 - offset_x ))
- height
- Type: System..::..Int32
チャイルド領域高さ(1≦ height ≦(ルート画像の高さ - offset_y ))
Return Value
Type: FHANDLE正常終了した場合は、確保されたチャイルド画像のハンドルを返す。 ライセンスエラー、未初期化エラー、パラメータ不正やメモリ確保失敗により異常終了した場合は、NULLを返す。
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_child_alloc() { FHANDLE hroot = FHANDLE.Zero; FHANDLE hchild = 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, "エラーが発生しました。"); // child 画像生成. hchild = fga.fnFGA_img_child_alloc(hroot, offset_x, offset_y, child_width, child_height); if (hchild == IntPtr.Zero) throw new FvException(f_err.F_ERR_NOMEMORY, "エラーが発生しました。"); // 画像情報取得. { IntPtr _adrs0 = fga.fnFGA_img_get_adrs(hchild); IntPtr _adrs1 = fga.fnFGA_img_get_ch_adrs(hchild, 1); int _channels = fga.fnFGA_img_get_channels(hchild); int _type = fga.fnFGA_img_get_type(hchild); int _width = fga.fnFGA_img_get_width(hchild); int _height = fga.fnFGA_img_get_height(hchild); SIZE_T _step = fga.fnFGA_img_get_step(hchild); SIZE_T _step_byte = fga.fnFGA_img_get_step_as_bytes(hchild); SIZE_T _pixel_size = fga.fnFGA_img_get_pixel_size(hchild); Console.WriteLine("fnFGA_img_get_adrs : {0}", _adrs0.ToInt64()); Console.WriteLine("fnFGA_img_get_ch_adrs : {0}", _adrs1.ToInt64()); Console.WriteLine("_channels={0}", _channels); Console.WriteLine("_type={0}", _type); Console.WriteLine("_width={0}", _width); Console.WriteLine("_height={0}", _height); Console.WriteLine("_step={0}", _step.ToInt64()); Console.WriteLine("_step_byte={0}", _step_byte.ToInt32()); Console.WriteLine("_pixel_size={0}", _pixel_size.ToInt32()); if (_adrs0 == IntPtr.Zero) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "画像アドレス0:取得できていません"); if (_adrs1 == IntPtr.Zero) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "画像アドレス1:取得できていません"); 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 (child_width != _width) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "幅:期待値と一致しません."); if (child_height != _height) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "高さ:期待値と一致しません."); } } finally { // オブジェクトの開放. hroot.Dispose(); 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) |