Add hermes_vision, build camera_ros on the fork, and bring up WM8960 audio
hermes_vision wraps OpenCV YuNet (Haar fallback) as a plain module plus a node that publishes /vision/faces as vision_msgs/Detection2DArray. It replaces the standalone detect_faces.py. pi/robot-env.sh puts the Raspberry Pi libcamera fork ahead of ROS's own copy, the venv's OpenCV 4.10 ahead of the apt one, and fixes the ROS domain and subnet-only discovery. camera_ros 0.7.0 now runs against the fork and publishes raw and compressed images. The stock wm8960-soundcard overlay fails on Ubuntu 24.04 with "No MCLK configured": it hangs the clock on the sound card's codec link, but the codec driver reads mclk from its own node. hermes-wm8960.dts adds it there, and capture opens at 8-48 kHz. The microphones still read digital zeros; see CONTEXT.md for what has been ruled out. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFN8nRRCiDiMN7ChBpHJhs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from hermes_vision.detect import Face, FaceDetector, merge, yunet_input_size
|
||||
|
||||
|
||||
@pytest.mark.parametrize('size,expected', [
|
||||
((1296, 972), (640, 480)),
|
||||
((640, 480), (640, 480)),
|
||||
((320, 240), (320, 256)), # small frames are not upscaled; 240/32 = 7.5 rounds to 8
|
||||
((1920, 1080), (640, 352)),
|
||||
((10, 10), (32, 32)),
|
||||
])
|
||||
def test_yunet_input_size_is_a_multiple_of_32(size, expected):
|
||||
got = yunet_input_size(*size)
|
||||
assert got == expected and got[0] % 32 == 0 and got[1] % 32 == 0
|
||||
|
||||
|
||||
def test_merge_drops_overlapping_boxes_and_keeps_distinct_ones():
|
||||
a, b, c = Face(100, 100, 80, 80), Face(105, 98, 78, 82), Face(400, 100, 80, 80)
|
||||
assert merge([a, b, c]) == [a, c]
|
||||
|
||||
|
||||
def test_blank_image_has_no_faces():
|
||||
det = FaceDetector(model_path='/nonexistent.onnx') # forces the Haar fallback
|
||||
assert det.backend == 'haar'
|
||||
assert det.detect(np.zeros((480, 640, 3), np.uint8)) == []
|
||||
Reference in New Issue
Block a user