回転する矩形領域内での濃度投影

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

Syntax

C#
public static int fnFIE_projection_rot_rectangle(
	FHANDLE hsrc,
	FHANDLE hdst,
	DPNT_T center,
	int direction,
	double start_angle,
	double pitch_angle,
	int samp_num_t,
	double pitch_t,
	double pitch_s,
	f_sampling_mode samp_mode
)
Visual Basic
Public Shared Function fnFIE_projection_rot_rectangle ( 
	hsrc As FHANDLE,
	hdst As FHANDLE,
	center As DPNT_T,
	direction As Integer,
	start_angle As Double,
	pitch_angle As Double,
	samp_num_t As Integer,
	pitch_t As Double,
	pitch_s As Double,
	samp_mode As f_sampling_mode
) As Integer

Parameters

hsrc
Type: fvalgcli..::..FHANDLE
入力画像( type: uc8, s16, us16, float, double )
hdst
Type: fvalgcli..::..FHANDLE
出力画像( type: uc8, s16, us16, float, double )
center
Type: fvalgcli..::..DPNT_T
矩形の中心座標
direction
Type: System..::..Int32
投影結果の出力方向 [0:横方向、1:縦方向]
start_angle
Type: System..::..Double
θ 方向のサンプリング開始角度 (radian 単位)
pitch_angle
Type: System..::..Double
θ 方向のサンプリング間隔 (radian 単位)
samp_num_t
Type: System..::..Int32
t 方向のサンプリング数 ( > 0 )
pitch_t
Type: System..::..Double
t 方向のサンプリング間隔 ( > 0 )
pitch_s
Type: System..::..Double
s 方向のサンプリング間隔 ( > 0 )
samp_mode
Type: fvalgcli..::..f_sampling_mode
画素値補間方法。
  • F_SAMPLING_NN: 最近傍法により画素値補間を行う。
  • F_SAMPLING_BILINEAR: 共一次線形補間により画素値補間を行う。
  • F_SAMPLING_CUBIC: 三次畳み込み法により画素値補間を行う。

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_IMAGE不正な画像オブジェクト
F_ERR_INVALID_PARAM不正なパラメータ
F_ERR_NOMEMORYメモリ不足エラー
F_ERR_NO_LICENCEライセンスエラー

Examples

C# Copy imageCopy
using System;
using System.Collections.Generic;
using System.Text;

using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        /// <summary>
        /// 回転する矩形領域内での濃度投影.
        /// </summary>
        [FvPluginExecute]
        public void fnFIE_projection_rot_rectangle()
        {
            int status = (int)f_err.F_ERR_NONE;

            for (int direction = 0; direction < 2; direction++)
            {
                FHANDLE hsrc = FHANDLE.Zero;    // 入力画像.
                FHANDLE hdst = FHANDLE.Zero;    // 出力画像.

                try
                {
                    // 入力画像のロード.
                    api.fnFIE_load_img_file(TestImageDir + "/testdata/calib_src_1shot.bmp", ref hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8);

                    // 入力画像の情報取得.
                    int width = api.fnFIE_img_get_width(hsrc);
                    int height = api.fnFIE_img_get_height(hsrc);
                    int channels = api.fnFIE_img_get_channels(hsrc);
                    int type = api.fnFIE_img_get_type(hsrc);

                    int dst_width = width;
                    int dst_height = height;

                    // 出力画像の確保.
                    hdst = api.fnFIE_img_root_alloc(type, channels, dst_width, dst_height);

                    DPNT_T center = DPNT_T.init(width / 2, height / 2);
                    double start_angle = 0 / 180 * System.Math.PI;
                    double pitch_angle = 0;
                    int samp_num_t;
                    if (direction == 0)
                        samp_num_t = dst_width;
                    else
                        samp_num_t = dst_height;
                    double pitch_t = 1;
                    double pitch_s = 1;

                    // 処理の実行.
                    status = api.fnFIE_projection_rot_rectangle(hsrc, hdst, center, direction, start_angle, pitch_angle, samp_num_t, pitch_t, pitch_s, f_sampling_mode.F_SAMPLING_BILINEAR);

                    // エラー判定.
                    Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

                    // コピー先画像の保存.
                    api.fnFIE_save_png(ResultDir + string.Format("/fnFIE_projection_rot_rectangle-{0}.png", direction), hdst, -1);
                }
                finally
                {
                    // オブジェクトの開放.
                    hsrc.Dispose();
                    hdst.Dispose();
                }
            }
        }
    }
}


Visual Basic Copy imageCopy
Imports System.Collections.Generic
Imports System.Text

Imports fvalgcli

Public Partial Class FIE
    ''' <summary>
    ''' 回転する矩形領域内での濃度投影.
    ''' </summary>
    <FvPluginExecute> _
    Public Sub fnFIE_projection_rot_rectangle()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        For direction As Integer = 0 To 1
            Dim hsrc As FHANDLE = FHANDLE.Zero
            ' 入力画像.
            Dim hdst As FHANDLE = FHANDLE.Zero
            ' 出力画像.
            Try
                ' 入力画像のロード.
                api.fnFIE_load_img_file(TestImageDir & "/testdata/calib_src_1shot.bmp", hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8)

                ' 入力画像の情報取得.
                Dim width As Integer = api.fnFIE_img_get_width(hsrc)
                Dim height As Integer = api.fnFIE_img_get_height(hsrc)
                Dim channels As Integer = api.fnFIE_img_get_channels(hsrc)
                Dim type As Integer = api.fnFIE_img_get_type(hsrc)

                Dim dst_width As Integer = width
                Dim dst_height As Integer = height

                ' 出力画像の確保.
                hdst = api.fnFIE_img_root_alloc(type, channels, dst_width, dst_height)

                Dim center As DPNT_T = DPNT_T.init(width \ 2, height \ 2)
                Dim start_angle As Double = (0 \ 180) * System.Math.PI
                Dim pitch_angle As Double = 0
                Dim samp_num_t As Integer
                If direction = 0 Then
                    samp_num_t = dst_width
                Else
                    samp_num_t = dst_height
                End If
                Dim pitch_t As Double = 1
                Dim pitch_s As Double = 1

                ' 処理の実行.
                status = api.fnFIE_projection_rot_rectangle(hsrc, hdst, center, direction, start_angle, pitch_angle, _
                    samp_num_t, pitch_t, pitch_s, f_sampling_mode.F_SAMPLING_BILINEAR)

                ' エラー判定.
                Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

                ' コピー先画像の保存.
                api.fnFIE_save_png(ResultDir & String.Format("/fnFIE_projection_rot_rectangle-{0}.png", direction), hdst, -1)
            Finally
                ' オブジェクトの開放.
                hsrc.Dispose()
                hdst.Dispose()
            End Try
        Next
    End Sub
End Class

See Also