inputImage=imread(\'cho.jpg\'); inputImage=doulbe(rgb2gray(imread(\'cho.jpg\')))
ID: 3772352 • Letter: I
Question
inputImage=imread('cho.jpg');
inputImage=doulbe(rgb2gray(imread('cho.jpg')));
M=size(inputImage,1);
N=size(inputImage,2);
transformedImage=zeros(M,N);
revisedImage=zeros(M,N);
i=0;
while(i j=0;
while(j
while(ii
while(jj
end
end
if(i==0)
alpha1=1/sqrt(M);
else
alpha1=2/sqrt(M);
end
if(j==0)
alpha2=1/sqrt(N);
else
alpha2=2/sqrt(N);
end
transformedImage(1+i,1+j)=
j=j+1;
end
disp([i,j]);
i=i+1;
end
//////////////////////////////////////////////////////////////
Two-dimensional Discrete Cosine Transform and image compression using MATLAB..
complete my code please.. TT
Explanation / Answer
Note:
Requirement is not clear and the some code is missing in the copyable code when comparing with the image code, based on understanding solution is posted.
inputImage=imread('ironMan.jpg');
inputImage=doulbe(rgb2gray(imread('cho.jpg')));
M=size(inputImage,1);
N=size(inputImage,2);
transformedImage=zeros(M,N);
revisedImage=zeros(M,N);
i=0;
while(i<M)
j=0;
while(j<N)
alpha1=j;
j=j+1;
while(ii<M)
alpha2=ii;
ii=ii+1;
while(jj<N)
imshow(log(abs(j)),[]), colormap(jet(64)), colorbar
jj=jj+1;
end
end
if(i==0)
alpha1=1/sqrt(M);
else
alpha1=2/sqrt(M);
end
if(j==0)
alpha2=1/sqrt(N);
else
alpha2=1/sqrt(N);
end
transformedImage(1+i,1+j)=alpha1+alpha2;
j=j+1;
end
disp([i,j]);
i=i+1;
end
transformedImage(:,floor(N*0.5):end)=0;
transformedImage(floor(|M*0.5):end,:)=0;
figure(31);
subplot(2,2,1);
imshow(inputImage);
title('Original Image');
subplot(2,2,2);
tT=log(abs(transformedImage));
imshow(uint8(tT/max(tT(:))*255));
axis on;
title('DCT Result (Log-scaled)');
subplot(2,2,3);
surf(transformedImage);
title('DCT Result (Surface Plot)');
subplot(2,2,4);
imshow(uint8(revisedImage));
title('Reconstrructed Image using Inverse DCT');
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.