ArUco detection on macOS (AVFoundation → OpenCV 4) intermittently returns no markers — sanity check on params/pipeline?
Hi all — I’m running an ArUco detector on macOS using AVFoundation for capture and OpenCV 4 (Homebrew). The pipeline is: capture BGRA CVPixelBuffer → convert to grayscale → cv::aruco::detectMarkers with DICT_4X4_50. Streaming works, but detection is inconsistent (often prints no markers) even with clean, high-contrast tags.
Environment
• macOS: [from sw_vers], Arch: [arm64/x86_64]
• Xcode/Swift: [versions]
• OpenCV: 4.x via Homebrew (prefix: [brew --prefix opencv@4])
• Linking via Package.swift with -I /include/opencv4 and -L /lib
Detector core (simplified)
• Convert BGRA → gray: cv::cvtColor(bgra, gray, cv::COLOR_BGRA2GRAY)
• dict = DICT_4X4_50
• params = DetectorParameters::create() (mostly defaults)
• cv::aruco::detectMarkers(gray, dict, corners, ids, rejected)
What I’ve tried
• Verified dictionary/IDs (0–49), multiple prints/sizes, improved lighting/distance
• Parameter sweeps: adaptiveThreshWinSizeMin/Max/Step, minMarkerPerimeterRate, cornerRefinementMethod (Subpix/None)
• Confirmed pixel format path (BGRA to gray) and tested lower camera presets
What would help
• Recommended starting parameters for DICT_4X4_50 on typical 720p/1080p webcam input
• Common pitfalls in macOS CVPixelBuffer → cv::Mat conversion that affect ArUco
• Quick checks to distinguish parameter issues vs. frame conversion issues
• If you have a known-good minimal config for 4x4_50, I’d love to compare
Artifacts
• I can provide a few PNG frames (pre-detection) where I expect detection but get none, plus logs of ids/rejected count.
Thanks in advance — looking for a sanity check and known-good parameter baselines before I dig deeper.