CN104091319A - Shredded paper picture splicing method for establishing energy function based on Monte Carlo algorithm - Google Patents

Shredded paper picture splicing method for establishing energy function based on Monte Carlo algorithm Download PDF

Info

Publication number
CN104091319A
CN104091319A CN201410298442.9A CN201410298442A CN104091319A CN 104091319 A CN104091319 A CN 104091319A CN 201410298442 A CN201410298442 A CN 201410298442A CN 104091319 A CN104091319 A CN 104091319A
Authority
CN
China
Prior art keywords
image
energy function
monte carlo
shredded paper
picture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410298442.9A
Other languages
Chinese (zh)
Other versions
CN104091319B (en
Inventor
王晓峰
苏盈盈
王洪珂
孙宝光
白翔文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing University of Science and Technology
Original Assignee
Chongqing University of Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing University of Science and Technology filed Critical Chongqing University of Science and Technology
Priority to CN201410298442.9A priority Critical patent/CN104091319B/en
Publication of CN104091319A publication Critical patent/CN104091319A/en
Application granted granted Critical
Publication of CN104091319B publication Critical patent/CN104091319B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

本发明提供了一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,主要涉及双面打印文件的拼接及复原问题,通常由于图片较多,信息量较大,故通常为非线性优化问题,准确建立模型难度较大,并求解较为困难,同时误差可能较大。故本发明把图像作为一个整体,采用基于随机思想的蒙特卡洛算法进行选择填充。考虑给定的来自同一页印刷文字文件的碎纸机破碎纸片如何拼接到一起,包括:仅纵切,既纵切又横切的情形,双面打印文件及纵切有横切等情况的碎纸片,可能包括中文或英文。本发明通过图片拼接算法,可以使碎纸片的自动拼接,以获得图片拼接及复原效果,减少人力物力消耗,并提高拼接复原效率。

The invention provides a mosaic method of shredded paper pictures based on the Monte Carlo algorithm to construct an energy function, which mainly involves the mosaic and restoration of double-sided printed documents. Usually, due to the large number of pictures and the large amount of information, it is usually a non-linear optimization. The problem is that it is difficult to accurately establish a model, and it is difficult to solve it, and the error may be large. Therefore, the present invention regards the image as a whole, and uses a Monte Carlo algorithm based on random thinking to select and fill. Consider how a given piece of shredder shredded paper from the same page of printed text is spliced together, including: only slits, both slits and cross-cuts, double-sided printing documents and slits with cross-cuts, etc. Scraps of paper, possibly including Chinese or English. Through the picture splicing algorithm, the present invention can automatically splice shredded paper to obtain picture splicing and restoration effects, reduce the consumption of manpower and material resources, and improve splicing and restoration efficiency.

Description

基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法Shredded paper image mosaic method based on Monte Carlo algorithm to construct energy function

技术领域technical field

本发明属于信息技术领域,涉及一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,具体地说,涉及一种自动破碎文件(碎纸)图片拼接技术,并提高拼接复原效率及准确度。The invention belongs to the field of information technology, and relates to a mosaic method for shredded paper pictures based on a Monte Carlo algorithm to construct an energy function. Spend.

背景技术Background technique

破碎文件的拼接在文件修复、司法物证复原鉴定、历史文献修复以及军事情报获取等领域都有着重要的应用,很多碎片拼接问题都可以归结为或近似为二维碎片的拼接问题。碎纸拼接是二维碎片图像拼接的典型问题。传统上,拼接复原工作需由人工完成,准确率较高,但效率很低。然而当碎片数量巨大,耗费大量的人力、物力,人工拼接很难在短时间内快速、准确完成任务,而且还可能对物件造成一定的损坏。The splicing of broken files has important applications in the fields of document restoration, judicial evidence restoration and identification, historical document restoration, and military intelligence acquisition. Many fragment splicing problems can be attributed or approximated to the splicing of two-dimensional fragments. Shredded paper stitching is a typical problem of 2D fragmented image stitching. Traditionally, splicing and restoration work has to be done manually, with high accuracy but low efficiency. However, when the number of fragments is huge and consumes a lot of manpower and material resources, it is difficult for manual splicing to complete the task quickly and accurately in a short period of time, and it may also cause certain damage to the object.

随着计算机技术的发展,利用计算机编程技术,通过图片拼接算法,可以进行碎纸片的自动拼接,以获得图片拼接及复原,减少人力物力消耗,并提高拼接复原效率。With the development of computer technology, using computer programming technology and image splicing algorithm, the automatic splicing of shredded paper can be carried out to obtain image splicing and restoration, reduce the consumption of manpower and material resources, and improve the efficiency of splicing and restoration.

发明内容Contents of the invention

本发明的目的在于提供一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,旨在解决现有技术图片拼接NP困难、拼接复原效率低的问题。The purpose of the present invention is to provide a shredded paper image mosaic method based on Monte Carlo algorithm to construct an energy function, aiming to solve the problems of NP-difficulty in image mosaic and low mosaic restoration efficiency in the prior art.

本发明是这样实现的,一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,包括以下步骤:The present invention is achieved in this way, a method for mosaicing shredded paper pictures based on a Monte Carlo algorithm to construct an energy function, comprising the following steps:

S1、将碎纸片扫描成二维灰度图片形式,获得(m×n)张,并用Matlab将图片信息读取成矩阵信息;S1. Scanning the scraps of paper into two-dimensional grayscale pictures to obtain (m×n) pieces, and using Matlab to read the picture information into matrix information;

S2、基于蒙特卡洛算法利用Matlab随机函数randperm对上述生成的图片产生随机的、不重复的m×n个图像碎片二维组合顺序;S2. Using the Matlab random function randperm to generate a random, non-repetitive two-dimensional combination sequence of m×n image fragments for the above-mentioned generated pictures based on the Monte Carlo algorithm;

S3、对m×n个碎片二维组合顺序作为拟生成的文件图片,基于均方根误差RMSE,计算图片当中每幅图像与邻近图片即上、下、左、右的能量函数,然后求出所有图片能量函数的和;S3. For the two-dimensional combination sequence of m×n fragments as the file picture to be generated, based on the root mean square error RMSE, calculate the energy function of each image in the picture and the adjacent pictures, that is, up, down, left, and right, and then find out The sum of all image energy functions;

S4、对步骤S2进行10000次循环,并比较每次能量函数的大小,获取能量函数最小值;S4. Perform 10,000 cycles of step S2, and compare the size of each energy function to obtain the minimum value of the energy function;

S5、得出的最小值所对应的碎片位置即为最优的排列方式;S5. The fragment position corresponding to the obtained minimum value is the optimal arrangement mode;

S6、通过多次大量的迭代,最小值逐渐收敛,获得最优值,即最佳拼图效果。S6. Through a large number of iterations, the minimum value gradually converges to obtain the optimal value, that is, the best puzzle effect.

本发明克服现有技术的不足,提供一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,主要涉及双面打印文件的拼接及复原问题,通常由于图片较多,信息量较大,故通常为非线性优化问题,准确建立模型难度较大,并求解较为困难,同时误差可能较大。故本发明把图像作为一个整体,采用基于随机思想的蒙特卡洛算法进行选择填充。考虑给定的来自同一页印刷文字文件的碎纸机破碎纸片如何拼接到一起,包括:仅纵切,既纵切又横切的情形,双面打印文件及纵切有横切等情况的碎纸片,可能包括中文或英文。对于具体不同的三种情况具体分析如下:1)对仅纵切文件同时考虑文件当中每个碎片间左、右2个约束关联条件;2)对包括横切、纵切文件同时考虑文件当中每个碎片间上、下、左、右4个约束关联条件;3)对双面文件同时考虑文件当中每个碎片间上、下、左、右以及反面8个约束关联条件,然后,建立能量函数,通常能量函数最小即拼接效果最好,通过蒙特卡洛的随机性质寻找最小值,最后利用Matlab编程,并获得最优解,并进行验证。The present invention overcomes the deficiencies of the prior art and provides a mosaic method for shredded paper pictures based on the energy function constructed by the Monte Carlo algorithm, which mainly involves the mosaic and restoration of double-sided printed documents. Therefore, it is usually a nonlinear optimization problem, and it is difficult to accurately establish a model, and it is difficult to solve it, and at the same time, the error may be large. Therefore, the present invention regards the image as a whole, and uses a Monte Carlo algorithm based on random thinking to select and fill. Consider how a given piece of shredder shredded paper from the same page of printed text is spliced together, including: only slits, both slits and cross-cuts, double-sided printing documents and slits with cross-cuts, etc. Scraps of paper, possibly including Chinese or English. The specific analysis of the three different situations is as follows: 1) For files that are only longitudinally cut, the left and right constraint association conditions between each fragment in the file are considered at the same time; 2) For files that include cross-cut and longitudinal 4 constraint association conditions of upper, lower, left, and right among fragments; 3) For double-sided files, consider the 8 constraint association conditions of each fragment in the file at the same time, and then establish an energy function , usually the smallest energy function means the best splicing effect. Find the minimum value through the random nature of Monte Carlo, and finally use Matlab programming to obtain the optimal solution and verify it.

附图说明Description of drawings

图1是本发明基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法的步骤流程图;Fig. 1 is the flow chart of the steps of the shredded paper picture splicing method based on the Monte Carlo algorithm to construct the energy function of the present invention;

图2本发明实施例中的随着1000迭代次数能量变化情况示意图;Fig. 2 is a schematic diagram of energy variation along with 1000 iterations in the embodiment of the present invention;

图3是本发明实施例中的随着10000迭代次数能量变化情况示意图;Fig. 3 is a schematic diagram of energy variation along with 10000 iterations in the embodiment of the present invention;

图4是本发明实施例中的碎片拼接上、下、左、右关系示意图。Fig. 4 is a schematic diagram of the relationship between top, bottom, left and right of splicing fragments in the embodiment of the present invention.

图5是本发明实施例中的5.000.bmp图像的直方图;Fig. 5 is the histogram of the 5.000.bmp image in the embodiment of the present invention;

图6是本发明实施例中的横线图;Fig. 6 is a horizontal line diagram in the embodiment of the present invention;

图7是本发明实施例中的点图;Fig. 7 is a point diagram in the embodiment of the present invention;

图8是本发明实施例中的竖图。Fig. 8 is a vertical view of an embodiment of the present invention.

具体实施方式Detailed ways

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

实施例Example

一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,如图1所示,包括以下步骤:A kind of mosaic method of shredded paper picture based on Monte Carlo algorithm constructing energy function, as shown in Figure 1, comprises the following steps:

S1、将碎纸扫描成二维灰度图片形式(m×n),并用Matlab将图片信息读取成矩阵信息;S1. Scan the shredded paper into a two-dimensional grayscale picture form (m×n), and use Matlab to read the picture information into matrix information;

在步骤S1中,更具体的包括:In step S1, more specifically include:

1)图像预处理1) Image preprocessing

通常的图像不能拿来直接使用,因为存在噪音、灰度等不同信息,直接使用会造成误差,导致结果不正确或误拼接,所以需要对图像进行预处理:Ordinary images cannot be used directly, because there are different information such as noise and grayscale, and direct use will cause errors, resulting in incorrect results or incorrect splicing, so the image needs to be preprocessed:

a)去噪处理a) Denoising processing

给出的图像由于成像原因、相机或电脑原因可能会出现噪音问题,而出现噪音会容易造成数据处理误差,比如最边上一列如果某个像素受到噪音影响0变成1,那么最后统计会造成一定的误差,所以采用通常使用的高斯滤波对图像进行去噪处理:The given image may have noise problems due to imaging, camera or computer reasons, and noise will easily cause data processing errors. For example, if a pixel in the last column is affected by noise and 0 becomes 1, then the final statistics will cause A certain error, so the commonly used Gaussian filter is used to denoise the image:

GG (( xx ,, ythe y )) == 11 22 πσπσ 22 ee -- xx 22 ++ ythe y 22 22 σσ 22 -- -- -- (( 11 ))

b)二值化处理b) Binarization processing

文中给出的图像为灰度图像,范围0~255,然而灰度图像往往是8位,计算量较大,故通常二值化处理,以减少运算量,加快执行速度。The image given in this article is a grayscale image, ranging from 0 to 255. However, the grayscale image is usually 8 bits and requires a large amount of calculation. Therefore, it is usually binarized to reduce the amount of calculation and speed up the execution.

首先,通常给出的打印纸图像,其为灰度图像(0~255),发现其图像信息值不仅仅只有0、255两种值,而是包括了在0~255中间的很多的值,但是在0、255应有较大的概率。采用了Matlab当中的imhist函数,由于0、255两点值比较多,其他点比较少,所以对线形采用了5.0倍的加粗,如图2所示,由图2可以看出,灰度值主要集中在0,255与0~255之间,所以按经验取阀值为180。即灰度值在0~180的,经二值化处理后灰度值为0;灰度值大于180,且小于等于255的,经二值化处理后灰度值为1。即:First of all, the commonly given printing paper image is a grayscale image (0-255), and it is found that the image information value is not only 0 and 255, but includes many values between 0-255, But there should be a greater probability at 0, 255. The imhist function in Matlab is used. Since there are more values of 0 and 255 points and less other points, the line shape is thickened by 5.0 times, as shown in Figure 2. It can be seen from Figure 2 that the gray value Mainly concentrated between 0, 255 and 0 ~ 255, so the threshold value is 180 according to experience. That is, if the gray value is between 0 and 180, the gray value is 0 after binarization processing; if the gray value is greater than 180 and less than or equal to 255, the gray value is 1 after binarization processing. Right now:

2)图片特征分析2) Image feature analysis

分析可知,图象拼接中,图片中间部位文字的存在与图片的拼接不存在影响,因此只需考虑图片左右边界处的文字特征。将图片导入Matlab软件后生成的n个灰度值矩阵只需用首列与末列的元素进行数据相似度分析,其他列的元素可以忽略不计。It can be seen from the analysis that in image stitching, the presence of text in the middle of the image has no effect on the stitching of the image, so only the text features at the left and right borders of the image need to be considered. The n gray value matrix generated after importing the image into Matlab software only needs to use the elements in the first column and the last column for data similarity analysis, and the elements in other columns can be ignored.

采取的是采集边界处的特征,进行基于灰度的图像二值化固定阀值法和均方差统计匹配法,对于其中可能产生的误差,验证如下:The feature at the boundary is collected, and the grayscale-based image binarization fixed threshold method and the mean square error statistical matching method are adopted. For the possible errors, the verification is as follows:

通常在中文的常见笔画为:横(一)、竖(丨)、撇(丿)、点(丶)、捺(乀)、折(乛)等,可以把它分成两类:Common strokes in Chinese are: horizontal (一), vertical (丨), left (丿), dot (丿), right down (乀), folding (乛), etc., which can be divided into two categories:

a)相邻一点或某几点,如:笔画(一)从中间箭头处被垂直截断,形成:a) Adjacent point or certain points, such as: stroke (1) is vertically cut off from the middle arrow, forming:

1.横通常3.点(与撇,捺结构相同),如图3所示;1. Horizontal usually 3. point (with cast aside, the same structure), as shown in Figure 3;

2.笔画(丶)从中间箭头处被垂直截断,形成如图4所示。2. The stroke ( ) is cut off vertically from the middle arrow, as shown in Figure 4.

b)相邻多点b) Adjacent multiple points

3.笔画(丨)从中间箭头处被垂直截断,形成如图5所示。3. The stroke (丨) is vertically truncated from the middle arrow, as shown in Figure 5.

综上,通过统计了常见的笔划,发现从一个字从中间断开的话,相邻图片像素通常上灰度相似,所以采用的均方差的方法理论上是可行的。之后,选择利用Matlab软件,并选用采集边界处的特征进行基于灰度的图像二值化固定阀值法和均方差统计匹配法的方法是可行的,误差应该较小,能得到较正确的结果。In summary, by counting the common strokes, it is found that if a character is disconnected from the middle, the grayscale of adjacent picture pixels is usually similar, so the method of mean square error is theoretically feasible. After that, it is feasible to choose to use Matlab software and select the features at the acquisition boundary to perform image binarization based on grayscale, fixed threshold method and mean square error statistical matching method. The error should be small and more correct results can be obtained. .

S2、基于蒙特卡洛算法利用Matlab随机函数randperm产生不重复的m×n个图像碎片;S2. Using the Matlab random function randperm based on the Monte Carlo algorithm to generate non-repetitive m×n image fragments;

S3、对m×n个碎片作为拟生成的文件图片,计算图片当中每幅图像上、下、左、右的能量函数,求所有图片能量函数的和;S3. For the m×n fragments as the file picture to be generated, calculate the energy function of the upper, lower, left and right of each image in the picture, and find the sum of the energy functions of all pictures;

在步骤S3中,更具体包括:In step S3, more specifically include:

1)基于灰度的均方差统计匹配算法1) Grayscale-based mean square error statistical matching algorithm

因为图片中间的文字存在与否与图片拼接无关,因此选择图片左、右、上、下边界处的特征进行匹配。但是,这可能存在边界处灰度值相似,但图片不匹配的现象。所以,选用采集边界处的特征进行基于灰度的均方差统计匹配的方法。通常判断误差的测度包括:Because the presence or absence of text in the middle of the picture has nothing to do with picture splicing, the features at the left, right, upper and lower boundaries of the picture are selected for matching. However, there may be a phenomenon that the gray value at the border is similar, but the picture does not match. Therefore, the feature at the acquisition boundary is selected for statistical matching based on the mean square error of the gray level. Common measures of judgment error include:

a)标准差a) standard deviation

标准差反映图像灰度相对于灰度平均值的离散情况,定义如下:The standard deviation reflects the dispersion of the image grayscale relative to the grayscale average value, which is defined as follows:

StdStd == 11 Mm ×× NN ΣΣ mm == 11 Mm ΣΣ nno == 11 NN (( Ff (( mm ,, nno )) -- Ff ‾‾ )) 22 -- -- -- (( 33 ))

其中,为图像F的均值,定义为:in, is the mean value of the image F, defined as:

Ff ‾‾ == 11 Mm ×× NN ΣΣ mm == 11 Mm ΣΣ nno == 11 NN Ff (( mm ,, nno )) -- -- -- (( 44 ))

标准差也可用来评价图像反差的大小。若标准差大,则图像灰度级分布分散,图像的反差大,可以看出更多的信息。标准差小,图像反差小,对比度不大,色调单一均匀,看不出太多的信息。Standard deviation can also be used to evaluate the size of image contrast. If the standard deviation is large, the gray level distribution of the image is dispersed, and the contrast of the image is large, so more information can be seen. The standard deviation is small, the image contrast is small, the contrast is not large, the tone is single and uniform, and there is not much information to be seen.

b)均方根误差RMSEb) root mean square error RMSE

融合图像F和标准参考图像R间的均方根误差定义为:The root mean square error between the fused image F and the standard reference image R is defined as:

RMSERMSE == ΣΣ ii == 11 Mm ΣΣ jj == 11 NN (( RR (( ii ,, jj )) -- Ff (( ii ,, jj )) )) 22 Mm ×× NN -- -- -- (( 55 ))

其中,M,N分别为图像的行数和列数。这里,考虑实时性问题,利用均方根误差较好。Among them, M and N are the number of rows and columns of the image, respectively. Here, considering the real-time problem, it is better to use root mean square error.

2)具体算法2) specific algorithm

通过运算得到任意一个矩阵的首(末)列与其他各个矩阵的末(首)列的二值化灰度值相应差值的均方差,当差值中0元素出现的概率越大,则灰度值的差值就越小,矩阵对应图片的边界处相似程度越高,故对应图片拼接的可能性越大。但是,此方法可能存在0元素出现的概率相同,灰度值不同,图片不匹配的情况。所以,选择放弃相减的方法,改选用均方差进行比较,方差最小的矩阵所对应的图片灰度值差最小,图像匹配程度最高,因此可将这2个图片进行拼接复原。The mean square error of the corresponding difference between the first (last) column of any matrix and the last (first) column of other matrices is obtained by operation. When the probability of 0 elements appearing in the difference is greater, the gray The smaller the difference of the degree value is, the higher the similarity degree is at the boundary of the matrix corresponding to the picture, so the possibility of splicing the corresponding picture is greater. However, this method may have the same probability of 0 elements appearing, the gray value is different, and the picture does not match. Therefore, I chose to abandon the method of subtraction and use the mean square error for comparison. The matrix with the smallest variance corresponds to the image with the smallest gray value difference and the highest image matching degree. Therefore, the two images can be spliced and restored.

通常给出了双面中、英文的字样难度较大,故以双面作为具体分析,其他几种形式是其简化形式。双面打印文件,通常共有图片2×m×n,而每幅图像的高度为M个像素。Usually it is more difficult to give double-sided Chinese and English words, so the double-sided is used as a specific analysis, and the other forms are simplified forms. For double-sided printing files, there are usually 2×m×n images in total, and the height of each image is M pixels.

这里采用构建基于数据的能量函数(代价函数)的思想,采用基于随机思想的蒙特卡洛算法,并采用Matlab求解,最后分析并验证。Here, the idea of constructing a data-based energy function (cost function) is adopted, the Monte Carlo algorithm based on random thought is adopted, and Matlab is used to solve it, and finally analyzed and verified.

a)算法分析a) Algorithm Analysis

假设打印纸页面分反正两面,一共有m×n个碎片,可以认为如果正确匹配的话,每个碎片之间上、下、左、右的匹配性应该很好,它所对应的均方差应该最小,这样所有的碎片之间的均方差应该是比较小或者是最小的(考虑到可能有误差的存在),基于这样的思路,建立能量函数,能量函数基于相连图片上、下、左、右间的均方差匹配关系,如图6所示,再包括反、正面两大种情况,故一共有8个约束条件。Assuming that the printing paper page is divided into two sides, there are a total of m×n fragments, it can be considered that if the matching is correct, the matching of the top, bottom, left and right of each fragment should be very good, and the corresponding mean square error should be the smallest , so that the mean square error between all fragments should be relatively small or minimal (considering the existence of possible errors), based on this idea, an energy function is established, and the energy function is based on the upper, lower, left, and right distance between the connected pictures. The mean square deviation matching relationship of , as shown in Figure 6, includes two situations, negative and positive, so there are a total of 8 constraints.

b)能量函数建立b) Energy function establishment

基于图像匹配的思路及上述的分析,构建基于每张图像上、下、左、右关系的能量函数,假设图片分别为像素集Xup,Xcenter,Xdown,Xleft,Xright,那么对于一张图片的能量函数可以得到,Based on the idea of image matching and the above analysis, the energy function based on the relationship between up, down, left and right of each image is constructed. Assuming that the pictures are pixel sets X up , X center , X down , X left , and X right , then for The energy function of a picture can be obtained,

f(x1,x2,x3,x4,x5)=Ψ(x1,x2)+Ψ(x1,x3)+Ψ(x1,x4)+Ψ(x1,x5)f(x 1 ,x 2 ,x 3 ,x 4 ,x 5 )=Ψ(x 1 ,x 2 )+Ψ(x 1 ,x 3 )+Ψ(x 1 ,x 4 )+Ψ(x 1 , x 5 )

同样,可以得到全局能量函数Similarly, the global energy function can be obtained

F(x1,x2,x3,x4,x5)=Σ(Ψ(x1,x2)+Ψ(x1,x3)+Ψ(x1,x4)+Ψ(x1,x5))F(x 1 ,x 2 ,x 3 ,x 4 ,x 5 )=Σ(Ψ(x 1 ,x 2 )+Ψ(x 1 ,x 3 )+Ψ(x 1 ,x 4 )+Ψ(x 1 , x 5 ))

故对于整张图片的全局能量函数Therefore, for the global energy function of the entire image

Ff (( xx PP ,, xx qq )) == ΣΣ qq ∈∈ NN ΨΨ (( xx PP ,, xx qq ))

其中Ψ(·)为相邻图片之间的均方差测度 Ψ ( x i , x j ) = x i ( : , 1 ) - x j ( : , end ) , N为q的邻域。where Ψ( ) is the mean square error measure between adjacent pictures Ψ ( x i , x j ) = x i ( : , 1 ) - x j ( : , end ) , N is the neighborhood of q.

S4、对步骤S2进行10000次循环,并比较每次能量函数的大小,取最小值;S4. Perform 10,000 cycles of step S2, and compare the size of each energy function, and take the minimum value;

S5、得出的最小值所对应的碎片位置即为最优的排列方式;S5. The fragment position corresponding to the obtained minimum value is the optimal arrangement mode;

在步骤S5,当不匹配或杂乱无章的时候能量函数比较大,当匹配较好的时候能量函数比较小,这样就将匹配问题转换成了能量最小的问题,那么此时应该是个寻找最优解的问题。即:In step S5, when there is no match or disorder, the energy function is relatively large, and when the match is good, the energy function is relatively small, so that the matching problem is converted into a problem with the smallest energy, then it should be a search for the optimal solution at this time question. Right now:

xx pp ** == argarg maxmax (( Ff (( xx PP ,, xx qq )) )) ..

S6、通过多次大量的迭代,最小值逐渐收敛,获得最优值,即最佳拼图效果。S6. Through a large number of iterations, the minimum value gradually converges to obtain the optimal value, that is, the best puzzle effect.

以一张图片为例进行复原拼接,如图7、8所示,从图中我们可以看到,随着迭代最终,最低能量初值为341.1,随着迭代的进行,运行1000次最低能量函数值为332.2;运行10000次最低能量函数值为328.3,并且从图像看是逐渐收敛,收敛于稳定值,即获得最优解。Take a picture as an example for restoration stitching, as shown in Figures 7 and 8. From the figure, we can see that as the iteration ends, the initial value of the lowest energy is 341.1. As the iteration progresses, the lowest energy function is run 1000 times The value is 332.2; the lowest energy function value is 328.3 after running 10,000 times, and it is gradually converging from the image, converging on a stable value, that is, the optimal solution is obtained.

相比与现有技术的缺点和不足,本发明具有以下有益效果:通过图片拼接算法,可以使碎纸片的自动拼接,以获得图片拼接及复原效果,减少人力物力消耗,并提高拼接复原效率。Compared with the shortcomings and deficiencies of the prior art, the present invention has the following beneficial effects: through the image splicing algorithm, the shredded paper can be spliced automatically to obtain the effect of splicing and restoration of pictures, reduce the consumption of manpower and material resources, and improve the efficiency of splicing and restoration .

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.

Claims (1)

1.一种基于蒙特卡洛算法构建能量函数的碎纸图片拼接方法,其特征在于包括以下步骤:1. A shredded paper picture splicing method based on Monte Carlo algorithm construction energy function, it is characterized in that comprising the following steps: S1、将碎纸片扫描成二维灰度图片形式,获得(m×n)张,并用Matlab将图片信息读取成矩阵信息;S1. Scanning the scraps of paper into two-dimensional grayscale pictures to obtain (m×n) pieces, and using Matlab to read the picture information into matrix information; S2、基于蒙特卡洛算法利用Matlab随机函数randperm对上述生成的图片产生随机的、不重复的m×n个图像碎片二维组合顺序;S2. Using the Matlab random function randperm to generate a random, non-repetitive two-dimensional combination sequence of m×n image fragments for the above-mentioned generated pictures based on the Monte Carlo algorithm; S3、对m×n个碎片二维组合顺序作为拟生成的文件图片,基于均方根误差RMSE,计算图片当中每幅图像与邻近图片即上、下、左、右的能量函数,然后求出所有图片能量函数的和;S3. For the two-dimensional combination sequence of m×n fragments as the file picture to be generated, based on the root mean square error RMSE, calculate the energy function of each image in the picture and the adjacent pictures, that is, up, down, left, and right, and then find out The sum of all image energy functions; S4、对步骤S2进行10000次循环,并比较每次能量函数的大小,获取能量函数最小值;S4. Perform 10,000 cycles of step S2, and compare the size of each energy function to obtain the minimum value of the energy function; S5、得出的最小值所对应的碎片位置即为最优的排列方式;S5. The fragment position corresponding to the obtained minimum value is the optimal arrangement mode; S6、通过多次大量的迭代,最小值逐渐收敛,获得最优值,即最佳拼图效果。S6. Through a large number of iterations, the minimum value gradually converges to obtain the optimal value, that is, the best puzzle effect.
CN201410298442.9A 2014-06-26 2014-06-26 The shredded paper picture joining method of energy function is built based on Monte carlo algorithm Expired - Fee Related CN104091319B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410298442.9A CN104091319B (en) 2014-06-26 2014-06-26 The shredded paper picture joining method of energy function is built based on Monte carlo algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410298442.9A CN104091319B (en) 2014-06-26 2014-06-26 The shredded paper picture joining method of energy function is built based on Monte carlo algorithm

Publications (2)

Publication Number Publication Date
CN104091319A true CN104091319A (en) 2014-10-08
CN104091319B CN104091319B (en) 2017-07-11

Family

ID=51639034

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410298442.9A Expired - Fee Related CN104091319B (en) 2014-06-26 2014-06-26 The shredded paper picture joining method of energy function is built based on Monte carlo algorithm

Country Status (1)

Country Link
CN (1) CN104091319B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108805811A (en) * 2018-05-30 2018-11-13 山东师范大学 A kind of natural image intelligence pattern splicing method and system based on nonconvex quadratic programming
CN116485658A (en) * 2023-06-19 2023-07-25 旷智中科(北京)技术有限公司 Multichannel image stitching method based on Monte Carlo tree search

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901481A (en) * 2010-08-11 2010-12-01 深圳市蓝韵实业有限公司 Image mosaic method
US8233740B2 (en) * 2006-12-26 2012-07-31 Alan Steven Roth System and method for constructing photorealistic mosaics
CN103177431A (en) * 2012-12-26 2013-06-26 中国科学院遥感与数字地球研究所 Method of spatial-temporal fusion for multi-source remote sensing data
CN103632338A (en) * 2013-12-05 2014-03-12 鲁东大学 Matching curve feature based image registration evaluating method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8233740B2 (en) * 2006-12-26 2012-07-31 Alan Steven Roth System and method for constructing photorealistic mosaics
CN101901481A (en) * 2010-08-11 2010-12-01 深圳市蓝韵实业有限公司 Image mosaic method
CN103177431A (en) * 2012-12-26 2013-06-26 中国科学院遥感与数字地球研究所 Method of spatial-temporal fusion for multi-source remote sensing data
CN103632338A (en) * 2013-12-05 2014-03-12 鲁东大学 Matching curve feature based image registration evaluating method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
刘孟娟: "基于聚类分析和灰度值匹配的碎片文件拼接复原", 《价值工程》 *
宋强等: "一种单传感器实时系统误差配准算法", 《海空航空工程学院学报》 *
王腾蛟: "基于Levenberg-Marquardt算法图像拼接研究", 《中国优秀硕士学位论文全文数据库.信息科技辑》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108805811A (en) * 2018-05-30 2018-11-13 山东师范大学 A kind of natural image intelligence pattern splicing method and system based on nonconvex quadratic programming
CN116485658A (en) * 2023-06-19 2023-07-25 旷智中科(北京)技术有限公司 Multichannel image stitching method based on Monte Carlo tree search
CN116485658B (en) * 2023-06-19 2023-09-12 旷智中科(北京)技术有限公司 Multichannel image stitching method based on Monte Carlo tree search

Also Published As

Publication number Publication date
CN104091319B (en) 2017-07-11

Similar Documents

Publication Publication Date Title
CN107093172B (en) Character detection method and system
CN105469027B (en) For the horizontal and vertical lines detection and removal of file and picture
CN102054271B (en) Text line detection method and device
US9111140B2 (en) Identification and separation of form and feature elements from handwritten and other user supplied elements
CN106960208A (en) A kind of instrument liquid crystal digital automatic segmentation and the method and system of identification
CN104252620A (en) Character-touching graph verification code recognition method
CN103473572B (en) A kind of evaluation methodology of handwritten Chinese character aesthetics
CN103996180B (en) Shredder based on English words feature crushes document restored method
CN103020929A (en) Text-characteristic-based method for recovering documents crushed by paper shredder
CN103914509A (en) Method of authenticating a printed document
CN103020634A (en) Segmentation method and device for recognizing identifying codes
CN105117704B (en) A kind of text image consistency comparison method based on multiple features
CN108038495A (en) A kind of incompleteness Chinese characters recognition method
CN104182966B (en) A kind of regular shredded paper method for automatically split-jointing
CN104156725A (en) Novel Chinese character stroke combination method based on angle between stroke segments
CN102750686B (en) Super-resolution file image restoration processing method based on learning
CN107203764B (en) Method and device for recognizing long microblog images
CN105551044B (en) A kind of picture control methods and device
CN110598581A (en) Optical music score recognition method based on convolutional neural network
CN108717544B (en) An automatic detection method of newspaper sample text based on intelligent image analysis
CN104091319B (en) The shredded paper picture joining method of energy function is built based on Monte carlo algorithm
RU2633182C1 (en) Determination of text line orientation
RU2597163C2 (en) Comparing documents using reliable source
CN104992176A (en) Inscription oriented Chinese character extracting method
CN104537368A (en) Recovery and analysis method for English printed double-sided printing broken file

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170711

CF01 Termination of patent right due to non-payment of annual fee