Phụ lục
307
% the COMPRESSED DATA which correspond to the input image
m_u(posbx,posby)=mu;
%---> the m_u matrix
m_l(posbx,posby)=ml; %---> the m_l matrix
mat_log(ii:ii+bx-1,jj:jj+by-1)=blocco_binario;
%---> the logical matrix
% the compressed image
matrice(ii:ii+bx-1,jj:jj+by- ...
1)=(double(blocco_binario).*mu)+(double(~blocco_binario).*ml);
posby=posby+1;
end
posbx=posbx+1;
end
out_rgb(:,:,1)=matrice;
% ----------------------- GREEN component ------------------
dvalue=double_a(:,:,2);
dx=size(dvalue,1);
dy=size(dvalue,2);
% if input image size is not a multiple of block size image is resized
modx=mod(dx,bx);
mody=mod(dy,by);
dvalue=dvalue(1:dx-modx,1:dy-mody);
% the new input image dimensions (pixels)
dx=dx-modx;
dy=dy-mody;
% number of non overlapping blocks required to cover
% the entire input image
nbx=size(dvalue,1)/bx;
nby=size(dvalue,2)/by;
% the output compressed image
matrice=zeros(bx,by);
% the compressed data
m_u=zeros(nbx,nby);
m_l=zeros(nbx,nby);
mat_log=logical(zeros(bx,by));
posbx=1;
for ii=1:bx:dx
posby=1;
for jj=1:by:dy
% the current block
blocco=dvalue(ii:ii+bx-1,jj:jj+by-1);