Windows CE .NET Webcam, Part 2

xiaoxiao2021-03-06  14

Windows CE .NET Webcam, Part 2

Mike HallMicrosoft Corporation

Steve MailsetElechy Consulting

September 17, 2002

Summary: Mike Hall and Steve Maillet finish building a WebCam device using Windows CE .NET, extending their work from last month's column to deploy the image to the CEPC reference platform (16 printed pages).

Welcome to Part 2 of the WebCam project. Last month we looked at building a WebCam using the Microsoft® Windows® CE .NET emulation environment. This showed how to configure a workspace that included the HTTPD Web server component, and how to use the shared Development PC / Emulator _FLATRELEASEDIR folder to copy images captured using the Windows XP Timershot PowerToy into the emulation environments / Release folder. This month we will extend this work to the CEPC platform, specifically adding support for a 1394 WebCam. By the way, before we Get Started with this Month's Project, I Want To Thank Chris Gray from The Windows Ce Development Team for The Webcam Project Idea and sample code.

Okay, So Here's What We will NEED for this Month's Project:

Windows CE .NET 4.1: http://www.microsoft.com/windows/embedded/ce.net/evaluation/trial/evalkit.asp. (Note That You Will Need The Evaluation, Or Full Product To Work with the Cepc Reference . platform) JPEG libraries from the Independent JPEG Group: http://www.ijg.org/ CEPC reference board:.. Building a CEPC Reference Board A suitable 1394 WebCam and 1394 PCI card I'm using an iBot 1394 WebCam from. Orange Micro, And An Unbranded 1394 PCI Card That Someone Kindly Lent Me for the duration of Writing this article.

Before we get started with the steps needed to build the CEPC / 1394 / WebCam device, we should initially take a look at the issues / delta's we face between last month's emulation project and this month's 1394 CEPC project. Last month we used the Windows XP Timershot PowerToy to capture an image from a USB connected WebCam. The image was provided to us in JPEG format by the Timershot PowerToy application. We simply needed to drop the image into the www / wwwpub folder and our Web server could then serve up the image (with the aid of some cunning script) .Life becomes slightly more interesting when we start using the 1394 WebCam. This will provide us with an RGB stream, which we will need to convert into a JPEG before dropping it into the www / wwwpub folder . Windows CE .NET does not include JPEG helper libraries, so we need to make use of third-party libraries to create our JPEG file. It can then be served up by the Web server, using exactly the same script as last month's article (The Emulator Is Just Great for trying out builds and scripts before working with a reason.)

There are a number of libraries available that provide the code needed to generate JPEG images Here are a couple to choose from:. JPEG libraries from the Independent JPEG Group (we're using these in this month's project), CxImage from CodeProject.com, And I'm Sure There Plenty of Others To Choose from.

In order to expose the JPEG image, we will need to create an application that will capture data from the 1394 WebCam, convert this information into JPEG file format, and drop the file into the www / wwwpub folder. This is in fact very similar to last month's project. In last month's project, the application was simply pulling the JPEG file (created by Timershot) from the / Release folder and dropping the image into the www / wwwpub folder-no image conversion / creation was needed.So let's get started with the basic project configuration. Though quite similar to the configuration used last month, we will need to add some additional components from that catalog to support the 1394 WebCam. I will point these out as we go.

We could create a headless platform;. We are simply serving up Web pages after all, and this should not require a local UI for the device In fact, we have a headless 1394 CEPC WebCam running in the office that boots and runs from a floppy disc. (Now that's a small operating system image!) The WebCam is pointing directly at a foosball table, this makes it possible for anyone to check availability (or scores) at any time of the day or night. for the purposes of this project, however, we will mirror the steps used from last month's emulator platform, and create a device with UI. (Feel free to play around with the platform settings and create a headless device if you'd prefer.)

Here are the steps to create the core placeform.

.. Launch Platform Builder From the File menu, click New Platform On the New Platform Wizard, click Next From the list of available BSPs, select CEPC:. X86, and then click Next From the list of available platform configurations, click Web Pad. . In the Platform name box, type WebCam as the name for your platform, and then click Next. From the list of Web Pad Device variants, select Web Pad, and then click Next. On the Application & Media page, only select Internet Browser , disable all other options (note that any of the features can be added, using the component catalog);. click Next On the Networking & Communications page, disable Personal Area Network (PAN) | Bluetooth (note that this can be added at any time, using the component catalog); click Next On the Congratulations page, click Done to close the New Platform Wizard From the Build menu, click Set Active Configuration From the list of platform configurations, select WebCam-CEPC:. X86 Win32 Release.. , and the click ok.at this pot .

From The Platform Builder Catalog, Locate, Select, Andd The Following Components (Here's Where We Start Adding Some Components That ":

Core OS | Display Based Devices | Applications & Services Development | C Libraries and Runtimes | Standard IO ASCII (STDIOA) Device Drivers |. IEEE 1394 | Non-AV / C WebCamera Driver Device Drivers |. IEEE 1394 | Test Tools-Sample Application. Core OS | Display Based Devices | Communication Services and Networking | Servers | Web Server (HTTPD).

We're all set. All of the core operating system components are now in place. We could build the image, and confirm that the Web server is running okay. From our desktop Internet browser, we would expect to see the default Windows CE HTML . page Now it's time to customize the platform by adding our custom application, and the resource files needed to support the script.First, let's change the name of our device on the network We looked at this last month;. here's a refresher.

WE NEED To Take a Look At The Parameter Tab of Of Our Project Workspace, Locate and Open the Project.reg File, And Add The Following Entry:

[HKEY_LOCAL_MACHINE / IDENT]

"Name" = "getmbed"

"Desc" = "Webcam Device"

The default Windows CE HTTPD page (/windows/www/wwwpub/default.htm) simply informs you that the Web server is running (which we may have tested before starting the platform customization). We need to replace this with our custom HTML page Well Also Want Our Internet Browser Always Shows An up-to-date Image.

Here's the HTML page. I'm using a one-second timeout on the page, and the image name being displayed is image.jpg. (Note that this is the name of the jpeg file we will output from our custom application.) For The purposes of this article we will call the html page "frame.html".