Build Webcam and IP camera solutions efficiently in C#.Net
- Quick start
- Online manual
- Start Onvif programming
- Supported cameras
- C# Camera Vision Videos
- C# Onvif.IP.Camera.Viewer
- C# Onvif IP Camera Viewer Git repository
- IP video camera viewer
- PTZ IP camera motion control
- Onvif network video recorder
- Motion detection and alarms
- IP camera to SIP video call
- Configure Onvif IP cam remotely
- Onvif IP camera video server
- Video stream on website
- Onvif Network Video Analytics
- Onvif IP Camera Manager
- Computer Vision Technology
- Motion recognition and analysis
- Object detection
- Object categorization
- Image Manipulation
- Ozeki SDK for Linux
- Commercial information
- Download the SDK
- Copy the C# code example into Visual Studio
- Build your IP Camera project
Did you know?
Did you know, that this SDK was used to build Ozeki Camera Recorder?
If you don't want to write code, it could be just what you need. Download it now from the follolwing page: Download Ozeki Camera Recorder.
Video tutorial on how to implement motion detection function for your camera viewer application in C#
This video demonstrates how you can detect the motion from USB and IP camera 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. Moreover you will able to develop such security system, which essential part is the motion detection.
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#.
|Download source code:||Basic_CameraViewer_7.zip|
Welcome to the Ozeki Camera SDK video guide tutorial part seven. In this chapter We will create a simple project to connect USB camera and IP camera and then we will learn how to detect the motion with them.
This is the 7. 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
- All purpose tool
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 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
- Fourth step - Extend the application with recording video function.
- and finally the Fifth step - Check the result and we try out our application
And lets start now with the step one.
First of all, let's download the necessary SDK from the camera-sdk.com. Click on the download then add a name, an email and a reason why you need this SDK. Click on the OK and you will see the downloading link. Click on it and install it. About the installation you can find more information in the Quick Start section.
After the installation let's create a new WPF solution project in the Visual Studio. Click on the new project and choose the WPF and give a name and select a folder, where you want to save. When the project is exist, then we add the System.Drawing.dll and the OzekiSDK.dll to the references. We can find the OzekiSDK where the installer put it. The System.Drawing.dll is located in the references in the Framework submenu on the Assemblies tab. And you can see it in the references list.
Next step is to create the graphical user interface. We can do it in the XAML file. We will need two button for USB camera Connection and Disconnection. And then we also need the same for the IP camera, but here we have to add three textboxes where we can add the connection data, like address of the camera, username and password as well. And then the related buttons. Now we add the necessary eventhandler for the Connection and Disconnection buttons. And finally we set the windows property.
After that we can deal with the controls. Firstly we add the essential namespaces, which are come from the Ozeki Camera SDK. Then we add the necessary object to display the image of the IP and USB camera. In the constructor we instantiate the above objects. Then we create a helpfunction, which create and set the videoviewer object and add it to the user interface. Now we establish the USB camera connection event handler. Here we create a webcamera object and connect it to the BitmapSourceprovider and then start the camera. Then we implement USB camera disconnection, where we stop the videoviewer and webcamera. At IP camera for the connection we add the camera address, the username and the password, then we can start the camera. The Disconnection happens like at the USB camera.
Now we come back to extend the user interface with a checkbox and a label element. For the checkbox we generate an eventhandler method.
Now we declare a new field, Motiondetector, which will be initiated at the connection. We have to modify the connector's connection and disconnection as well. Here is a little explanation how the detector object works. Firstly the detector will get the image of the camera, which it analyzes, than transmits to the videoviewer. So this is a middle layer between the camera and videoviewer, and that's why we have to solve the connection and disconnection this way. We execute the changes at USB and at IP camera. At disconection we also have to stop the detector.
Before implementing the Motionchecked, first we have to prepare for it with a few helpfunction.
With GUIThread, we can handle the event, which come from the camera, in another thread.
Next is the StartMotionDetection, where set and start the motion detection. Here we subscribe for the MotionDetection event with the detector_MotionDetection. The eventhandler method in another thread indicate on the user interface if a motion is detected.
Finally we stop the detector and unsubscribe from the MotionDetection event.
In the MotionChecked we use the previously function. If the checkbox is checked, than call the StartMotionDetection(), else call the StopMotionDetection().
Now check the result. At USB camera it works. I wait until the redness disapear to show motion stopped. Now let's try at IP camera. Add the necessary data: camera address, username and password. Because this is the trial version it could happen this image will wait for us for a few moments. Here is Peter. And you can see the motion detection works here as well.
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 Peter will show how you can make a camera server and streaming the image of the camera to some kind of smartphone. It is gonna be exciting. Thanks for watching. See you in the next video. Bye.