1 #include "../lib/args.h" 2 #include "../lib/opencv.h" 3 #include "../lib/dataset.h" 4 #include "../lib/image_io.h" 5 #include "../lib/viewer.h" 6 #include "../lib/filesystem.h" 13 int main(
int argc,
const char* argv[]) {
14 get_args(argc, argv,
"dataset_parameters.json [dataset_group]");
22 viewer view(
"Dataset Viewer", sz,
true);
25 auto& depth_opacity_slider = view.
add_real_slider(
"depth op", 0.0, 0.0, 1.0);
30 view_index idx(slider_x.value(), slider_y.value());
31 if(! datas.
valid(idx))
return;
39 if(depth_opacity_slider == 1.0) {
40 cv::Mat_<ushort> depth_img =
load_depth(depth_filename);
42 view.
draw(cv::Point(0, 20), viz_depth_img);
43 }
else if(depth_opacity_slider == 0.0) {
45 view.
draw(cv::Point(0, 20), img);
48 cv::Mat_<ushort> depth_img =
load_depth(depth_filename);
50 cv::Mat_<cv::Vec3b> viz_depth_img_col;
51 cv::cvtColor(viz_depth_img, viz_depth_img_col, CV_GRAY2BGR);
52 cv::addWeighted(img, 1.0-depth_opacity_slider, viz_depth_img_col, depth_opacity_slider, 0.0, img);
53 view.
draw(cv::Point(0, 20), img);
55 }
catch(
const std::runtime_error&) {
56 std::cout <<
"could not load " << image_filename << std::endl;
real_slider & add_real_slider(const std::string &caption, real default_val, real min_val, real max_val, int steps=100)
cv::Size image_size_with_border() const
static cv::Mat_< uchar > visualize_depth(const cv::Mat &, float min_d, float max_d)
std::string image_filename() const
std::string encode_view_index(view_index idx)
int main(int argc, const char *argv[])
void draw(const cv::Mat_< cv::Vec3b > &, real blend=1.0)
cv::Mat_< ushort > load_depth(const std::string &filename)
dataset_view view(int x) const
cv::Mat_< cv::Vec3b > load_texture(const std::string &filename)
bool valid(view_index) const
std::string depth_filename() const
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)
void clear(int width, int height)
dataset_group group(const std::string &grp) const
std::function< void()> update_callback
std::string string_opt_arg(const std::string &def="")
void get_args(int argc, const char *argv[], const std::string &usage)