You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Hi !! I have a tiff image, which i have altered to get another matrix say a .Now, I want to compress and decompress it.
1 view (last 30 days)
Show older comments
nayana
on 5 Jan 2013
i want to compress my matrix(large size) a by using Huffman coding and then decode it again to get the original matrix a. can u post links of any coding u might know that solves my problem
14 Comments
nayana
on 6 Jan 2013
I have tried the file in this link http://www.mathworks.in/matlabcentral/fileexchange/19870-adaptive-huffman-coding
I got the result but my encoded output is uint8 class and of 110458233 bytes where as my original image is 839640 bytes and of uint16 type, so my question is did it really get compressed as the bytes are more in encoded image than in original
Walter Roberson
on 6 Jan 2013
The output stores only 1 bit per array element; the input had 16 bits per array element. You should be able to calculate from there.
nayana
on 7 Jan 2013
Edited: nayana
on 7 Jan 2013
@walter Roberson, Thanks a lot for your help.Actually i am new to mat lab. so i could not figure this out... As you said the output stores less bits per each array element but on whole total no of bits of output is more than total bits of input.so can u clarify whether its compressed or not pls!!
nayana
on 7 Jan 2013
Edited: Walter Roberson
on 7 Jan 2013
@ walter Roberson
i have used code in this link http://www.mathworks.in/matlabcentral/fileexchange/19870-adaptive-huffman-coding and even other codes but whatever i try output size is more than input.
can u please suggest me some coding to compress an array, where i am storing all the coordinate values and intensity values of an image in that array.
Walter Roberson
on 7 Jan 2013
Why are you storing all the coordinate values? Is your image not defined over a regular grid? Why not at most store the first coordinate and the last coordinate for each of the two dimensions, if the coordinates are equally spaced?
nayana
on 8 Jan 2013
Edited: nayana
on 8 Jan 2013
I need to compress such array, that's the job my professor gave to me.anyway i just want output size to be decreased,if 5 elements are there i want it to take it as 5 bits ,but since its of type uint8 its taking 1 byte. i want to convert it into a suitable format so that it will take only 1 bit or something less than 1 byte... By storing the output it in a text file or any other file or by changing its format, if its possible to reduce size, can u please suggest me
nayana
on 9 Jan 2013
Thank you.Its working but after storing output into file when i try to read it, the size of the result is one less than that of input.. Do u have an idea about this???
Walter Roberson
on 9 Jan 2013
Make sure you write a multiple of 8 bits, as files can only store multiples of 8 bits.
Answers (1)
Jan
on 5 Jan 2013
See Also
Categories
Find more on Import, Export, and Conversion in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)