title: C# - Multithreaded Processing of a single Image (Webcam Frames)
body: <p>I have made a programm which is able to capture webcam frames and display them after running different per pixel algorithms - for example making the image gray scale.
  At the moment I am using the FastBitmap class (can't find the link atm) which uses pointers to set and get a pixel within a bitmap.</p>
  
  <p>However, I wanted to make my programm multithreaded so that multiple threads are working on the same image. For that I split the image into several sections via its BitmapData (one section per thread) and let the different threads work on their given section BitmapData. In the end a "manager" waits until all threads are done (join) and hands in the resulting image.
  That's the theory, but in real this isn't working for me.</p>
  
  <p>When I run this programm I get some strange errors, telling me that I have to release the LHC before reusing it, that I am accessing illegal memory, external exceptions etc. ... Everytime another and I can't understand why but I think the BitmapData sections are the main problem but I don't want to use the slower Mashal copy!</p>
  
  <p>So my questions are the following:</p>
  
  <ul>
  <li>Is it possible to have sectioned multithreaded image processing in C# with unsafe pointer methods?</li>
  <li>If yes - how?</li>
  </ul>
  
  <p>As for image processing libraries:
  I don't need filters or some default image processing algorithms but I need my own "per pixel" algorithm - I even thought about adding a pixel shader to my program. xD</p>
  
  <p>As my programm is based around the converting of frames of a webcam I need the fastest algorithm possible.
  I've read all forum posts and tutorials etc. which I could just find and still have no idea how to do this with unsafe code correctly until I've made this account to finally ask this question here.</p>
  
  <p>Robbepop</p>