Conversation
4ed7580 to
9989103
Compare
| * @param legacy legacy chessboard pattern (pre 4.6.0). Pattern generation was changed for even row patterns (see https://github.com/opencv/opencv_contrib/issues/3291). | ||
| * The first markers in the dictionary are used to fill the white chessboard squares. | ||
| */ | ||
| CV_WRAP CharucoBoard(const Size& size, float squareLength, float markerLength, |
There was a problem hiding this comment.
I propose to not touch the constructor, but add setLegacyFlag() method. It's easier to remove legacy method in future than break compatibility for all code that uses Charuco.
There was a problem hiding this comment.
I agree that we should not have an overload ctor, but rather a legacy flag (set to true by default) as the last parameter in the existing ctor (with an explanation in the ctor documentation), and go without a setLegacy method.
The reasons are below:
- Migrating from pre-4.6.0 to 4.6.0 breaks the code silently (when using a physical target manufactured with pre 4.6.0) and it is difficult for a novice developer to figure out why.
- Migrating from pre-4.5.5 to 4.7.0 breaks the code explicitly because the ctor is different (Size instead of two ints), as in @stefan523's example code in ChArUco pattern has broken backward compatibility #23152. When the developer fixes the compilation error, they trigger the silent failures of the item above. If we introduce a legacy flag set to true by default, this is avoided and backward compatibility is preserved even if the developer is not aware of the legacy flag.
- Migrating from 4.6.0 to 4.7.0 requires the developer to explicitly update the ctor both in the Size parameters and in the legacy flag set to false (that is, assuming they are analyzing a target fabricated using 4.6.0 code). This is the only case that actually leads to backward compatibility issues per my suggestion, when the developer is not aware of the role of the legacy flag.
I think that it is more important to maintain backward compatibility with the dozens of released versions that have been employed to produce physical charuco targets that are still is use in production lines. Deciding otherwise will inevitably lead to systems version upgrades silently failing without an evident explanation.
There was a problem hiding this comment.
I propose to not touch the constructor, but add
setLegacyFlag()method. It's easier to remove legacy method in future than break compatibility for all code that uses Charuco.
I'm not sure if I understand the ask correctly.
I did keep the existing ctor as-is and added an overload with legacy flag in order to pass the ABI compliance check:
https://pullrequest.opencv.org/buildbot/builders/precommit_linux64/builds/102489/steps/Compare%20ABI%20dumps/logs/report-html
Adding a setLegacyFlag() method would add a new sympol as well. And this would break code, trigger an ABI compliance failure if removed in the future, would it not? I don't see the difference in that respect.
The existing ctor already creates a board. Adding a setLegacyFlag() method that is called after the constructor has run would mean to clear the board and recreate it differently. Is that really the ask? I don't see the advantage, only things that could go bad in the workflow. Or do I get it wrong?
Either way I'm fine with anything that enables usage of existing targets and data. @asmorkalov, please advise and I'll try to adapt.
There was a problem hiding this comment.
I believe we should minimize or do not bring code with legacy/buggy behavior from opencv_contrib into the main repository (as we don't really want to support/maintain that).
If setLegacyFlag() doesn't work, then I propose to create CharucoBoardLegacy or cv::aruco::legacy::CharucoBoard in opencv_contrib/modules/aruco for this purpose.
There is inheritance with Board base class and Pimpl design, but some trick is required to expose Board::Impl to opencv_contrib (we don't need that in public OpenCV headers).
There was a problem hiding this comment.
Deciding otherwise will inevitably lead to systems version upgrades silently failing without an evident explanation.
one way or another, mentioning this change in the release notes would have been nice..
There was a problem hiding this comment.
probably it makes sense to dub the BBF order (i.e. 4.6, 4.7 behavior) "legacy" and hence set the flag to false by default.
I doubt that with that many WBF patterns in the wild and WBF effectively being the default from 4.8 on BBF will be anything but legacy.
There was a problem hiding this comment.
Resolved: constructor is not being touched. Different board layouts are supported by setBBF(bool) method.
There was a problem hiding this comment.
Sorry, there is useful information for discussion here. Please don't mark as resolved for now.
There was a problem hiding this comment.
@AleksandrPanov, what are the required steps to merge this pull request?
There was a problem hiding this comment.
I'm interest as well to understand when this pul request will be close?
|
👍 nice work! lets hope the maintainers agree. |
|
@alalek, @asmorkalov, I updated the PR according to your suggestions: Leaving the constructor as-is, adding a method to optionally select different pattern designs. Can you please review? |
asmorkalov
left a comment
There was a problem hiding this comment.
👍 Thanks a lot for the contribution!
alalek
left a comment
There was a problem hiding this comment.
@asmorkalov There is something wrong again with GitHub Actions - no builds are run.
d259d2d to
8bd30af
Compare
|
Hi @alalek, |
There was a problem hiding this comment.
@stefan523, thank you for work, LGTM
The board design had to change to get compatibility with checkerboard pattern for camera calibration.
| * Default behavior: WBF for even row, BBF for odd row patterns. | ||
| */ | ||
| CV_WRAP void setBBF(bool BBF); | ||
| CV_WRAP bool getBBF() const; |
There was a problem hiding this comment.
@AleksandrPanov Did you really verify that?
Default pattern must be like this: https://github.com/opencv/opencv/blob/4.7.0/doc/pattern.png
We start discussion of this patch with setLegacyPattern() flag. No aggrement to use BBF or other unclear abbreviations (first, even, odd in one description is a true mess).
Description should mention changes after 4.5.5/4.6.0 releases.
Default behavior must be preserved (4.7.0).
There was a problem hiding this comment.
@alalek, @AleksandrPanov, all raised concerns should've been resolved now. Please approve.
There was a problem hiding this comment.
@alalek, I liked @stefan523's idea to give a logical name to the board design parameter. I think that @stefan523 need choose a different name (instead of BBF) and improve the description in the documentation.
Pattern design was changed to implement for calibration compatibility with charuco chessboards (interactive calibration tool + kalibr). For a better understanding, I suggest using this board design parameter as a new parameter, and not just a flag for compatibility with old solutions. I could suggest the name of the parameter as chessboardPatternCompatibility.
I was wrong, the default behavior should be like in 4.7.0.
There was a problem hiding this comment.
Documentation/comments should be more clear now.
I had the parameter change to legacyParamter per directions in the other comment, but I am happy to change it again to anything else like chessboardPatternCompatibility if this would be the accepted name?
| * @param legacy legacy chessboard pattern (pre 4.6.0). Pattern generation was changed for even row patterns (see https://github.com/opencv/opencv_contrib/issues/3291). | ||
| * The first markers in the dictionary are used to fill the white chessboard squares. | ||
| */ | ||
| CV_WRAP CharucoBoard(const Size& size, float squareLength, float markerLength, |
There was a problem hiding this comment.
Resolved: constructor is not being touched. Different board layouts are supported by setBBF(bool) method.
dbc2a2f to
e80ff08
Compare
Can someone please restart the build checks?
|
|
Is there already an (approximate) date for the OpenCV 4.8 release by any chance? |
|
When will it be merge? |
|
|
@stefan523 @pietrocolombo I apologize for the delay. The ball is on my side. |
e80ff08 to
e55784a
Compare
|
Rebased and squashed. |
|
Thank you Stefan! |
Add support for certain ChArUco board patterns as they had been generated with OpenCV contrib version prior 4.6.0.
The pull request adds a
setLegacyParameter(bool)method to the Charuco class to allow switching to the old board design as described in #23152.Default setting for this parameter is `false´ to remain compatible with OpenCV contrib 4.6.0 and OpenCV 4.7.0.
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.