Telerik blogs
DotNetT Light_870x220

The WebCam component is here for WPF and WinForms and there's a lot it can do. In this post, we'll take a closer look at it.

Our R3 2019 release is out, and with it RadWebCam is out of beta for WPF and makes its debut in the WinForms suite. Now you can give your users the ability to view a video feed, take and save pictures and video directly from your WPF or WinForms application. You can read more about everything that's new in the respective release blogs for Telerik UI for WPF and Telerik UI for WinForms.

For the moment lets focus on the new WebCam control. To get started all you need is a webcam plugged into your computer or an integrated one. Drop the RadWebCam component on your Window or Form and start the project. It’s that simple! RadWebCam will find the webcam and use the video stream with the highest quality to start streaming.

webcam

Whether you are building software for a gym subscription, or for surveillance, access control, a photo booth, machine learning or anything else, you can rely on RadWebCam. We did our best to try and abstract away all the complex internals involved in displaying a video stream from a camera inside a WPF/WinForms component. Nevertheless, flexibility and customization are in our DNA and we stayed true to that. There are a number of customizations you can perform to ensure RadWebCam fits your case as precisely as you need it to. The rich API is designed around ease of use and maximum control for the developer.

WebCam Extensive API

Say Cheese! Taking Snapshots

Taking snapshots of what is currently displayed by the camera is as simple as pressing a button, calling a method or executing a command in the case of WPF applications. You also have the choice of showing a preview of the snapshot taken or directly processing it further. To choose whether to show a preview or not, you can use the PreviewSnapshots property. Once you’ve decided, you have to handle the SnapshotTaken event where you get access to the actual image. What you do with it is entirely up to you: save it, send it, edit it, run it through your neural network, anything you fancy.

webcam taking snapshots

And… Action! Recording Video

If a picture can say a thousand words, imagine what 30 of them per second in HD resolution can do. You can use RadWebCam to record video from your camera just as easily as taking snapshots. You have a readily available button inside the camera UI, a command in the WPF case and a method you can call. To set up things you should set the RecordingFilePath property and you are ready to roll. You also have the RecordingStarted and RecordingEnded events to let you act immediately before or after a video recording. Sound is ON as long as you need it. You can choose whether to add audio to your video recordings by initializing RadWebCam with or without an audio recording device.

WebCam Video Recording

You are the Director: Choosing Devices and Formats

Sometimes you have several cameras and microphones available and you need a means to choose between them. Even when you have a single camera you might want to use different frame sizes or frame rates. We've got you covered here as well. You can use the available API to iterate over the devices and their formats available on the given machine.

var mics = RadWebCam.GetAudioCaptureDevices();
var cameras = RadWebCam.GetVideoCaptureDevices();
var videoFormats = RadWebCam.GetVideoFormats(cameras[0]);

WebCam Devices

On top of the devices and formats you can allow your users to further fine tune their camera with the built-in settings control. With it they can adjust all the settings their webcam supports like Brightness, White Balance, Saturation etc.

WebCam Settings Dialog

Swapping Lenses: Localization, Styling and Touch

RadWebCam has you covered no matter what the language of choice is for your customers and how they prefer to interact with your application. Mouse, keyboard or touch, RadWebCam supports it all. You can tailor fit the UI through the visibility properties available for the individual buttons in the toolbar as well as the whole toolbar itself. You can also choose from a plethora of readily available themes we provide with our UI suites.

webcam localizationWebCam Styling and AppearanceWebCam Touch Support

Take #1859: Error Handling

Sometimes things do not work out as initially planned or fall midway. There are a number of ways your webcam can stop working or not work at all. These include when another application is using the camera and it is busy. Access to cameras can be forbidden in the Windows settings or the camera can be unplugged for whatever reason, even mid-session. In any of these cases RadWebCam will handle the case and display a message. You can also handle the CameraError event and add your input into the error handling process.

Get Started Today

RadWebCam for WinForms and WPF is out now, grab your webcam and get creative or unleash your customers’ potential and see what they can create with this powerful tool. Download the latest version of your favorite Telerik UI suite from the Your Account area of our website. If you are a new to the Telerik UI suites, download a free trial.


About the Author

Ivan Petrov

Ivan Petrov was a Senior Software Developer working at the Telerik WinForms DevLabs.

Related Posts

Comments

Comments are disabled in preview mode.