title: Opencv writing and reading from a buffer
body: <p>I have two tasks (Threads) each task runs on a different processor(core), the first capture an image repeatedly using OpenCV <code>videocapture()</code>.</p>
  
  <p>I only used these two lines for the capture :</p>
  
  <pre><code>cv::Mat frame;
  capture.read(frame);
  </code></pre>
  
  <p>Now I want to display the captured image using the second task. After executing the <code>imshow</code> function within the second task's code :</p>
  
  <pre><code>cv::imshow("Display window", frame);
  </code></pre>
  
  <p>I got the following output error : </p>
  
  <pre><code>OpenCV Error: Assertion failed (size.width&gt;0 &amp;&amp; size.height&gt;0) in imshow, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp, line 304
  terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp:304: error: (-215) size.width&gt;0 &amp;&amp; size.height&gt;0 in function imshow
  </code></pre>
  
  <p>So, how can I avoid this error?</p>
  
  <p>The complete code is hosted at <a href="https://github.com/sendjasni/ReVC_opencv/blob/master/re_task.cpp" rel="nofollow noreferrer">Github</a>  </p>