Skip to content
Snippets Groups Projects
Commit cf9b2961 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Add simple img show to display

parent cfef444a
No related branches found
No related tags found
No related merge requests found
Pipeline #10495 failed
...@@ -17,6 +17,11 @@ namespace ftl { ...@@ -17,6 +17,11 @@ namespace ftl {
* Multiple local display options for disparity or point clouds. * Multiple local display options for disparity or point clouds.
*/ */
class Display { class Display {
public:
enum style_t {
STYLE_NORMAL, STYLE_DISPARITY, STYLE_DEPTH
};
public: public:
explicit Display(nlohmann::json &config); explicit Display(nlohmann::json &config);
~Display(); ~Display();
...@@ -25,6 +30,8 @@ class Display { ...@@ -25,6 +30,8 @@ class Display {
bool render(const cv::Mat &rgb, const cv::Mat &depth); bool render(const cv::Mat &rgb, const cv::Mat &depth);
bool render(const cv::Mat &img, style_t s=STYLE_NORMAL);
bool active() const; bool active() const;
void wait(int ms); void wait(int ms);
......
...@@ -84,6 +84,27 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) { ...@@ -84,6 +84,27 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) {
return true; return true;
} }
bool Display::render(const cv::Mat &img, style_t s) {
if (s == STYLE_NORMAL) {
cv::imshow("Image", img);
} else if (s = STYLE_DISPARITY) {
Mat idepth;
if ((bool)config_["flip_vert"]) {
cv::flip(img, idepth, 0);
} else {
idepth = img;
}
idepth.convertTo(idepth, CV_8U, 255.0f / 256.0f);
applyColorMap(idepth, idepth, cv::COLORMAP_JET);
cv::imshow("Disparity", idepth);
}
return true;
}
void Display::wait(int ms) { void Display::wait(int ms) {
if (config_["points"] && q_.rows != 0) { if (config_["points"] && q_.rows != 0) {
#if defined HAVE_VIZ #if defined HAVE_VIZ
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment