サイズ情報の取得 (WIL 用)

Namespace: FVIL.Ipl
Assembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)

Syntax

C#
public static ImageSize ToImageSize(
	int width,
	int height,
	int depth,
	int channels
)
Visual Basic
Public Shared Function ToImageSize ( 
	width As Integer,
	height As Integer,
	depth As Integer,
	channels As Integer
) As ImageSize

Parameters

width
Type: System..::..Int32
IplImage の画像の幅 [0~]
height
Type: System..::..Int32
IplImage の画像の高さ [0~]
depth
Type: System..::..Int32
IplImage のピクセルの型
この値は、IPL の下記定数と等価です。
  • IPL_DEPTH_1U (本ライブラリでは対応していません。)
  • IPL_DEPTH_8U
  • IPL_DEPTH_16U
  • IPL_DEPTH_8S (本ライブラリでは対応していません。)
  • IPL_DEPTH_16S
  • IPL_DEPTH_32S
  • IPL_DEPTH_32F
  • IPL_DEPTH_64F
channels
Type: System..::..Int32
IplImage のチャネル数 [1~16]

Return Value

Type: ImageSize
CFviImage を確保する際に使用するサイズ情報を返します。

Remarks

引数に指定された IplImage のサイズ情報と互換性がある画像オブジェクトのサイズ情報に変換します。
引数 width,height,channels が許容範囲内の場合は ImageSize にそのまま格納されます。
depth は下表のように変換されます。

対応表:
depth画像種別 (ImageType)
IPL_DEPTH_8UUC8
IPL_DEPTH_16SUS16
IPL_DEPTH_16US16
IPL_DEPTH_32SI32
IPL_DEPTH_32FFLOAT
IPL_DEPTH_64FDOUBLE

処理に失敗した場合は例外が発行されます。 例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。


エラーコード:
ErrorCode メンバ内容
16FVIL.ErrorCode.INVALID_IMAGETYPE対応する画像種別がありません。
17FVIL.ErrorCode.INVALID_IMAGESIZE幅、高さが許容範囲外です。
18FVIL.ErrorCode.INVALID_CHANNELチャネル数が許容範囲外です。

Examples

出力結果:
Copy imageCopy
HorzSize            : 93
VertSize            : 47
ImageType           : D64
Channel             : 1
Depth               : 64
ImageInfo           : GRAY


ソースコード:
C# Copy imageCopy
// $Revision: 1.3 $

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Reflection;

namespace SampleCode.Ipl
{
    partial class Converter
    {
        public static void ToImageSize2()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            // 1) 画像サイズ情報の取得.
            FVIL.ImageSize image_size = FVIL.Ipl.IplImageConverter.ToImageSize(93, 47, (int)IPL_DEPTH.IPL_DEPTH_64F, 1);

            // -) 確認.(任意)
            Console.WriteLine("{0,-20}: {1}", "HorzSize", image_size.HorzSize);
            Console.WriteLine("{0,-20}: {1}", "VertSize", image_size.VertSize);
            Console.WriteLine("{0,-20}: {1}", "ImageType", image_size.ImageType);
            Console.WriteLine("{0,-20}: {1}", "Channel", image_size.Channel);
            Console.WriteLine("{0,-20}: {1}", "Depth", image_size.Depth);
            Console.WriteLine("{0,-20}: {1}", "ImageInfo", image_size.ImageInfo);
        }
    }
}


Visual Basic Copy imageCopy
' $Revision: 1.2 $

Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.Drawing
Imports System.Reflection

Namespace Ipl
    Partial Class Converter
        Public Shared Sub ToImageSize2()
            Console.WriteLine(MethodBase.GetCurrentMethod().Name)

            ' 1) 画像サイズ情報の取得.
            Dim image_size As FVIL.ImageSize = FVIL.Ipl.IplImageConverter.ToImageSize(93, 47, CInt(IPL_DEPTH.IPL_DEPTH_64F), 1)

            ' -) 確認.(任意)
            Console.WriteLine("{0,-20}: {1}", "HorzSize", image_size.HorzSize)
            Console.WriteLine("{0,-20}: {1}", "VertSize", image_size.VertSize)
            Console.WriteLine("{0,-20}: {1}", "ImageType", image_size.ImageType)
            Console.WriteLine("{0,-20}: {1}", "Channel", image_size.Channel)
            Console.WriteLine("{0,-20}: {1}", "Depth", image_size.Depth)
            Console.WriteLine("{0,-20}: {1}", "ImageInfo", image_size.ImageInfo)
        End Sub
    End Class
End Namespace

Exceptions

ExceptionCondition
FVIL..::..CFviExceptionこの例外の原因については、上記のエラーコード表をご参照ください。

See Also