mirror of
https://github.com/opencv/opencv.git
synced 2025-08-04 21:36:35 +08:00
Add docs to Dictionary get/set/add/remove functions
This commit is contained in:
parent
364eedb87e
commit
3c88a001a2
@ -373,11 +373,65 @@ public:
|
||||
CV_WRAP void detectMarkersMultiDict(InputArray image, OutputArrayOfArrays corners, OutputArray ids,
|
||||
OutputArrayOfArrays rejectedImgPoints = noArray(), OutputArray dictIndices = noArray()) const;
|
||||
|
||||
/** @brief Returns a specific dictionary from the set of dictionaries used for marker detection.
|
||||
*
|
||||
* @param index Index of the dictionary to retrieve. Default is 0, returning the first dictionary if multiple are set.
|
||||
*
|
||||
* Returns the dictionary at the specified index from the internal collection of dictionaries used by the ArucoDetector.
|
||||
* If only one dictionary is set, or if the index is 0, this method will return that dictionary.
|
||||
* If multiple dictionaries are in use (e.g., for dictionary cascade), this allows access to each dictionary individually.
|
||||
* @note If the index is out of bounds, the function throws an error.
|
||||
*/
|
||||
CV_WRAP const Dictionary& getDictionary(int index = 0) const;
|
||||
|
||||
/** @brief Sets a specific dictionary in the list of dictionaries used for marker detection, replacing the dictionary at the given index.
|
||||
*
|
||||
* @param dictionary The dictionary to set at the specified index.
|
||||
* @param index Index of the dictionary to set. Default is 0, replacing the first dictionary if multiple are set.
|
||||
*
|
||||
* Sets the dictionary at the specified index within the internal collection of dictionaries used by the ArucoDetector.
|
||||
* If implementing a dictionary cascade or similar, this method allows for replacing specific dictionaries within the collection.
|
||||
* @note If the index is out of bounds, the method is going to throw an error.
|
||||
*/
|
||||
CV_WRAP void setDictionary(const Dictionary& dictionary, int index = 0);
|
||||
|
||||
/** @brief Returns all dictionaries currently used for marker detection as a vector.
|
||||
*
|
||||
* @return A constant reference to a std::vector<Dictionary> containing all dictionaries used by the ArucoDetector.
|
||||
*
|
||||
* Provides access to the entire set of Dictionary objects currently configured within the ArucoDetector.
|
||||
* This is useful for inspecting the dictionaries being used, iterating through them, or determining the number of dictionaries in use.
|
||||
*/
|
||||
CV_WRAP const std::vector<Dictionary>& getDictionaries() const;
|
||||
|
||||
/** @brief Sets the entire collection of dictionaries to be used for marker detection, replacing any existing dictionaries.
|
||||
*
|
||||
* @param dictionaries A std::vector<Dictionary> containing the new set of dictionaries to be used.
|
||||
*
|
||||
* Configures the ArucoDetector to use the provided vector of Dictionary objects for marker detection.
|
||||
* This method replaces any dictionaries that were previously set.
|
||||
* @note Setting an empty vector of dictionaries will throw an error.
|
||||
*/
|
||||
CV_WRAP void setDictionaries(const std::vector<Dictionary>& dictionaries);
|
||||
|
||||
/** @brief Adds a new dictionary to the collection of dictionaries used for marker detection.
|
||||
*
|
||||
* @param dictionary The dictionary to add to the collection.
|
||||
*
|
||||
* Appends the provided Dictionary object to the internal collection of dictionaries used by the ArucoDetector.
|
||||
* This method is useful when you want to extend the set of dictionaries already in use without replacing them entirely.
|
||||
*/
|
||||
CV_WRAP void addDictionary(const Dictionary& dictionary);
|
||||
|
||||
/** @brief Removes a dictionary from the collection of dictionaries at the specified index.
|
||||
*
|
||||
* @param index Index of the dictionary to remove from the collection.
|
||||
*
|
||||
* Removes the Dictionary object at the specified index from the internal collection of dictionaries.
|
||||
* After removing a dictionary, the indices of subsequent dictionaries in the collection will be shifted.
|
||||
* @note If the index is out of bounds, the function will throw. It will also not allow removing the last
|
||||
* dictionary of the internal collection.
|
||||
*/
|
||||
CV_WRAP void removeDictionary(int index);
|
||||
|
||||
CV_WRAP const DetectorParameters& getDetectorParameters() const;
|
||||
|
@ -648,7 +648,7 @@ enum class DictionaryMode {
|
||||
|
||||
struct ArucoDetector::ArucoDetectorImpl {
|
||||
/// dictionaries indicates the types of markers that will be searched
|
||||
std::vector<Dictionary> dictionaries;
|
||||
vector<Dictionary> dictionaries;
|
||||
|
||||
/// marker detection parameters, check DetectorParameters docs to see available settings
|
||||
DetectorParameters detectorParams;
|
||||
@ -657,7 +657,7 @@ struct ArucoDetector::ArucoDetectorImpl {
|
||||
RefineParameters refineParams;
|
||||
ArucoDetectorImpl() {}
|
||||
|
||||
ArucoDetectorImpl(const std::vector<Dictionary>&_dictionaries, const DetectorParameters &_detectorParams,
|
||||
ArucoDetectorImpl(const vector<Dictionary>&_dictionaries, const DetectorParameters &_detectorParams,
|
||||
const RefineParameters& _refineParams): dictionaries(_dictionaries),
|
||||
detectorParams(_detectorParams), refineParams(_refineParams) {
|
||||
CV_Assert(!dictionaries.empty());
|
||||
@ -838,7 +838,7 @@ struct ArucoDetector::ArucoDetectorImpl {
|
||||
|
||||
// Clean up rejectedImgPoints by comparing to itself and all candidates
|
||||
const float epsilon = 0.000001f;
|
||||
auto compareCandidates = [epsilon](std::vector<Point2f> a, std::vector<Point2f> b) {
|
||||
auto compareCandidates = [epsilon](vector<Point2f> a, vector<Point2f> b) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (std::abs(a[i].x - b[i].x) > epsilon || std::abs(a[i].y - b[i].y) > epsilon) {
|
||||
return false;
|
||||
@ -1113,7 +1113,7 @@ ArucoDetector::ArucoDetector(const Dictionary &_dictionary,
|
||||
arucoDetectorImpl = makePtr<ArucoDetectorImpl>(vector<Dictionary>{_dictionary}, _detectorParams, _refineParams);
|
||||
}
|
||||
|
||||
ArucoDetector::ArucoDetector(const std::vector<Dictionary> &_dictionaries,
|
||||
ArucoDetector::ArucoDetector(const vector<Dictionary> &_dictionaries,
|
||||
const DetectorParameters &_detectorParams,
|
||||
const RefineParameters& _refineParams) {
|
||||
arucoDetectorImpl = makePtr<ArucoDetectorImpl>(_dictionaries, _detectorParams, _refineParams);
|
||||
@ -1454,6 +1454,7 @@ const vector<Dictionary>& ArucoDetector::getDictionaries() const {
|
||||
}
|
||||
|
||||
void ArucoDetector::setDictionaries(const vector<Dictionary>& dictionaries) {
|
||||
CV_Assert(!dictionaries.empty());
|
||||
arucoDetectorImpl->dictionaries = dictionaries;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user