title: OpenCv C++ record video when motion detected from cam
body: <p>I am attempting to use a straightforward motion detection code to detect movement from a camera. I'm using the OpenCV library and I have some code that takes the difference between two frames to detect a change.</p>
  
  <p>I have the difference frame working just fine and it's black when no motion is present.</p>
  
  <p>The problem is how now i can detect that blackness to stop recording or no darkness to begin recording frames.</p>
  
  <p>Thank u all.</p>