title: Detect frame drop in OpenCV
body: <p>How can I detect a dropped frame in OpenCV?  Right now I am doing a check like the following:</p>
  
  <pre><code>int main() {
       VideoCapture cap(-1); 
       if (!cap.isOpened()) {
           cout &lt;&lt; "Webcam is not open." &lt;&lt; endl;
           return -1;
       }
  
       Mat frame;
  
       while (true) {
           cap.read(frame);
  
           if (!frame.empty()) {
               imshow("frame", frame);
           }
           else {
               cout &lt;&lt; "No captured frame" &lt;&lt; endl;
               break;
           }
       }
  }
  </code></pre>
  
  <p>But I still get messages saying "Camera frame dropped!" without my "No captured frame" message.  What conditions result in the camera frame being dropped/how can I check for those conditions?</p>