Skip to content
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

fix opencv init intrinsic calib #27

Merged
merged 4 commits into from Sep 27, 2022
Merged

Conversation

rameau-fr
Copy link
Owner

Fix the bug of OpenCV fisheye camera calibration error when points are too close to image's borders.
Notes:

  • This fix only affect the fisheye cameras
  • The boards with corners too close to the borders are removed only for initialization using opencv calib but are taken into consideration properly during the remaining of the calibration process

@rameau-fr rameau-fr added the bug Something isn't working label Sep 7, 2022
src/Camera.cpp Outdated Show resolved Hide resolved
src/Camera.cpp Outdated
bool valid_board = true;
if (distortion_model_ == 1) {
float thresh_border_x = im_cols_ / 20;
float thresh_border_y = im_rows_ / 20;
Copy link
Collaborator

Choose a reason for hiding this comment

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

const float . Also why do we need to divide img size by this number 20?

src/Camera.cpp Outdated
float thresh_border_x = im_cols_ / 20;
float thresh_border_y = im_rows_ / 20;
for (int i = 0; i < board_obs_temp->pts_2d_.size(); i++) {
float pt_x = board_obs_temp->pts_2d_[i].x;
Copy link
Collaborator

Choose a reason for hiding this comment

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

const float&

Copy link
Owner Author

Choose a reason for hiding this comment

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

sorry I am not sure where you would like to set a const float&

src/Camera.cpp Outdated Show resolved Hide resolved
src/Camera.cpp Show resolved Hide resolved
src/Camera.hpp Outdated
@@ -44,6 +44,9 @@ class Camera final {
// camera index
int cam_idx_;

// fisheye border margin to exclude invalid boards during initialization
const float border_marging = 0.05; // border margin tolerance
Copy link
Collaborator

Choose a reason for hiding this comment

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

constexpr float border_margin_ = 0.05f. Also it could be inside private.

src/Camera.cpp Outdated
const float thresh_border_x = float(im_cols_) * border_marging;
const float thresh_border_y = float(im_rows_) * border_marging;
for (int i = 0; i < board_obs->pts_2d_.size(); i++) {
float pt_x = board_obs->pts_2d_[i].x;
Copy link
Collaborator

@BAILOOL BAILOOL Sep 22, 2022

Choose a reason for hiding this comment

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

float pt_x -> const float& pt_x

@BAILOOL BAILOOL merged commit ac6e173 into master Sep 27, 2022
@BAILOOL BAILOOL deleted the feature/fisheye-calib-bugfix branch September 27, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants