Spiht compressed images over wireless channel

I have a matlab code for spiht compression and decompression, and it is working successfully for image compression. I need to transmit the bit stream representing the compressed image over wireless channel, how can I do that? Shall I put the channel part between the compression and decompression files? In this case, the bit stream output of the compression file is passed through the channel, and the output from the channel is the input to the decompression stage. In this case, the only information transmitted over the channel is the compressed image in the form of ones and zeros.

Answers (2)

Yes that is the correct idea. For further emphasis, the decompression side must use only the transmitted data (and any constants) to recreate the image

6 Comments

But the compression file must be at the transmitter and the decompression file must be at the receiver. What I have done is that I put all files (compression, channel, decompression) in one file, and just replaced the input of the decompression stage with the output of the channel. When I tried to put the compression and channel files together and separate the decompression file, I faced a problem. The decompression file can not run alone separably as happened in the first case.
You should be able to break up the code into compression, transmission, reception, and decompression. The transmission and reception together should output exactly the same as the input to the transmission. You should be able to take what you would transmit and write it to a file. And then you should be able to "clear all" and read from the file into a vector. And then you should be able to pass that read data through the decompressor to recreate the input. If you cannot do this then you are relying on data "leaking" from one side to the other.
The code is actually broken into the mentioned stages and there is no data leaking from one side to another. My problem is that it seems that the decompression stage needs some constants, not only the transmitted vector and I can not determine which constants are needed. The data received after the channel (with some bits in error due to noise) is the input to the decompression stage, and the required constants are recalled from the work space in Matlab. These constants are generated during the compression stage. This why I put all files together.
constants that need to be generated during the compression stage are not constants.
Now if you could break it up into a step that does not depend at all on input that creates the constants, then you could also call that step in the decompressor.
I can not understand what do you mean. Let us speak generally about any spiht-based compression technique without any channels. The compression and decompression stages are always in the same m-file. If I want to run them separately in two files, how can I know the parameters or constants needed with the data bit stream to perform decompression successfully.
Move the compression and decompression into different .m files. Create a third .m file that creates the constants without looking at the input at all, and call it from those other two files. The compression file should output a vector of bytes that represents the compressed data. (You can write that vector of bytes to a file if you want.) The decompression should accept as an argument only the vector of bytes, nothing else -- if you think you need something else then it should be saved as part of the vector of bytes.
function byte_vector = spiht_compress(input_file, arg1)
the_constants = create_the_constants(arg1);
parameters_for_constants = typecast(arg1, 'uint8');
...
compressed_data = ....
byte_vector = [parameters_for_constants(:), compressed_data(:)];
end
function uncompressed = spiht_decompression( byte_vector )
parameters_for_constants = typecast(byte_vector(1:16), 'double');
compressed_data = byte_vector(17:end);
the_constants = create_the_constants(parameters_for_constants);
...
end
Note that any arguments needed to create the constants had to be saved in the byte vector. Then on decompression they had to be extracted from the byte vector and passed to the constant-creator. For example if you want to set the code to save 11 bits per item and that "11" alters the constants you build, then that "11" needs to be saved as part of the output when compressing. The byte vector that is the output of the spiht compressor has to include all the information needed to decompress. It does not have to include the constants themselves, it only has to include the parameters needed to build the constants. If no parameters at all are needed to build the constants then it makes everything even easier.

Sign in to comment.

can u pls forward me the code regarding SPIHT ALGORITHM. mail:vasavichowdary26@gmail.com I m doing final year project. So it will help me Thanks in advance

Asked:

on 22 Mar 2016

Commented:

on 2 Mar 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!