March 2019
Intermediate to advanced
538 pages
13h 38m
English
In the Startup mode, we just need to load the XML detector files to detect the face and eyes and initialize the webcam, which we've already covered. Let's also create a main GUI window with a mouse callback function that OpenCV will call whenever the user moves or clicks their mouse in our window. It may also be desirable to set the camera resolution to something reasonable; for example, 640 x 480, if the camera supports it. This is done as follows:
// Create a GUI window for display on the screen. namedWindow(windowName); // Call "onMouse()" when the user clicks in the window. setMouseCallback(windowName, onMouse, 0); // Set the camera resolution. Only works for some systems. videoCapture.set(CAP_PROP_FRAME_WIDTH, 640); ...