Files=dir (' C: \ Users \ Zhou Ziwei \ Desktop \ project related \ scraps of paper \ \ *. Annex 1 PNG ');
% bulk load imageImage=cell (1, the size (files, 1)) % define a tuple
For n=1: numel (files)
Image {n}=imread ([' C: \ Users \ Zhou Ziwei \ Desktop, finish up, scraps of paper, annex 1 \ ', files (n). The name]);
End
[h, z]=size (image {1, 1}); % to calculate the size of the image matrix (row, column)
% takes the most left and right column only grey correlation analysis
N % byz stored images, the left column (1980 lines, n columns)
For k=1: n
Byz (:, k)=image} {1, and k (:, 1); % will be the first images of the left-hand column k into the matrix byz the first column k
Byy (:, k)=image} {1, and k (:, z); % will be the first k the right side of the picture of a column in the matrix byy the first column k
End
% using margins in the first picture
For I=1: n % traverse all those pictures in attachment 1
Sum=0;
For j=1: h % traversal pictures every row of the left column
If byz (j, I)==255% to calculate the number of 255
Sum=sum + 1;
The else
break;
End
End
If the sum==h % if the following number and line number 255, shows that he belongs to the first picture
F=I;
End
End
Paixu=zeros (1, n); Definition of % n column, which is used to sort
The index=1;
Paixu (index)=f; % to choose the first picture