計測ライン(線分)上の濃度投影の作成

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

Syntax

C#
public static int fnFIE_edge1d_projection_line(
	FHANDLE hsrc,
	DSGMT_T line,
	int prj_width,
	DOUBLE_PTR pprj,
	int prj_len,
	ref F_ARRAY_INDEX valid_reg
)
Visual Basic
Public Shared Function fnFIE_edge1d_projection_line ( 
	hsrc As FHANDLE,
	line As DSGMT_T,
	prj_width As Integer,
	pprj As DOUBLE_PTR,
	prj_len As Integer,
	ByRef valid_reg As F_ARRAY_INDEX
) As Integer

Parameters

hsrc
Type: fvalgcli..::..FHANDLE
入力画像(type:uc8,s16,us16,double / ch:1)
line
Type: fvalgcli..::..DSGMT_T
計測ライン(線分)
  • st 始点
  • ed 終点
prj_width
Type: System..::..Int32
濃度投影片幅(0以上、単位:画素)
pprj
Type: fvalgcli..::..DOUBLE_PTR
濃度プロファイル配列
prj_len
Type: System..::..Int32
濃度プロファイル配列の長さ
valid_reg
Type: fvalgcli..::..F_ARRAY_INDEX%
濃度プロファイルの有効領域
  • index 要素番号:濃度プロファイル配列の原点からのオフセット量
  • size 長さ :有効領域の長さ

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
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 System.Runtime.InteropServices;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        [FvPluginExecute]
        public void fnFIE_edge1d_projection_line()
        {
            string filepath = TestImageDir + "/testdata/image_file_8bpp.bmp";

            int status = (int)f_err.F_ERR_NONE;
            FHANDLE hImage = FHANDLE.Zero;
            DOUBLE_PTR pprj = DOUBLE_PTR.Zero;

            try
            {
                api.fnFIE_load_bmp(filepath, ref hImage, f_color_img_type.F_COLOR_IMG_TYPE_UC8);

                int prj_width = 5;
                int prj_len = 0;
                int length = 0;

                DSGMT_T line;
                line.st.x = 50;
                line.st.y = 250;
                line.ed.x = 450;
                line.ed.y = 250;

                // 計測ラインの長さを計算.
                api.fnFIE_edge1d_calc_projection_line_length(line, ref length);
                prj_len = (int)(length + 0.5);
                pprj = DOUBLE_PTR.alloc(prj_len);

                F_ARRAY_INDEX valid_reg = new F_ARRAY_INDEX();
                status = api.fnFIE_edge1d_projection_line(hImage, line, prj_width, pprj, prj_len, ref valid_reg);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "fnFIE_edge1d_projection_line: エラーが発生しました。({0})", (f_err)status);
                Console.WriteLine("fnFIE_edge1d_projection_line");
            }
            finally
            {
                hImage.Dispose();
                pprj.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_edge1d_projection_line()
        Dim filepath As String = TestImageDir & "/testdata/image_file_8bpp.bmp"

        Dim status As Integer = CInt(f_err.F_ERR_NONE)
        Dim hImage As FHANDLE = FHANDLE.Zero
        Dim pprj As DOUBLE_PTR = DOUBLE_PTR.Zero

        Try
            api.fnFIE_load_bmp(filepath, hImage, f_color_img_type.F_COLOR_IMG_TYPE_UC8)

            Dim prj_width As Integer = 5
            Dim prj_len As Integer = 0
            Dim length As Integer = 0

            Dim line As DSGMT_T
            line.st.x = 50
            line.st.y = 250
            line.ed.x = 450
            line.ed.y = 250

            ' 計測ラインの長さを計算.
            api.fnFIE_edge1d_calc_projection_line_length(line, length)
            prj_len = CInt(Math.Truncate(length + 0.5))
            pprj = DOUBLE_PTR.alloc(prj_len)

            Dim valid_reg As New F_ARRAY_INDEX()
            status = api.fnFIE_edge1d_projection_line(hImage, line, prj_width, pprj, prj_len, valid_reg)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "fnFIE_edge1d_projection_line: エラーが発生しました。({0})", CType(status, f_err))
            Console.WriteLine("fnFIE_edge1d_projection_line")
        Finally
            hImage.Dispose()
            pprj.Dispose()
        End Try
    End Sub
End Class

See Also