Move contrib charuco to main objdetect#22986
Conversation
asmorkalov
left a comment
There was a problem hiding this comment.
I propose:
- Do not use inheritance for Charuco. There is no so much in common, but Charuco class gets "detectMarkers", "refineMarkers", etc
- It makes sense to add constructor with
cv::Ptr<ArucoDetector> - m.b. extract Charuco interface to dedicated header file.
492d8c7 to
2e12af2
Compare
I use inheritance for |
f767839 to
8304d06
Compare
f226e34 to
9de448c
Compare
There is old charuco check in |
|
Also it makes sense to add Charuco dictionary name as command line parameter and remove it from extended config. It's more obvious and handy solution. |
9de448c to
2eeae14
Compare
eb0d580 to
5be4c66
Compare
dd0f91e to
0b8e274
Compare
1919f7d to
56d17ff
Compare
c59db63 to
f4041a2
Compare
d1a7317 to
100cc55
Compare
modules/objdetect/include/opencv2/objdetect/charuco_detector.hpp
Outdated
Show resolved
Hide resolved
modules/objdetect/include/opencv2/objdetect/charuco_detector.hpp
Outdated
Show resolved
Hide resolved
modules/objdetect/include/opencv2/objdetect/charuco_detector.hpp
Outdated
Show resolved
Hide resolved
|
@alalek The PR is almost ready for merge. Could you take a look? |
| namespace aruco { | ||
|
|
||
| //! @addtogroup aruco | ||
| //! @{ |
There was a problem hiding this comment.
Documentation is still broken since #22368 .
There is no aruco group: http://pullrequest.opencv.org/buildbot/export/pr/22986/docs/d5/d54/group__objdetect.html
There was a problem hiding this comment.
Now this looks like this:

Is it ok?
https://pullrequest.opencv.org/buildbot/export/pr/22986/docs/d5/d54/group__objdetect.html
| CV_WRAP void matchImagePoints(InputArrayOfArrays detectedCorners, InputArray detectedIds, | ||
| OutputArray objPoints, OutputArray imgPoints) const override; | ||
| protected: | ||
| struct CharucoImpl; |
There was a problem hiding this comment.
class CV_EXPORTS_W CharucoBoard : public Board {
How many PImpl fields in this class with such inheritance?
Must be one (for the discussion above).
There was a problem hiding this comment.
Do you suggest make PImpl fields as private and prevent class inheritors using this field? In the ImageCollection (imgcodecs), Model (dnn), IntelligentScissorsMB classes PImpl fields set as protected and can be used by the class's inheritors.
There was a problem hiding this comment.
private
Where is it suggested?
They must reuse the single "impl" field instead of adding a new one.
See Model (dnn) inheritance pattern.
There was a problem hiding this comment.
fields GridImpl and CharucoImpl were removed from GridBoard, CharucoBoard
There was a problem hiding this comment.
So, change in virtual void matchImagePoints() is not needed anymore.
BTW, too many unnecessary Ptr<> in implementation, especially without NULL checks.
Reference should be used instead.
There was a problem hiding this comment.
change most Ptr<> to reference
There was a problem hiding this comment.
@alalek, do you want me to remove the virtuality for the function matchImagePoints() and generateImage()? Do you want me to use virtuality into Pimpl implementation?
There was a problem hiding this comment.
I want this kind of code to work correctly:
cv::Ptr<cv::aruco::Board> board = cv::aruco::CharucoBoard::create(3, 3);
std::vector<cv::Point2f> a1;
std::vector<int> a2;
std::vector<cv::Point2f> a3;
std::vector<cv::Point2f> a4;
board->matchImagePoints(a1, a2, a3, a4);
without virtual in matchImagePoints() I need to create func virtual void pimplMatchImagePoints() and call this from main Boards classes
Should I do it?
There was a problem hiding this comment.
This done - remove public virtual API for Board classes
| /** @defgroup objdetect_aruco | ||
| * ArUco Marker Detection |
There was a problem hiding this comment.
/build/precommit_docs/4.x/opencv/modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp:13: warning: missing title after \defgroup objdetect_aruco
There was a problem hiding this comment.
See how it looks in final docs: https://pullrequest.opencv.org/buildbot/export/pr/22986/docs/d5/d54/group__objdetect.html
There was a problem hiding this comment.
Now this looks like this:

Is it ok?
https://pullrequest.opencv.org/buildbot/export/pr/22986/docs/d5/d54/group__objdetect.html
63b8512 to
ffe588f
Compare
fdeb045 to
1f214f2
Compare
6b6d1b9 to
0ed1de9
Compare
|
@asmorkalov Is there final approval? |
| protected: | ||
| Board(Ptr<BoardImpl> impl); | ||
| template<typename T> T& as() { CV_Assert(boardImpl); return static_cast<T&>(*boardImpl); } | ||
| template<typename T> const T& as() const { CV_Assert(boardImpl); return static_cast<const T&>(*boardImpl); } |
There was a problem hiding this comment.
This could be thrown away from public headers:
See TextRecognitionModel_Impl::from(impl)
|
@alalek Ready for review |
…uco_to_main_objdetect merge with opencv/opencv_contrib#3394 move Charuco API from contrib to main repo: - add CharucoDetector: ``` CharucoDetector::detectBoard(InputArray image, InputOutputArrayOfArrays markerCorners, InputOutputArray markerIds, OutputArray charucoCorners, OutputArray charucoIds) const // detect charucoCorners and/or markerCorners CharucoDetector::detectDiamonds(InputArray image, InputOutputArrayOfArrays _markerCorners, InputOutputArrayOfArrays _markerIds, OutputArrayOfArrays _diamondCorners, OutputArray _diamondIds) const ``` - add `matchImagePoints()` for `CharucoBoard` - remove contrib aruco dependencies from interactive-calibration tool - move almost all aruco tests to objdetect ### 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. - [x] The feature is well documented and sample code can be built with the project CMake
merge with opencv/opencv_contrib#3394
move Charuco API from contrib to main repo:
matchImagePoints()forCharucoBoardPull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.