1 #include "../lib/common.h" 2 #include "../lib/args.h" 3 #include "../lib/opencv.h" 4 #include "../lib/json.h" 5 #include "../lib/intrinsics.h" 6 #include "../lib/misc.h" 7 #include "../lib/viewer.h" 24 int main(
int argc,
const char* argv[]) {
25 get_args(argc, argv,
"reprojection.json [densify_mode=fast]");
29 std::cout <<
"loading reprojection parameters" << std::endl;
35 viewer view(754+754, 424+30);
38 auto& diff_range = view.
add_int_slider(
"difference range", 100, 0, 500);
39 auto& superimpose = view.
add_int_slider(
"superimpose (%)", 0, 0, 100);
44 cv::Mat_<real> reprojected_depth;
56 for(
auto& samp : samples) samp.color_depth = samp.ir_depth;
58 for(
auto& samp : samples) samp.color_depth = samp.ir_depth - samp.color_depth;
60 densifier->densify(samples, reprojected_depth);
62 view.
draw(cv::Rect(0, 0, 754, 424), color);
63 cv::Rect depth_rect(754, 0, 754, 424);
65 else view.
draw_depth(depth_rect, reprojected_depth, min_d.value(), max_d.value());
66 if(superimpose.value() > 0) {
67 float blend = superimpose.value() / 100.0;
68 view.
draw(depth_rect, color, blend);
73 cv::Vec3b selected_mode_color(0, 255, 200);
74 auto col = [&](
depth_mode md) {
return (md == used_depth_mode ? selected_mode_color : view.
text_color); };
84 running = view.
show(keycode);
std::unique_ptr< depth_densify_base > make_depth_densify(const std::string &method)
cv::Mat_< cv::Vec3b > get_color_frame()
kinect_reprojection_parameters decode_kinect_reprojection_parameters(const json &j_parameters)
std::string in_filename_arg()
void draw(const cv::Mat_< cv::Vec3b > &, real blend=1.0)
int main(int argc, const char *argv[])
cv::Mat_< float > get_depth_frame(bool undistorted=false)
void draw_depth(cv::Rect rect, const cv::Mat_< float > &depth_img, float min_d, float max_d, real blend=1.0)
void draw_text(cv::Rect rect, const std::string &text, text_alignment=left)
int_slider & add_int_slider(const std::string &caption, int default_val, int min_val, int max_val, int step=1)
std::vector< sample< Value > > reproject_ir_to_color_samples(const cv::Mat_< Value > &distorted_ir_values, const cv::Mat_< Depth > &distorted_ir_z, bool distort_color=true) const
void clear(int width, int height)
json import_json_file(const std::string &filename)
std::string string_opt_arg(const std::string &def="")
void get_args(int argc, const char *argv[], const std::string &usage)