22. December 2008 09:23
One of my clients wanted a control that allows them to capture an image from either a hard-drive or a webcam using WPF. The first one isn't that hard, so I'll skip that one. The second is a bit thougher. When I searched the internet how to capture webcam images using WPF, I found this great blog entry by Tamir Khason.
One of the downsides of this control is that it displays the video rotated by 180 degrees using this Philips webcam. I also need a way to capture images when the user presses a button. I have made some small modifications to the CapPlayer class written by Tamir Khason. You can find the file attached to this blog, but below is a description of what I have added:
Added dependency property Rotation to CapPlayer
I have added a dependency property named Rotation. This code allows you to bind the rotation degree (in my case 180) for the video as well as the snapshots taken by using the CurrentBitmap property.
Added property CurrentBitmap to CapPlayer
I added a property named CurrentBitmap that retrieves the current bitmap in the video so it allows me to take snapshots.
Added Devices property to the CapDevice
Easily iterate through all the devices
Important update: this article has been updated into a new article.
WebcamPlayer.zip (13.89 kb) [Downloads: 4350]