want to know the bytes of upperLeft image

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

What do you mean by "get the bytes" or "know the bytes"? You already have upperLeft as a variable. The elements in that variable ARE the bytes of it. You already have them. You already know them.
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
OK done with this. thank you

Sign in to comment.

Answers (2)

a=whos('upperleft');
a.bytes
will give you the size of the variable

2 Comments

no its not working. it is giving me ox1 empty structure. See , actually upperleft is LL band after DWT. Any other suggestion?
change 'upperleft' to 'A'

Sign in to comment.

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

Categories

Find more on Printing and Saving in Help Center and File Exchange

Products

Tags

Asked:

on 8 Apr 2015

Commented:

on 9 Apr 2015

Community Treasure Hunt

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

Start Hunting!