Construction of Resampling matrix and Zeroing mask Derivation for an image

Status
Not open for further replies.

TGupta

Newbie level 6
Joined
Feb 28, 2013
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,343
Hi,
Can anybody tell me how to construct resampling matrix using linear transformation of form y = (Ap/q) x ,where Ap/q is resampling matrix and x is the input signal and y is output signal
And also how to multiply such matrix with an image as I am getting errors.Also how to do zeroing mask derivation.
Here is my code for resampling matrix construction.

CODE:

clc
clear all
p=input('Value of p:');
q=input('Value of q:');
x=imread('C:\Users\Tushar\Desktop\tulips.jpg');
R = double(x,:,1));
G = double(x,:,2));
B = double(x,:,3));
[m1,n1]=size(R);
disp(m1);
disp(n1);
for i=1p + 1)
for j=1q + 1)
A(i,j)=0;
A(1,1)=1;
A((p+1),(q+1))=1;
end
end
%j=1;
for i=2ceil((p+1)/2))
j=1;
%if ((mod(abs(p-(i*q)),p)<mod(abs(p-((i + 1)*q)),p)))
if(mod(i,2)==0)
%j=j+1;
A(i,j)=mod(abs(p-((i+1)*q)),p)/p;
A(i,(j + 1))=1-A(i,j);
end
% A((p+2)-i,(q+2)-j)=A(i,j);
% A((p+2)-i,(q+1)-j)=A(i,(j + 1));
%if ((mod(abs(p-(i*q)),p)>mod(abs(p-((i + 1)*q)),p)))
if(mod(i,2)~=0)
j=j+1;
A(i,j)=mod(abs(p-((i+1)*q)),p)/p;
A(i,(j + 1))=1-A(i,j);
end
A((p+2)-i,(q+2)-j)=A(i,j);
A((p+2)-i,(q+1)-j)=A(i,(j + 1));
%end
end
disp(A);
B=repmat(A,[m1,n1]);
%disp(B);
y= A.*[R), G), B)]';
imshow;

Thanks in advance
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…