1 #ifndef LICORNEA_VIEWER_H_ 2 #define LICORNEA_VIEWER_H_ 26 std::string window_name_;
27 std::vector<std::unique_ptr<slider_base>> sliders_;
28 cv::Mat_<cv::Vec3b> shown_image_;
29 bool running_modal_ =
false;
31 static std::string get_window_name_(
const std::string& title = std::string());
34 cv::Vec3b
black = cv::Vec3b(0, 0, 0);
35 cv::Vec3b
white = cv::Vec3b(255, 255, 255);
45 viewer(
const std::string& title, cv::Size sz,
bool resizeable =
false) :
48 viewer(cv::Size sz,
bool resizeable =
false) :
49 viewer(sz.width, sz.height, resizeable) { }
50 explicit viewer(
const std::string& title,
bool resizeable =
false);
63 void clear(
int width,
int height);
67 void draw(
const cv::Mat_<cv::Vec3b>&,
real blend = 1.0);
68 void draw(
const cv::Mat_<uchar>&,
real blend = 1.0);
70 void draw(cv::Rect rect,
const cv::Mat_<cv::Vec3b>& img,
real blend = 1.0);
71 void draw(cv::Point pt,
const cv::Mat_<cv::Vec3b>& img,
real blend = 1.0)
72 {
draw(cv::Rect(pt, img.size()), img, blend); }
74 void draw(cv::Rect rect,
const cv::Mat_<uchar>& img,
real blend = 1.0);
75 void draw(cv::Point pt,
const cv::Mat_<uchar>& img,
real blend = 1.0)
76 {
draw(cv::Rect(pt, img.size()), img, blend); }
78 void draw_depth(cv::Rect rect,
const cv::Mat_<float>& depth_img,
float min_d,
float max_d,
real blend = 1.0);
79 void draw_depth(cv::Point pt,
const cv::Mat_<float>& depth_img,
float min_d,
float max_d,
real blend = 1.0)
80 {
draw_depth(cv::Rect(pt, depth_img.size()), depth_img, min_d, max_d, blend); }
87 bool show(
int& keycode);
94 static cv::Mat_<uchar>
visualize_depth(
const cv::Mat&,
float min_d,
float max_d);
95 static cv::Mat_<uchar>
visualize_ir(
const cv::Mat&,
float min_ir,
float max_ir);
118 int_slider(
int value_,
int min_,
int max_,
int step_);
120 int slider_max()
const;
123 void set_value(
int val);
125 operator int ()
const {
return value(); }
137 int slider_max()
const;
140 void set_value(
real val);
142 operator real ()
const {
return value(); }
real_slider & add_real_slider(const std::string &caption, real default_val, real min_val, real max_val, int steps=100)
viewer & operator=(const viewer &)=delete
std::function< void(int keycode)> key_callback
viewer(cv::Size sz, bool resizeable=false)
static cv::Mat_< uchar > visualize_depth(const cv::Mat &, float min_d, float max_d)
void draw_2d_cross_indicator(cv::Rect rect, real value_x, real value_y, real max_abs_value)
void draw(const cv::Mat_< cv::Vec3b > &, real blend=1.0)
std::function< void(int event, int x, int y)> mouse_callback
cv::Vec3b indicator_color
cv::Vec3b background_color
viewer(const std::string &title, cv::Size sz, bool resizeable=false)
void draw_depth(cv::Point pt, const cv::Mat_< float > &depth_img, float min_d, float max_d, real blend=1.0)
void draw(cv::Point pt, const cv::Mat_< cv::Vec3b > &img, real blend=1.0)
void draw_depth(cv::Rect rect, const cv::Mat_< float > &depth_img, float min_d, float max_d, real blend=1.0)
void draw(cv::Point pt, const cv::Mat_< uchar > &img, real blend=1.0)
void draw_2d_arrow_indicator(cv::Rect rect, real value_x, real value_y, real max_value)
viewer(const std::string &title, int width, int height, bool resizeable=false)
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)
static cv::Mat_< uchar > visualize_ir(const cv::Mat &, float min_ir, float max_ir)
std::function< void()> update_callback