Microsoft.SPOT.Bitmap - JPEG decoder quality

Hi everyone,

I have a problem dealing with JPG images coming from a serial camera (Adafruit CMOS TTL Serial Camera). The camera gives me a 320x240 px JPG image that I have to process in Fez Cobra.
If I save the original image to SD card the quality of the jpg is a good. But if I decode the image in memory, using the Bitmap class, the quality is highly reduced and the picure loses color depth. In my application, the picture quality is critical, because I need to measure colors.

This is the code:

Byte[] jpg = camera.getPictureBytes();  //retrieves JPG byte array

//if I save jpg byte array to SD I get the good picture here

Bitmap bp = new Bitmap(jpg, Bitmap.BitmapImageType.Jpeg); //this gives me a reduced color picture 

The builtin Bitmap decoder is fast, but does not suites my quality needs. Because of that, I’ve wrote 2 JPG decoders in RLP wich gives me the quality I nedd, but those algorithms (NanoJPG and other) and have very slow performance (6 seconds, and 10 seconds) when 2 secods max is acceptable por my application.

Is there anyway to get a good and fast JPEG decoder?

I’m using Fez Cobra with GHI Premium SDK.

If you can give me any advice I will appreciate very very much.

Thanks,
Paco

Hi jpmanson,

I think you encounter the same problem as this post refer to : http://www.tinyclr.com/forum/topic?id=8901 (even if it is about motion jpeg).

Of course if you keep the byte array as it is, it wont fall in quality, but I think the Bitmap class is not as much powerful as in the normal framework, so that it probably does an adaptation to the target device it addresses wih Microframework.

If you want to process image recognition, I engage you in trying some other processors that have advanced graphic DSP to achieve your goal…

Thanks Louis,

Yes…I don’t believe that I can solve my problem only with EMX. Basically what I need to do is JPEG decoding and 2D Convolution filtering. Those algorithms, even implemented in RLP, are too slow. The decoder takes 6 seconds and convolution takes 10 seconds with a 320x240 image…

I’ll have to find an extra hardware (DSP or similar) for that job…

Thanks again,
Juan Pablo