Comments [Description] This comment is for reference only, and the marking groups in each division make comments independently according to their own understanding of the topic and the students' answers.
This topic requires extracting appropriate features from the data, establishing a reasonable and effective model, and splicing and restoring the paper pieces. The characteristics that can be considered are the matching of adjacent gray vectors, the sum of gray levels by row or column, and the row spacing. Regarding the algorithm model, there should be specific algorithm flow (such as flow chart, algorithm description, pseudo code, etc. ) and design principles. Although the correct recovery result is unique, the quality of students' solutions can not be judged only by the recovery effect provided by students, but by mathematical models, solving methods and calculation results (such as recovery rate). On the other hand, the amount of manual intervention and the rationality of intervention time nodes need to be considered in the evaluation. Question 1. The recovery problem of text with only vertical cutting has obvious information characteristics because of "only vertical cutting" and large paper. An intuitive modeling method is to define the (asymmetric) distance between two segments according to certain characteristics, and establish an optimization model by using the idea of optimal Hamilton path or optimal Hamilton cycle (TSP). There are many ways to solve TSP, and students should pay attention to the characteristics of asymmetric distance matrix or directed graph when solving TSP. There may also be various optimization models and algorithms, which should be recognized as long as the models are reasonable and the repair effect is good. This problem is relatively simple, the recovery process can be completed without manual intervention, and the recovery rate can approach or reach 100%. Question 2. An intuitive modeling method for horizontal and vertical cutting text recovery is: firstly, using the line information characteristics of text files, a clustering model of segments in the same line is established. After the row clustering results are obtained, the sorting of each row of fragments is completed by using a method similar to the problem 1. Finally, the sorted rows are sorted vertically. There are also various solutions to this problem, and the models and methods should be graded according to their rationality, innovation and effectiveness. For example, considering the close-up of four neighbors, it is also a natural idea that the debris grows step by step. Question 3. The problem of restoring both sides of the text is a continuation of problem 2, and the basic solution is the same as problem 2. But the difference is that we need to make full use of the feature information of double-sided characters here. These feature information can be well used to improve the recovery rate. In the process of marking papers, students' expansion of questions can be considered. For example, in the model test, if students can build their own fragments to test and evaluate the restoration effect of the mosaic restoration model proposed by our team, they can consider adding points appropriately. There should be a program when marking papers, and the running results of the program should be consistent with the results given in the test paper.
Clear% free space
Clc% clear screen
% image data reading
left _ col =[];
right _ col =[];
For fp = 0: 208
str = int 2 str(FP);
If fp< 10
name = ['0' '0' str '。 BMP '];
elseif fp & gt= 10 & amp; fp & lt 100
name = ['0' str '。 BMP '];
other
name = [str '。 BMP '];
end
A = imread (name);
[m, n] = size (a);
left_col = [left_col a(:, 1)];
right_col = [right_col a(:,n)];
end
% has finished reading
left _ col = double(left _ col); % type conversion
Right_col = double (right column);
% Find all columns whose leftmost (left_col) pixels are all 255 (blank).
row = 1;
For bi =1:209;
Number = length (find(left_col (:,bi) = = 255);
If quantity == 180
S(row, 1)= bi; The pixel in the first column of% Save is empty (gray value: 255) and put it in the first column of array S.
row = row+ 1;
end
end
S = [S (:,1) zeros (row- 1,18)]; % matrix initialization
O = [ones(row- 1, 19)]; % Initialize a identity matrix.
sign = 1;
w = 0;
For r =1:row-1; % line
For p =1:18; % column p+ 1
num = 1000000000; % makes num large enough
For j =1:209;
count = 0;
count = length(find(S = = j)); % eliminate duplication
If count ~= 0
Continue;
other
Blank = length (find(right_col (:,S(r, p)) = = 255); % If all the blanks on the right side of the draft paper are 255 (blank), jump out and terminate the splicing behind this line.
If blank == 180
Symbol = 0;
Break; % jump out of this loop and enter the p loop.
other
ri=right_col(:,S(r,p)); % Calculate the left and right stitching accuracy
le=left_col(:,j);
c = ri-le;
c = c.^2;
error = sum(c(:);
end
If num>= error%, find the one with the smallest difference and the highest accuracy.
Num = error;
w = j;
end
end
end
If the symbol == 0
sign = 1;
Break; % jumped out of the P cycle and entered the R cycle.
other
S(r,p+ 1)= w; The% 2D array stores the splicing position of each piece of paper.
end
end
end
S = S-O; % data collation, the picture starts with 000.bmp, and the array subscript starts with 1
//////////////////////////////////////////////////////////////////////////
The third problem is the characteristic classification code of waste paper:
Clear% free space
Clc% clear screen
% image data reading
char namea = (209,7);
char nameb = (209,7);
For fpa = 0: 208
str = int 2 str(FPA);
If FPA< 10
FPA = FPA+ 1;
namea(fpa,:=[' 0 ' ' 0 ' str ' a . BMP '];
elseif fpa & gt= 10 & amp; fpa & lt 100
FPA = FPA+ 1;
namea(fpa,:=[' 0 ' str ' a . BMP '];
other
FPA = FPA+ 1;
namea(fpa,:=[str ' a . BMP '];
end
end
For afp = 1:209
a= imread(namea(afp,);
fdataa(:,:,AFP)= a;
end
%%% read the data of reverse B.
For fpb = 0: 208
str = int 2 str(fpb);
If fpb <10
fpb = FP b+ 1;
nameb(fpb,:=[' 0 ' ' 0 ' str ' b . BMP '];
elseif fpb & gt= 10 & amp; fpb & lt 100
fpb = FP b+ 1;
nameb(fpb,:=[' 0 ' str ' b . BMP '];
other
fpb = FP b+ 1;
nameb(fpb,:=[str ' b . BMP '];
end
end
For bfp = 1:209
b= imread(nameb(bfp,);
fdatab(:,:,BFP)= b;
end
% has finished reading
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Qfdataa = ~ fdataa% inversion
Qfdatab = ~ fdatab% inversion
For lj = 1:209% line cumulative sum
Ldataa(:,lj) = sum(qfdataa(:,:,lj),2); % before (a) cumulative total
Ldatab(:,lj) = sum(qfdatab(:,:,lj),2); % negative (b) cumulative sum
end
Ldataa(Ldataa & gt; 0)= 1; Positive normalized percentage
Ldatab(Ldatab & gt; 0)= 1; Negative normalized percentage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% data classification transverse front (a) classification
for flta = 1:209;
For pflta = 1:209.
numa = 0;
For flha =1:180;
if Ldataa(flha,flta) == Ldataa(flha,pflta)
numa = numa+ 1;
end
end
tsavea(flta,pf LTA)= numa; % Save the matching degree between every two pictures.
end
end
% data classification horizontally reversed (b) classification
for fltb = 1:209;
For pfltb = 1:209.
number = 0;
For flhb =1:180;
If Ldatab(flhb, fltb) == Ldatab(flhb, pfltb)
number = number+ 1;
end
end
tsaveb(fltb,pfl TB)= number; % Save the matching degree between every two pictures.
end
end
%%%%%%%%%%%%%%%%%%%%%%%
Total matching degree%
% ts ave =(ts avea+ts aveb)/2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Find all columns whose leftmost (left_col) pixels are all 255 (blank).
% fdataa = double(fdataa);
% fdatab = double(fdatab);
row = 1;
For bi =1:209;
number=length(find(fdataa(:, 1,bi)~ = 0 & amp; fdatab(:,72,bi)~ = 0));
If quantity == 180
S(row, 1)= bi; The pixel in the first column of% Save is empty (gray value: 255) and put it in the first column of array S.
row = row+ 1;
end
end
S = [S (:,1) zeros (row- 1,18)]; % matrix initialization
O = [ones(row- 1, 19)]; % Initialize a identity matrix.
%%%%%%%%%%%%%%%%%%