2#include <visp3/core/vpConfig.h>
3#include <visp3/gui/vpDisplayFactory.h>
5#include <visp3/core/vpTime.h>
6#include <visp3/io/vpVideoReader.h>
15int main(
int argc,
char **argv)
17#if defined(VISP_HAVE_OPENCV) && \
18 (((VISP_HAVE_OPENCV_VERSION < 0x030000) && defined(HAVE_OPENCV_HIGHGUI)) || \
19 ((VISP_HAVE_OPENCV_VERSION >= 0x030000) && defined(HAVE_OPENCV_VIDEOIO)))
20#ifdef ENABLE_VISP_NAMESPACE
24 std::string videoname =
"video.mp4";
26 for (
int i = 1;
i < argc;
i++) {
27 if (std::string(argv[i]) ==
"--name" && i + 1 < argc) {
28 videoname = std::string(argv[++i]);
30 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
31 std::cout <<
"\nUsage: " << argv[0]
32 <<
" [--name <video name> (default: " << videoname <<
")]"
49 std::cout <<
"Video name : " << videoname << std::endl;
50 std::cout <<
"Video framerate: " << g.
getFramerate() <<
"Hz" << std::endl;
51 std::cout <<
"Video dimension: " << I.getWidth() <<
" " << I.getHeight() << std::endl;
53#ifdef VISP_HAVE_DISPLAY
56 std::cout <<
"No image viewer is available..." << std::endl;
63 while ((!g.
end()) && (!quit)) {
74 ss <<
"Frame: " << ++cpt;
75 std::cout <<
"Read " << ss.str() << std::endl;
86 std::cout <<
"End of video was reached" << std::endl;
88#ifdef VISP_HAVE_DISPLAY
93 std::cout <<
e.getMessage() << std::endl;
98 std::cout <<
"Install OpenCV and rebuild ViSP to use this example." << std::endl;
Class that defines generic functionalities for display.
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
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.
Definition of the vpImage class member functions.
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
void open(vpImage< vpRGBa > &I) VP_OVERRIDE
void setFileName(const std::string &filename)
void acquire(vpImage< vpRGBa > &I) VP_OVERRIDE
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.
VISP_EXPORT double measureTimeMs()
VISP_EXPORT int wait(double t0, double t)