config

package
v0.0.0-...-c11bf8b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config provides TOML configuration loading for MiFace.

The configuration file supports the following structure:

[camera]
device_id = 0
width = 1280
height = 720
fps = 30

[tracking]
enable_face = true
enable_hands = true
enable_pose = true
smoothing_factor = 0.5

[vmc]
enabled = true
address = "127.0.0.1"
port = 39539

Example usage:

cfg, err := config.Load("config.toml")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Camera device: %d\n", cfg.Camera.DeviceID)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CameraConfig

type CameraConfig struct {
	// DeviceID is the camera device index (default: 0).
	DeviceID int `toml:"device_id"`
	// Width is the capture width in pixels (default: 1280).
	Width int `toml:"width"`
	// Height is the capture height in pixels (default: 720).
	Height int `toml:"height"`
	// FPS is the target frame rate (default: 30).
	FPS int `toml:"fps"`
}

CameraConfig holds webcam capture settings.

type Config

type Config struct {
	Camera   CameraConfig   `toml:"camera"`
	Tracking TrackingConfig `toml:"tracking"`
	VMC      VMCConfig      `toml:"vmc"`
}

Config represents the complete configuration for MiFace.

func Default

func Default() *Config

Default returns the default configuration.

func Load

func Load(path string) (*Config, error)

Load reads and parses a TOML configuration file. If the file does not exist, it returns the default configuration.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for invalid values.

type TrackingConfig

type TrackingConfig struct {
	// EnableFace enables face landmark tracking (default: true).
	EnableFace bool `toml:"enable_face"`
	// EnableHands enables hand landmark tracking (default: true).
	EnableHands bool `toml:"enable_hands"`
	// EnablePose enables pose/body tracking (default: true).
	EnablePose bool `toml:"enable_pose"`
	// SmoothingFactor controls Kalman filter smoothing (0.0-1.0, default: 0.5).
	SmoothingFactor float64 `toml:"smoothing_factor"`
}

TrackingConfig holds face/body tracking settings.

type VMCConfig

type VMCConfig struct {
	// Enabled enables VMC protocol output (default: true).
	Enabled bool `toml:"enabled"`
	// Address is the destination IP address (default: "127.0.0.1").
	Address string `toml:"address"`
	// Port is the destination UDP port (default: 39539).
	Port int `toml:"port"`
}

VMCConfig holds VMC (Virtual Motion Capture) protocol sender settings. VMC uses the OSC protocol for communication.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL