Skip to content

move aruco from contrib to objdetect in main repository#22368

Merged
asmorkalov merged 22 commits intoopencv:4.xfrom
AleksandrPanov:move_contrib_aruco_to_main_objdetect
Dec 16, 2022
Merged

move aruco from contrib to objdetect in main repository#22368
asmorkalov merged 22 commits intoopencv:4.xfrom
AleksandrPanov:move_contrib_aruco_to_main_objdetect

Conversation

@AleksandrPanov
Copy link
Copy Markdown
Contributor

@AleksandrPanov AleksandrPanov commented Aug 11, 2022

Megre together with opencv/opencv_contrib#3325

  1. Move aruco_detector, aruco_board, aruco_dictionary, aruco_utils to objdetect
    1.1 add virtual Board::draw(), virtual ~Board()
    1.2 move testCharucoCornersCollinear to Board classes (and rename to checkCharucoCornersCollinear)
    1.3 add wrappers to keep the old api working
  2. Reduce inludes
  3. Fix java tests (add objdetect import)
  4. Refactoring

Pull Request Readiness Checklist

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

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • 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
**WIP**
force_builders=linux,win64,docs,Linux x64 Debug,Custom
Xbuild_contrib:Docs=OFF

build_image:Custom=ubuntu:22.04
build_worker:Custom=linux-1

@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch 5 times, most recently from 8f00a1b to 75edd43 Compare August 22, 2022 21:49
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch 2 times, most recently from 2fedf4d to 3752927 Compare August 24, 2022 06:04
@AleksandrPanov AleksandrPanov marked this pull request as ready for review August 24, 2022 08:00
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch 2 times, most recently from 04388eb to d3a9169 Compare August 26, 2022 09:08
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch from d3a9169 to c57fa3d Compare August 26, 2022 11:47
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch 3 times, most recently from ddbfca8 to 21bd0df Compare September 13, 2022 01:58

/** @brief get rightBottomBorder
*/
CV_WRAP const Point3f& getRightBottomBorder() const;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M.b getRightBottomCorner?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename getRightBottomBorder to getRightBottomCorner

@vpisarev vpisarev self-requested a review September 13, 2022 14:37
Copy link
Copy Markdown
Contributor

@vpisarev vpisarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except for a few questionable CV_EXPORTS_AS(...), I'm fine with the pull request

@asmorkalov asmorkalov self-requested a review September 14, 2022 06:15
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek could you take a look on the patch, at least on public API design?

@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch from 93f4598 to 035c7b9 Compare September 20, 2022 06:44
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch from b2fef4f to fd0c02d Compare December 8, 2022 22:43
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch from 92868e1 to 68aca5c Compare December 12, 2022 19:02
@AleksandrPanov AleksandrPanov force-pushed the move_contrib_aruco_to_main_objdetect branch from 25d2493 to ba67ad4 Compare December 12, 2022 22:30
Comment on lines +14 to +20
public class ArucoTest extends OpenCVTestCase {

public void testGenerateBoards() {
Dictionary dictionary = Objdetect.getPredefinedDictionary(Objdetect.DICT_4X4_50);

Mat point1 = new Mat(4, 3, CvType.CV_32FC1);
int row = 0, col = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something wrong with indentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed indentation

* - DICT_ARUCO_ORIGINAL: standard ArUco Library Markers. 1024 markers, 5x5 bits, 0 minimum
distance
*/
enum PREDEFINED_DICTIONARY_NAME {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping


/** @brief get rightBottomBorder
*/
CV_WRAP const Point3f& getRightBottomBorder() const;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

// of the authors and should not be interpreted as representing official policies,
// either expressed or implied, of the Regents of The University of Michigan.

#include <opencv2/core.hpp>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong precomp.hpp usage.

All files of opencv modules must follow these rules:

  • .cpp file: one and only one (1) usage of precomp.hpp include on the first place (2).
  • .hpp file: can't use precomp.hpp at all

Copy link
Copy Markdown
Contributor Author

@AleksandrPanov AleksandrPanov Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, sorry part of cpp previously missed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

precomp.hpp was added to all objdetect/aruco cpp files and removed from all objdetect/aruco hpp files


template<typename T>
inline bool readWriteParameter(const std::string& name, T& parameter, const Ptr<FileNode> readNode = nullptr,
const Ptr<FileStorage> writeStorage = nullptr) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ptr<FileStorage>

we don't need Ptr in internal calls.

Use reference / const reference instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed Ptr from readWriteParameter

@AleksandrPanov
Copy link
Copy Markdown
Contributor Author

It looks like I fixed it. If it's not, sorry @alalek, it's easy to get lost here.

if(_in.type() == CV_8UC3)
cvtColor(_in, _out, COLOR_BGR2GRAY);
else
_in.copyTo(_out);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a copy still performed if the image is already grey? A Copy operation seems to be expensive performance wise

@arsserpentarium
Copy link
Copy Markdown

arsserpentarium commented Mar 27, 2023

can you imagine, what kind words people say to you, when you change how to use aruco markers without clear documentation?
So, scripts doesn't work anymore. And no one know how to fix it.

Comment on lines +79 to +84
CV_WRAP static Mat getByteListFromBits(const Mat &bits);


/** @brief Transform list of bytes to matrix of bits
*/
CV_WRAP static Mat getBitsFromByteList(const Mat &byteList, int markerSize);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be InputArray as it is public API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants