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 MSVC compilation errors for mrcal_wrapper #11

Merged
merged 3 commits into from
Nov 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/mrcal_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CholmodCtx {
};
static CholmodCtx cctx;

#define BARF(args...) std::fprintf(stderr, ##args)
#define BARF(...) std::fprintf(stderr, __VA_ARGS__)

// forward declarations for functions borrowed from mrcal-pywrap
static mrcal_problem_selections_t construct_problem_selections(
Expand All @@ -54,11 +54,10 @@ bool lensmodel_one_validate_args(mrcal_lensmodel_t *mrcal_lensmodel,
std::vector<double> intrinsics,
bool do_check_layout);

// Empty vector just to pass in so it's not NULL?
mrcal_point3_t observations_point[0];
mrcal_pose_t
extrinsics_rt_fromref[0]; // Always zero for single camera, it seems?
mrcal_point3_t points[0]; // Seems to always to be None for single camera?
mrcal_point3_t* observations_point = nullptr;
mrcal_pose_t*
extrinsics_rt_fromref = nullptr; // Always zero for single camera, it seems?
mrcal_point3_t* points = nullptr; // Seems to always to be None for single camera?

static std::unique_ptr<mrcal_result> mrcal_calibrate(
// List, depth is ordered array observation[N frames, object_height,
Expand Down Expand Up @@ -119,8 +118,10 @@ static std::unique_ptr<mrcal_result> mrcal_calibrate(
auto c_observations_board = observations_board_data.data();
// Try to make sure we don't accidentally make a zero-length array or
// something stupid
mrcal_observation_point_t
c_observations_point[std::max(Nobservations_point, 1)];
std::vector<mrcal_observation_point_t>
observations_point_data(std::max(Nobservations_point, 1));
mrcal_observation_point_t*
c_observations_point = observations_point_data.data();

for (int i_observation = 0; i_observation < Nobservations_board;
i_observation++) {
Expand Down