-215
opencv
assertion_error
ai_generated
true
cv::error: (-215:Assertion failed) !_dictionary.empty() in function 'detectMarkers'
ID: opencv/aruco-dictionary-not-found
92%Fix Rate
86%Confidence
1Evidence
2024-01-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4.6.0 | active | — | — | — |
| 4.8.1 | active | — | — | — |
| 4.9.0 | active | — | — | — |
Root Cause
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.
generic中文
传递给 cv::aruco::detectMarkers 的 ArUco 字典对象为空或未正确初始化,通常是由于无效的字典 ID 或创建失败。
Official Documentation
https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.htmlWorkarounds
-
95% success Use a predefined dictionary: cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
Use a predefined dictionary: cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
-
90% success Check dictionary availability before use: if (dictionary.empty()) { /* fallback */ }
Check dictionary availability before use: if (dictionary.empty()) { /* fallback */ }
中文步骤
使用预定义字典:cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
在使用前检查字典是否为空:if (dictionary.empty()) { /* 回退 */ }
Dead Ends
Common approaches that don't work:
-
80% fail
The dictionary object may be empty if not populated with marker images; detectMarkers requires a non-empty dictionary with predefined markers.
-
85% fail
If the dictionary ID is not available in the OpenCV build, the constructor returns an empty dictionary, causing the assertion.