want to know the bytes of upperLeft image
조회 수: 6 (최근 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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!