# Reconstruction of Shredded Paper Documents by Feature Matching

Authors: Peng Li; Xi Fang; Lianglu Pan; Yi Piao; Mengjun Jiao
Journal: Mathematical Problems in Engineering
 (2014)

---

## Abstract

Splicing the shredded paper means the technology that, according the paper, which has been shredded to design a particular algorithm to splice and recover the original paper. This paper introduced the algorithm of splicing the shredded paper based on the matching to texture feature. By means of this algorithm, we modeled for the problem of splicing the shredded paper and solved it. And, we used the algorithm to splice both pieces of English shredded paper and Chinese shredded paper. The recovered paper had proved the accuracy of the algorithm.


---

## Body

## 1. Introduction

Repairing of fragments is important in that it can be applied to many areas such as restoration of archeological findings, the obtainment of modern war information. A direct and valid way is splicing the fragments manually. But when there was a huge quantity of the fragments, splicing manually would consume vast human resources [1]. Even during the process of splicing some valuable fragments might be damaged by workers unintentionally. Along with the development of technology, more and more people tried to resolve this type of problem which could be attributed to the problem of how to repair the 2D fragments. As the typical problem of repairing of 2D fragments, the technology of splicing the shredded paper had received much more attention than before. In many cases, people need to recover the shredded paper which may carry some important information. Those pieces of paper might be shredded by shredder or some other ways. For now, to achieve the solution of this problem, researchers had proposed various algorithms. However, there were some limitation existed in many main trend of the splicing technologies [2]. This paper introduced the algorithm based on the matching to texture feature. This algorithm is modeled for the paper which had been shredded only in lengthwise or been shredded horizontally and vertically. In the process of solving the problem, we also designed the different details for both kinds of shredded paper whose text was printed in English and Chinese.This paper described the main problems of splicing the shredded paper and proposed the core algorithm of the matching to texture feature. Afterwards, this paper discussed the solutions for the all those problems in two conditions in which the text was printed in English and Chinese. Results showed that the proposed algorithm is efficient. And finally, there would be a summary of the recovered result.


## 2. Main Problem and Assumption

Based on the paper which had been shredded in different ways, there were the following problems to be solved.(1)
For shredded paper which was cut in lengthways from the same page of file, it was necessary to build the corresponding mathematical model and algorithm.
(2)
Given the condition that the paper had been shredded either horizontally or vertically, we should model the corresponding mathematical model and algorithm which is certainly different from(
1
).
(3)
Under the condition in Problem 2, we took the further consideration that the document had been printed double-sided which had made it more difficult to complete the reconstruction of shredded paper. Based on the model from the above problem, we should propose an advanced algorithm to deal with this problem.
(4)
There was a conclusive difference that height of the word was not consistent between the English text and Chinese text.In this paper, the model of those problems was presented based on the following necessary and reasonable assumptions.(1)
The text form from exactly the same paper was consistent basically.
(2)
There was no piece of shredded paper lost.
(3)
The size of each piece of the shredded paper was identical.
(4)
The paper was shredded paper regularly.
(5)
The direction of the shredded paper was consistent.All the conclusions which yield from this paper were based on the above assumptions. And it was worth noting that at some point the shredded document might need to be preprocessed to make sure that all pieces of paper satisfied the assumptions. For instance, when the text of paper was oblique or distorted for reason of wet, we should have to do further preprocess to correct it before the pieces of paper were scanned into computer.


## 3. Modeling and Solving for Problem: Repairing of Shredded English Paper

### 3.1. Analysis for Problem  1

For shredded paper which was cut in lengthways from the same page of file, we take the shredded paper in Figure1 for an example while modeling the mathematical model and algorithm. From Figure 1 we could see that the paper had been shredded to 19 pieces.Figure 1
Scanning copies of the 19 pieces of shredded paper.The scanning copies shown in Figure1 had never been handled with some preprocessing software. And in fact, nearly more than half of the pieces need to be preprocessed for various reasons such as wrinkled surface of paper. The scanning copies mentioned in this paper were the results of this kind of preprocessing.To solve this problem, firstly, we would quantify the pixel from the left and right edge of the shredded paper, which could yield matching degree-matrix for each piece of shredded paper. In this case, the match degree expressed the similarity for splicing [3]. Judgment of the left edge of each piece could help us determine the right piece which was from the left edge of the original file as the first piece. Then, we would select another piece of shredded paper and splice both pieces with each other. This selected piece should have the highest match degree with the right edge of the first piece. By this analogy, we could deduce that when processing the ith splicing, we would also select the adjacent piece by judging the match degree. Finally, we can get the correct splicing result of the original file.For the shredded paper in Figure1, we can do the binarization of pixel from the edge of each piece of the shredded paper by programming. There were n pixels which composed the left and right edge of the piece of shredded paper [4]. Suppose that vector x
i is the binarization of the pixel from the left edge of the ith piece and vector y
i is the binarization of the pixel from right edge. In addition,
(1)
x
i
=
(
x
i
1
,
x
i
2
,
…
,
x
i
n
)
T
,
y
i
=
(
y
i
1
,
y
i
2
,
…
,
y
i
n
)
T
.And then, we could define the number of the pixel matching of the right edge of theith piece and the left edge of the jth piece as
(2)
a
=
∑
i
=
1
n
x
i
k
y
j
k
,
b
=
∑
i
=
1
n
y
j
k
(
1
-
x
i
k
)
,
c
=
∑
i
=
1
n
x
i
k
(
1
-
y
j
k
)
,
c
=
∑
i
=
1
n
(
1
-
x
i
k
)
(
1
-
y
j
k
)
.There was a necessary introduction that in the result of the binarization the value “1” represented the black pixel and “0” represented the white [5]. Thereinto, the symbol a is the (1-1) matching number of vector x
j and vector y
j. Analogously, the symbol b is the (0-1) matching number, the symbol c is the 1-0 matching number, the symbol d is the (0-0) matching number.The matching measure of binary vector is obtained by method of simple match coefficient:(3)
δ
i
j
=
a
+
d
a
+
b
+
c
+
d
.In the above equation, the numerator is the sum of the matching number of (1-1) and (0-0). The denominator is the sum of all the numbers.By that analogy, we can get the matching degree of left and right edge of any pieces withinm pieces of shredded paper:
(4)
δ
=
(
δ
11
δ
12
⋯
δ
1
m
δ
21
δ
22
⋯
δ
2
m
⋮
⋮
⋮
δ
m
1
δ
m
2
⋯
δ
m
m
)
m
×
m
.The symbolδ
i
i represented the matching degree of both the left and right edges of the ith piece. It meant nothing.Through running the program we could regard the certain piece (“008” piece) as the part of the left edge of the original paper for the reason that the “008” piece of shredded paper had the regular blank on its left edge. So we chose 008 as the beginning of our splicing work.We would get vectors of the “008” and other pieces of shredded paper.(5)
δ
8
=
(
δ
81
,
δ
82
,
…
,
δ
8
m
)
.From the matching vector we can know that the “014” piece has the maximum similarity with the 008 piece of shredded paper. So we spliced the 014 piece and the 008 piece as the first step.Then, we would get vectors of the “014” and other pieces of shredded paper:(6)
δ
14
=
(
δ
141
,
δ
142
,
…
,
δ
14
m
)
.Following the above steps until all pieces of the shredded paper had been spliced we could recover the original paper. The correct order was 3-6-2-7-15-18-11-0-5-1-9-13-10-8-12-14-17-16-4.The result of the repairing of English shredded paper was showed as Figure2.Figure 2
Result of the reconstruction of English shredded paper.


### 3.2. Analysis for Problem  2

For this problem we should design for the model that the paper had been shredded either horizontally or vertically. Here we took the following shredded paper for example in Figure3. The paper has been shredded into 11(lines) * 19(rows) pieces.Figure 3
Scanning copies of the 209 pieces of shredded paper.


#### 3.2.1. Solving Idea and Method

Supposed that all pieces of the shredded paper had been splicing regularly so we could get a11
*
19 grid. Each piece of the shredded paper could be located by its (x
,
y) coordinate. To simplify the whole problem, we might as well ignore the row coordinate y at first. At this point we should only determine the line coordinate x of each piece of shredded paper.We supposed further that the pieces of shredded paper in each line had already been spliced in correct sequence [6]. And then, we only needed to get the sequence of all the 11 lines of shredded paper. We defined symbol d as the distance of pixels between the bottom of the text in the first line and the top of the piece of shredded paper. By using inequality and enumeration method we could get the d values of all the 11 lines. And by comparing the d values of lines with the d value of each piece of shredded paper we can get the line coordinate x of the latter (based on the actual situation, this paper considers that the d values of the shredded paper from the same line in original paper were identical).Up to this point, essentially, the Problem 2 was simplified into Problem 1. We could easily recover the shredded paper by using the model and algorithm that were proposed in Problem 1.


#### 3.2.2. Preprocessing of Data

To get thed values of all the 11 lines, it was necessary to do the preprocessing of data of shredded paper. We defined the height of row h as the pixel distance between the bottom of the text in the nth line and the bottom of the text in the (n
-
1)th line. For the English shredded paper, there was the significant difference in values of h between each other [7]. On the basis of this characteristic, we could get the area which had the high concentration of pixels by progressive scanning technology of pixel. Through this method, we could get the height of row h.As we all know, some letters occupied additional space like “d,” “b,” “p,” “q,” and so on. When there was a sentence which was constituted by letters, the black pixel proportion of the middle part of the sentence on the paper was not uniform [8]. Take the word “public,” for example, the frequency distribution of black pixel was showed as Figure 4.Figure 4
Frequency distribution of black pixel.It was obvious from Figure4 that the black pixels concentrated on the middle part of the whole word. In view of the above, this paper selected the way of scanning the shredded paper from top to bottom to get the line which has the maximum sudden-change of black pixel. From this we might judge the location of the line from the original paper. In this case, we defined the bottom of the text as the third dotted line. Then we could get the height of the row h
=
64 pixel.


#### 3.2.3. Modeling and Solving

As previously stated, we would ignore the sequence of the line of the shredded paper. At this point, we supposed that all pieces of the shredded paper had been splicing correctly as before. We modeled 9 pieces of shredded paper for analysis.As Figure5 showed, the rectangular boxes which were circled by thick lines meant a piece of shredded paper. While the rectangular boxes with the dotted lines represented the lines of text.Figure 5
9 pieces of shredded paper model.The symbolH was the pixel height of the line of the shredded paper. From the pieces of shredded paper we could get that the H of each piece of shredded paper was 180 pixels and the line coordinated x
=
1,2
,
…
,
11. The symbol h was the height of the word. Thus, we might get the pixel distance d by the following method.Suppose that the lines of the text werem,; we could get the minimum positive integer which meet the inequality that m
h
-
x
H
>
0. Do plug m into the following formula:
(7)
d
x
+
1
=
m
H
-
x
H
.Then we could obtain the value ofd of (
x
+
1
)th.For example, assuming thed
1 value of first line of the shredded paper, we used the following process to get the value of d
2 and d
3.Whenx
=
1, we could know the d
2
=
68
m
-
1
*
180. From this equation we could easily work out that m
=
3. So d
2 is 24 pixels.And whenx
=
2, with the same method, we can know that d
3 is 48 pixels.By that analogy, we could obtain all thed values of each line of shredded paper, and then we would get the right order of each line of shredded paper.By using of the model in Problem 1, we could get the row coordinatey. When we got all the coordinates (x
,
y) we could locate all pieces of the shredded paper. And the final result is shown as Figure 6.Figure 6
The result of the reconstruction of English shredded paper.


### 3.3. Analysis for Problem  3

Based on the Problem 2, the purpose of the Problem 3 was to repair the shredded paper which was printed double-sided. It posed a new problem that before repairing the shredded paper we should identify whether the shredded paper was the front or the back side of the original paper. Through the relation between thed value and line coordinate of shredded paper we could obtain the row coordinate of shredded paper. And then, the problem came down to an easier problem: sorting and splicing of shredded paper which was printed double-sided in the same line of the original paper.


#### 3.3.1. Solving Idea and Method

As previously stated, we should identify the front and back of the shredded paper while sorting and splicing them. Given that the text of both sides has the same line height, firstly, we can still use the model in Problem 2 to get the correspondence of the row coordinate of the shredded paper and the value ofd. By calculating the value of d of each piece of shredded paper, we could get the row coordinate of each of them. Then, the problem was simplified into an easier problem of how to sort and splice both sides of the shredded paper which were on the same row. This paper introduced a new concept: sum-similarity [9]. While we were splicing two pieces of shredded paper, both sides of the shredded paper would generate the similarity of splicing on the edge of themselves [10]. And, the sum-similarity is the summation of both two values of similarity. For the shredded paper which was printed on both sides, there would have been two conditions which would generate two sets of sum-similarity. Consequently, the identification of the front and back of the shredded paper was turned into the comparison between the two sets of the sum-similarity. Afterwards, we would always take out the piece of shredded paper which had the maximum sum-similarity splicing with the special piece of shredded paper at every turn. Finally, we could get the recovered paper.


#### 3.3.2. Modeling and Solving

By the conclusion based on Problem 2, we could obtain thed value of each piece of the shredded paper which would yield the line coordinate of each piece. Suppose that the two sides of each piece of shredded paper had been named A and B side as well as the original paper. And we supposed further that the text in A side of the shredded paper ought to belong to the A side of the original paper. So, there were two cases to be considered when the tth piece was splicing with (t
+
1)th piece of shredded paper under the condition when both pieces came from the same line of the original paper.Case 1.
When we were splicingtth piece of shredded paper with (t
+
1)th piece, the A side of tth piece should be spliced with the A side of (t
+
1)th piece as well as their B sides. And at this point there would lead to two similarities of splicing. Then we could get the overall similarity by summing the two similarity of splicing. The exact process was showed as Figure 7.Figure 7
Flowchart for the process in Case1.Case 2.
When we were splicingtth piece of shredded paper with (t
+
1)th piece, the A side of tth piece should be spliced with the B side of (t
+
1)th piece while the B side of tth piece was spliced with the A side of (t
+
1)th piece, there would also lead to two similarities of splicing refer to Case 1. Certainly, we would get the overall similarity by the same way.After that, we could choose the most special piece of shredded paper through the program such as the piece which was from the left edge of the original paper. We defined this piece of shredded paper as the first piece. This way, when we try splicing the rest of 18 pieces of shredded paper with the first piece, there would be 36 values of overall similarity. By the algorithm in Problem 1, we chose the piece which had the maximum similarity to splice with the first piece.By that analogy, we would foresee that when we sort theith piece, there would be 2
*
(
19
-
i
) values of overall similarity. We would always take out the piece of shredded paper which had the maximum sum-similarity splicing with the special piece of shredded paper at every turn until all pieces of shredded paper had been spliced. By that point, we might obtain the result of reconstruction of shredded paper as Figures 8 and 9 showed.Figure 8
The result of the reconstruction of text from A side in English shredded paper printed double-sided.Figure 9
The result of the reconstruction of text from B side in English shredded paper printed double-sided.Finally, a summary of the time performance of this algorithm could be described by Figure10.Figure 10
Time performance of the algorithm for shredded document.Figure10 had shown the relation between the number of fragments in a certain line and the time consumption when the algorithm was used to splice the double-sided of shredded paper. For an 11(lines) * 19(rows) double-sided shredded paper the algorithms would consume no longer than 10 milliseconds. From Figure 10 we could learn that there was a nonlinear relationship between the time consumption and the number of fragments. The time complexity of the algorithm could be expressed as o
(
n
2
).


## 3.1. Analysis for Problem  1

For shredded paper which was cut in lengthways from the same page of file, we take the shredded paper in Figure1 for an example while modeling the mathematical model and algorithm. From Figure 1 we could see that the paper had been shredded to 19 pieces.Figure 1
Scanning copies of the 19 pieces of shredded paper.The scanning copies shown in Figure1 had never been handled with some preprocessing software. And in fact, nearly more than half of the pieces need to be preprocessed for various reasons such as wrinkled surface of paper. The scanning copies mentioned in this paper were the results of this kind of preprocessing.To solve this problem, firstly, we would quantify the pixel from the left and right edge of the shredded paper, which could yield matching degree-matrix for each piece of shredded paper. In this case, the match degree expressed the similarity for splicing [3]. Judgment of the left edge of each piece could help us determine the right piece which was from the left edge of the original file as the first piece. Then, we would select another piece of shredded paper and splice both pieces with each other. This selected piece should have the highest match degree with the right edge of the first piece. By this analogy, we could deduce that when processing the ith splicing, we would also select the adjacent piece by judging the match degree. Finally, we can get the correct splicing result of the original file.For the shredded paper in Figure1, we can do the binarization of pixel from the edge of each piece of the shredded paper by programming. There were n pixels which composed the left and right edge of the piece of shredded paper [4]. Suppose that vector x
i is the binarization of the pixel from the left edge of the ith piece and vector y
i is the binarization of the pixel from right edge. In addition,
(1)
x
i
=
(
x
i
1
,
x
i
2
,
…
,
x
i
n
)
T
,
y
i
=
(
y
i
1
,
y
i
2
,
…
,
y
i
n
)
T
.And then, we could define the number of the pixel matching of the right edge of theith piece and the left edge of the jth piece as
(2)
a
=
∑
i
=
1
n
x
i
k
y
j
k
,
b
=
∑
i
=
1
n
y
j
k
(
1
-
x
i
k
)
,
c
=
∑
i
=
1
n
x
i
k
(
1
-
y
j
k
)
,
c
=
∑
i
=
1
n
(
1
-
x
i
k
)
(
1
-
y
j
k
)
.There was a necessary introduction that in the result of the binarization the value “1” represented the black pixel and “0” represented the white [5]. Thereinto, the symbol a is the (1-1) matching number of vector x
j and vector y
j. Analogously, the symbol b is the (0-1) matching number, the symbol c is the 1-0 matching number, the symbol d is the (0-0) matching number.The matching measure of binary vector is obtained by method of simple match coefficient:(3)
δ
i
j
=
a
+
d
a
+
b
+
c
+
d
.In the above equation, the numerator is the sum of the matching number of (1-1) and (0-0). The denominator is the sum of all the numbers.By that analogy, we can get the matching degree of left and right edge of any pieces withinm pieces of shredded paper:
(4)
δ
=
(
δ
11
δ
12
⋯
δ
1
m
δ
21
δ
22
⋯
δ
2
m
⋮
⋮
⋮
δ
m
1
δ
m
2
⋯
δ
m
m
)
m
×
m
.The symbolδ
i
i represented the matching degree of both the left and right edges of the ith piece. It meant nothing.Through running the program we could regard the certain piece (“008” piece) as the part of the left edge of the original paper for the reason that the “008” piece of shredded paper had the regular blank on its left edge. So we chose 008 as the beginning of our splicing work.We would get vectors of the “008” and other pieces of shredded paper.(5)
δ
8
=
(
δ
81
,
δ
82
,
…
,
δ
8
m
)
.From the matching vector we can know that the “014” piece has the maximum similarity with the 008 piece of shredded paper. So we spliced the 014 piece and the 008 piece as the first step.Then, we would get vectors of the “014” and other pieces of shredded paper:(6)
δ
14
=
(
δ
141
,
δ
142
,
…
,
δ
14
m
)
.Following the above steps until all pieces of the shredded paper had been spliced we could recover the original paper. The correct order was 3-6-2-7-15-18-11-0-5-1-9-13-10-8-12-14-17-16-4.The result of the repairing of English shredded paper was showed as Figure2.Figure 2
Result of the reconstruction of English shredded paper.


## 3.2. Analysis for Problem  2

For this problem we should design for the model that the paper had been shredded either horizontally or vertically. Here we took the following shredded paper for example in Figure3. The paper has been shredded into 11(lines) * 19(rows) pieces.Figure 3
Scanning copies of the 209 pieces of shredded paper.


### 3.2.1. Solving Idea and Method

Supposed that all pieces of the shredded paper had been splicing regularly so we could get a11
*
19 grid. Each piece of the shredded paper could be located by its (x
,
y) coordinate. To simplify the whole problem, we might as well ignore the row coordinate y at first. At this point we should only determine the line coordinate x of each piece of shredded paper.We supposed further that the pieces of shredded paper in each line had already been spliced in correct sequence [6]. And then, we only needed to get the sequence of all the 11 lines of shredded paper. We defined symbol d as the distance of pixels between the bottom of the text in the first line and the top of the piece of shredded paper. By using inequality and enumeration method we could get the d values of all the 11 lines. And by comparing the d values of lines with the d value of each piece of shredded paper we can get the line coordinate x of the latter (based on the actual situation, this paper considers that the d values of the shredded paper from the same line in original paper were identical).Up to this point, essentially, the Problem 2 was simplified into Problem 1. We could easily recover the shredded paper by using the model and algorithm that were proposed in Problem 1.


### 3.2.2. Preprocessing of Data

To get thed values of all the 11 lines, it was necessary to do the preprocessing of data of shredded paper. We defined the height of row h as the pixel distance between the bottom of the text in the nth line and the bottom of the text in the (n
-
1)th line. For the English shredded paper, there was the significant difference in values of h between each other [7]. On the basis of this characteristic, we could get the area which had the high concentration of pixels by progressive scanning technology of pixel. Through this method, we could get the height of row h.As we all know, some letters occupied additional space like “d,” “b,” “p,” “q,” and so on. When there was a sentence which was constituted by letters, the black pixel proportion of the middle part of the sentence on the paper was not uniform [8]. Take the word “public,” for example, the frequency distribution of black pixel was showed as Figure 4.Figure 4
Frequency distribution of black pixel.It was obvious from Figure4 that the black pixels concentrated on the middle part of the whole word. In view of the above, this paper selected the way of scanning the shredded paper from top to bottom to get the line which has the maximum sudden-change of black pixel. From this we might judge the location of the line from the original paper. In this case, we defined the bottom of the text as the third dotted line. Then we could get the height of the row h
=
64 pixel.


### 3.2.3. Modeling and Solving

As previously stated, we would ignore the sequence of the line of the shredded paper. At this point, we supposed that all pieces of the shredded paper had been splicing correctly as before. We modeled 9 pieces of shredded paper for analysis.As Figure5 showed, the rectangular boxes which were circled by thick lines meant a piece of shredded paper. While the rectangular boxes with the dotted lines represented the lines of text.Figure 5
9 pieces of shredded paper model.The symbolH was the pixel height of the line of the shredded paper. From the pieces of shredded paper we could get that the H of each piece of shredded paper was 180 pixels and the line coordinated x
=
1,2
,
…
,
11. The symbol h was the height of the word. Thus, we might get the pixel distance d by the following method.Suppose that the lines of the text werem,; we could get the minimum positive integer which meet the inequality that m
h
-
x
H
>
0. Do plug m into the following formula:
(7)
d
x
+
1
=
m
H
-
x
H
.Then we could obtain the value ofd of (
x
+
1
)th.For example, assuming thed
1 value of first line of the shredded paper, we used the following process to get the value of d
2 and d
3.Whenx
=
1, we could know the d
2
=
68
m
-
1
*
180. From this equation we could easily work out that m
=
3. So d
2 is 24 pixels.And whenx
=
2, with the same method, we can know that d
3 is 48 pixels.By that analogy, we could obtain all thed values of each line of shredded paper, and then we would get the right order of each line of shredded paper.By using of the model in Problem 1, we could get the row coordinatey. When we got all the coordinates (x
,
y) we could locate all pieces of the shredded paper. And the final result is shown as Figure 6.Figure 6
The result of the reconstruction of English shredded paper.


## 3.2.1. Solving Idea and Method

Supposed that all pieces of the shredded paper had been splicing regularly so we could get a11
*
19 grid. Each piece of the shredded paper could be located by its (x
,
y) coordinate. To simplify the whole problem, we might as well ignore the row coordinate y at first. At this point we should only determine the line coordinate x of each piece of shredded paper.We supposed further that the pieces of shredded paper in each line had already been spliced in correct sequence [6]. And then, we only needed to get the sequence of all the 11 lines of shredded paper. We defined symbol d as the distance of pixels between the bottom of the text in the first line and the top of the piece of shredded paper. By using inequality and enumeration method we could get the d values of all the 11 lines. And by comparing the d values of lines with the d value of each piece of shredded paper we can get the line coordinate x of the latter (based on the actual situation, this paper considers that the d values of the shredded paper from the same line in original paper were identical).Up to this point, essentially, the Problem 2 was simplified into Problem 1. We could easily recover the shredded paper by using the model and algorithm that were proposed in Problem 1.


## 3.2.2. Preprocessing of Data

To get thed values of all the 11 lines, it was necessary to do the preprocessing of data of shredded paper. We defined the height of row h as the pixel distance between the bottom of the text in the nth line and the bottom of the text in the (n
-
1)th line. For the English shredded paper, there was the significant difference in values of h between each other [7]. On the basis of this characteristic, we could get the area which had the high concentration of pixels by progressive scanning technology of pixel. Through this method, we could get the height of row h.As we all know, some letters occupied additional space like “d,” “b,” “p,” “q,” and so on. When there was a sentence which was constituted by letters, the black pixel proportion of the middle part of the sentence on the paper was not uniform [8]. Take the word “public,” for example, the frequency distribution of black pixel was showed as Figure 4.Figure 4
Frequency distribution of black pixel.It was obvious from Figure4 that the black pixels concentrated on the middle part of the whole word. In view of the above, this paper selected the way of scanning the shredded paper from top to bottom to get the line which has the maximum sudden-change of black pixel. From this we might judge the location of the line from the original paper. In this case, we defined the bottom of the text as the third dotted line. Then we could get the height of the row h
=
64 pixel.


## 3.2.3. Modeling and Solving

As previously stated, we would ignore the sequence of the line of the shredded paper. At this point, we supposed that all pieces of the shredded paper had been splicing correctly as before. We modeled 9 pieces of shredded paper for analysis.As Figure5 showed, the rectangular boxes which were circled by thick lines meant a piece of shredded paper. While the rectangular boxes with the dotted lines represented the lines of text.Figure 5
9 pieces of shredded paper model.The symbolH was the pixel height of the line of the shredded paper. From the pieces of shredded paper we could get that the H of each piece of shredded paper was 180 pixels and the line coordinated x
=
1,2
,
…
,
11. The symbol h was the height of the word. Thus, we might get the pixel distance d by the following method.Suppose that the lines of the text werem,; we could get the minimum positive integer which meet the inequality that m
h
-
x
H
>
0. Do plug m into the following formula:
(7)
d
x
+
1
=
m
H
-
x
H
.Then we could obtain the value ofd of (
x
+
1
)th.For example, assuming thed
1 value of first line of the shredded paper, we used the following process to get the value of d
2 and d
3.Whenx
=
1, we could know the d
2
=
68
m
-
1
*
180. From this equation we could easily work out that m
=
3. So d
2 is 24 pixels.And whenx
=
2, with the same method, we can know that d
3 is 48 pixels.By that analogy, we could obtain all thed values of each line of shredded paper, and then we would get the right order of each line of shredded paper.By using of the model in Problem 1, we could get the row coordinatey. When we got all the coordinates (x
,
y) we could locate all pieces of the shredded paper. And the final result is shown as Figure 6.Figure 6
The result of the reconstruction of English shredded paper.


## 3.3. Analysis for Problem  3

Based on the Problem 2, the purpose of the Problem 3 was to repair the shredded paper which was printed double-sided. It posed a new problem that before repairing the shredded paper we should identify whether the shredded paper was the front or the back side of the original paper. Through the relation between thed value and line coordinate of shredded paper we could obtain the row coordinate of shredded paper. And then, the problem came down to an easier problem: sorting and splicing of shredded paper which was printed double-sided in the same line of the original paper.


### 3.3.1. Solving Idea and Method

As previously stated, we should identify the front and back of the shredded paper while sorting and splicing them. Given that the text of both sides has the same line height, firstly, we can still use the model in Problem 2 to get the correspondence of the row coordinate of the shredded paper and the value ofd. By calculating the value of d of each piece of shredded paper, we could get the row coordinate of each of them. Then, the problem was simplified into an easier problem of how to sort and splice both sides of the shredded paper which were on the same row. This paper introduced a new concept: sum-similarity [9]. While we were splicing two pieces of shredded paper, both sides of the shredded paper would generate the similarity of splicing on the edge of themselves [10]. And, the sum-similarity is the summation of both two values of similarity. For the shredded paper which was printed on both sides, there would have been two conditions which would generate two sets of sum-similarity. Consequently, the identification of the front and back of the shredded paper was turned into the comparison between the two sets of the sum-similarity. Afterwards, we would always take out the piece of shredded paper which had the maximum sum-similarity splicing with the special piece of shredded paper at every turn. Finally, we could get the recovered paper.


### 3.3.2. Modeling and Solving

By the conclusion based on Problem 2, we could obtain thed value of each piece of the shredded paper which would yield the line coordinate of each piece. Suppose that the two sides of each piece of shredded paper had been named A and B side as well as the original paper. And we supposed further that the text in A side of the shredded paper ought to belong to the A side of the original paper. So, there were two cases to be considered when the tth piece was splicing with (t
+
1)th piece of shredded paper under the condition when both pieces came from the same line of the original paper.Case 1.
When we were splicingtth piece of shredded paper with (t
+
1)th piece, the A side of tth piece should be spliced with the A side of (t
+
1)th piece as well as their B sides. And at this point there would lead to two similarities of splicing. Then we could get the overall similarity by summing the two similarity of splicing. The exact process was showed as Figure 7.Figure 7
Flowchart for the process in Case1.Case 2.
When we were splicingtth piece of shredded paper with (t
+
1)th piece, the A side of tth piece should be spliced with the B side of (t
+
1)th piece while the B side of tth piece was spliced with the A side of (t
+
1)th piece, there would also lead to two similarities of splicing refer to Case 1. Certainly, we would get the overall similarity by the same way.After that, we could choose the most special piece of shredded paper through the program such as the piece which was from the left edge of the original paper. We defined this piece of shredded paper as the first piece. This way, when we try splicing the rest of 18 pieces of shredded paper with the first piece, there would be 36 values of overall similarity. By the algorithm in Problem 1, we chose the piece which had the maximum similarity to splice with the first piece.By that analogy, we would foresee that when we sort theith piece, there would be 2
*
(
19
-
i
) values of overall similarity. We would always take out the piece of shredded paper which had the maximum sum-similarity splicing with the special piece of shredded paper at every turn until all pieces of shredded paper had been spliced. By that point, we might obtain the result of reconstruction of shredded paper as Figures 8 and 9 showed.Figure 8
The result of the reconstruction of text from A side in English shredded paper printed double-sided.Figure 9
The result of the reconstruction of text from B side in English shredded paper printed double-sided.Finally, a summary of the time performance of this algorithm could be described by Figure10.Figure 10
Time performance of the algorithm for shredded document.Figure10 had shown the relation between the number of fragments in a certain line and the time consumption when the algorithm was used to splice the double-sided of shredded paper. For an 11(lines) * 19(rows) double-sided shredded paper the algorithms would consume no longer than 10 milliseconds. From Figure 10 we could learn that there was a nonlinear relationship between the time consumption and the number of fragments. The time complexity of the algorithm could be expressed as o
(
n
2
).


## 3.3.1. Solving Idea and Method

As previously stated, we should identify the front and back of the shredded paper while sorting and splicing them. Given that the text of both sides has the same line height, firstly, we can still use the model in Problem 2 to get the correspondence of the row coordinate of the shredded paper and the value ofd. By calculating the value of d of each piece of shredded paper, we could get the row coordinate of each of them. Then, the problem was simplified into an easier problem of how to sort and splice both sides of the shredded paper which were on the same row. This paper introduced a new concept: sum-similarity [9]. While we were splicing two pieces of shredded paper, both sides of the shredded paper would generate the similarity of splicing on the edge of themselves [10]. And, the sum-similarity is the summation of both two values of similarity. For the shredded paper which was printed on both sides, there would have been two conditions which would generate two sets of sum-similarity. Consequently, the identification of the front and back of the shredded paper was turned into the comparison between the two sets of the sum-similarity. Afterwards, we would always take out the piece of shredded paper which had the maximum sum-similarity splicing with the special piece of shredded paper at every turn. Finally, we could get the recovered paper.


## 3.3.2. Modeling and Solving

By the conclusion based on Problem 2, we could obtain thed value of each piece of the shredded paper which would yield the line coordinate of each piece. Suppose that the two sides of each piece of shredded paper had been named A and B side as well as the original paper. And we supposed further that the text in A side of the shredded paper ought to belong to the A side of the original paper. So, there were two cases to be considered when the tth piece was splicing with (t
+
1)th piece of shredded paper under the condition when both pieces came from the same line of the original paper.Case 1.
When we were splicingtth piece of shredded paper with (t
+
1)th piece, the A side of tth piece should be spliced with the A side of (t
+
1)th piece as well as their B sides. And at this point there would lead to two similarities of splicing. Then we could get the overall similarity by summing the two similarity of splicing. The exact process was showed as Figure 7.Figure 7
Flowchart for the process in Case1.Case 2.
When we were splicingtth piece of shredded paper with (t
+
1)th piece, the A side of tth piece should be spliced with the B side of (t
+
1)th piece while the B side of tth piece was spliced with the A side of (t
+
1)th piece, there would also lead to two similarities of splicing refer to Case 1. Certainly, we would get the overall similarity by the same way.After that, we could choose the most special piece of shredded paper through the program such as the piece which was from the left edge of the original paper. We defined this piece of shredded paper as the first piece. This way, when we try splicing the rest of 18 pieces of shredded paper with the first piece, there would be 36 values of overall similarity. By the algorithm in Problem 1, we chose the piece which had the maximum similarity to splice with the first piece.By that analogy, we would foresee that when we sort theith piece, there would be 2
*
(
19
-
i
) values of overall similarity. We would always take out the piece of shredded paper which had the maximum sum-similarity splicing with the special piece of shredded paper at every turn until all pieces of shredded paper had been spliced. By that point, we might obtain the result of reconstruction of shredded paper as Figures 8 and 9 showed.Figure 8
The result of the reconstruction of text from A side in English shredded paper printed double-sided.Figure 9
The result of the reconstruction of text from B side in English shredded paper printed double-sided.Finally, a summary of the time performance of this algorithm could be described by Figure10.Figure 10
Time performance of the algorithm for shredded document.Figure10 had shown the relation between the number of fragments in a certain line and the time consumption when the algorithm was used to splice the double-sided of shredded paper. For an 11(lines) * 19(rows) double-sided shredded paper the algorithms would consume no longer than 10 milliseconds. From Figure 10 we could learn that there was a nonlinear relationship between the time consumption and the number of fragments. The time complexity of the algorithm could be expressed as o
(
n
2
).


## 4. The Application of Improved Algorithm Used in Chinese Shredded Paper

The algorithm above had been used in the repairing English shredded paper. But obviously, the algorithm was not absolutely appropriate for the Chinese shredded paper for the reason that there was a crucial difference between the two kinds of text—the height of the row.More specifically, to the Chinese characters which were from the text, the height of the characters was mainly identical. Based on the actual situation we could get the height of the rowh by the program easily rather than calculate the frequency distribution of black pixel. And once we got the h, we might model and solve the problem with the same way used in English shredded paper. Totally speaking, the algorithms for Chinese and for English shredded paper were similar in essence. Both kinds of the shredded document should be preprocessed to satisfy the five assumptions mentioned in chapter 2. Both executions of the two algorithms were also similar with each other. The main difference was the course of getting the height of the row h. Here we gave the concrete steps which could be described as the following Figures 11, 12, and 13.Figure 11
The concrete steps of recovery of Chinese shredded paper.Figure 12
Scanning copy of Chinese shredded paper.Figure 13
The result of the reconstruction of Chinese shredded paper.And, Figure12 showed the scanning copy of shredded paper and Figure 13 showed the result of recovery of Chinese paper which was shredded either horizontally or vertically.


## 5. Conclusion

In this paper the model and algorithm for reconstruction of shredded paper had been discussed. For the condition in Problem 1, this paper compared the similarity degree between the rightmost pixels of a certain shredded paper and the leftmost pixels of other pieces of shredded paper. The time complexity of this algorithm was low. Based on this model and algorithm the problem was solved without any manual intervention. For the condition in Problem 2, this paper sorted the shredded paper according to the location of each piece of shredded paper and satisfactory result was obtained. For the condition in Problem 3, this paper sorted the shredded paper by the optimum matching for the double-sided printed of shredded paper. This model and algorithm could recover the shredded paper with only a little manual intervention. And, given the difference between English text and Chinese text, this paper had proposed the improved algorithm to complete the reconstruction of Chines shredded paper.At last, it must also be pointed out that the proposed algorithms had their own limitation and bound. Through extensive tests, we ought to admit that in the practical problem, not every piece from various shredders was exactly identical. And at the same time, the text color, the texture of the paper, the cutting direction (such as documents were shredded askew and promiscuously), or the large stains on the paper, and so on, all of the conditions above would have an impact more or less on repairmen of the shredded document. In some cases, the proper preprocessing would reduce this kind of impact. But in many other much more serious cases, the algorithms introduced in this paper were not performing precisely enough. To improve the general applicability of the algorithm, we had been trying some other methods. As we explore more kinds of shredded paper, we believe that the technology would become more and more mature.



---

*Source: 514748-2014-03-06.xml*