歪み補正画像の内接矩形画像や外接矩形画像作成のための係数の算出2

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

Syntax

C#
public static int fnFIE_calib_undistort_fit_rect(
	F_CAMERA_PARAM camera,
	int src_width,
	int src_height,
	int mode,
	double scale,
	ref DPNT_T fit_offset,
	ref int fit_width,
	ref int fit_height
)
Visual Basic
Public Shared Function fnFIE_calib_undistort_fit_rect ( 
	camera As F_CAMERA_PARAM,
	src_width As Integer,
	src_height As Integer,
	mode As Integer,
	scale As Double,
	ByRef fit_offset As DPNT_T,
	ByRef fit_width As Integer,
	ByRef fit_height As Integer
) As Integer

Parameters

camera
Type: fvalgcli..::..F_CAMERA_PARAM
カメラ内部パラメータ構造体
src_width
Type: System..::..Int32
カメラ画像とワープ変換先画像の横幅
src_height
Type: System..::..Int32
カメラ画像とワープ変換先画像の縦幅
mode
Type: System..::..Int32
計算モード指定
  • 0 内接する:ワープ変換後の画像は無効領域を持たない
  • 1 外接する:ワープ変換前の画素は全てワープ変換後の画像に出現する
scale
Type: System..::..Double
スケール係数 ( scale > 0 )
fit_offset
Type: fvalgcli..::..DPNT_T%
オフセット
fit_width
Type: System..::..Int32%
内接または外接する領域を最大限にとったときの横幅
fit_height
Type: System..::..Int32%
内接または外接する領域を最大限にとったときの縦幅

Return Value

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

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

Remarks

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>
        /// 歪み補正画像の内接矩形画像や外接矩形画像作成のための係数の算出2.
        /// </summary>
        /// <param name="camera"></param>
        /// <param name="hsrc"></param>
        /// <param name="fit_offset"></param>
        /// <param name="fit_width"></param>
        /// <param name="fit_height"></param>
        public void fnFIE_calib_undistort_fit_rect
        (F_CAMERA_PARAM camera, FHANDLE hsrc, ref double scale, ref DPNT_T fit_offset, ref int fit_width, ref int fit_height)
        {
            int status = (int)f_err.F_ERR_NONE;

            // [in].
            int src_width = api.fnFIE_img_get_width(hsrc);
            int src_height = api.fnFIE_img_get_height(hsrc);
            int mode = 0;    // 0:内接 1:外接.
            scale = 1.0;

            status = api.fnFIE_calib_undistort_fit_rect(camera, src_width, src_height, mode, scale, ref fit_offset, ref fit_width, ref fit_height);
            Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

            // パラメータの表示.
            Console.WriteLine(" scale = {0}\n offset.x = {1}\n offset.y = {2}\n width = {3}\n height = {4}\n",
                                scale, fit_offset.x, fit_offset.y, fit_width, fit_height);
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

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

Public Partial Class FIE
    ''' <summary>
    ''' 歪み補正画像の内接矩形画像や外接矩形画像作成のための係数の算出2.
    ''' </summary>
    ''' <param name="camera"></param>
    ''' <param name="hsrc"></param>
    ''' <param name="fit_offset"></param>
    ''' <param name="fit_width"></param>
    ''' <param name="fit_height"></param>
    Public Sub fnFIE_calib_undistort_fit_rect(camera As F_CAMERA_PARAM, hsrc As FHANDLE, ByRef scale As Double, ByRef fit_offset As DPNT_T, ByRef fit_width As Integer, ByRef fit_height As Integer)
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        ' [in].
        Dim src_width As Integer = api.fnFIE_img_get_width(hsrc)
        Dim src_height As Integer = api.fnFIE_img_get_height(hsrc)
        Dim mode As Integer = 0
        ' 0:内接 1:外接.
        scale = 1.0

        status = api.fnFIE_calib_undistort_fit_rect(camera, src_width, src_height, mode, scale, fit_offset, _
            fit_width, fit_height)
        Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

        ' パラメータの表示.
        Console.WriteLine(" scale = {0}" & vbLf & " offset.x = {1}" & vbLf & " offset.y = {2}" & vbLf & " width = {3}" & vbLf & " height = {4}" & vbLf, scale, fit_offset.x, fit_offset.y, fit_width, fit_height)
    End Sub
End Class

See Also