1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Remove add/removeDictionary and retain ABI of set/getDictionary

functions
This commit is contained in:
Benjamin Knecht
2025-02-24 18:01:10 +01:00
parent 6c3b195a57
commit 314f99f7a0
4 changed files with 37 additions and 88 deletions
+6 -20
View File
@@ -1439,22 +1439,19 @@ void ArucoDetector::read(const FileNode &fn) {
arucoDetectorImpl->refineParams.readRefineParameters(fn);
}
const Dictionary& ArucoDetector::getDictionary(int index) const {
CV_Assert(index >= 0 && static_cast<size_t>(index) < arucoDetectorImpl->dictionaries.size());
return arucoDetectorImpl->dictionaries[index];
const Dictionary& ArucoDetector::getDictionary() const {
return arucoDetectorImpl->dictionaries[0];
}
void ArucoDetector::setDictionary(const Dictionary& dictionary, int index) {
// special case: if index is 0, we add the dictionary to the list to preserve the old behavior
CV_Assert(index == 0 || (index >= 0 && static_cast<size_t>(index) < arucoDetectorImpl->dictionaries.size()));
if (index == 0 && arucoDetectorImpl->dictionaries.empty()) {
void ArucoDetector::setDictionary(const Dictionary& dictionary) {
if (arucoDetectorImpl->dictionaries.empty()) {
arucoDetectorImpl->dictionaries.push_back(dictionary);
} else {
arucoDetectorImpl->dictionaries.at(index) = dictionary;
arucoDetectorImpl->dictionaries[0] = dictionary;
}
}
const vector<Dictionary>& ArucoDetector::getDictionaries() const {
vector<Dictionary> ArucoDetector::getDictionaries() const {
return arucoDetectorImpl->dictionaries;
}
@@ -1463,17 +1460,6 @@ void ArucoDetector::setDictionaries(const vector<Dictionary>& dictionaries) {
arucoDetectorImpl->dictionaries = dictionaries;
}
void ArucoDetector::addDictionary(const Dictionary& dictionary) {
arucoDetectorImpl->dictionaries.push_back(dictionary);
}
void ArucoDetector::removeDictionary(int index) {
CV_Assert(index >= 0 && static_cast<size_t>(index) < arucoDetectorImpl->dictionaries.size());
// disallow no dictionaries
CV_Assert(arucoDetectorImpl->dictionaries.size() > 1ul);
arucoDetectorImpl->dictionaries.erase(arucoDetectorImpl->dictionaries.begin() + index);
}
const DetectorParameters& ArucoDetector::getDetectorParameters() const {
return arucoDetectorImpl->detectorParams;
}