ルート画像の変更

Namespace: fvalgcli
Assembly: fvalgcli_fga (in fvalgcli_fga.dll) Version: 3.1.0.0 (3.1.0.3)

Syntax

C#
public static int fnFGA_img_root_realloc(
	FHANDLE himg,
	f_imgtype type,
	int channels,
	int width,
	int height
)
Visual Basic
Public Shared Function fnFGA_img_root_realloc ( 
	himg As FHANDLE,
	type As f_imgtype,
	channels As Integer,
	width As Integer,
	height As Integer
) As Integer

Parameters

himg
Type: fvalgcli..::..FHANDLE
サイズを変更する画像のハンドル
type
Type: fvalgcli..::..f_imgtype
確保する画像種別。f_imgtype に定義された定数を指定。
channels
Type: System..::..Int32
チャネル数(1〜16)
width
Type: System..::..Int32
画像幅(1以上)
height
Type: System..::..Int32
画像高さ(1以上)

Return Value

Type: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_NOMEMORYメモリ不足エラー
F_ERR_INVALID_IMAGE画像オブジェクトの異常(ハンドルが不正orインポートされていてリサイズ不可)
F_ERR_INVALID_PARAMパラメータ異常
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

注意: ルート画像をreallocすると、それまでattachされていたチャイルド画像はすべてNULL画像になります。 また fnFGA_img_root_import_alloc() にて確保されたルート画像が指定された場合は、 F_ERR_INVALID_IMAGE エラーとなります。

Examples

C# Copy imageCopy
//    $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_root_realloc()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE hroot = FHANDLE.Zero;

            int type = (int)f_imgtype.F_IMG_UC8;
            int channels = 3;
            int width = 640;
            int height = 480;

            try
            {
                // root 画像生成.
                hroot = fga.fnFGA_img_root_alloc(type, channels, width, height);
                if (hroot == IntPtr.Zero)
                    throw new FvException(f_err.F_ERR_NOMEMORY, "エラーが発生しました。");

                // root 画像変更.
                int type_re = (int)f_imgtype.F_IMG_UI32;
                int channels_re = 1;
                int width_re = 800;
                int height_re = 600;
                status = fga.fnFGA_img_root_realloc(hroot, type_re, channels_re, width_re, height_re);
                if (status != (int)f_err.F_ERR_NONE)
                    throw new FvException(status, "エラーが発生しました。");

                // 画像情報取得.
                {
                    int _channels = fga.fnFGA_img_get_channels(hroot);
                    int _type = fga.fnFGA_img_get_type(hroot);
                    int _width = fga.fnFGA_img_get_width(hroot);
                    int _height = fga.fnFGA_img_get_height(hroot);

                    if (channels_re != _channels)
                        throw new FvException(f_err.F_ERR_INVALID_IMAGE, "チャネル数:期待値と一致しません.");
                    if (type_re != _type)
                        throw new FvException(f_err.F_ERR_INVALID_IMAGE, "タイプ:期待値と一致しません.");
                    if (width_re != _width)
                        throw new FvException(f_err.F_ERR_INVALID_IMAGE, "幅:期待値と一致しません.");
                    if (height_re != _height)
                        throw new FvException(f_err.F_ERR_INVALID_IMAGE, "高さ:期待値と一致しません.");
                }
            }
            finally
            {
                // オブジェクトの開放.
                hroot.Dispose();
            }
        }
    }
}

Exceptions

ExceptionCondition
System.IO..::..FileNotFoundException 実行環境に NVIDIA CUDA Runtime が存在しない場合、FGA ライブラリのロードが失敗し、この例外が発行されます。
必要な環境については FGA ライブラリ説明書 をご参照ください。
例外メッセージの例 (32bit 日本語 O/S の場合):
DLL 'fgamt.x86.3.0.0.dll' を読み込めません: 指定されたモジュールが見つかりません。 (HRESULT からの例外: 0x8007007E)

See Also