Video tutorial on how to create a basic camera viewer in C#
This video demonstrates how you can build an own basic camera viewer application in C#. You will see how you can download the Ozeki Camera SDK from the official website. Then how you can integrate the SDK in a Visual Studio solution as a reference. After this video you will know how you can display the image of the USB and IP camera. This is the basic application, which we will use in the following videos.
|Download source code:||Basic_CameraViewer_3.zip|
DISCLAIMER: Please note that the following features will only work if your IP camera supports the given functionality. So please check the user manual of your IP camera to make sure it supports the feature that you wish to implement in C#.
Welcome to the Ozeki Camera SDK video guide tutorial part three. In this chapter We will create a simple project to connect USB camera and IP camera and display the camera image.
This is the 3. video guide from our C# .NET camera tutorial series, in which we present how to use Ozeki Camera SDK to develop different kind of camera solutions.
This SDK is:
- ONVIF compliant
- Easy to use
Whether you're a beginner or an experienced C# developer you will certainly be able to implement the solutions presented in these tutorial videos, if you use this Camera SDK. This is gonna be a great video series. They contain short and practical code explanations.
This video will be exciting and fun. I hope you will enjoy it.
In this video the main steps are the following:
- First step - Download the sdk from the website
- Second step - Create WPF solution in Visual Studio
- Third step - Implementing the camera viewer application
- and finally the Fourth step - Check the result and we try out our application
And lets start now with the step one.
Before we start developing we will need the Ozeki Camera SDK. You can download it on the www.camera-sdk.com. You need registrate yourself, which means that you must add a name, email address and a reason why you need this SDK. After that you will get the downloading link. The installation is simple, but if you are not sure you can find a description on the Quick Start section of on our website.
First, we have to create a new WPF solution. Click on the New Project and choose the WPF project and give it a name. Click on the OK button. When the project is opened, we have to add the OzekiSDK.dll and the System.Drawing.dll as a reference. When you find the file click on the OK button. We can see them in the reference list.
We will need some control to handle our project. We need 2 groupbox controls, to separate USB the camera and the IP camera. The USB camera groupbox has 2 button to connect and disconnect to camera.
Moreover, the IP camera groupbox has a little bit more control. Need 3 textboxes for authentication. We have to give the current IP address, and username and password if it is required and necessary 2 buttons to connect and disconnect to camera.
Furthermore, we will create a CameraViewer in the CameraBox control. Finally, we create one more groupbox, for the new features that we will implement in the following tutorials. When the controls are ready, I create the buttons click event. And I resize our application.
We have to add 4 namespaces:
- and Ozeki.Media.Video.Controls
We need some variables to handle our application. We initialize the MediaConnector and the bitmapsourceprovider in the main constructor. After that we create and set the cameraviewer control and add it to the grid called Camerabox and we have to set the bitmapsourceprovider instance to the videoviewer control.
Finally, we have to write the connect and the disconnect buttons. We will get the default device to our webcamera instance and start the viewer and connect our webcamera to the mediaconnector. In the disconnect_usb_camera_click event, we stop the viewer and the webcamera. These were the webcamera start and stop methods.
Now we implement the connect and the disconnect buttons for the ipcamera. We have to know what is the correct ip adress of the camera. We probably need username and password for the connection. Based on the given data we connect to the selected IP camera. and start the viewer and the ipcamera in the connect button click event. In the disconnect_ip_camera_click event, we stop the viewer and the ipcamera. These were the IP camera connect and disconnect methods.
Now we are ready, let's try out our application. First, i start the default webcamera. "Ohh its me. " Works well and i stop now and i try to connect one IP camera. I have to give the correct detailed information and the camera image is appeared. Works well. This is an easy way to create a camera viewer, and we can view the camera image, from USB camera, or RTSP camera, or standard ONVIF IP camera.
I hope you enjoyed the video.
If you liked this video and you want to learn more about further great solutions provided by Ozeki Camera SDK, then download the trial version from our website www.camera-sdk.com and follow our tutorial videos. For more information check out our website, and if you have any questions, send us an email to email@example.com.
In the next chapter David will build a snapshot application, that can be used to take a picture from camera image. It is gonna be exciting. If you liked this video subscribe to our youtube channel. See you in the next video. Bye.
- Video tutorial on what is ONVIF and what is ONVIF camera
- Video tutorial on how to find your camera on the network in C#
- Video tutorial on how to implement taking snapshot function in C#
- Video tutorial on how to PTZ your camera in C#
- Video tutorial on how to record video in C#
- Video tutorial on how to detect the motion in C#
- How to stream the camera image to a mobile in C#
- Video tutorial on how to stream the image of the camera to a website in C#
- Stream camera image during SIP video call in C#