i want to know how to find the size of original image & compressed image..

8 ビュー (過去 30 日間)
azizullah khan
azizullah khan 2013 年 12 月 7 日
回答済み: Daniel Glez 2016 年 11 月 17 日
I want to find the size of compressed and original images size after applying FFT or DCT or PCA.Kindly if anyone have idea about it please share it with me.Thanks in advance.
p=imread('picture.jpg');
a=imresize(p,[100,100]);
%DCT
Z(:,:,1)=dct2(a(:,:,1));
Z(:,:,2)=dct2(a(:,:,2));
Z(:,:,3)=dct2(a(:,:,3));
for i=1:100
for j=1:100
if((i+j)>60)
Z(i,j,1)=0;
Z(i,j,2)=0;
Z(i,j,3)=0;
end
end
end
K(:,:,1)=idct2(Z(:,:,1));
K(:,:,2)=idct2(Z(:,:,2));
K(:,:,3)=idct2(Z(:,:,3));
subplot(2,4,1);
%imshow(Z);
imshow(uint8(K));
title('70% compression');
How can we find the size of the '70%' compressed image i.e K ?
  2 件のコメント
azizullah khan
azizullah khan 2013 年 12 月 7 日
p=imread('picture.jpg');
a=imresize(p,[100,100]);
%DCT
Z(:,:,1)=dct2(a(:,:,1));
Z(:,:,2)=dct2(a(:,:,2));
Z(:,:,3)=dct2(a(:,:,3));
for i=1:100
for j=1:100
if((i+j)>60)
Z(i,j,1)=0;
Z(i,j,2)=0;
Z(i,j,3)=0;
end
end
end
K(:,:,1)=idct2(Z(:,:,1));
K(:,:,2)=idct2(Z(:,:,2));
K(:,:,3)=idct2(Z(:,:,3));
subplot(2,4,1);
%imshow(Z);
imshow(uint8(K));
title('70% compression');
How can we find the size of the '70%' compressed image i.e K ?

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

採用された回答

Image Analyst
Image Analyst 2013 年 12 月 7 日
Look at the file size in your operating system. For example, use Windows Explorer. Or if you want to do it all in MATLAB, use imfinfo(), if you have the Image Processing Toolbox.
  9 件のコメント
azizullah khan
azizullah khan 2014 年 2 月 1 日
Dear sir,in the above code i have compressed the image by taking the higher component to zero.and then take the inverse of that compressed image...then how you can say that images is not compressed.... please if you have code on compressing image using dct/fft/dft please share it with me....please...... simply i want compressed image using fft/dct/dft.I need code.... please help me...please....................
Image Analyst
Image Analyst 2014 年 2 月 1 日
When you compress it, it's compressed. If you inverse/reverse/restore/undo the compression, you recover your original image and it won't be compressed anymore. Don't you agree? I don't have any compression demos using fft or dct available to give you.

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

その他の回答 (2 件)

chitresh
chitresh 2013 年 12 月 7 日
original file size = (width* height*bit depth)/8;
and you can get compressed file size from imfinfo('imagefile'); and rest parameters to like width , height and bitdepth
  4 件のコメント
chitresh
chitresh 2013 年 12 月 15 日
dear if your problem is solved then please accept the answer
azizullah khan
azizullah khan 2014 年 1 月 29 日
編集済み: azizullah khan 2014 年 1 月 29 日
dear bro... its not clear..kindly find the size of compressed images of the above.... please take a example of image and solve my problem i shall be very thankful to you.........best luck

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


Daniel Glez
Daniel Glez 2016 年 11 月 17 日
Hello! I would like to add a note here:
Be careful and check that you haven't registered into your workspace a variable named "sum". In that case this error also appears. It happened to me while computing MSE and PSNR in a matrix substraction like follows:
mse = sum(sum((I-I64).^2))/(m*n)
PSNR = 10*log(max(I(:))/sqrt(mse))
OUT:
Subscript indices must either be real positive
integers or logicals.
Error in mse_psnr (line 11)
mse = sum(sum((I-I64).^2))/(m*n)
Thanks to all.

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by