Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › MFCameraIntrinsic_PinholeCameraModel

MFCameraIntrinsic_PinholeCameraModel

構造体
サイズx64: 16 バイト / x86: 16 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
FocalLengthMF_FLOAT28+0+0焦点距離をX・Yで示す2次元ベクトル(MF_FLOAT2)。
PrincipalPointMF_FLOAT28+8+8主点(光学中心)をX・Yで示す2次元ベクトル(MF_FLOAT2)。

各言語での定義

#include <windows.h>

// MF_FLOAT2  (x64 8 / x86 8 バイト)
typedef struct MF_FLOAT2 {
    FLOAT x;
    FLOAT y;
} MF_FLOAT2;

// MFCameraIntrinsic_PinholeCameraModel  (x64 16 / x86 16 バイト)
typedef struct MFCameraIntrinsic_PinholeCameraModel {
    MF_FLOAT2 FocalLength;
    MF_FLOAT2 PrincipalPoint;
} MFCameraIntrinsic_PinholeCameraModel;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MF_FLOAT2
{
    public float x;
    public float y;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFCameraIntrinsic_PinholeCameraModel
{
    public MF_FLOAT2 FocalLength;
    public MF_FLOAT2 PrincipalPoint;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MF_FLOAT2
    Public x As Single
    Public y As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFCameraIntrinsic_PinholeCameraModel
    Public FocalLength As MF_FLOAT2
    Public PrincipalPoint As MF_FLOAT2
End Structure
import ctypes
from ctypes import wintypes

class MF_FLOAT2(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_float),
        ("y", ctypes.c_float),
    ]

class MFCameraIntrinsic_PinholeCameraModel(ctypes.Structure):
    _fields_ = [
        ("FocalLength", MF_FLOAT2),
        ("PrincipalPoint", MF_FLOAT2),
    ]
#[repr(C)]
pub struct MF_FLOAT2 {
    pub x: f32,
    pub y: f32,
}

#[repr(C)]
pub struct MFCameraIntrinsic_PinholeCameraModel {
    pub FocalLength: MF_FLOAT2,
    pub PrincipalPoint: MF_FLOAT2,
}
import "golang.org/x/sys/windows"

type MF_FLOAT2 struct {
	x float32
	y float32
}

type MFCameraIntrinsic_PinholeCameraModel struct {
	FocalLength MF_FLOAT2
	PrincipalPoint MF_FLOAT2
}
type
  MF_FLOAT2 = record
    x: Single;
    y: Single;
  end;

  MFCameraIntrinsic_PinholeCameraModel = record
    FocalLength: MF_FLOAT2;
    PrincipalPoint: MF_FLOAT2;
  end;
const MF_FLOAT2 = extern struct {
    x: f32,
    y: f32,
};

const MFCameraIntrinsic_PinholeCameraModel = extern struct {
    FocalLength: MF_FLOAT2,
    PrincipalPoint: MF_FLOAT2,
};
type
  MF_FLOAT2 {.bycopy.} = object
    x: float32
    y: float32

  MFCameraIntrinsic_PinholeCameraModel {.bycopy.} = object
    FocalLength: MF_FLOAT2
    PrincipalPoint: MF_FLOAT2
struct MF_FLOAT2
{
    float x;
    float y;
}

struct MFCameraIntrinsic_PinholeCameraModel
{
    MF_FLOAT2 FocalLength;
    MF_FLOAT2 PrincipalPoint;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFCameraIntrinsic_PinholeCameraModel サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; FocalLength : MF_FLOAT2 (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; PrincipalPoint : MF_FLOAT2 (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MF_FLOAT2
    #field float x
    #field float y
#endstruct

#defstruct global MFCameraIntrinsic_PinholeCameraModel
    #field MF_FLOAT2 FocalLength
    #field MF_FLOAT2 PrincipalPoint
#endstruct

stdim st, MFCameraIntrinsic_PinholeCameraModel        ; NSTRUCT 変数を確保