In the preceding section, we set up the UI of our application. In this section, we will play the video feed that's provided by a camera from a personal computer.
Before accessing a camera, we should find out some information about it—if we use OpenCV, we need the index of the camera that we want to capture a video from; if we use Qt, we need the device name of it. For a typical laptop, it usually has one default built-in webcam whose index is 0, but its name is platform or environment dependent. If we have multiple webcams for a computer, usually both of their indices and names are platform or environment dependent. To determine this information, we can turn to the QCameraInfo class from the Qt library.