Speed questions:

Jul 17, 2007 at 3:01 PM
I have been developing a video project using windows CE and the .net compact framework. I use the webcam driver to receive JEPG images and use the built in Bitmap class to convert the JEPG to BMP. I then display to the screen. The slowest part of this process seems to be creating the new Bitmap using the stream constructor. (Example Below). I was wondering if anyone knows how to do this any faster? I am getting a very slow frame rate and need to speed it up? Does anyone have any suggestions?

Stream stream = moCamera.MJPEG2JPEG(address, mnSize);
Bitmap oBitmap = new Bitmap(stream);
Jul 17, 2007 at 3:26 PM
Some of the webcams can stream uncompressed video. I haven't tried it, but that conversion may be faster.

Jul 20, 2007 at 6:06 PM
I have the same problem and i solve this with the ImagingFactory under c#, it increased by approx. 3 fps

Jul 23, 2007 at 6:22 PM
Try the native code from camtest.zip that I just posted. It depends on your hardware, and the frame size, but the native code conversion rates are higher that what you've mentioned.

Jul 26, 2007 at 8:02 AM

I'm having speed-problems as well. I'm working with the camtest2-testprogram. On a PXA270-board with resolution 640x480 the frame rate is 5 fps. As Doug mentioned in an earlier posting, converting the mjpeg-frames to bitmaps is the costly part (about 190ms for the DisplayFrame-Function).
In my case though, I can't even request a higher frame-rate than 5 fps from the driver. I guess this means, that in the Probe / Commit process the driver determines that there is not enough bandwidth available to support a higher frame rate. I checked the size of a single frame: about 25 kbyte. With 5 fps the required data rate is 125 kbyte per second. Since USB Full-Speed (which both the quickcam 5000pro and the board support) allows 1500 kbyte/s it should be possible to get higher frame rates, right? Or is it possible, that the transfer is Low-Speed (192 kbyte/s)? If I were sure that the driver could transfer data faster, I could try an uncompressed video stream to reduce conversion-time.

So I guess my questions are:
- Why doesn't the driver allow a higher frame-rate although USB provides the necessary bandwidth? Is this a driver-problem?
- How could one accelerate the conversion of mjpeg-frames? Could there be done something with directdraw (I don't really know what is possible there...)?

And a third question:
- Is there a way to receive the debug-messages from the driver without using platform-builder? I just have a board with a wince-image preinstalled...

Jul 26, 2007 at 3:40 PM
Hi again

I just figured out, why I couldn't choose higher frame-rates at 640x480. It had nothing to do with the driver. In camtest2, CamTest2.cpp, Line 619/620, the interval-time is read from the Formatprops structures (Formats). The Frameindex (wFrame) is used to find the right Formatprops:

if (wInterval < Formats[wFrame].nNumInterval)
dwFrameInterval = Formats[wFrame].dwInterval[wInterval];

Since wFrame seems to start with 1, the Formats-Array should be indexed with wFrame-1. If not, the above if-condition usually results to false and the lowest frame-rate is chosen (5fps in my case)...
So the bottleneck really is the conversion of the mjpeg-frames.

I also experienced errors during conversion of the jpegs to bitmaps:
Decoding failed, hr = 0x80004005 (E_FAIL)
The error occurs at the following statement:
pImageDecoder->EndDecode(hr) (mjpeg2bmp.cpp, function GetBitMapImage)
Any ideas on that? Is EndDecode really necessary? pImageDecoder->Decode() should be finished with decoding at the time EndDecode is called...
I also got E_OUTOFMEMORY under stress, although all allocated memory is released properly...

And again: Does anyone have an idea how to accelerate the conversion of mjpeg-frames? Could there be done something with directdraw?

Thanks for any help
Dec 1, 2007 at 3:05 PM

What I need?

Take still pictures when an event is successful, without human intervention (i.e without someone clicking the button). I have written code in C#. In my opinion, some sort of command line would be the best in this case.

Can anyone please help me with this issue. A quick response is very much desired. Thanks a lot in advance.


I am doing a senior design project in electrical engineering. The project was to upgrade a vending machine by adding more functionality to it such as cashless purchases (student id cards and rfid cards), completely replace the control logic board (we are using the EBOX 2300 for this part), and also replace other modules such as the old vacuum display and the power board, etc. Basically, its a complete upgrade to a vending machine with remote web accessibility. Remote stock management, sales check, and user management are a few added features.

Important details!

I need to be able to take a picture of the user when the vending procedure is successful. The camera should also take pictures if there is any vandalism detected by use of an accelerometer.