Sir, Iam doing a matlab project on reconstruction of image using circulant matrices. The code is below. Whilw performing multiplication (r1=img*r)

1 view (last 30 days)
img=imread('car.jpg');
imshow(img);
rchan = img(:,:,1); % Red channel)
gchan = img(:,:,2); % Green channel
bchan = img(:,:,3); % Blue channel
[row1,column1] = size(rchan);
[row2,column2] = size(gchan);
[row3,column3] = size(bchan);
rvect=reshape(rchan,[],1);
gvect=reshape(gchan,[],1);
bvect=reshape(bchan,[],1);
A=[rvect(:),gvect(:),bvect(:)];
c=cov(double(A));
imshow(rchan);
j=(c(1,1)+c(2,2)+c(3,3))/3;
k=(c(1,2)+c(2,3)+c(1,3))/3;
l=(c(1,3)+c(1,2)+c(2,3))/3;
m=[j k l;l j k;k l j];
[V,D,M]=eig(m);
r=V;
s=V(:,2:3);
t=V(:,1);
r1=img*r;
s1=img*s;
t1=img*t;
x=reshape(r1,row1,column1,[]);
y=reshape(r2,row2,column2,[]);
z=reshape(r3,row3,column3,[]);
imshow(x);
imshow(y);
imshow(z);
error
Error using *
MTIMES is not fully supported for integer classes. At least one input must be scalar.
To compute elementwise TIMES, use TIMES (.*) instead.
Error in dsp2 (line 30)
r1=img*r;

Answers (2)

madhan ravi
madhan ravi on 20 Oct 2018
Try as the message says:
r1=img.*r;
s1=img.*s;
t1=img.*t;
  12 Comments
Rik
Rik on 20 Oct 2018
Then make sure they are the same class. You can convert them all to a double, or put them all in uint8 (which I'm guessing is the class of img and therefore A)

Sign in to comment.


Aditya C
Aditya C on 20 Oct 2018
here is the image used

Categories

Find more on Create and Run Performance Tests in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!