want to know the bytes of upperLeft image

1 view (last 30 days)
tina jain
tina jain on 8 Apr 2015
Commented: tina jain on 9 Apr 2015
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 Comments
tina jain
tina jain on 8 Apr 2015
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

Sign in to comment.

Answers (2)

Thomas Koelen
Thomas Koelen on 8 Apr 2015
Edited: Thomas Koelen on 8 Apr 2015
a=whos('upperleft');
a.bytes
will give you the size of the variable
  2 Comments
tina jain
tina jain on 8 Apr 2015
no its not working. it is giving me ox1 empty structure. See , actually upperleft is LL band after DWT. Any other suggestion?

Sign in to comment.


Image Analyst
Image Analyst on 8 Apr 2015
I thought we talked about this before. Use dir() or imfinfo() to get the size on disk.

Tags

Products

Community Treasure Hunt

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

Start Hunting!