I have a PS3 Eye webcam capable of delivering frames up to 120 times a second based on the resolution.
I need to do some processing on each frame, and currently that takes up quite a lot of time. The webcam is set to 60 fps, that leaves around 16 ms of processing time per frame, but due to the processing bottleneck, i am only able to retrieve around 30 frames a second.
Behind the scenes a while loop retrieves the bitmap data from the camera, and sets a bitmap property, and notifies that a new frame has been retrieved, so the images wont stack up if processing takes too long.
I am thinking i should be able to somehow use threading to make the processing "faster".
Perhaps like this
Do you guys think threading, perhaps by using the Task Parallel library will improve performance?
Thanks in advance!
Your idea should work. Theoretically you should now be able to "double time" and get to the desired 60FPS.
One problem:
Whoops, now what, both are busy. So you might want to have a 3rd thread to act like a "server" which fetches the images, queues and serves them to you "worker" threads.