Damaged bank bill picture positive and negative repairing method and system based on continuous interpolation technology
Technical Field
The invention relates to the technical field of picture restoration, in particular to a method and a system for repairing a picture of a damaged bank bill in a positive and negative direction based on a continuous and fractional interpolation technology.
Background
Image inpainting is to restore the integrity of the damaged image, and information filling is carried out on the specified area, so that the transition between the filled area and the original area is natural and looks like the original area which is not damaged. The image repairing technology is an important component of the digital image processing technology, has great application prospect in the aspects of medical images, movie and television special effects, virtual reality, cultural relic image recovery, banking business processing and the like, and is a research hotspot of the current computer vision and computer graphics. Particularly, in a financial system, along with the continuous expansion of the digitization and networking services of the financial system, a large amount of bill materials need to be scanned and uploaded through a scanner in the daily processing flow of banking services.
However, the uploaded bill images often have the phenomena of yellowing and incomplete storage due to long-term storage of paper bills, and the condition of damaged bill image information due to data loss also occurs when a small number of bill images are stored in a database for many years. It is necessary to repair the damaged images and pictures in order to recover the information of the customer and some important information in the bank.
At the present stage, many researchers have proposed different image repairing methods and achieved certain success, but many methods lack stability and universality, the repairing is not complete, and meanwhile, the texture part processing is not prominent. As follows:
as shown in fig. 3, which is the image to be patched.
1. The repairing is performed by using the methods of documents [1] and [2] ([1] Xing Huo, joining Tan, and MinHu. an automatic video scratch removal based on third type connectivity, Multimedia Tools and Applications, vol.71, No.2, pp.451-467,2014.[2] Xing Huo, joining Tan.A novel non-linear method of automatic video scratch removal, Proceedings-4th International reference Home, pp.39-45,2012.) the repairing method is performed by using a continuous repairing method (i.e. the latest method for performing image repairing by using a continuous method, specifically, the algorithm is described in [1] and [2], wherein the repairing method is only an improved method of repairing the scratch of document [1] and [2], as shown in the figure, and only the image is recovered by using the basic repairing method of the continuous repairing method, namely, which is described in the document [1] and the scratch of [ 4 ].
2. By using the binary continuous patch method of document [3] ([3] Xing Huo, Jieqingtan. Bivariate ratio interpolar in image inpainting, Journal of information and Computational Science, vol.2, No.3, pp.487-492,2005.). Document [3] is a recent image repair method using binary segmentation, and as a result of the processing, as shown in fig. 5, this method can repair scratches well, but the entire image has a phenomenon of right shift.
Therefore, aiming at the limitations of various repair technologies at present, how to design an efficient and simple repair method under the existing hardware condition has become a technical problem which needs to be solved urgently at present.
Disclosure of Invention
The invention aims to solve the defects that the image repairing technology in the prior art is lack of stability and universality and cannot repair picture details, and provides a bank damaged bill picture positive and negative repairing method and system based on a continuous and fractional interpolation technology to solve the problems.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a damaged bank bill image positive and negative repairing method based on a continuous interpolation technology comprises the following steps:
initializing image characteristic analysis; analyzing the input damaged bill image to judge whether the damaged bill image is a gray image or a color image; if the color image is a gray image, the color image is executed along R, G, B three color channels;
utilizing a forward repairing mode to repair damaged points of the bill image, constructing a forward interpolation window by inputting known pixel information of the damaged bill image, and reconstructing the pixel information of each damaged point by combining the forward interpolation window with a continuous rational interpolation formula to obtain a repaired bill image A;
repairing damaged points of the bill image by using a negative repairing mode, constructing a negative interpolation window by inputting known pixel information of the damaged bill image, and reconstructing the pixel information of each damaged point by combining the negative interpolation window with a continuous rational interpolation formula to obtain a repaired bill image B;
and constructing a final repairing result C by using the two repaired images, and superposing the bill image A and the bill image B to obtain the final repairing result C of the damaged bill image.
The method for repairing the damaged point of the bill image by utilizing the forward repairing mode comprises the following steps:
determining a forward interpolation window, reading information of an input damaged bill image, and constructing the forward interpolation window consisting of 16 sampling points by known pixel information around a point (x, y) to be repaired; which comprises the following steps:
for the point (x, y) to be repaired, searching and finding 16 adjacent known pixel points around the point (x, y);
according to the coordinate position of the point to be repaired, sequentially selecting:
taking the 16 pixel points as sampling points;
constructing a forward interpolation window of (x-2, x-1, x +1, x +2) × (y-2, y-1, y +1, y +2) according to the 16 sampling points;
calculating a positive gray value, and calculating the gray value of the damaged point by combining the positive interpolation window with a binary vector rational interpolation function;
traversing each point to be repaired in the damaged bill image from left to right and from top to bottom in sequence, performing a forward interpolation window determination step and a forward gray value calculation step to obtain a gray value of each point to be repaired, and obtaining a repaired bill image A after all the points to be repaired obtain the gray values.
The method for repairing the damaged point of the bill image by using the negative repairing mode comprises the following steps:
determining a negative interpolation window, reading the information of the input damaged bill image, and constructing the negative interpolation window consisting of 16 sampling points by known pixel information around the point (x, y) to be repaired; which comprises the following steps:
for the point (x, y) to be repaired, searching and finding 16 adjacent known pixel points around the point (x, y);
according to the coordinate position of the point to be repaired, sequentially selecting:
taking the 16 pixel points as sampling points;
constructing a negative interpolation window of (x-2, x-1, x +1, x +2) × (y +2, y +1, y-1, y-2) according to the 16 sampling points;
calculating a negative gray value, and calculating the gray value of the damaged point by combining the negative interpolation window with a binary vector rational interpolation function;
traversing each point to be repaired in the damaged bill image from left to right and from top to bottom in sequence, performing a negative interpolation window determination step and a negative gray value calculation step to obtain a gray value of each point to be repaired, and obtaining a repaired bill image B after all the points to be repaired obtain the gray values.
The calculation of the forward gray value comprises the following steps:
the binary vector rational interpolation format is defined as:
wherein, the pair i is 0,1, L, m, m, n is the length and width of the input image respectively;
wherein,is a Newton-Thiele type mixed difference quotient;
constructed binary vector rational functionSatisfies the following conditions:
combining the forward interpolation window (x-2, x-1, x +1, x +2) × (y-2, y-1, y +1, y +2) with a binary vector rational function to calculate the gray value R of the point (x, y) to be repaired1(x, y), namely:
R1(x,y)=A0(y)+(x-x0)A1(y)+(x-x0)(x-x1)A2(y)+(x-x0)(x-x1)(x-x2)A3(y),
wherein x0=x-2,x1=x-1,x2=x+1,x3=x+2,y0=y-2,y1=y-1,y2=y+1,y3=y+2,
φNT[x0,L,xi;y0,L,yj]I-0, 1,2,3, j-0, 1,2,3, a Newton-Thiele type mixed differential quotient;
φNT[xi;yj]=f(xi,yj) Wherein f (x)i,yj) For corresponding known pixel point (x)i,yj) Is determined by the gray-scale value of (a),
the calculation of the negative gray value comprises the following steps:
construct a rational interpolation function of binary vectors as
Where, for i, 0,1, L, m, m, n are the size of the input image length and width, respectively.
Wherein,is a Newton-Thiele type mixed difference quotient;
constructed binary vector rational functionSatisfies the following conditions:
combining a negative interpolation window (x-2, x-1, x +1, x +2) × (y +2, y +1, y-1, y-2) with a binary vector rational interpolation function to calculate the pixel value of the point (x, y) to be repaired to be R2(x, y), i.e.
R2(x,y)=B0(y)+2B1(y)+2B2(y)-2B3(y),
Wherein, x'0=x-2,x′1=x-1,x′2=x+1,x′3=x+2,y′0=y+2,y′1=y+1,y′2=y-1,y′3=y-2,
Wherein,
φNT[x′0,L,x′i;y′0,L,y′j],i=0,1,2,3,j0,1,2,3, a Newton-Thiele type mixed differential quotient,
x′0=x-2,x′1=x-1,x′2=x+1,x′3=x+2,y′0=y+2,y′1=y+1,y′2=y-1,y′3=y-2,
middle phi of the above formulaNT[x′i;y′j]Satisfies the following conditions: phi is aNT[x′i;y′j]=f(x′i,y′j) Wherein f (x'i,y′j) Is the corresponding known pixel point (x'i,y′j) The gray value of (a).
The method for constructing the final repairing result C by using the two repaired images comprises the following steps:
respectively endowing the repaired bill image A and the repaired bill image B with weighting factors to obtain a final repairing result C of the damaged bill image, wherein the formula is as follows:
C=(A+B)/2。
a bank damaged bill image positive and negative repairing system based on a continuous interpolation technology,
the device comprises an initialization image input module, a display module and a display module, wherein the initialization image input module is used for determining the type of an input image; the positive repairing module is used for obtaining a positive repaired bill image A; the negative repairing module is used for obtaining a bill image B subjected to negative repairing; the superposition repairing module is used for superposing the bill image A and the bill image B into a final repairing result C;
the output end of the initialized image input module is respectively connected with the input end of the positive repairing module and the input end of the negative repairing module, and the output end of the positive repairing module and the output end of the negative repairing module are both connected with the input end of the overlaying repairing module.
Advantageous effects
Compared with the prior art, the method and the system for repairing the image of the damaged bank bill in the positive and negative directions based on the continuous and fractional interpolation technology improve the quality and efficiency of image repair. The method is suitable for all image processing, the repaired image is good in effect and rich in texture details, and the defects that other repairing methods in the prior art are not stable enough, cannot be suitable for all images, cannot completely repair images or the repaired images are not prominent enough in texture are overcome.
Drawings
FIG. 1 is a sequence diagram of the method of the present invention;
FIG. 2 is a structural connection diagram of the present invention;
FIG. 3 is a picture to be patched;
FIG. 4 is a graph of an experiment after repairing FIG. 3 using the method of reference [1] [2 ];
FIG. 5 is an experimental diagram after repairing FIG. 3 using the method of reference [3 ];
FIG. 6 is a graph of an experiment after the repair of FIG. 3 using the method of the present invention.
Detailed Description
So that the manner in which the above recited features of the present invention can be understood and readily understood, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings, wherein:
as shown in fig. 1, according to the method for repairing the damaged bank bill picture in the positive and negative directions based on the continuous interpolation technology, the damaged image can be effectively restored through the positive interpolation window and the rational interpolation of the binary vector, another restored image can be obtained through the negative interpolation window and the rational interpolation of the binary vector, and the two images are optimized through weighting, so that the final repairing effect is obtained.
The interpolation window structure is used for reconstructing the pixel information of the damaged point, and the pixel information of the damaged point constructed by different interpolation windows also has certain difference and deviation, so the determination of the interpolation window plays an important role in the presentation of the final result C. Aiming at the technical characteristic, specific positive interpolation window and specific negative interpolation window are respectively provided, and the positive interpolation window and the negative interpolation window are not determined randomly, so that a large amount of experiments show that the image repaired by the positive interpolation window has the phenomenon of right image offset, the image repaired by the negative interpolation window has the phenomenon of left image offset, and the idea related to the invention can effectively correct the image offset and reconstruct a better repairing result.
The selection of the window is determined based on the interpolation positions of the existing pixel points, and the existing pixel points are all points around the damaged point. Particularly, for the continuous interpolation technique, in order to better apply the continuous theory to the actual process, it is preferable to select continuous coordinate points to perform the process, i.e. it is preferable to select Y-2, Y-1, Y +1, Y +2 or vice versa, Y +2, Y +1, Y-1, Y-2 for several coordinate points on the Y axis, and only in this order, the expression of the continuous formula can be better maintained. In the experimental process, it is found that the selection is made according to the ascending order of Y, namely Y-2, Y-1, Y +1, Y +2, in this case, the interpolation result may cause the image to have a shift phenomenon, and in order to alleviate the occurrence of the image, the reverse order may be adopted for processing, namely, the negative window concept is proposed. The introduction of the negative window is the window which is considered only due to the offset phenomenon caused by the positive window. Similarly, since coordinate continuity is maintained, in addition to the forward points y-2, y-1, y +1, y +2, another preferred alternative is y-2, y-1, y +1, y + 2. Because the introduction of the negative window alleviates the offset phenomenon, the positive window and the negative window are combined for processing.
Which comprises the following steps:
first, image feature analysis is initialized. The input damaged bill image is analyzed to judge whether the damaged bill image is a gray scale image or a color image. In the case of a color image, the color image is performed as a grayscale image along R, G, B three color channels, respectively. If the image is a gray image, the second step of processing is directly performed.
And secondly, repairing the damaged point of the bill image by using a forward repairing mode. And constructing a forward interpolation window by inputting known pixel information of the damaged bill image, and reconstructing the pixel information of each damaged point by combining the forward interpolation window with the continuous division rational interpolation to obtain a repaired bill image A. The definition of positive or negative windows is an artificial definition because the windows are chosen in different directions and positions, thereby defining positive or negative. The method comprises the following specific steps:
(1) and determining a forward interpolation window. Reading information of an input damaged bill image, and forming a forward interpolation window by taking 16 nearest pixel points around a point (x, y) to be repaired as sampling points, wherein the method comprises the following steps:
A. for the point (x, y) to be repaired, the search finds 16 known pixel points adjacent to the point (x, y) to be repaired.
B. According to the coordinate position of the point to be repaired, sequentially selecting:
and taking the 16 pixel points as sampling points.
C. A forward interpolation window of (x-2, x-1, x +1, x +2) × (y-2, y-1, y +1, y +2) is constructed from the 16 sample points.
(2) And calculating a forward gray value. The reconstruction of the gray value of the damaged point needs the gray value of the existing pixel point to reconstruct, that is, the interpolation technology is the most reasonable and effective method, and the effective combination of the interpolation window and the interpolation function can better reconstruct the gray information of the damaged point, here, the gray value of the damaged point is calculated by combining the forward interpolation window and the binary vector rational interpolation function, which specifically comprises the following steps:
A. the binary vector rational interpolation format is defined as:
wherein, the pair i is 0,1, L, m, m, n is the length and width of the input image respectively;
wherein,is a Newton-Thiele type mixed difference quotient;
constructed binary vector rational functionSatisfies the following conditions:
B. combining the forward interpolation window (x-2, x-1, x +1, x +2) × (y-2, y-1, y +1, y +2) with a binary vector rational function to calculate the gray value R of the point (x, y) to be repaired1(x, y), namely:
R1(x,y)=A0(y)+(x-x0)A1(y)+(x-x0)(x-x1)A2(y)+(x-x0)(x-x1)(x-x2)A3(y),
wherein x0=x-2,x1=x-1,x2=x+1,x3=x+2,y0=y-2,y1=y-1,y2=y+1,y3=y+2,
φNT[x0,L,xi;y0,L,yj]I-0, 1,2,3, j-0, 1,2,3, a Newton-Thiele type mixed differential quotient;
φNT[xi;yj]=f(xi,yj) Wherein f (x)i,yj) For corresponding known pixel point (x)i,yj) Is determined by the gray-scale value of (a),
(3) traversing each point to be repaired in the damaged bill image from left to right and from top to bottom, determining a forward interpolation window and calculating a forward gray value, and calculating the gray value of each point to be repaired aiming at a plurality of points to be repaired in the image. And obtaining a repaired bill image A after all the points to be repaired obtain the gray value.
And thirdly, repairing the damaged point of the bill image by using a negative repairing mode. And constructing a negative interpolation window by inputting known pixel information of the damaged bill image, and reconstructing the pixel information of each damaged point by combining the negative interpolation window with the continuous rational interpolation to obtain a repaired bill image B. Which comprises the following steps:
(1) and determining a negative interpolation window. Reading information of an input damaged bill image, and constructing a negative interpolation window consisting of 16 sampling points by known pixel information around a point (x, y) to be repaired; which comprises the following steps:
A. for the point (x, y) to be repaired, the search finds 16 known pixel points adjacent to the point (x, y) to be repaired.
B. According to the coordinate position of the point to be repaired, sequentially selecting:
and taking the 16 pixel points as sampling points.
C. A negative interpolation window of (x-2, x-1, x +1, x +2) × (y +2, y +1, y-1, y-2) is constructed from the 16 sample points.
(2) And calculating a negative gray value. And calculating the gray value of the damaged point by combining the negative interpolation window with a binary vector rational interpolation function. Which comprises the following steps:
A. construct a rational interpolation function of binary vectors as
Where, for i, 0,1, L, m, m, n are the size of the input image length and width, respectively.
Wherein,is a Newton-Thiele type mixed difference quotient;
constructed binary vector rational functionSatisfies the following conditions:
B. combining a negative interpolation window (x-2, x-1, x +1, x +2) × (y +2, y +1, y-1, y-2) with a binary vector rational interpolation function to calculate the pixel value of the point (x, y) to be repaired to be R2(x, y), i.e.
R2(x,y)=B0(y)+2B1(y)+2B2(y)-2B3(y),
Wherein, x'0=x-2,x′1=x-1,x′2=x+1,x′3=x+2,y′0=y+2,y′1=y+1,y′2=y-1,y′3=y-2,
Wherein,
φNT[x′0,L,x′i;y′0,L,y′j]i-0, 1,2,3, j-0, 1,2,3, a Newton-Thiele type mixed differential quotient,
x′0=x-2,x′1=x-1,x′2=x+1,x′3=x+2,y′0=y+2,y′1=y+1,y′2=y-1,y′3=y-2,
middle phi of the above formulaNT[x′i;y′j]Satisfies the following conditions: phi is aNT[x′i;y′j]=f(x′i,y′j) Wherein f (x'i,y′j) Is the corresponding known pixel point (x'i,y′j) The gray value of (a).
(3) And traversing each point to be repaired in the damaged bill image from left to right and from top to bottom in sequence, and performing a negative interpolation window determination step and a negative gray value calculation step to obtain the gray value of each point to be repaired. And obtaining a repaired bill image B after all the points to be repaired obtain the gray value.
And fourthly, constructing a final repairing result C by using the two repaired images, and superposing the bill image A and the bill image B to obtain the final repairing result C of the damaged bill image. The method for constructing the final repairing result C by using the two repaired images is as follows:
respectively endowing the repaired bill image A and the repaired bill image B with weighting factors to obtain a final repairing result C of the damaged bill image, wherein the formula is as follows:
C=(A+B)/2。
as shown in fig. 2, the present invention further provides a system for repairing the damaged bank bill picture in positive and negative directions based on the continuous interpolation technology, which includes an initialized image input module for determining the type of an input image; the positive repairing module is used for obtaining a positive repaired bill image A; the negative repairing module is used for obtaining a bill image B subjected to negative repairing; and the overlaying and repairing module is used for overlaying the bill image A and the bill image B into a final repairing result C. The output end of the initialized image input module is respectively connected with the input end of the positive repairing module and the input end of the negative repairing module, the initialized image is respectively transmitted to the positive repairing module and the negative repairing module to be synchronously processed, the output end of the positive repairing module and the output end of the negative repairing module are both connected with the input end of the overlaying module, and then the images processed by the positive repairing module and the negative repairing module are overlaid to obtain a final processing result.
As shown in FIG. 6, after the reconstruction is performed by the method of the present invention, the detail recovery of the scratched part is better, and the method is optimized and improved to a greater extent than the method of the document [1] [2] [3 ].
The foregoing shows and describes the general principles, essential features, and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are merely illustrative of the principles of the invention, but that various changes and modifications may be made without departing from the spirit and scope of the invention, which fall within the scope of the invention as claimed. The scope of the invention is defined by the appended claims and equivalents thereof.