want to know the bytes of upperLeft image
1 次查看(过去 30 天)
显示 更早的评论
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
回答(2 个)
Thomas Koelen
2015-4-8
编辑:Thomas Koelen
2015-4-8
a=whos('upperleft');
a.bytes
will give you the size of the variable
Image Analyst
2015-4-8
I thought we talked about this before. Use dir() or imfinfo() to get the size on disk.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!