2値画像アドレス取得(チャネル0固定)
Namespace: fvalgcliAssembly: fvalgcli_fga (in fvalgcli_fga.dll) Version: 3.1.0.0 (3.1.0.3)
Syntax
C# |
---|
public static void fnFGA_img_get_binadrs( FHANDLE himg, ref IntPtr adrs, ref int bitpos ) |
Visual Basic |
---|
Public Shared Sub fnFGA_img_get_binadrs ( himg As FHANDLE, ByRef adrs As IntPtr, ByRef bitpos As Integer ) |
Parameters
- himg
- Type: fvalgcli..::..FHANDLE
アドレスを取得する画像のハンドル
- adrs
- Type: System..::..IntPtr%
左上画素が含まれるブロックのアドレス
- bitpos
- Type: System..::..Int32%
ブロック内の左上画素のビット位置。 ブロック内一番左側(X座標が小さい方)を0とする0〜31の値。
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> /// 2値画像の画像アドレス取得(チャネル0固定). /// </summary> [FvPluginExecute] public void fnFGA_img_get_binadrs() { FHANDLE hroot = IntPtr.Zero; FHANDLE hchild = IntPtr.Zero; int type = (int)f_imgtype.F_IMG_BIN; // 2値画像. int channels = 3; int width = 320; int height = 240; 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: エラーが発生しました。"); int offset_x = 70; int offset_y = 20; // child 画像生成. hchild = fga.fnFGA_img_child_alloc(hroot, offset_x, offset_y, 128, 64); if (hchild == IntPtr.Zero) throw new FvException(f_err.F_ERR_NOMEMORY, "fnFGA_img_child_alloc: エラーが発生しました。"); // 2値画像の画像アドレス取得(チャネル0固定). { IntPtr adrs = IntPtr.Zero; int bitpos = 0; fga.fnFGA_img_get_binadrs(hchild, ref adrs, ref bitpos); Console.WriteLine("adrs={0}, bitpos={1}", adrs.ToInt64(), bitpos); if (adrs == IntPtr.Zero) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "画像アドレス:取得できていません"); if (bitpos != (offset_x % 64)) throw new FvException(f_err.F_ERR_INVALID_IMAGE, string.Format("値が一致しません。({0})", bitpos)); } // 2値画像の画像アドレス取得. { IntPtr adrs = IntPtr.Zero; int bitpos = 0; fga.fnFGA_img_get_ch_binadrs(hchild, 1, ref adrs, ref bitpos); Console.WriteLine("adrs={0}, bitpos={1}", adrs.ToInt64(), bitpos); if (adrs == IntPtr.Zero) throw new FvException(f_err.F_ERR_INVALID_IMAGE, "画像アドレス:取得できていません"); if (bitpos != (offset_x % 64)) throw new FvException(f_err.F_ERR_INVALID_IMAGE, string.Format("値が一致しません。({0})", bitpos)); } } 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) |