compression and decompresion

5 ビュー (過去 30 日間)
Pat
Pat 2012 年 3 月 13 日
I have a code foe compressing a image
a is input image
singvals=20 ;
%a=imread('15.jpg');
dvalue=double(a);
[u,s,v] = svds(dvalue, singvals);
if isa(a,'uint8')
im = uint8(u * s * transpose(v));
% end
elseif isa(a,'uint16')
im = uint16(u * s * transpose(v));
%end
elseif isa(a,'double')
im = (u * s * transpose(v));
else im = (u * s * transpose(v));
end
please tell how todecompress an image
please help

回答 (3 件)

Jan
Jan 2012 年 3 月 13 日
This method of compressing works by deleting of "unnecessary" details. If these details are deleted, you cannot reconstruct them afterwards. Therefore there is no way to "decompress" the result to reconstruct the original.
  6 件のコメント
Walter Roberson
Walter Roberson 2012 年 3 月 15 日
ebcot is part of JPEG 2000, which has an unclear legal status that cannot be investigated without agreeing to the license terms. If the agreement said that you owed them 95% of your first decade of post-graduate salary, you would not be able to find out out without signing the agreement before being allowed to read it.
Jan
Jan 2012 年 3 月 16 日
@Pat: Why do you want to avoid JPEG?

サインインしてコメントする。


Walter Roberson
Walter Roberson 2012 年 3 月 15 日
The array "im" that is calculated by the routine is the (lossy) decompressed image.
  8 件のコメント
Jan
Jan 2012 年 3 月 18 日
The maximum line length in M-code and inside EVAL commands was discussed here: http://www.mathworks.com/matlabcentral/newsreader/view_thread/288439
Walter Roberson
Walter Roberson 2012 年 3 月 18 日
Ah, so post 6.5, the shortest line that had problems was my test on 2008b Linux-64 with +0 repmat 40050 times, which would be 80000 characters. I knew I remembered "40000" in there somewhere!

サインインしてコメントする。


Jan
Jan 2012 年 3 月 18 日
A short JPEG compression:
img = rand(100, 100, 3);
imwrite(img, 'File.jpg'); % Compressed image
decompressed = imread('File.jpg');
What's wrong with using imwrite as compressor? svds is neither "more direct" or "more trivial".

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by