File: drawingHelpers.cpp

package info (click to toggle)
visp 3.7.0-7
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 166,380 kB
  • sloc: cpp: 392,705; ansic: 224,448; xml: 23,444; python: 13,701; java: 4,792; sh: 206; objc: 145; makefile: 118
file content (43 lines) | stat: -rw-r--r-- 1,300 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "drawingHelpers.h"

#include <visp3/core/vpImageConvert.h>

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

bool drawingHelpers::display(vpImage< vpRGBa> &I, const std::string &title, const bool &blockingMode)
{
  vpDisplay::display(I);
  vpDisplay::setTitle(I, title);
  vpDisplay::displayText(I, 15, 15, "Left click to continue...", vpColor::red);
  vpDisplay::displayText(I, 35, 15, "Right click to stop...", vpColor::red);
  vpDisplay::flush(I);
  vpMouseButton::vpMouseButtonType button;
  vpDisplay::getClick(I, button, blockingMode);
  bool hasToContinue = true;
  if (button == vpMouseButton::button3) {
    // Right click => stop the program
    hasToContinue = false;
  }

  return hasToContinue;
}

bool drawingHelpers::display(vpImage<unsigned char> &D, vpImage<vpRGBa> &Idisp, const std::string &title, const bool &blockingMode)
{
  vpImageConvert::convert(D, Idisp);
  return display(Idisp, title, blockingMode);
}

bool drawingHelpers::display(vpImage<double> &D, vpImage<vpRGBa> &Idisp, const std::string &title, const bool &blockingMode)
{
  vpImage<unsigned char> I; // Image to display
  vpImageConvert::convert(D, I);
  vpImageConvert::convert(I, Idisp);
  return display(Idisp, title, blockingMode);
}

#endif