fill a matrix from an im age

1 view (last 30 days)
firdaoues
firdaoues on 6 May 2014
Commented: Sven on 6 May 2014
val=zeros(R,C);
val=double(val);
val(1,1)=img(1,2)+img(2,2)+img(2,1);
val(1,C)=img(1,C-1)+img(2,C-1)+img(2,C);
val(R,1)=img(R,2)+img(R-1,1)+img(R-1,2);
val(R,C)=img(R,C-1)+img(R-1,C)+img(R-1,C-1);
for i=2:C-1
val(1,i)=abs(img(1,i+1)-img(1,i-1))+img(2,i-1)+img(2,i)+img(2,i+1);
val(R,i)=abs(img(R,i+1)-img(R,i-1))+img(R-1,i-1)+img(R-1,i)+img(R-1,i+1);
end
%%img a grayscale image
%%[R,C]=size(img)
%%this code gives me a wrong results can any one help me???????????
  1 Comment
Sven
Sven on 6 May 2014
The results look right to me.
But wait, you say... how can this guy know that the results are right? I haven't even described what I'm looking for!
... exactly.

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with MATLAB 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!