Skip to content

Add charuco pattern into calibration.cpp#23486

Merged
asmorkalov merged 15 commits intoopencv:4.xfrom
vovka643:4.x_calibration_with_aruco
Apr 26, 2023
Merged

Add charuco pattern into calibration.cpp#23486
asmorkalov merged 15 commits intoopencv:4.xfrom
vovka643:4.x_calibration_with_aruco

Conversation

@vovka643
Copy link
Copy Markdown
Contributor

added charuco pattern into calibration.cpp. Added charuco pattern with predefined aruco dictionary and with dictionary from file.

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

@asmorkalov asmorkalov self-requested a review April 13, 2023 06:18
@asmorkalov asmorkalov self-assigned this Apr 13, 2023
@asmorkalov asmorkalov changed the title add charuco pattern into calibration.cpp WIP: add charuco pattern into calibration.cpp Apr 14, 2023
dictionary.readDictionary(fn);
}

cv::aruco::CharucoBoard ch_board ({ boardSize.width + 1, boardSize.height + 1 },
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.

Why +1?

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.

Still relevant.

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.

Discussed the issue offline. Decided to remove +1, but add note about the board size units. Chessboard and radon board size are defined in inner corners, all other boards - in elements (circles or squares).

@asmorkalov asmorkalov changed the title WIP: add charuco pattern into calibration.cpp Add charuco pattern into calibration.cpp Apr 14, 2023
@asmorkalov
Copy link
Copy Markdown
Contributor

/home/ci/opencv/samples/cpp/calibration.cpp:552:122: warning: enum constant in boolean context [-Wint-in-bool-context]

/home/ci/opencv/samples/cpp/calibration.cpp:565:37: warning: comparison of integer expressions of different signedness: 'std::vector<cv::Point_<float> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]

@asmorkalov
Copy link
Copy Markdown
Contributor

./example_cpp_calibration -w=7 -h=5 -pt=charucoboard -ad=DICT_5X5_100 ./calib.list -o=charuco_calib.yaml
...
ERRORS:
Parameter 'ad': can not convert: [DICT_5X5_100] to [int]

@asmorkalov asmorkalov added this to the 4.8.0 milestone Apr 18, 2023
Comment on lines +62 to +63
" [-ad=<arucoDict>] # Aruco dictionary name for charuco board"
" [-adf=<dictFilename>] # Custom aruco dictionary file for charuco board"
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.

\n is missing at the end of the line.

@asmorkalov
Copy link
Copy Markdown
Contributor

The sample uses wrong visualization or something is broken in the pipeline. I see this:
preview_1

@vovka643
Copy link
Copy Markdown
Contributor Author

You should write inner corners of desk. For your desk you should use parameters: h=4, w =6

@asmorkalov
Copy link
Copy Markdown
Contributor

To summarize test results:

  • Charuco board is equal to chessboard (checkerboard). Command ./example_cpp_calibration -w=6 -h=4 -pt=chessboard ./calib.list -o=charuco_calib.yaml works well, produce realistic results and visualization.
    preview_1
  • ./example_cpp_calibration -w=6 -h=4 -pt=charucoboard -ad=5 ./calib.list -o=charuco_calib.yaml produces broken visualization and also not realistic calibration results: RMS error reported by calibrateCamera: 52.5128. See image above.
  • PR added charuco board generation to gen_pattern.py #23363 claims that the board has 7x5 size, but the proposed parameters do not work.

@asmorkalov
Copy link
Copy Markdown
Contributor

Please ignore my previous statement about wrong visualization and calibration. I screwed up with board size. ./example_cpp_calibration -w=4 -h=6 -pt=chessboard ./calib.list -o=charuco_calib.yaml works expected.

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.

👍 Tested manually with command ./example_cpp_calibration -w=5 -h=7 -pt=charuco -ad=DICT_5X5_100 ./calib.xml -o=charuco_calib.yml and template from #23363

@asmorkalov asmorkalov merged commit a174a6c into opencv:4.x Apr 26, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
Add charuco pattern into calibration.cpp opencv#23486

Added charuco pattern into calibration.cpp. Added charuco pattern with predefined aruco dictionary and with dictionary from file.

### 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
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
Add charuco pattern into calibration.cpp opencv#23486

Added charuco pattern into calibration.cpp. Added charuco pattern with predefined aruco dictionary and with dictionary from file.

### 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
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.

2 participants