How We Developed A LiveCam App on Windows Azure

Recording Video from Cameras

The main task of server is to constantly get images from web cameras when in the “record” state and store them in the database. The process which initializes the new event of camera processing should be constantly working on the server. In Windows Azure the task is solved by writing a cycle with request of the processing method with a certain interval. Furthermore the code should be launched under a worker role.
The general, the algorithm of the camera processing in terms of our object model can be written as follows:
1. Request all ImageSource objects with the “Record” state and objects which require recording of the next frame.
2. Get an image for each requested ImageSource.
3. Create a new ImageData object with the received image.
4. Save in the ImageSource, the date and time of the last received frame and a link to the created ImageData (LastImageId field stores a link to the last frame).

In relation item 1 above each ImageSource has a frame frequency and stores the date and time of the last frame taken. Based on these properties and the current time one can easily get a necessity condition of taking a frame in a certain time period.
Please note that when creating an ImageData object with the main image we also save it as a scaled-down copy. This is necessary to allow a client request for several images without substantial load on the communication channel.

Deployment at MS Azure

After we developed the application, tested and debugged it in “warm house conditions” it’s time to deploy it on Windows Azure.
We created database in the SQL Azure online developer portal where we also made rules for the firewall, in addition Microsoft recommends enabling “Allow Microsoft Services access to this server” to facilitate communication with other elements in Windows Azure (such as storage).

To create tables and  indexes it is necessary to use SQL?MD. SQLCMD is a part of Microsoft SQL Server and can be found in the SQL Server folder. For example, in «Microsoft Sql Server 2008» this utility can be found in the «C:Program FilesMicrosoft SQL Server100ToolsBinn» folder.
Command line examples for connecting to SQL Azure, are given below.
SQLCMD.EXE -U user_name@server_name -P password -S server_name.database.windows.net -d db_name
,where

  • user_name – user name
  • server_name – server name
  • db_name – data base name

To create the database structure using the script, it is sufficient to execute the following command:

SQLCMD.EXE -U user_name@server_name -P password -S server_name.database.windows.net -d db_name -i filename
where

  • user_name – user name
  • server_name – server name
  • db_name – data base name
  • filename – path to SQL script

Using Visual Studio one should begin with C#/Cloud Service/Windows Azure Cloud Service project creation. Our Azure project will consist of a ASP.NET Web Role project and a Worker Role project. We will host Web Services and Silverlight applications on an ASP.NET Web Role.

About The Author
Alexander Slepov has 7+ years of experience in areas of software and business applications development. He has B.D. degree in physics. Alexander is familiar with a numerous programming languages and tools such as WPF, Silverlight, Win Forms, XML WebServices, ASP.Net, .Net Remoting, ADO.Net, XML, XSD, HTML, CSS, XAML and more.

About The Company
Enterra is a multi-national software development company with 9+ years of experience and offices in The United States, Russia, and Germany. One of the lines of businesses is a full-cycle custom .NET development. For all projects Enterra uses the latest technologies and world best practices. Enterra is a Microsoft Gold Certified Partner. Enterra’s website: http://www.enterra-inc.com or email Enterra at info@enterra-inc.com?

Pages: 1 2


Array
Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!