画像情報取得

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static int fnFIE_img_get_params(
	FHANDLE himg,
	ref int channels,
	ref f_imgtype type,
	ref SIZE_T step,
	ref int width,
	ref int height
)
Visual Basic
Public Shared Function fnFIE_img_get_params ( 
	himg As FHANDLE,
	ByRef channels As Integer,
	ByRef type As f_imgtype,
	ByRef step As SIZE_T,
	ByRef width As Integer,
	ByRef height As Integer
) As Integer

Parameters

himg
Type: fvalgcli..::..FHANDLE
情報を取得する画像のハンドル
channels
Type: System..::..Int32%
画像メモリのチャネル数 (省略時は IntPtr.Zero を指定)
type
Type: fvalgcli..::..f_imgtype%
画像メモリの種別 (省略時は IntPtr.Zero を指定)
step
Type: fvalgcli..::..SIZE_T%
画像メモリの行ステップ(画素単位) (省略時は IntPtr.Zero を指定)
width
Type: System..::..Int32%
領域幅 (省略時は IntPtr.Zero を指定)
height
Type: System..::..Int32%
領域高さ (省略時は IntPtr.Zero を指定)

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_IMAGE画像オブジェクトの異常
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        /// <summary>
        /// 画像情報取得.
        /// </summary>
        [FvPluginExecute]
        public void fnFIE_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
            {                
                // パディングサイズの設定.
                api.fnFIE_img_set_padding_size(exp);

                // root 画像生成.
                hroot = api.fnFIE_img_root_alloc(type, channels, width, height);
                Assert.IsTrue(hroot != FHANDLE.Zero, "fnFIE_img_root_alloc: エラーが発生しました。");

                // 画像情報取得.
                int _channels = 0;
                int _type = 0;
                int _width = 0;
                int _height = 0;
                SIZE_T _step = new fvalgcli.SIZE_T(0);


                status = api.fnFIE_img_get_params(hroot, ref _channels, ref _type, ref _step, ref _width, ref _height);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

                Assert.IsTrue(_channels == channels, "チャネル数:期待値と一致しません.");
                Assert.IsTrue(_type == type, "種別:期待値と一致しません.");
                Assert.IsTrue(_width == width, "幅:期待値と一致しません.");
                Assert.IsTrue(_height == height, "高さ:期待値と一致しません.");
                Assert.IsTrue(_step != 0, "ステップ:取得できていません.");

                // パディングサイズの復元.
                api.fnFIE_img_set_padding_size(exp_init);
            }
            finally
            {
                // オブジェクトの開放.
                hroot.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    ''' <summary>
    ''' 画像情報取得.
    ''' </summary>
    <FvPluginExecute> _
    Public Sub fnFIE_img_get_params()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)
        Dim hroot As FHANDLE = IntPtr.Zero
        Dim type As Integer = CInt(f_imgtype.F_IMG_UC8)
        Dim channels As Integer = 3
        Dim width As Integer = 640
        Dim height As Integer = 480
        Dim exp As Integer = 4
        Dim exp_init As Integer = 3

        Try
            ' パディングサイズの設定.
            api.fnFIE_img_set_padding_size(exp)

            ' root 画像生成.
            hroot = api.fnFIE_img_root_alloc(type, channels, width, height)
            Assert.IsTrue(hroot <> FHANDLE.Zero, "fnFIE_img_root_alloc: エラーが発生しました。")

            ' 画像情報取得.
            Dim _channels As Integer = 0
            Dim _type As Integer = 0
            Dim _width As Integer = 0
            Dim _height As Integer = 0
            Dim _step As SIZE_T = New fvalgcli.SIZE_T(0)


            status = api.fnFIE_img_get_params(hroot, _channels, _type, _step, _width, _height)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

            Assert.IsTrue(_channels = channels, "チャネル数:期待値と一致しません.")
            Assert.IsTrue(_type = type, "種別:期待値と一致しません.")
            Assert.IsTrue(_width = width, "幅:期待値と一致しません.")
            Assert.IsTrue(_height = height, "高さ:期待値と一致しません.")
            Assert.IsTrue(_step <> 0, "ステップ:取得できていません.")

            ' パディングサイズの復元.
            api.fnFIE_img_set_padding_size(exp_init)
        Finally
            ' オブジェクトの開放.
            hroot.Dispose()
        End Try
    End Sub
End Class

See Also