# cv::error: (-215:断言失败) !_dictionary.empty() 在函数 'detectMarkers' 中

- **ID:** `opencv/aruco-dictionary-not-found`
- **领域:** opencv
- **类别:** assertion_error
- **错误码:** `-215`
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

传递给 cv::aruco::detectMarkers 的 ArUco 字典对象为空或未正确初始化，通常是由于无效的字典 ID 或创建失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 4.6.0 | active | — | — |
| 4.8.1 | active | — | — |
| 4.9.0 | active | — | — |

## 解决方案

1. ```
   使用预定义字典：cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
   ```
2. ```
   在使用前检查字典是否为空：if (dictionary.empty()) { /* 回退 */ }
   ```

## 无效尝试

- **** — The dictionary object may be empty if not populated with marker images; detectMarkers requires a non-empty dictionary with predefined markers. (80% 失败率)
- **** — If the dictionary ID is not available in the OpenCV build, the constructor returns an empty dictionary, causing the assertion. (85% 失败率)
