Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
tutorial-image-viewer.cpp
1
2
#include <visp3/core/vpConfig.h>
3
#include <visp3/core/vpImagePoint.h>
4
#include <visp3/gui/vpDisplayGDI.h>
5
#include <visp3/gui/vpDisplayOpenCV.h>
6
#include <visp3/gui/vpDisplayX.h>
7
#include <visp3/io/vpImageIo.h>
8
9
int
main()
10
{
11
#ifdef ENABLE_VISP_NAMESPACE
12
using namespace
VISP_NAMESPACE_NAME
;
13
#endif
14
15
try
{
16
vpImage<vpRGBa>
I;
17
vpImageIo::read
(I,
"monkey.ppm"
);
18
19
#if defined(VISP_HAVE_X11)
20
vpDisplayX
d
(I);
21
#elif defined(VISP_HAVE_GDI)
22
vpDisplayGDI
d
(I);
23
#elif defined(HAVE_OPENCV_HIGHGUI)
24
vpDisplayOpenCV
d
(I);
25
#else
26
std::cout <<
"No image viewer is available..."
<< std::endl;
27
#endif
28
vpDisplay::setTitle
(I,
"Monkey"
);
29
vpDisplay::display
(I);
30
31
vpDisplay::displayRectangle
(I,
vpImagePoint
(90, 90), 70, 90,
vpColor::red
,
false
, 2);
32
vpDisplay::flush
(I);
33
34
vpImage<vpRGBa>
O;
35
vpDisplay::getImage
(I, O);
36
37
try
{
38
vpImageIo::write
(I,
"monkey-out.jpg"
);
39
vpImageIo::write
(O,
"monkey-out-with-overlay.jpg"
);
40
}
41
catch
(...) {
42
std::cout <<
"Cannot write the image: unsupported format..."
<< std::endl;
43
}
44
45
vpDisplay::getClick
(I);
46
}
47
catch
(
const
vpException
&e) {
48
std::cout <<
"Catch an exception: "
<<
e
<< std::endl;
49
}
50
}
vpColor::red
static const vpColor red
Definition
vpColor.h:198
vpDisplayGDI
Display for windows using GDI (available on any windows 32 platform).
Definition
vpDisplayGDI.h:130
vpDisplayOpenCV
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Definition
vpDisplayOpenCV.h:139
vpDisplayX
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition
vpDisplayX.h:135
vpDisplay::getClick
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Definition
vpDisplay_uchar.cpp:894
vpDisplay::display
static void display(const vpImage< unsigned char > &I)
Definition
vpDisplay_uchar.cpp:869
vpDisplay::getImage
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
Definition
vpDisplay.cpp:139
vpDisplay::setTitle
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
Definition
vpDisplay_uchar.cpp:1364
vpDisplay::flush
static void flush(const vpImage< unsigned char > &I)
Definition
vpDisplay_uchar.cpp:845
vpDisplay::displayRectangle
static void displayRectangle(const vpImage< unsigned char > &I, const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)
Definition
vpDisplay_uchar.cpp:665
vpException
error that can be emitted by ViSP classes.
Definition
vpException.h:60
vpImageIo::read
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Definition
vpImageIo.cpp:116
vpImageIo::write
static void write(const vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Definition
vpImageIo.cpp:336
vpImagePoint
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition
vpImagePoint.h:82
vpImage
Definition of the vpImage class member functions.
Definition
vpImage.h:131
VISP_NAMESPACE_NAME
Definition
vpEigenConversion.h:44
ibvs-four-points.e
e
Definition
ibvs-four-points.py:272
yolo-centering-task-afma6.d
d
Definition
yolo-centering-task-afma6.py:273
tutorial
image
tutorial-image-viewer.cpp
Generated by
1.17.0