help to fix this

조회 수: 2 (최근 30일)
Hamrit
Hamrit 2012년 6월 10일
clear all
clc
global Gdi
global c
O=imread('12.jpg');
D1= im2double(O);
for ng=1:3
XD=D1(:,:,ng);
[lg,cg]=size(XD);
lg1=lg/8;
lg2=fix(lg1);
g1=lg2*8;
cg1=cg/8;
cg2=fix(cg1);
g2=cg2*8;
ofs = ones(g1,g2)*128;
p=0;
t=1;
v=1;
while v<=(g1-7)
while t<=(g2-7)
pix=XD(v:(v+7),t:(t+7));
pig=pix*256;
pg=fix(pig);
p=p+1;
Gm(:,:,p)=pg(:,:,1);
%____________________________________________________________________
for i=1:1:1
for j=1:1:8
b(i,j)=1/sqrt(8);
end
end
for i=2:1:8
for j=1:1:8
b(i,j)=sqrt(.25)*cos((2*(j-1)+1)*(i-1)*pi/16);
end
end
%dtr=b';
c(:,:,p)=b*Gm(:,:,p);
d(:,:,p)=c(:,:,p)*b';
t=t+8;
end
t=1;
v=v+8;
end
for z=1:p
n=[3 5 7 9 11 13 15 17;
5 7 9 11 13 15 17 19;
7 9 11 13 15 17 19 21;
9 11 13 15 17 19 21 23;
11 13 15 17 19 21 23 25;
13 15 17 19 21 23 25 27;
15 17 19 21 23 25 27 29;
17 19 21 23 25 27 29 31];
QG(:,:,z)=d(:,:,z)./n;
DQG(:,:,z)=fix(QG(:,:,z));
%$$$$$$$$$ DECOMPRESSION $$$$$$$$$$$$$$$$$$$$$$$
GDCTi(:,:,z)=DQG(:,:,z).*n;
Go(:,:,z)= IDCT (GDCTi(:,:,z));
for i=1:1:1
for j=1:1:8
b(i,j)=1/sqrt(8);
end
end
for i=2:1:8
for j=1:1:8
b(i,j)=sqrt(.25)*cos((2*(j-1)+1)*(i-1)*pi/16);
end
end
%dtr=b';
c(:,:,z)=b*GDCTi(:,:,z);
Gdi(:,:,z)=c(:,:,z)*b;
end
%Gdi =uint8(Gdi(:,:,z));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
p=1;
pas_sbloc=8;
for i=1:pas_sbloc:lg
for j=1:pas_sbloc:cg
C(i:pas_sbloc+i-1,j:pas_sbloc+j-1)=Gdi(:,:,p);
p=p+1;
end
end
if ng==1
Rh=C;
elseif ng==2
Gh=C;
else
Bh=C;
end
end
figure(2);
A=cat(3,Rh,Gh,Bh);
imshow(uint8(A));
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 6월 10일
In what manner is it broken? Do you get an error message? How does the output differ from your expectations?

댓글을 달려면 로그인하십시오.

답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by