i'm using matlab for image correlation. in my program i have to read 15 or 20 images one by one and correlate them with the 1st one, i.e. at first
image2 will be correlated with image1, and then
image3 will be correlated with image1, and then
image4 will be correlated with image1, and so on...
so i wrote a .m file in MATLAB to read the images and give the correlation coefficient as output. now the problem is that each time i run the .m file, I have to change the index of the image manually, i.e. if i have run the program once with two images namely 'apple1.tiff' and 'apple2.tiff', then I have to change the 2nd image to 'apple3.tiff' manually in the program body to run the program for correlation of 'apple3.tiff' with 'apple1.tiff'. so as you see I have to change the image name (i.e. the serial no. 1, 2, 3 ... after 'apple') in the .m file manually for 20 times to correlate 20 images with 1st one ('apple1.tiff').
So please help me to write a command in my .m file (program) so that i have to give only the no. of images and write the name of 1st image (e.g. 'apple1.tiff') in the program body and the program itself will read the next images ('apple2.tiff' to 'apple20.tiff') one by one.
here is the simple code i'm using in my .m file to read two images
and correlate them:
im1=imread('apple1.tiff'); //imread is the read command.
r=corr2(im1,im2); // corr2 is a inbuilt function of matlab
Now please help me to write a for loop or any other way so that only 'apple2.tiff' changes to 'apple3.tiff', 'apple4.tiff' and so on when the program runs..
the 1st image i.e. 'apple1.tiff' will remain the same.
please reply. I thank U in advance....