-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move contrib charuco to main objdetect #22986
Move contrib charuco to main objdetect #22986
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -134,7 +128,7 @@ bool calib::parametersController::loadFromParser(cv::CommandLineParser &parser) | |||
} | |||
else if(templateType.find("charuco", 0) == 0) { | |||
mCapParams.board = chAruco; | |||
mCapParams.boardSize = cv::Size(6, 8); | |||
mCapParams.boardSize = cv::Size(5, 7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to touch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After fix the vars h
/w
is setting num corners for CharucoBard (like in chessboard)
After fix CharucoBoard create looks like this:
cv::aruco::CharucoBoard::create(mBoardSize.width + 1, mBoardSize.height + 1, capParams.charucoSquareLength,
capParams.charucoMarkerSize, mArucoDictionary);
mCapParams.boardSize = cv::Size(5, 7);
was fixed to support compatibility with old default parameters
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this looks like this:
Is it ok?
https://pullrequest.opencv.org/buildbot/export/pr/22986/docs/d5/d54/group__objdetect.html
* @param imgPoints Vector of vectors of the projections of board marker corner points. | ||
*/ | ||
CV_WRAP void matchImagePoints(InputArrayOfArrays detectedCorners, InputArray detectedIds, | ||
OutputArray objPoints, OutputArray imgPoints) const override; | ||
protected: | ||
struct CharucoImpl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields GridImpl
and CharucoImpl
were removed from GridBoard, CharucoBoard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change most Ptr<>
to reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This done - remove public virtual API for Board classes
/** @defgroup objdetect_aruco | ||
* ArUco Marker Detection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this looks like this:
Is it ok?
https://pullrequest.opencv.org/buildbot/export/pr/22986/docs/d5/d54/group__objdetect.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No dots in headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ArUco" will better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()
forCharucoBoard
Pull 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.