Reputation: 1
I have been facing a lot of issues in transferring images through a radio module, the problem arises when reconstructing the image on the receiving side.
The module allows us to transfer 256 bytes in each packet, out of this 16 bytes is reserved for headers(Address+AES128 Encryption) which leaves us with 240 bytes of ASCII encoded string.
What I have done so far is converted a colored image into base64 encoded stream (import base64 in Python) then split it into multiple different lines to incorporate it within the 240-byte limit which is then sent to the transmitter. However, on the receiving end, I have found that after a certain number of packets, few packets are missed, rendering the whole image incomplete and useless. I have also tried other forms of encoding such as hex, which has resulted in a similar way.
The image in question is a 320x240 pixels, 24-bit depth colored image of a JPG format (PNG image is bigger in size).
If anyone is aware of other ways for converting the image into strings or any open-source tool which would allow me to convert images into ASCII streams or even Binary streams, please let me know.
Edit: After looking in this matter more in depth, one of the possible ideas is to create a system where the receiver sends a feed back to the transmitter that a particular packet is missed. Is there an existing software that exists or code that would allow me to check it.
Thanks.
Upvotes: 0
Views: 644
Reputation: 207798
I think the issue is that neither JPEG nor Base64 can tolerate any data loss, because everything depends on something that has gone before.
A better approach may be to use a method that can tolerate missing data. So, maybe you can transmit one scanline, or so, of the image at a time and identify which line it is and put it into an empty image at the place identified by the scanline. If a line or two is missing you will get a black line which you could fix by interpolation or inpainting.
The problem then becomes size. Your image is currently 11kB. If you send the raw pixels of a 320x240 RGB file, that will be 230kB which is 20x bigger. You could convert to YCbCr which subsamples the chroma like JPEG and only takes half the bandwidth, so that gets you to 115kB.
You should also investigate if you can transmit binary rather than ASCII - that will help a lot, since Base64 encoding swells data by around 30%.
Still thinking... by the way, you may get some ideas from reading up on Slow Scan TV, Raspberry Pi High Altitude Ballooning and here.
Upvotes: 1