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 4b321ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 4 additions & 1 deletion modules/aruco/include/opencv2/aruco/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ class CV_EXPORTS_W CharucoBoard : public Board {
* @return bool value, 1 (true) if detected corners form a line, 0 (false) if they do not.
solvePnP, calibration functions will fail if the corners are collinear (true).
*
* The number of ids in charucoIDs should be <= the number of chessboard corners in the board. This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false). Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases: for number of charucoIDs <= 2, the function returns true.
* The number of ids in charucoIDs should be <= the number of chessboard corners in the board.
* This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false).
* Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases:
* for number of charucoIDs <= 2,the function returns true.
*/
CV_EXPORTS_W bool testCharucoCornersCollinear(const Ptr<CharucoBoard> &board, InputArray charucoIds);

Expand Down
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 4b321ac

Please sign in to comment.