Skip to content

Commit

Permalink
remove readWrite() from API
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrPanov committed Jul 4, 2022
1 parent 059ade9 commit f572d15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 0 additions & 2 deletions modules/aruco/include/opencv2/aruco_detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ struct CV_EXPORTS_W RefineParameters {
* If it set to false, only the provided corner order is considered (default true).
*/
CV_PROP_RW bool checkAllOrders;
private:
bool readWrite(const Ptr<FileNode>& readNode = nullptr, const Ptr<FileStorage>& writeStorage = nullptr);
};

/**
Expand Down
13 changes: 7 additions & 6 deletions modules/aruco/src/aruco_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,28 @@ bool DetectorParameters::writeDetectorParameters(const Ptr<FileStorage>& fs)
return readWrite(nullptr, fs);
}

bool RefineParameters::readWrite(const Ptr<FileNode>& readNode, const Ptr<FileStorage>& writeStorage) {
static inline bool readWrite(RefineParameters& refineParameters, const Ptr<FileNode>& readNode,
const Ptr<FileStorage>& writeStorage = nullptr) {
CV_Assert(!readNode.empty() || !writeStorage.empty());
bool check = false;

check |= readWriteParameter("minRepDistance", this->minRepDistance, readNode, writeStorage);
check |= readWriteParameter("errorCorrectionRate", this->errorCorrectionRate, readNode, writeStorage);
check |= readWriteParameter("checkAllOrders", this->checkAllOrders, readNode, writeStorage);
check |= readWriteParameter("minRepDistance", refineParameters.minRepDistance, readNode, writeStorage);
check |= readWriteParameter("errorCorrectionRate", refineParameters.errorCorrectionRate, readNode, writeStorage);
check |= readWriteParameter("checkAllOrders", refineParameters.checkAllOrders, readNode, writeStorage);
return check;
}

bool RefineParameters::readRefineParameters(const FileNode &fn) {
if(fn.empty())
return false;
Ptr<FileNode> pfn = makePtr<FileNode>(fn);
return readWrite(pfn);
return readWrite(*this, pfn);
}

bool RefineParameters::writeRefineParameters(const Ptr<FileStorage> &fs) {
if(fs.empty())
return false;
return readWrite(nullptr, fs);
return readWrite(*this, nullptr, fs);
}

/**
Expand Down

0 comments on commit f572d15

Please sign in to comment.