images !

18 views (last 30 days)
Nada
Nada on 4 May 2011
[EDIT: Thu May 12 22:58:48 UTC 2011 Duplicate Removed - MKF]
i am working on a project named water marking using super resolution .. i want to ask a small question .. how can i take the photo size 256*256 (host image) .. resize it to make it 64*48 then put the resized image down the host image using NPT (logo image) .. so finally the host image will be resized to 256*244 and down it the logo image will be 64*48 ! please help me with its code !
  5 Comments
Nada
Nada on 4 May 2011
hmmm .. fine !
all what i need is what u said !
a 256*256 image where its lower part is the same image but with smaller size 64*48 !
it is a task .. i really dunno how is it related to super resolution but it is a task ! any help with coding ??
Nada
Nada on 4 May 2011
clear
[A,map]=imread('lena256.bmp');
A=double(A);
[m,n]=size(A);
ps=zeros(12,256);
ips=1;
jps=1;
for i=1:8:m;
for j=1:8:n;
C=dct2(A(i:i+7,j:j+7));
DC=[1 1 0 0 0 0 0 0; 1 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;];
ps(ips,jps)=C(1,3);
ps(ips+1,jps)=C(2,2);
ps(ips+2,jps)=C(3,1);
C=C.*DC;
ips=ips+3;
if(ips>12)
jps=jps+1;
ips=1;
else
end
B(i:i+7,j:j+7)=C;
end
end
for i=1:8:m;
for j=1:8:n;
DD=B(i:i+7,j:j+7);
%DD=DD.*DC;
D(i:i+7,j:j+7)=idct2(DD);
end
end
figure(1)
imshow(A,map)
figure(2)
imshow(D,map)
ips=1;
jps=1;
for i=1:8:m;
for j=1:8:n;
DD=B(i:i+7,j:j+7);
DD(1,3)=ps(ips,jps);
DD(2,2)=ps(ips+1,jps);
DD(3,1)=ps(ips+2,jps);
ips=ips+3;
if(ips>12)
jps=jps+1;
ips=1;
else
end
D(i:i+7,j:j+7)=idct2(DD);
end
end
figure(3)
imshow(D,map)
i need to take figure 3 then do what i told u about !

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 4 May 2011
I = imread('cameraman.tif'); %sample
I(end-63:end,1:48) = imresize(I,[64 48]); %engine
imtool(I) %view
  1 Comment
Nada
Nada on 4 May 2011
clear
[A,map]=imread('lena256.bmp');
A=double(A);
[m,n]=size(A);
ps=zeros(12,256);
ips=1;
jps=1;
for i=1:8:m;
for j=1:8:n;
C=dct2(A(i:i+7,j:j+7));
DC=[1 1 0 0 0 0 0 0; 1 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0;];
ps(ips,jps)=C(1,3);
ps(ips+1,jps)=C(2,2);
ps(ips+2,jps)=C(3,1);
C=C.*DC;
ips=ips+3;
if(ips>12)
jps=jps+1;
ips=1;
else
end
B(i:i+7,j:j+7)=C;
end
end
for i=1:8:m;
for j=1:8:n;
DD=B(i:i+7,j:j+7);
%DD=DD.*DC;
D(i:i+7,j:j+7)=idct2(DD);
end
end
figure(1)
imshow(A,map)
figure(2)
imshow(D,map)
ips=1;
jps=1;
for i=1:8:m;
for j=1:8:n;
DD=B(i:i+7,j:j+7);
DD(1,3)=ps(ips,jps);
DD(2,2)=ps(ips+1,jps);
DD(3,1)=ps(ips+2,jps);
ips=ips+3;
if(ips>12)
jps=jps+1;
ips=1;
else
end
D(i:i+7,j:j+7)=idct2(DD);
end
end
figure(3)
imshow(D,map)
i need to take figure 3 and do what i wrote in the Q.
any help please??

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!