sir, i need 1X4 1024 v vectors,v is prediction coefficient.why am insisting in int class is,i need to further embed bits into the original image based on error value.my actual work is watermarking .when i embed the bits into image(using double class),the watermarked image is blank(fully white).
??? Error using ==> mtimes MTIMES is not fully supported for integer classes. At least one input must be scalar. Error in ==> lpre at 16 v(:,:,k)=(inv(X'*X))*X'*y;%errror coefficients
1 view (last 30 days)
Show older comments
hello
I have taken 256*256 image. i need to find linear prediction for the image using four neighbours.Then i need to calculate error values.while doing this prediction, i get error in the particular line.
clc;
clear all;
close all;
a=imread('E:/celulas.jpg');
[m n]=size(a);
B = padarray(a,[1 1]);
[m1 n1]=size(B);
A=B;
%linear prediction
k=1;
for i=2:(m1-1)
for j=2:(n1-1)
A(i,j)=(B(i-1,j)/4)+(B(i+1,j)/4)+(B(i,j-1)/4)+(B(i,j+1)/4);%replacing center value with 4 neighbours
X=[B(i-1,j);B(i+1,j);B(i,j-1);B(i,j+1)];%context vectors
y=B(i,j);
*v(:,:,k)=(inv(X'*X))*X'*y;%errror coefficients*-getting error in this line
xhat=v(:,:,k)*X;%predicted pixel
yhat(i-1,j-1)=xhat;%predicted image
e(i-1,j-1)=abs(B(i-1,j-1)-xhat);
k=k+1;
B(i,j)=A(i,j);%updating the value
end
end
but when i convert image into double ,i dont get error why?-without changing the format i want to get the values.kindly provide me suggestions thanks in advance
Answers (1)
Matt J
on 20 Aug 2014
Edited: Matt J
on 20 Aug 2014
You should convert to double as you have done. There's no clear reason to prefer integer format for what you are doing and the operations you are doing are not defined for integers in any case. I would, however, recommend that you re-implement the calculation of v(:,:,k) as follows
v(:,:,k)=X\y; %instead of (inv(X'*X))*X'*y;
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!