NXT-Spy – Some studies about the weight of the transfered images

The tests done previously on the camera application revealed that the images sent by the phone weighted 12 bits/pixel.

So I borrowed a book at the library called “Compressed Image File Formats” (John Miano 1999) to see how I could have a better image encoding than the one I am currently using. Very surprisingly, I learn that JPEG images size is based on the redundancy of the colors and so for two images of the same format, the size can change completely. This last point lead me to understand that what I thought was a JPEG image was actually a raw image file encoded in 12 bits.

So now that this is understood, let’s go back to the code and try to figure out why Android won’t encode my image in JPEG even if I have already clearly specified in my code the compression (parameters.setPreviewFormat(PixelFormat.JPEG)).

So after having done some tests, I realized that the setPreviewFormat function is not working at all. After some research, I realized that a lot of websites said to use the ImageFormat class, but the problem is that this class appeared only in the Android 2.2 version and my Hero runs 2.1. So I went on Android’s website to see the additions in Android 2.2 [source]. And in the “Graphics” section, it says that not only, they added the ImageFormat class but also that there is a “new YUV image format API to enable compression from YUV to JPEG and manipulation of YUV data.”. So I think that the answer is quite clear : I won’t be able to compress my images unless I wait for an Android upgrade for my phone.

Supervisor’s comment:

I think we can do something better by only sending values for the pixels that have changed but it may be that by reducing the image size the frame rate will be acceptable.

Leave a Reply

Your email address will not be published. Required fields are marked *