Eigene Skills vom MacBook (9 Skills)
This commit is contained in:
@@ -0,0 +1,189 @@
|
||||
---
|
||||
name: kinect-visualization
|
||||
description: Use Xbox Kinect (or compatible depth cameras) for visualization, interactive installations, and creative coding projects. Covers detection, driver setup, data extraction, and integration with platforms like Touchdesigner, Unity, and Python.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
platforms: [linux, macos, windows]
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [kinect, visualization, depth-camera, touchdesigner, creative-coding]
|
||||
related_skills: [systematic-debugging, plan]
|
||||
---
|
||||
|
||||
# Xbox Kinect Visualization Skill
|
||||
|
||||
## Overview
|
||||
|
||||
This skill covers setting up, detecting, and extracting data from an Xbox Kinect (or compatible depth camera) for use in visualization projects, interactive installations, and creative coding. The Kinect provides RGB video, depth data, audio, and skeleton tracking.
|
||||
|
||||
## Device Detection
|
||||
|
||||
### macOS
|
||||
|
||||
The Xbox Kinect connects via USB and is identified as:
|
||||
|
||||
```
|
||||
Product: Xbox NUI Sensor
|
||||
Vendor: Microsoft
|
||||
USB Vendor ID: 0x045E (1118)
|
||||
USB Product ID: 0x02C4 (708)
|
||||
Device appears as: Xbox NUI Sensor@02210000 in system profiler
|
||||
```
|
||||
|
||||
**Verify detection:**
|
||||
|
||||
```bash
|
||||
system_profiler SPUSBDataType
|
||||
```
|
||||
|
||||
Or via Python:
|
||||
|
||||
```python
|
||||
import usb.core
|
||||
dev = usb.core.find(idVendor=0x045E, idProduct=0x02C4)
|
||||
if dev:
|
||||
print('Kinect found!')
|
||||
print('Address:', dev.address)
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
Similar USB IDs. Install [libfreenect2](https://github.com/libfreenect2/libfreenect2) or [OpenNI2](https://openni.org/) drivers.
|
||||
|
||||
### Linux
|
||||
|
||||
`libfreenect2`, `OpenNI2`, or direct `libusb` access.
|
||||
|
||||
## Driver Options
|
||||
|
||||
### 1. OpenNI2 + SensorKinect (Touchdesigner compatible)
|
||||
|
||||
**macOS:** Install OpenNI2 framework and SensorKinect driver for the Xbox Kinect.
|
||||
|
||||
**Touchdesigner:** The built-in Kinect CHOP will detect the device once OpenNI2/SensorKinect is installed.
|
||||
|
||||
### 2. libfreenect / libfreenect2 (OpenKinect)
|
||||
|
||||
**Cross-platform:** `brew install libfreenect2` (macOS) or system package managers (Linux/Windows).
|
||||
|
||||
**Python:** `pip install pykinect2` or `pip install openni2`.
|
||||
|
||||
### 3. Touchdesigner Built-in Kinect CHOP
|
||||
|
||||
In Touchdesigner: `Touch → External Commands → Kinect CHOP`.
|
||||
|
||||
Select the device when prompted. Requires OpenNI2/SensorKinect drivers on macOS.
|
||||
|
||||
## Data Extraction
|
||||
|
||||
### Python (usb.core + libusb)
|
||||
|
||||
```python
|
||||
import usb.core
|
||||
import usb.util
|
||||
|
||||
dev = usb.core.find(idVendor=0x045E, idProduct=0x02C4)
|
||||
if dev is None:
|
||||
print('Kinect not found')
|
||||
exit(1)
|
||||
|
||||
# Detach kernel driver if active
|
||||
if dev.is_kernel_driver_active(0):
|
||||
dev.detach_kernel_driver(0)
|
||||
|
||||
# Set configuration
|
||||
dev.set_configuration()
|
||||
|
||||
# Claim interface 0
|
||||
usb.util.claim_interface(dev, 0)
|
||||
|
||||
# Read from endpoint (example - find the right endpoint)
|
||||
cfg = dev.get_configuration()
|
||||
for intf in cfg.interfaces():
|
||||
for alt in intf.altsettings:
|
||||
for ep in alt.endpoints:
|
||||
direction = 'IN' if usb.util.endpoint_direction(ep.bEndpointAddress) == usb.util.ENDPOINT_IN else 'OUT'
|
||||
print(f'EP: {hex(ep.bEndpointAddress)} dir={direction} maxpkt={ep.wMaxPacketSize}')
|
||||
```
|
||||
|
||||
### Touchdesigner CHOP Parameters
|
||||
|
||||
- **Device:** Select the Kinect device
|
||||
- **Frame Rate:** 30fps (video), 30fps (depth)
|
||||
- **Output Channels:** Red, Green, Blue, Depth
|
||||
- **Skeleton Tracking:** If using OpenNI2
|
||||
|
||||
## Creative Coding Integration
|
||||
|
||||
### Touchdesigner
|
||||
|
||||
1. Add Kinect CHOP to your network
|
||||
2. Connect to TOP/CHOP/SOP components for visualization
|
||||
3. Use depth data for particle systems, 3D mappings, or interactive surfaces
|
||||
4. Use video feed for texturing or background removal
|
||||
|
||||
### Unity
|
||||
|
||||
Use the [Kinect Unity Plugin](https://github.com/Kinect/Unity-Kinect) or [OpenNI2 Unity Integration](https://github.com/occipital/openni-unity).
|
||||
|
||||
### Python / Processing / OpenFrameworks
|
||||
|
||||
- `pykinect2` or `openni2` for Python
|
||||
- `ofxKinect` for openFrameworks
|
||||
- KinectToe plugin for Touchdesigner
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Device not found** — Verify USB connection, IDs (0x045E/0x02C4), and that the device is powered.
|
||||
|
||||
2. **Kernel driver active** — Detach kernel driver: `dev.detach_kernel_driver(0)` before claiming interface.
|
||||
|
||||
3. **Touchdesigner can't see device** — Install OpenNI2 + SensorKinect drivers on macOS. Without these, the Kinect CHOP won't list the device.
|
||||
|
||||
4. **Depth data looks wrong** — Ensure correct camera mode (near mode vs. wide mode). Some Kinect models have different depth ranges.
|
||||
|
||||
5. **USB bandwidth issues** — Try connecting the Kinect directly to the computer (not through a hub), especially for Kinect v2.
|
||||
|
||||
### Error Patterns
|
||||
|
||||
| Error | Cause | Fix |
|
||||
|-------|-------|-----|
|
||||
| `ValueError: Device not found` | Wrong vendor/product IDs | Verify `idVendor=0x045E, idProduct=0x02C4` |
|
||||
| `USBError: Could not detach kernel driver` | Kernel driver holding interface | Use `dev.detach_kernel_driver(0)` or run with appropriate permissions |
|
||||
| `Kinect CHOP shows no device` | Missing OpenNI2/SensorKinect drivers | Install OpenNI2 framework and SensorKinect driver |
|
||||
| `Depth data is all zeros` | Wrong camera mode or setup | Check Kinect model and mode settings |
|
||||
|
||||
## Support Files
|
||||
|
||||
This skill is packaged with support files in the following directories:
|
||||
|
||||
- `references/kinect-ids.md` — Condensed device IDs, USB descriptors, and interface layouts
|
||||
- `references/troubleshooting-kinect.md` — Error transcripts, reproduction recipes, provider quirks
|
||||
- `references/freenecttd-plugin.md` — FreenectTD plugin installation guide for TouchDesigner macOS (new)
|
||||
- `scripts/probe-kinect.py` — Deterministic probe script that enumerates Kinect endpoints and validates communication
|
||||
|
||||
To add a new support file, use `skill_manage` with `file_path` starting `references/` or `scripts/`. The skill's SKILL.md will automatically gain a pointer to the new file.
|
||||
|
||||
## Related Skills
|
||||
|
||||
- `systematic-debugging` — For debugging Kinect connection or data issues
|
||||
- `plan` — For planning Kinect integration projects
|
||||
|
||||
## Version History
|
||||
|
||||
| Version | Date | Changes |
|
||||
|---------|------|---------|
|
||||
| 1.0.0 | — | Initial release — detection, drivers, data extraction, and integration patterns |
|
||||
|
||||
## References
|
||||
|
||||
- Xbox Kinect Technical Specifications
|
||||
- OpenNI2 Framework Documentation
|
||||
- libfreenect2 Project
|
||||
- Touchdesigner Kinect CHOP Documentation
|
||||
- Microsoft Kinect SDK (legacy)
|
||||
|
||||
<!-- Keep this skill curator-managed. Do not hand-edit. -->
|
||||
@@ -0,0 +1,44 @@
|
||||
# FreenectTD Plugin for TouchDesigner macOS
|
||||
|
||||
**Source**: https://github.com/stosumarte/FreenectTD
|
||||
**Latest version**: v1.0.1
|
||||
**Purpose**: Enables Xbox Kinect usage with TouchDesigner on macOS without requiring OpenNI2 framework (which has download issues at openni.org)
|
||||
|
||||
## Installation
|
||||
|
||||
1. Download the latest FreenectTOP.zip from the releases tab:
|
||||
```
|
||||
https://github.com/stosumarte/FreenectTD/releases/latest/download/FreenectTOP.zip
|
||||
```
|
||||
|
||||
2. Unzip and copy `FreenectTOP.plugin` to TouchDesigner's plugin folder:
|
||||
```
|
||||
/Users/<username>/Library/Application Support/Derivative/TouchDesigner099/Plugins
|
||||
```
|
||||
|
||||
3. Show hidden files in Finder if needed: `⌘⇧.`
|
||||
|
||||
4. Restart TouchDesigner — FreenectTOP will appear under the "Custom" OPs panel
|
||||
|
||||
## Usage
|
||||
|
||||
**Output indexes**:
|
||||
- Index 0: RGB stream
|
||||
- Index 1: Depth map
|
||||
- Index 2: IR stream
|
||||
- Index 3: Point cloud map
|
||||
|
||||
**Example usage**: Drag FreenectTOP into your network. By default it outputs RGB. Use Render Select TOP with index 1 for depth, index 2 for IR.
|
||||
|
||||
## Notes
|
||||
|
||||
- Only one Kinect device per machine is supported
|
||||
- Only one FreenectTD OP can be active at a time
|
||||
- Works with Kinect V1 and V2
|
||||
- Alternative: Use the installer from releases (FreenectTOP_[version]_Installer.pkg) for simpler installation
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If plugin doesn't appear: Ensure TouchDesigner is closed and restarted after copying the plugin
|
||||
- If Kinect not detected: Verify USB connection and that `system_profiler SPUSBDataType` shows Xbox NUI Sensor
|
||||
- Only one Kinect per machine supported
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Probe script for Xbox Kinect device detection and endpoint enumeration."""
|
||||
import usb.core
|
||||
import usb.util
|
||||
|
||||
VENDOR_ID = 0x045E
|
||||
PRODUCT_ID = 0x02C4
|
||||
|
||||
def main():
|
||||
print("=== Kinect USB Probe ===")
|
||||
dev = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
|
||||
|
||||
if dev is None:
|
||||
print("❌ Kinect not found via USB")
|
||||
print(" - Verify Kinect is connected")
|
||||
print(" - Check USB cable and port")
|
||||
return 1
|
||||
|
||||
print(f"✅ Kinect found at address: {dev.address}")
|
||||
print(f" Vendor ID: 0x{VENDOR_ID:04x} ({dev.idVendor})")
|
||||
print(f" Product ID: 0x{PRODUCT_ID:04x} ({dev.idProduct})")
|
||||
print(f" bcdDevice: {dev.bcd_device}")
|
||||
|
||||
# Try to set configuration
|
||||
try:
|
||||
dev.set_configuration()
|
||||
print("✅ Configuration set successfully")
|
||||
except usb.core.USBError as e:
|
||||
print(f"⚠️ Could not set configuration: {e}")
|
||||
|
||||
# Claim interface 0
|
||||
try:
|
||||
usb.util.claim_interface(dev, 0)
|
||||
print("✅ Interface 0 claimed successfully")
|
||||
except usb.core.USBError as e:
|
||||
print(f"⚠️ Could not claim interface 0: {e}")
|
||||
|
||||
# Enumerate configurations and interfaces
|
||||
cfg = dev.get_configuration()
|
||||
print(f"
|
||||
Configuration: {cfg.bConfigurationValue}")
|
||||
|
||||
for intf in cfg.interfaces():
|
||||
print(f"
|
||||
Interface: {intf.bInterfaceNumber}")
|
||||
print(f" Subclass: {intf.bInterfaceSubclass}")
|
||||
print(f" Protocol: {intf.bInterfaceProtocol}")
|
||||
|
||||
for alt in intf.altsettings:
|
||||
print(f" Alternate Setting: {alt.bAlternateSetting}")
|
||||
for ep in alt.endpoints:
|
||||
direction = 'IN' if usb.util.endpoint_direction(ep.bEndpointAddress) == usb.util.ENDPOINT_IN else 'OUT'
|
||||
print(f" EP {hex(ep.bEndpointAddress)}: {direction}, maxpacket: {ep.wMaxPacketSize}")
|
||||
|
||||
# Release interface
|
||||
usb.util.release_interface(dev, 0)
|
||||
print("
|
||||
✅ Probe complete - interface released")
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit(main())
|
||||
Reference in New Issue
Block a user