← 返回
数据分析 中文

Pywayne Cv Camera Model

Camera model wrapper for camera_models C++ library via pybind11. Use when working with pywayne.cv.camera_model module to load camera models from YAML configu...
通过 pybind11 封装 camera_models C++ 库。用于配合 pywayne.cv.camera_model 模块从 YAML 配置加载相机模型。
wangyendt
数据分析 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 803
下载
💾 27
安装
1
版本
#latest

概述

Pywayne Camera Model

This module wraps the camera_models C++ library via pybind11, providing a Python interface for camera operations.

Quick Start

from pywayne.cv.camera_model import CameraModel
from pywayne.cv.tools import write_cv_yaml
import numpy as np

# Create camera model
camera = CameraModel()

# Load from YAML file
camera.load_from_yaml('camera_config.yaml')

# Access properties
print(f"Model: {camera.model_type}")
print(f"Size: {camera.image_width}x{camera.image_height}")

Loading from YAML

from pathlib import Path

# Sample YAML configuration
yaml_data = {
    "model_type": "PINHOLE",
    "camera_name": "my_camera",
    "image_width": 1280,
    "image_height": 720,
    "distortion_parameters": {"k1": 0.0, "k2": 0.0},
    "projection_parameters": {"fx": 600.0, "fy": 600.0, "cx": 640.0, "cy": 360.0}
}

# Write YAML file
write_cv_yaml('camera_config.yaml', yaml_data)

# Load model
camera.load_from_yaml('camera_config.yaml')

Supported Camera Models

Model TypeDescription
-------------------------
PINHOLEStandard pinhole camera with radial distortion
PINHOLE_FULLFull pinhole model with all distortion parameters
CATACatadioptric camera model
EQUIDISTANTEquidistant camera model
OCAMUnified camera model

Projection Operations

lift_projective()

Lifts a 2D image point to a 3D projective ray:

# Input can be tuple, list, or numpy array
ray_3d = camera.lift_projective([u, v])  # Returns np.ndarray (x, y, z)

space_to_plane()

Projects a 3D point onto the 2D image plane:

# Input can be tuple, list, or numpy array
uv = camera.space_to_plane([x, y, z])  # Returns np.ndarray (u, v)

Properties

PropertyDescription
----------------------
model_typeCamera model type (enum)
camera_nameName of the loaded camera
image_widthImage width in pixels
image_heightImage height in pixels

Parameters Dictionary

Export all camera parameters as a dictionary:

params = camera.get_parameters_as_dict()
print(params)

Includes model-specific parameters:

  • Pinhole: k1, k2, p1, p2, fx, fy, cx, cy
  • Pinhole Full: k1-k6, p1-p2, fx, fy, cx, cy
  • CATA: xi, k1-k2, p1-p2, gamma1-2, u0, v0
  • Equidistant: k2-k5, mu, mv, u0, v0
  • OCAM: C, D, E, center_x, center_y, poly, inv_poly

Requirements

  • camera_models - C++ library (auto-downloaded via gettool if missing)
  • numpy - Array operations
  • pywayne.cv.tools.write_cv_yaml - For writing YAML files

Notes

  • Library is automatically checked and downloaded via gettool if not found
  • Supports both tuple/list and numpy array inputs for projection methods
  • Output from projection methods is always np.ndarray with dtype=np.float64

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-29 08:50 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,005
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 367 📥 140,240
productivity

Pywayne Statistics

wangyendt
综合性统计检验库,包含37种以上方法,涵盖正态性检验、位置检验、相关性检验、时间序列检验和模型诊断。
★ 0 📥 1,866