image iteration

Hi there, I have this set of images as shown, I found the centroid of each by using the code below, now I stored the new images in Im01,Im02,Im03, and they are all N by N matrix images.
Im1 = imread('image1.png');
[x,y] = ait_centroid(Im1);
Im01=circshift(Im1, [-1 -5]);
[x,y] = ait_centroid(Im01);
Im01=uint16(Im01);
Im2 = imread('image2.png');
[x,y] = ait_centroid(Im2);
Im02=circshift(Im2, [-2 -4]); [x,y] = ait_centroid(Im02);
Im02=uint16(Im02);
Im3 = imread('image3.png'); [x,y] = ait_centroid(Im3); Im03=circshift(Im3, [-3 -5]); [x,y] = ait_centroid(Im03); Im03=uint16(Im03);
my challenge is how to add this images using iteration cos i hav a large set of images(not jst the 3 images) im working on.I was able to add them manually n show the mean by doin this
G=imadd(Im01,Im02,'uint16'); G=imadd(G,Im03,'uint16'); imshow(uint8(G/3),[]);
and it worked.But when I tried iterating by doin this
G=imadd(Im01,Im02,'uint16'); for i=1:1:3 G=imadd(G,Im(i),'uint16'); end
I get error, I also tired to define the images as a matrix of a matrix by
H = [ [Im01] [Im02] [Im03] ] G=imadd(Im01,Im02,'uint16'); for i=1:1:3 G=imadd(G,H(i),'uint16'); end image error indicates in H(i)..Please I need help, thanks.

2 Comments

Oleg Komarov
Oleg Komarov on 10 Apr 2011
Report the full error message.
kiki
kiki on 11 Apr 2011
first error
??? Undefined function or method 'Im' for input arguments of type 'double'.
Error in ==> lodexamp at 168
G=imadd(G,Im(1),'uint16');
the second error
Error in ==> picstest at 166
G=imadd(G,H(i),'uint16');

Sign in to comment.

 Accepted Answer

Walter Roberson
Walter Roberson on 10 Apr 2011

0 votes

3 Comments

kiki
kiki on 10 Apr 2011
Thanks for the links,have seen before,I do understand some of the explanations but I haven't been able to achieve my aim because I cant interpret some of the codes, Im still learning matlab.
Walter Roberson
Walter Roberson on 11 Apr 2011
Where you have Im01 change it to Im{1} . Where you have Im02, change it to Im{2}. Where you have Im(i) change it to Im{i}
kiki
kiki on 11 Apr 2011
Thanks a bunch.It worked!

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!