Ozeki Camera Recorder Stat

How to get started with Web camera/IP camera development in C#.NET

This page helps you how to get started with Web camera/IP camera development projects in C#.NET. It gives you information about the prerequisites, the setup procedure and how to find good, working examples for various camera related tasks.

Creating Onvif IP camera solution in C#.NET with Ozeki Camera SDK
Figure 1 - How to create your own Onvif IP camera solution in C#.NET

Step 1. System requirements

You can check the system requirements for Web camera/IP camera programing and the prerequisites for OZEKI Camera SDK at the following webpage: OZEKI Camera SDK system requirements.

Step 2. Download OZEKI Camera SDK

In order to develop webcam or IP camera features, first you need to download OZEKI Camera SDK. Although installation process is very simple, if you need help the quick start quide gives you detailed step-by-step instructions to quickly and easily install OZEKI Camera SDK on your PC.

Step 3. Your first project

After you have installed OZEKI Camera SDK on your PC, start your project by lauching Microsoft Visual Studio and follow these steps:

  1. First of all, you will need to create your own Visual Studio project in your IDE. You can do this in the most simple way with the "New project" icon that can be seen in the left top corner of the IDE, or with the Ctrl + Shift + N hotkeys.
  2. It is highly recommended to use the same title as the name of the project that you can see at the beginning of any tutorial's first code section (typically named Form1.cs or rarely Program.cs) right after the namespace keyword. For example, in the very first tutorial it should be: VideoCameraViewer01. If you do not use the same name, your program will probably show you an error message while everything else is being OK. Using the same name will prevent further problems.
  3. Now, you should save the project. In earlier Visual Studio IDEs (2010 and before) you have to use the Save all button in order to save the whole solution.
  4. After this comes the most important step. You have to add the OzekiSDK.dll as a reference to your solution which requires the SDK to be installed in your system. If you are building a WPF application, you will also have to add the System.Drawing.dll to the references. In the Solution explorer window at the right side of the IDE you must right-click on the references part and choose the Add reference option. Now the only job you have to do is looking for it in your file system using the Browse tab and add it to the references. You will also find some basic references e.g. System.Drawing.dll in the Assemblies tab under the Framework submenu. You can check the references about the SDK mentioned above for more detailed description.
  5. Using an incorrect framework can cause errors so you should change the properties of your project. To do this you should click the Project menu on the menubar of the IDE and choose the [YourApplication'sName] Properties element. Right on the first tab there is an option called Target framework. Automatically .NET Framework 4.0 Client Profile is selected but you should turn it into only .NET Framework 4.0. After choosing this option a dialog window will pop up where you should click on the 'Yes' button. Now, everything is given to build the project properly and make it work well.
  6. The next step is implementing the same source code you can find on the actual tutorial's site.
    • Windows Forms Application:
      If the preferred example program requires a Windows Forms Application, you need to follow the instructions in this section. In most cases this step can be divided into two parts. You must copy both code sections into your Visual Studio project. The first one contains all the important functions of the application we would like to use in order to connect to the camera and implement further features. This requires to copy all the code from this part into your Form1.cs source file within the Visual Studio. The second one is only about the graphical user interface that belongs to the application that you can see after you have started to run your actual project. In other words: with this code section your application's GUI will contain all the important elements like buttons, the image of the camera, controllers (checkboxes, radio buttons, sliders), etc.. This requires to copy all the code from this part into your Form1.Designer.cs source file within the Visual Studio. (In the Solution explorer you can find the designer source file under the Form1.cs section.) If you are using a newer version of Visual Studio it can happen that the files' names are different from these. They are usually like MainForm.cs and Main.Designer.cs. In this case you should copy the content of the files into the proper files of your own project's source codes.
    • WPF Application:
      If the preferred example program contains a WPF Application, you need to follow the instructions in this section. Important notice: WPF Applications require the inclusion of the System.Drawing.dll as well as the OzekiSDK.dll resources.
      In most cases this step can be divided into two parts: you must copy both code sections into your Visual Studio project. The first one contains all the important functions of the application we would like to use in order to connect to the camera and implement further features. This requires to copy all the code from this part into your MainWindow.xaml.cs source file within the Visual Studio. The second one is only about the graphical user interface that belongs to the application that you can see after you have run your actual project. In other words: with this code section your application's GUI will contain all the important elements like buttons, the image of the camera, and similar things. This requires to copy all the code from this part into your MainWindow.xaml source file within the Visual Studio. (In the Solution explorer you can find the designer source file under the MainWindow.xaml section.)
    • Console Application:
      If the preferred example project implements a Console Application, you have to choose the Console Application option during the creation of the new project (File > New > Project > Console Application). Visual Studio will add a Console Application file automatically to your project and solution. Copy the whole code from the Program.cs part of the online documentation to your Program.cs file. If the project requires more class creations, you need to create these classes and copy the appropriate source code as well.
  7. Hopefully, everything is okay now, so clicking the Run button above will run your application.

Step 4. Build your own IP camera project

By using OZEKI Camera SDK you will be able to develop excellent IP camera solutions like the following examples. Choose a software that you want to create then feel free to download and use their source code. You can also modify the source code freely according to your purposes.

Select the preferred IP camera solution and start the development in C#.NET now: