1 #include <visp3/core/vpConfig.h>
3 #include <visp3/gui/vpDisplayFactory.h>
5 #include <visp3/core/vpTime.h>
6 #include <visp3/io/vpVideoReader.h>
15 int main(
int argc,
char **argv)
17 #if defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_HIGHGUI) && defined(HAVE_OPENCV_VIDEOIO)
18 #ifdef ENABLE_VISP_NAMESPACE
22 std::string videoname =
"video.mp4";
24 for (
int i = 0; i < argc; i++) {
25 if (std::string(argv[i]) ==
"--name")
26 videoname = std::string(argv[i + 1]);
27 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
28 std::cout <<
"\nUsage: " << argv[0] <<
" [--name <video name> (default: " << videoname <<
")]"
45 std::cout <<
"Video name : " << videoname << std::endl;
46 std::cout <<
"Video framerate: " << g.
getFramerate() <<
"Hz" << std::endl;
47 std::cout <<
"Video dimension: " << I.
getWidth() <<
" " << I.
getHeight() << std::endl;
49 #ifdef VISP_HAVE_DISPLAY
52 std::cout <<
"No image viewer is available..." << std::endl;
59 while ((!g.
end()) && (!quit)) {
70 ss <<
"Frame: " << ++cpt;
71 std::cout <<
"Read " << ss.str() << std::endl;
82 std::cout <<
"End of video was reached" << std::endl;
84 #ifdef VISP_HAVE_DISPLAY
94 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.
const char * getMessage() const
unsigned int getWidth() const
unsigned int getHeight() const
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
void acquire(vpImage< vpRGBa > &I)
void open(vpImage< vpRGBa > &I)
void setFileName(const std::string &filename)
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.
VISP_EXPORT int wait(double t0, double t)
VISP_EXPORT double measureTimeMs()