指定座標の濃度値取得

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

Syntax

C#
public static int fnFIE_img_get_dens(
	FHANDLE himg,
	int ch,
	int x,
	int y,
	ref double dens
)
Visual Basic
Public Shared Function fnFIE_img_get_dens ( 
	himg As FHANDLE,
	ch As Integer,
	x As Integer,
	y As Integer,
	ByRef dens As Double
) As Integer

Parameters

himg
Type: fvalgcli..::..FHANDLE
濃度を取得する画像( type: bin, uc8, s16, us16, i32, ui32, double, float, rgbq, rgbtri )
ch
Type: System..::..Int32
対象チャネル
x
Type: System..::..Int32
対象画素のX座標
y
Type: System..::..Int32
対象画素のY座標
dens
Type: System..::..Double%
濃度値

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_NOMEMORYメモリ不足エラー
F_ERR_INVALID_IMAGE画像オブジェクトの異常
F_ERR_INVALID_PARAMパラメータ異常
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_dens()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE himg = FHANDLE.Zero;// 濃度を取得する画像.
            const int ch = 0;            // 対象チャネル.
            const int x = 10;            // 対象画素のX座標.
            const int y = 20;            // 対象画素のY座標.
            double dens = 0;            // 濃度値.
            const double dens_init = 100;

            try
            {
                // 処理画像の確保.
                himg = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_UC8, ch + 1, x * 2, y * 2);

                api.fnFIE_img_clear(himg, dens_init);

                // 指定座標の濃度値取得.
                status = api.fnFIE_img_get_dens(himg, ch, x, y, ref dens);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

                Assert.IsTrue(dens_init == dens, "期待値と一致しません.");
            }
            finally
            {
                // オブジェクトの開放.
                himg.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_dens()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim himg As FHANDLE = FHANDLE.Zero
        ' 濃度を取得する画像.
        Const  ch As Integer = 0
        ' 対象チャネル.
        Const  x As Integer = 10
        ' 対象画素のX座標.
        Const  y As Integer = 20
        ' 対象画素のY座標.
        Dim dens As Double = 0
        ' 濃度値.
        Const  dens_init As Double = 100

        Try
            ' 処理画像の確保.
            himg = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_UC8), ch + 1, x * 2, y * 2)

            api.fnFIE_img_clear(himg, dens_init)

            ' 指定座標の濃度値取得.
            status = api.fnFIE_img_get_dens(himg, ch, x, y, dens)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

            Assert.IsTrue(dens_init = dens, "期待値と一致しません.")
        Finally
            ' オブジェクトの開放.
            himg.Dispose()
        End Try
    End Sub
End Class

See Also