mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-03 21:26:36 +00:00
aux/tracking: Adjust checkerboard corners for subpixel accuracy
This commit is contained in:
parent
ee3f54adb6
commit
6dcf69df83
src/xrt
|
@ -113,6 +113,9 @@ public:
|
|||
|
||||
} state;
|
||||
|
||||
bool subpixel_enable;
|
||||
bool subpixel_size;
|
||||
|
||||
bool clear_frame = false;
|
||||
|
||||
cv::Mat grey;
|
||||
|
@ -241,6 +244,16 @@ do_view(class Calibration &c,
|
|||
draw_rect(rgb, view.post_rect, cv::Scalar(0, 255, 0));
|
||||
}
|
||||
|
||||
if (found && c.subpixel_enable) {
|
||||
cv::TermCriteria tcrit(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30,
|
||||
0.1);
|
||||
|
||||
cv::Size size(c.subpixel_size, c.subpixel_size);
|
||||
cv::Size zero(-1, -1);
|
||||
|
||||
cv::cornerSubPix(grey, view.current, size, zero, tcrit);
|
||||
}
|
||||
|
||||
cv::drawChessboardCorners(rgb, c.chessboard_size, view.current, found);
|
||||
|
||||
return found;
|
||||
|
@ -557,12 +570,12 @@ t_calibration_stereo_create(struct xrt_frame_context *xfctx,
|
|||
struct xrt_frame_sink *gui,
|
||||
struct xrt_frame_sink **out_sink)
|
||||
{
|
||||
|
||||
auto &c = *(new Calibration());
|
||||
|
||||
c.gui.sink = gui;
|
||||
|
||||
c.base.push_frame = t_calibration_frame;
|
||||
c.subpixel_enable = params->subpixel_enable;
|
||||
c.subpixel_size = params->subpixel_size;
|
||||
|
||||
*out_sink = &c.base;
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ t_psvr_create(struct xrt_frame_context *xfctx,
|
|||
|
||||
#define T_CALIBRATION_DEFAULT_PARAMS \
|
||||
{ \
|
||||
9, 7, 0.025f, \
|
||||
9, 7, 0.025f, true, 5, \
|
||||
}
|
||||
|
||||
struct t_calibration_params
|
||||
|
@ -185,6 +185,9 @@ struct t_calibration_params
|
|||
int checker_cols_num;
|
||||
int checker_rows_num;
|
||||
float checker_size_meters;
|
||||
|
||||
bool subpixel_enable;
|
||||
int subpixel_size;
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -112,6 +112,8 @@ scene_render_select(struct gui_scene *scene, struct program *p)
|
|||
igInputInt("Checkerboard Rows", &cs->params.checker_rows_num, 1, 5, 0);
|
||||
igInputInt("Checkerboard Columns", &cs->params.checker_cols_num, 1, 5,
|
||||
0);
|
||||
igCheckbox("Subpixel", &cs->params.subpixel_enable);
|
||||
igInputInt("Subpixel Search Size", &cs->params.subpixel_size, 1, 5, 0);
|
||||
|
||||
static ImVec2 button_dims = {0, 0};
|
||||
bool pressed = igButton("Done", button_dims);
|
||||
|
|
Loading…
Reference in a new issue