-215
opencv
assertion_error
ai_generated
true
cv::error: (-215:断言失败) !_dictionary.empty() 在函数 'detectMarkers' 中
cv::error: (-215:Assertion failed) !_dictionary.empty() in function 'detectMarkers'
ID: opencv/aruco-dictionary-not-found
92%修复率
86%置信度
1证据数
2024-01-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 4.6.0 | active | — | — | — |
| 4.8.1 | active | — | — | — |
| 4.9.0 | active | — | — | — |
根因分析
传递给 cv::aruco::detectMarkers 的 ArUco 字典对象为空或未正确初始化,通常是由于无效的字典 ID 或创建失败。
English
The ArUco dictionary object passed to cv::aruco::detectMarkers is empty or not properly initialized, often due to an invalid dictionary ID or failed creation.
官方文档
https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html解决方案
-
使用预定义字典:cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
-
在使用前检查字典是否为空:if (dictionary.empty()) { /* 回退 */ }
无效尝试
常见但无效的做法:
-
80% 失败
The dictionary object may be empty if not populated with marker images; detectMarkers requires a non-empty dictionary with predefined markers.
-
85% 失败
If the dictionary ID is not available in the OpenCV build, the constructor returns an empty dictionary, causing the assertion.