5 #include <visp3/core/vpConfig.h>
7 #include <visp3/gui/vpDisplayD3D.h>
8 #include <visp3/gui/vpDisplayGDI.h>
9 #include <visp3/gui/vpDisplayGTK.h>
10 #include <visp3/gui/vpDisplayOpenCV.h>
11 #include <visp3/gui/vpDisplayX.h>
13 #include <visp3/core/vpColor.h>
16 #include <visp3/core/vpMunkres.h>
19 #include <visp3/core/vpUniRand.h>
24 #if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
26 #if defined(VISP_HAVE_DISPLAY)
27 #ifdef ENABLE_VISP_NAMESPACE
36 std::vector<vpImagePoint> rand_ips {};
37 while (rand_ips.size() < 10) {
38 rand_ips.emplace_back(rand.uniform(10, I.
getHeight() - 10), rand.uniform(10, I.
getWidth() - 10));
45 #if defined(VISP_HAVE_X11)
46 vpDisplayX d(I, disp_scale_type);
47 #elif defined(VISP_HAVE_GDI)
49 #elif defined(HAVE_OPENCV_HIGHGUI)
51 #elif defined(VISP_HAVE_GTK)
53 #elif defined(VISP_HAVE_D3D9)
56 std::cout <<
"No image viewer is available..." << std::endl;
72 std::for_each(begin(rand_ips), end(rand_ips), std::bind(display_point, std::placeholders::_1,
vpColor::red));
77 std::vector<vpImagePoint> user_ips {};
83 user_ips.push_back(ip);
89 std::for_each(begin(user_ips), end(user_ips), std::bind(display_point, std::placeholders::_1,
vpColor::green));
97 std::vector<std::vector<double> > cost_matrix(rand_ips.size(), std::vector<double>(user_ips.size()));
98 for (
auto i = 0u; i < rand_ips.size(); i++) {
99 for (
auto j = 0u; j < user_ips.size(); j++) {
107 std::for_each(begin(rand_ips), end(rand_ips), std::bind(display_point, std::placeholders::_1,
vpColor::red));
108 std::for_each(begin(user_ips), end(user_ips), std::bind(display_point, std::placeholders::_1,
vpColor::green));
111 for (
const auto &[i, j] : vpMunkres::run(cost_matrix)) {
122 std::cout <<
"Catch an exception: " << e << std::endl;
Class to define RGB colors available for display functionalities.
static const vpColor blue
static const vpColor black
static const vpColor green
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed....
Display for windows using GDI (available on any windows 32 platform).
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void displayCircle(const vpImage< unsigned char > &I, const vpImageCircle &circle, const vpColor &color, bool fill=false, unsigned int thickness=1)
static void display(const vpImage< unsigned char > &I)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
error that can be emitted by ViSP classes.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static double distance(const vpImagePoint &iP1, const vpImagePoint &iP2)
unsigned int getWidth() const
unsigned int getHeight() const
Class for generating random numbers with uniform probability density.