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

Merge pull request #25378 from AleksandrPanov:move_charuco_tutorial

Move Charuco/Calib tutorials and samples to main repo #25378

Merge with https://github.com/opencv/opencv_contrib/pull/3708

Move Charuco/Calib tutorials and samples to main repo:

- [x] update/fix charuco_detection.markdown and samples
- [x] update/fix charuco_diamond_detection.markdown and samples
- [x] update/fix aruco_calibration.markdown and samples
- [x] update/fix aruco_faq.markdown
- [x] move tutorials, samples and tests to main repo
- [x] remove old tutorials, samples and tests from contrib


### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Alexander Panov
2024-04-16 12:14:33 +03:00
committed by GitHub
parent 4fb0541916
commit e2621f128e
33 changed files with 1947 additions and 137 deletions
@@ -45,4 +45,47 @@ inline static bool saveCameraParams(const std::string &filename, cv::Size imageS
return true;
}
inline static cv::aruco::DetectorParameters readDetectorParamsFromCommandLine(cv::CommandLineParser &parser) {
cv::aruco::DetectorParameters detectorParams;
if (parser.has("dp")) {
cv::FileStorage fs(parser.get<std::string>("dp"), cv::FileStorage::READ);
bool readOk = detectorParams.readDetectorParameters(fs.root());
if(!readOk) {
throw std::runtime_error("Invalid detector parameters file\n");
}
}
return detectorParams;
}
inline static void readCameraParamsFromCommandLine(cv::CommandLineParser &parser, cv::Mat& camMatrix, cv::Mat& distCoeffs) {
//! [camDistCoeffs]
if(parser.has("c")) {
bool readOk = readCameraParameters(parser.get<std::string>("c"), camMatrix, distCoeffs);
if(!readOk) {
throw std::runtime_error("Invalid camera file\n");
}
}
//! [camDistCoeffs]
}
inline static cv::aruco::Dictionary readDictionatyFromCommandLine(cv::CommandLineParser &parser) {
cv::aruco::Dictionary dictionary;
if (parser.has("cd")) {
cv::FileStorage fs(parser.get<std::string>("cd"), cv::FileStorage::READ);
bool readOk = dictionary.readDictionary(fs.root());
if(!readOk) {
throw std::runtime_error("Invalid dictionary file\n");
}
}
else {
int dictionaryId = parser.has("d") ? parser.get<int>("d"): cv::aruco::DICT_4X4_50;
if (!parser.has("d")) {
std::cout << "The default DICT_4X4_50 dictionary has been selected, you could "
"select the specific dictionary using flags -d or -cd." << std::endl;
}
dictionary = cv::aruco::getPredefinedDictionary(dictionaryId);
}
return dictionary;
}
}