title: Multithreading an OpenCV Program
body: <p>Thanks for reading my post. </p>
  
  <p>I have a problem with multithreading an opencv application I was hoping you guys could help me out with. </p>
  
  <p>My aim is to Save 400 frames (in jpeg) from the middle of a video sequence for further examination.</p>
  
  <p>I have the code running fine single threaded, but the multithreading is causing quite a lot of issues so I’m wondering if I have got the philosophy all wrong. </p>
  
  <p>In terms of a schematic of what I should do, would I be best to:</p>
  
  <p>Option 1 : somehow simultaneously access the single video file (or make copies?), then with individual threads cycling through the video frame by frame,  save each frame when it is between predetermined limits? E.g. thread 1 saves frames 50 to 100, thread 2 saves frames 101 to 150 etc.</p>
  
  <p>Option 2 : open the file once, cycle through frame by frame then pass an individual frame to a series of unique threads to carry out a saving operation. E.g. frame 1 passed to thread 1 for saving, frame 2 to thread 2 for saving, frame 3 to thread 1,   frame 4 to thread 2 etc etc. </p>
  
  <p>Option 3 : some other buffer/thread arrangement which is a better idea than the above! </p>
  
  <p>I'm using visual C++ with the standard libs.</p>
  
  <p>Many thanks for your help on this, </p>
  
  <p>Cheers, Kay</p>