want to know the bytes of upperLeft image

조회 수: 6 (최근 30일)
tina jain
tina jain 2015년 4월 8일
댓글: tina jain 2015년 4월 9일
executing the code below
close all;
clear all;
imData=imread('lena256.bmp');
imshow(imData);
figure(1);
title('Original image');
pause(2);
map=gray(256);
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar');
[N, M]=size(imData);
dwt_row_image=zeros(N, M);
tmpData=zeros(1, M);
for i=1:N
tmpData(1, 1:M)=imData(i, 1:M);
tmpData(1, 1:M)=dwt(tmpData, Lo_R);
dwt_row_image(i, 1:M)=tmpData(1, 1:M);
end
tmpData=zeros(1, N);
dwt1_imData=zeros(N, M);
for i=1:M
tmpData(1, 1:N)=dwt_row_image(1:N, i)';
tmpData(1, 1:N)=dwt(tmpData, Lo_R);
dwt1_imData(1:N, i)=tmpData(1, 1:N)';
end
figure(2);
imshow(dwt1_imData, map); % our first aim % shifting the image to the
title(' After DWT');
pause(2);
[rows, columns, numberOfColorChannels] = size(dwt1_imData);% edited by me
r1 = int32(M/2);
c1 = int32(N/2);
r2 = r1+1;
c2 = c1+1;
upperLeft = dwt1_imData(1:r1, 1:c1);
figure(3);
imshow(upperLeft, map);
dpcm22(upperLeft);
%------------function dpcm22--------------
function dpcm22(A)
[Height,Width,Depth] = size(A);
if Depth > 1
A1 = double(A(:,:,1));
else
A1 = double(A);
end
%
Qtype = 'uniform'; % ’uniform’ and ’nonuniform’
B = 5; % # bits of quantization
%hello();
*fileInfo = dir('upperLeft');*
[rows, columns, numberOfColorChannels] = size(A);
disp(fileInfo.bytes);
fileSizeInProgram = rows * columns * numberOfColorChannels
fprintf('File size on disk = %f bytes.\n', fileInfo.bytes);
fprintf('File size in program = %f bytes.\n', fileSizeInProgram);
comp_ratio=fileInfo.bytes / fileSizeInProgram;
disp(comp_ratio);
Now the problem is that the bold part is not working, please suggest how to get the bytes of upperLeft image as dir command is not working
  댓글 수: 3
tina jain
tina jain 2015년 4월 8일
Image Analyst let me explain, fileSizeInProgram = rows * columns * numberOfColorChannels it is giving fileSizeInProgram = 128*128*1=16384
now I want to calculate File size on disk
tina jain
tina jain 2015년 4월 8일
OK done with this. thank you

댓글을 달려면 로그인하십시오.

답변 (2개)

Thomas Koelen
Thomas Koelen 2015년 4월 8일
편집: Thomas Koelen 2015년 4월 8일
a=whos('upperleft');
a.bytes
will give you the size of the variable
  댓글 수: 2
tina jain
tina jain 2015년 4월 8일
no its not working. it is giving me ox1 empty structure. See , actually upperleft is LL band after DWT. Any other suggestion?
Thomas Koelen
Thomas Koelen 2015년 4월 8일
change 'upperleft' to 'A'

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2015년 4월 8일
I thought we talked about this before. Use dir() or imfinfo() to get the size on disk.
  댓글 수: 1
tina jain
tina jain 2015년 4월 9일
Yes, I am sorry. I forgot about that.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by