1 #include <visp3/gui/vpDisplayGDI.h>
3 #include <visp3/gui/vpDisplayOpenCV.h>
4 #include <visp3/gui/vpDisplayX.h>
6 #include <visp3/detection/vpDetectorFace.h>
8 #include <visp3/io/vpVideoReader.h>
10 int main(
int argc,
const char* argv[])
13 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020200)
17 std::string opt_face_cascade_name =
"./haarcascade_frontalface_alt.xml";
18 std::string opt_video =
"video.mpeg";
21 for (
int i=0; i<argc; i++) {
22 if (std::string(argv[i]) ==
"--haar")
23 opt_face_cascade_name = std::string(argv[i+1]);
24 else if (std::string(argv[i]) ==
"--video")
25 opt_video = std::string(argv[i+1]);
26 else if (std::string(argv[i]) ==
"--help") {
27 std::cout <<
"Usage: " << argv[0] <<
" [--haar <haarcascade xml filename>] [--video <input video file>] [--help]" << std::endl;
38 #if defined(VISP_HAVE_X11)
40 #elif defined(VISP_HAVE_GDI)
42 #elif defined(VISP_HAVE_OPENCV)
54 bool exit_requested =
false;
55 while( ! g.
end() && ! exit_requested) {
60 bool face_found = face_detector.
detect(I);
64 std::ostringstream text;
66 text <<
"Found " << face_detector.
getNbObjects() <<
" face(s)";
71 std::vector<vpImagePoint> p = face_detector.
getPolygon(i);
82 exit_requested =
true;
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
void setCascadeClassifierFile(const std::string &filename)
Display for windows using GDI (available on any windows 32 platform).
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
error that can be emited by ViSP classes.
size_t getNbObjects() const
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
void open(vpImage< vpRGBa > &I)
bool detect(const vpImage< unsigned char > &I)
std::vector< std::vector< vpImagePoint > > & getPolygon()
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
void acquire(vpImage< vpRGBa > &I)
const char * getMessage(void) const
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)
void setFileName(const char *filename)
std::string & getMessage(size_t i)
unsigned int getHeight() const
Defines a rectangle in the plane.
vpRect getBBox(size_t i) const
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)