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

MFCameraIntrinsic_DistortionModel

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

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

フィールド

フィールドサイズx64x86説明
Radial_k1FLOAT4+0+0半径方向の歪み係数k1。
Radial_k2FLOAT4+4+4半径方向の歪み係数k2。
Radial_k3FLOAT4+8+8半径方向の歪み係数k3。
Tangential_p1FLOAT4+12+12接線方向の歪み係数p1。
Tangential_p2FLOAT4+16+16接線方向の歪み係数p2。

各言語での定義

#include <windows.h>

// MFCameraIntrinsic_DistortionModel  (x64 20 / x86 20 バイト)
typedef struct MFCameraIntrinsic_DistortionModel {
    FLOAT Radial_k1;
    FLOAT Radial_k2;
    FLOAT Radial_k3;
    FLOAT Tangential_p1;
    FLOAT Tangential_p2;
} MFCameraIntrinsic_DistortionModel;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFCameraIntrinsic_DistortionModel
{
    public float Radial_k1;
    public float Radial_k2;
    public float Radial_k3;
    public float Tangential_p1;
    public float Tangential_p2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFCameraIntrinsic_DistortionModel
    Public Radial_k1 As Single
    Public Radial_k2 As Single
    Public Radial_k3 As Single
    Public Tangential_p1 As Single
    Public Tangential_p2 As Single
End Structure
import ctypes
from ctypes import wintypes

class MFCameraIntrinsic_DistortionModel(ctypes.Structure):
    _fields_ = [
        ("Radial_k1", ctypes.c_float),
        ("Radial_k2", ctypes.c_float),
        ("Radial_k3", ctypes.c_float),
        ("Tangential_p1", ctypes.c_float),
        ("Tangential_p2", ctypes.c_float),
    ]
#[repr(C)]
pub struct MFCameraIntrinsic_DistortionModel {
    pub Radial_k1: f32,
    pub Radial_k2: f32,
    pub Radial_k3: f32,
    pub Tangential_p1: f32,
    pub Tangential_p2: f32,
}
import "golang.org/x/sys/windows"

type MFCameraIntrinsic_DistortionModel struct {
	Radial_k1 float32
	Radial_k2 float32
	Radial_k3 float32
	Tangential_p1 float32
	Tangential_p2 float32
}
type
  MFCameraIntrinsic_DistortionModel = record
    Radial_k1: Single;
    Radial_k2: Single;
    Radial_k3: Single;
    Tangential_p1: Single;
    Tangential_p2: Single;
  end;
const MFCameraIntrinsic_DistortionModel = extern struct {
    Radial_k1: f32,
    Radial_k2: f32,
    Radial_k3: f32,
    Tangential_p1: f32,
    Tangential_p2: f32,
};
type
  MFCameraIntrinsic_DistortionModel {.bycopy.} = object
    Radial_k1: float32
    Radial_k2: float32
    Radial_k3: float32
    Tangential_p1: float32
    Tangential_p2: float32
struct MFCameraIntrinsic_DistortionModel
{
    float Radial_k1;
    float Radial_k2;
    float Radial_k3;
    float Tangential_p1;
    float Tangential_p2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFCameraIntrinsic_DistortionModel サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Radial_k1 : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Radial_k2 : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Radial_k3 : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Tangential_p1 : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Tangential_p2 : FLOAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MFCameraIntrinsic_DistortionModel
    #field float Radial_k1
    #field float Radial_k2
    #field float Radial_k3
    #field float Tangential_p1
    #field float Tangential_p2
#endstruct

stdim st, MFCameraIntrinsic_DistortionModel        ; NSTRUCT 変数を確保
st->Radial_k1 = 100
mes "Radial_k1=" + st->Radial_k1