CN110264478A - A kind of method and device of line manuscript base picture colouring - Google Patents

A kind of method and device of line manuscript base picture colouring Download PDF

Info

Publication number
CN110264478A
CN110264478A CN201910551946.XA CN201910551946A CN110264478A CN 110264478 A CN110264478 A CN 110264478A CN 201910551946 A CN201910551946 A CN 201910551946A CN 110264478 A CN110264478 A CN 110264478A
Authority
CN
China
Prior art keywords
region
manuscript base
base picture
label
point
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.)
Pending
Application number
CN201910551946.XA
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Institute of Computing Technology of CAS
Tencent Cyber Tianjin Co Ltd
Original Assignee
Institute of Computing Technology of CAS
Tencent Cyber Tianjin Co Ltd
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 Institute of Computing Technology of CAS, Tencent Cyber Tianjin Co Ltd filed Critical Institute of Computing Technology of CAS
Priority to CN201910551946.XA priority Critical patent/CN110264478A/en
Publication of CN110264478A publication Critical patent/CN110264478A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Abstract

This application discloses a kind of method and devices of line manuscript base picture colouring to avoid the colour contamination of adjacent area for precisely being painted to line manuscript base picture.The application method includes: to obtain the wired manuscript base picture of institute to be painted;According to preset image segmentation algorithm by each line original text image segmentation multiple regions;Select an at least width line manuscript base picture as reference picture, and using the line manuscript base picture in addition to reference picture as target image;Obtain the label in each region of reference picture;All areas in line manuscript base picture are matched two-by-two;The label in each region in target image is determined according to the label in the region of matching result and reference picture;It is painted according to label and the preset corresponding relationship of field color to the wired manuscript base picture of institute.

Description

A kind of method and device of line manuscript base picture colouring
Technical field
This application involves the method and devices that technical field of image processing more particularly to a kind of line manuscript base picture are painted.
Background technique
With flourishing for game industry and caricature industry, the renewal speed of game products and caricature product gradually adds Fastly.The update of game products and caricature product mainly includes drawing line manuscript base picture and carrying out two processes of colouring to line manuscript base picture.
A game products or caricature product generally comprise a large amount of line manuscript base pictures, are needed based on painting to a large amount of line manuscript base pictures It asks, a current method is that the line manuscript base picture for using neural network to treat colouring is trained, to complete the upper of line manuscript base picture Color.
However, since the method for being trained colouring using neural network is not mature enough, in obtained color image, The problems such as often will appear adjacent area colour contamination, leads to result inaccuracy of painting.
Summary of the invention
The embodiment of the present application provides a kind of method and device of line manuscript base picture colouring, accurate for carrying out to line manuscript base picture Colouring, avoids the colour contamination of adjacent area.
In view of this, the application first aspect provides a kind of painting methods of line manuscript base picture, comprising:
Obtain the wired manuscript base picture of institute to be painted;
According to preset image segmentation algorithm by each line original text image segmentation multiple regions;
Select an at least width line manuscript base picture as reference picture, and using the line manuscript base picture in addition to the reference picture as mesh Logo image;
Obtain the label in each region of the reference picture;
All areas in described wired manuscript base picture are matched two-by-two;
Each region in the target image is determined according to the label in the region of matching result and the reference picture Label;
It is painted according to label and the preset corresponding relationship of field color to the wired manuscript base picture of institute.
In a kind of possible design, in the first implementation of the first aspect of the embodiment of the present application,
It selects one of them unmarked region to be marked according to the label in obtained unmarked region to include:
It is calculated according to preset error estimation algorithm and is selected according to the label in obtained unmarked region to each unmarked The risk that region is marked;
It is marked according to the smallest unmarked region of the label risk of selection in obtained unmarked region.
In a kind of possible design, in second of implementation of the first aspect of the embodiment of the present application,
After each iterative calculation, according to the label in obtained unmarked region select one of them unmarked region into Before line flag, further includes:
According to the syntople between preset MINLP model algorithm and label to obtained unmarked region Label optimizes, and the syntople between the syntople between the label and region is corresponding.
The application second aspect provides a kind of coloring means of line manuscript base picture, comprising:
First acquisition unit, for obtaining the wired manuscript base picture of institute to be painted;
Cutting unit, for according to preset image segmentation algorithm by each line original text image segmentation multiple regions;
First selecting unit for selecting an at least width line manuscript base picture as reference picture, and will remove the reference picture Outer line manuscript base picture is as target image;
Second acquisition unit, the label in each region for obtaining the reference picture;
Matching unit, for being matched two-by-two to all areas in described wired manuscript base picture;
Tag determination unit, the label for the region according to matching result and the reference picture determine the target figure The label in each region as in;
Upper color element, for being carried out according to the preset corresponding relationship of label and field color to the wired manuscript base picture of institute Color.
In a kind of possible design, in the first implementation of the second aspect of the embodiment of the present application,
The matching unit is used for:
The shape feature in each region of the line manuscript base picture is extracted according to preset Shape context inner distance algorithm;
The all areas in the line manuscript base picture are matched two-by-two according to the shape feature.
In a kind of possible design, in second of implementation of the second aspect of the embodiment of the present application,
The matching unit is used for:
For each region of the line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes Current point with the shortest distance of other each points on zone boundary inside region and current point with on zone boundary other The angle of point each point shortest distance line and current point tangent line;
The all areas in the line manuscript base picture are matched two-by-two according to the shape feature.
In a kind of possible design, in the third implementation of the second aspect of the embodiment of the present application,
The matching unit is used for:
For each region of the line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes Current point with the shortest distance of other each points on zone boundary inside region and current point with on zone boundary other The angle of point each point shortest distance line and current point tangent line;
For each region of the line manuscript base picture, multiple shortest distance reference intervals and multiple angle reference areas are obtained Between;
It establishes and is equal to the shortest distance reference interval number with the one-to-one point vector of point, the dimension of described vector With the product of the angle reference interval number, value of the described vector in each dimension is equal to, with the same region of current point Point in other points on boundary, positioned at a shortest distance reference interval and in an angle reference interval Number;
The matching value of each point between any two of the region in the line manuscript base picture is calculated according to described vector;
The matching value of region between any two in the line manuscript base picture is calculated according to the matching value of each point.
In a kind of possible design, in the 4th kind of implementation of the second aspect of the embodiment of the present application,
The matching unit is used for:
For each region of the line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes Current point with the shortest distance of other each points on zone boundary inside region and current point with on zone boundary other The angle of point each point shortest distance line and current point tangent line;
For each region of the line manuscript base picture, multiple shortest distance reference intervals and multiple angle reference areas are obtained Between;
It establishes and is equal to the shortest distance reference interval number with the one-to-one point vector of point, the dimension of described vector With the product of the angle reference interval number, value of the described vector in each dimension is equal to, with the same region of current point Point in other points on boundary, positioned at a shortest distance reference interval and in an angle reference interval Number;
The matching value of each point between any two of the region in the line manuscript base picture is calculated according to described vector;
Point matching value in the line manuscript base picture between any two region greater than threshold value is set to preset penalty value;
For any two region in the line manuscript base picture, all match point combinations for meeting preset condition, institute are obtained State match point combination include the one group of point selected from points multiple on a zone boundary and from another zone boundary it is multiple The one group of point selected in point, two groups of points respectively on respective zone boundary according to preset direction correspond and it is two corresponding The matching value of point is respectively less than threshold value, and the preset direction is clockwise or counterclockwise;
For each match point combination, the sum of each matching value and corresponding punishment total value in the match point group, institute are obtained The product that punishment total value is the preset penalty value and penalty number is stated, the penalty number is the number and one of the multiple point The difference of group point midpoint number;
Using the minimum value of the sum as the matching value in described two regions.
In a kind of possible design, in the 5th kind of implementation of the second aspect of the embodiment of the present application,
The matching unit is used for:
For each region of the line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes Current point with the shortest distance of other each points on zone boundary inside region and current point with on zone boundary other The angle of point each point shortest distance line and current point tangent line;
For each region of the line manuscript base picture, the most short distance inside region between points is obtained on zone boundary From maximum value and shortest distance line and tangent line angle maximum value;
Average segmentation is carried out according to maximum value of the number of preset shortest distance reference interval to the shortest distance, is obtained To multiple shortest distance reference intervals;
Average segmentation is carried out according to maximum value of the number of preset angle reference interval to the angle, obtains multiple folders Angle reference interval;
It establishes and is equal to the shortest distance reference interval number with the one-to-one point vector of point, the dimension of described vector With the product of the angle reference interval number, value of the described vector in each dimension is equal to, with the same region of current point Point in other points on boundary, positioned at a shortest distance reference interval and in an angle reference interval Number;
The matching value of each point between any two of the region in the line manuscript base picture is calculated according to described vector;
Point matching value in the line manuscript base picture between any two region greater than threshold value is set to preset penalty value;
For any two region in the line manuscript base picture, all match point combinations for meeting preset condition, institute are obtained State match point combination include the one group of point selected from points multiple on a zone boundary and from another zone boundary it is multiple The one group of point selected in point, two groups of points respectively on respective zone boundary according to preset direction correspond and it is two corresponding The matching value of point is respectively less than threshold value, and the preset direction is clockwise or counterclockwise;
For each match point combination, the sum of each matching value and corresponding punishment total value in the match point group, institute are obtained The product that punishment total value is the preset penalty value and penalty number is stated, the penalty number is the number and one of the multiple point The difference of group point midpoint number;
Using the minimum value of the sum as the matching value in described two regions.
In a kind of possible design, in the 6th kind of implementation of the second aspect of the embodiment of the present application,
The tag determination unit is used for:
Using the label in the region with the smallest reference picture of the Region Matching value of the target image as the mesh The label in logo image region.
In a kind of possible design, in the 7th kind of implementation of the second aspect of the embodiment of the present application,
The label is number;
The tag determination unit is used for:
For any two region in the line manuscript base picture, the matching value match point corresponding with the matching value is obtained The ratio of one group of point midpoint number is as weight in combination;
With the first energy functionMinimum objective function carries out iteration at least once It calculates, after each iterative calculation, selects one of them unmarked region to be marked according to the label in obtained unmarked region Note, and next iteration calculating is carried out after label, after the number of iterations reaches preset times, according to last time iteration meter Remaining all unmarked regions are marked in the label in obtained unmarked region, and the unmarked region is that label is not true The region of fixed target image, f (j) represent the label in j-th of region, and f (i) represents the label of ith zone, wi,jRepresent i-th A region weight corresponding with j-th of region, i and j are positive integer.
In a kind of possible design, in the 8th kind of implementation of the second aspect of the embodiment of the present application,
The label is number;
The tag determination unit is used for:
For any two region in the line manuscript base picture, the matching value match point corresponding with the matching value is obtained The ratio of one group of point midpoint number is as weight in combination;
With the first energy functionMinimum objective function carries out iteration at least once It calculates, after each iterative calculation, is calculated according to preset error estimation algorithm and selected according to the label in obtained unmarked region Select the risk that each unmarked region is marked;Label risk of selection according to obtained unmarked region is the smallest unmarked Region is marked, and next iteration calculating is carried out after label, after the number of iterations reaches preset times, according to last Remaining all unmarked regions are marked in the label in the unmarked region that an iteration is calculated, the unmarked region For the region of the undetermined target image of label, f (j) represents the label in j-th of region, and f (i) represents the label of ith zone, wi,jIth zone weight corresponding with j-th of region is represented, i and j are positive integer.
In a kind of possible design, in the 9th kind of implementation of the second aspect of the embodiment of the present application,
The coloring means of the line manuscript base picture further include:
Optimize unit, for according to syntople between preset MINLP model algorithm and label to obtaining The label in unmarked region optimizes, and the syntople between the syntople between the label and region is corresponding.
The third aspect of the embodiment of the present application provides a kind of terminal device, comprising: memory, transceiver, processor and Bus system;Wherein, the memory is for storing program;The processor is used to execute the finger in the memory It enables, so that the communication device realizes the function of the coloring means such as aforementioned second aspect middle line manuscript base picture.
The fourth aspect of the embodiment of the present application provides a kind of computer readable storage medium, the computer-readable storage Instruction is stored in medium, when run on a computer, so that computer executes such as aforementioned second aspect middle line manuscript base picture Coloring means function.
As can be seen from the above technical solutions, the embodiment of the present application has the advantage that
Region segmentation first is carried out to the wired manuscript base picture of institute, label label then is carried out to the region of reference picture, then to line All areas in manuscript base picture are matched two-by-two, and then can determine the label of object region, finally according to label with The corresponding relationship of field color paints to line manuscript base picture, and the accurate colouring to line manuscript base picture may be implemented, and paint Minimum unit is exactly a cut zone, if can accurate cut-off rule manuscript base picture, can be to avoid adjacent area colour contamination.
Detailed description of the invention
Fig. 1 is one embodiment schematic diagram of line manuscript base picture to be painted in the embodiment of the present application;
Fig. 2 is another embodiment schematic diagram of line manuscript base picture to be painted in the embodiment of the present application;
Fig. 3 is a kind of one embodiment schematic diagram of the painting methods of line manuscript base picture provided by the embodiments of the present application;
Fig. 4 is the embodiment schematic diagram of the discontinuous line manuscript base picture in the embodiment of the present application middle line original text boundary;
Fig. 5 is to be shown in the embodiment of the present application using the colouring result after SEEDS algorithm is split the line manuscript base picture of Fig. 4 It is intended to;
Fig. 6 is the colouring result signal after being split using ERS algorithm to the line manuscript base picture of Fig. 4 in the embodiment of the present application Figure;
Fig. 7 is the colouring knot after being split using bead partitioning algorithm to the line manuscript base picture of Fig. 4 in the embodiment of the present application Fruit schematic diagram;
Fig. 8 is the result schematic diagram using connected component analysis method to the line manuscript base picture colouring of Fig. 4;
Fig. 9 is one embodiment schematic diagram of reference picture in the embodiment of the present application;
Figure 10 is after carrying out Region Matching to target image and reference picture shown in Fig. 9 using Patch-Match algorithm Result schematic diagram;
Figure 11 is after carrying out Region Matching to target image and reference picture shown in Fig. 9 using SIFT feature algorithm algorithm Result schematic diagram;
Figure 12 is after carrying out Region Matching to target image and reference picture shown in Fig. 9 using Shape context algorithm Result schematic diagram;
Figure 13 is to carry out region to target image and reference picture shown in Fig. 9 using Shape context inner distance algorithm Result schematic diagram after matching;
Figure 14 is that all areas provided by the embodiments of the present application in line manuscript base picture carry out matched implementation illustration two-by-two It is intended to;
Figure 15 is one embodiment schematic diagram in the region of the embodiment of the present application middle line manuscript base picture;
Figure 16 is of region between any two calculated in the embodiment of the present application according to the matching value of each point in line manuscript base picture Embodiment schematic diagram with value;
Figure 17 (a) is not use Active Learning and MINLP model algorithm, using Active Learning, is learned using active Practise the contrast schematic diagram of label accuracy rate corresponding with three kinds of situations of MINLP model algorithm;
Figure 17 (b) is the embodiment schematic diagram of reference picture in the embodiment of the present application;
Figure 17 (c) is another embodiment schematic diagram of line manuscript base picture to be painted in the embodiment of the present application;
Figure 17 (d) is according to the reference picture of Figure 17 (b) in the case where not using MINLP model algorithm to figure The effect diagram that line manuscript base picture in 17 (c) is painted;
Figure 17 (e) be using MINLP model algorithm in the case where according to the reference picture of Figure 17 (b) to Figure 17 (c) effect diagram that the line manuscript base picture in is painted;
Figure 18 is the contrast schematic diagram of the label accuracy rate of object region when λ takes different value;
Figure 19 is a kind of structural representation of one embodiment of the device of line manuscript base picture colouring provided by the embodiments of the present application Figure;
Figure 20 is a kind of structural schematic diagram of one embodiment of terminal device provided by the embodiments of the present application.
Specific embodiment
The embodiment of the present application provides a kind of method and device of line manuscript base picture colouring, accurate for carrying out to line manuscript base picture Colouring, avoids the colour contamination of adjacent area.
The description and claims of this application and term " first ", " second ", " third ", " in above-mentioned attached drawing The (if present)s such as four " are to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should manage The data that solution uses in this way are interchangeable under appropriate circumstances, so that embodiments herein described herein for example can be to remove Sequence other than those of illustrating or describe herein is implemented.In addition, term " includes " and " corresponding to " and their times What is deformed, it is intended that cover it is non-exclusive include, for example, contain the process, method of a series of steps or units, system, Product or equipment those of are not necessarily limited to be clearly listed step or unit, but may include be not clearly listed or for The intrinsic other step or units of these process, methods, product or equipment.
It is specifically please referred to it should be understood that the application is applied to the scenes such as cartoon making, animation production and game making Fig. 1, one embodiment schematic diagram of line manuscript base picture to be painted in the embodiment of the present application.Shown in FIG. 1 is personage's line manuscript base picture, In the line manuscript base picture, personage is divided into multiple regions by line original text boundary, is exactly to fill each region to the colouring of line manuscript base picture Corresponding color.As shown in Fig. 2, another embodiment schematic diagram of line manuscript base picture to be painted in the embodiment of the present application.It can be with Find out, Fig. 2 and it is shown in FIG. 1 be image of the same personage under different conditions.
The method of line manuscript base picture colouring provided by the embodiments of the present application is suitable for carrying out colouring scene to multiple line manuscript base pictures, It may include any object such as personage, animal, object in multiple line original texts.
In order to make it easy to understand, will be introduced below with specific embodiment.Referring to Fig. 3, the embodiment of the present application provides A kind of line manuscript base picture painting methods one embodiment schematic diagram.The embodiment of the present application provides a kind of the upper of line manuscript base picture One embodiment of color method, comprising:
301, obtain the wired manuscript base picture of institute to be painted.
It is understood that wired manuscript base picture may include same object different conditions image, also may include not With the image of object, the embodiment of the present application is without limitation.
302, according to preset image segmentation algorithm by each line original text image segmentation multiple regions.
It is understood that each region to line manuscript base picture is needed to paint respectively, it is necessary to each region into Row extracts, so the embodiment of the present application is split processing to line manuscript base picture using image segmentation algorithm, to obtain multiple areas Domain.
However, with the presence of line manuscript base picture the discontinuous situation in line original text boundary, as shown in figure 4, in the embodiment of the present application The embodiment schematic diagram of the discontinuous line manuscript base picture in line original text boundary.Shown in Fig. 4 is " Doraemon ", figure 4, it is seen that machine Boundary between the region of a foot and the region of body of device cat is discontinuous, and under normal circumstances, foot is different with the color of body, So the image segmentation algorithm in the embodiment of the present application needs precisely to divide the discontinuous adjacent area in boundary, to prevent It is a region by two zone errors Ground Splits of noncoherent boundary two sides.
There are many image segmentation algorithms, including SEEDS algorithm, ERS algorithm and bead partitioning algorithm etc..In order to test this The segmentation effect of three kinds of algorithms, the embodiment of the present application are respectively adopted these three algorithms and are split to line manuscript base picture shown in Fig. 4, Then the region obtained to segmentation is painted respectively, and result of painting is as shown in Fig. 5, Fig. 6 and Fig. 7, and wherein Fig. 5 is that the application is real The colouring result schematic diagram after being split using SEEDS algorithm to the line manuscript base picture of Fig. 4 in example is applied, Fig. 6 is the application implementation Colouring result schematic diagram after being split using ERS algorithm to the line manuscript base picture of Fig. 4 in example, Fig. 7 are in the embodiment of the present application Colouring result schematic diagram after being split using line manuscript base picture of the bead partitioning algorithm to Fig. 4.
From fig. 5, it can be seen that being split using line manuscript base picture of the SEEDS algorithm to Fig. 4, it cannot be guaranteed that " Doraemon " is former Some region shapes;From fig. 6, it can be seen that being split using line manuscript base picture of the ERS algorithm to Fig. 4, the line original text of " Doraemon " A line in boundary is divided into multiple zonules, and dimension constraint is weaker, and it is adjacent to be partitioned into discontinuous two of boundary Region;From figure 7 it can be seen that being split using line manuscript base picture of the bead partitioning algorithm to Fig. 4, effect is preferable, can be accurate Discontinuous two adjacent areas in boundary are separated.
In order to preferably embody the effect being split using line manuscript base picture of the bead partitioning algorithm to Fig. 4, the application is real The method that example uses connected component analysis is applied, to the different color mark of each connected region in the line manuscript base picture of Fig. 4, knot Fruit is as shown in figure 8, using connected component analysis method to the result schematic diagram of the line manuscript base picture colouring of Fig. 4.
Comparison diagram 7 and Fig. 8 can be seen that can be accurately by the region of " Doraemon " foot and body using bead partitioning algorithm The region segmentation of body is opened.
Therefore, in order to guarantee the accurate segmentation to line manuscript base picture, the embodiment of the present application can be made using bead partitioning algorithm For image segmentation algorithm, in addition to this, the embodiment of the present application can also be capable of the algorithm of accurate cut-off rule manuscript base picture using other.
303, select an at least width line manuscript base picture as reference picture, and using the line manuscript base picture in addition to reference picture as mesh Logo image.
It should be noted that the quantity of reference picture can be adjusted according to the quantity of line manuscript base picture to be painted, example Such as, if the quantity of line manuscript base picture to be painted is more, tens width line manuscript base pictures can be chosen as reference picture, if to be painted The negligible amounts of line manuscript base picture can choose a few width line manuscript base pictures as reference picture;In addition, the quantity of reference picture can root It is adjusted according to the complexity of line manuscript base picture to be painted, it, can be with for example, if the complexity of line manuscript base picture to be painted is higher Tens width line manuscript base pictures, which are chosen, as reference picture can choose a few width lines if the complexity of line manuscript base picture to be painted is lower Manuscript base picture is as reference picture.
It is further to note that the embodiment of the present application does not limit the execution sequence between step 302 and step 303 It is fixed.
304, obtain the label in each region of reference picture.
It should be noted that the method that the embodiment of the present application paints to line manuscript base picture is after choosing reference picture, to ginseng The label for examining each region of image is marked, which can be handmarking, which is the label for obtaining label As a result.
Label is used for marked region, may include diversified forms, such as can be number, can be letter, or Chinese character.
305, to all areas in wired manuscript base picture matched two-by-two.
It should be noted that matching process has very much, the application is not limited this, and matching result can be two arbitrarily The matching degree in region is also possible to and another highest region of a Region Matching degree.
The embodiment of the present application between step 304 and step 305 execution sequence without limitation.
306, the label in each region in target image is determined according to the label in the region of matching result and reference picture.
It should be noted that according to same matching result determine area label method can there are many, and Different matching As a result the method for corresponding determining area label can also be different, thus the embodiment of the present application to determine area label method not It is specifically limited.
307, it is painted according to label and the preset corresponding relationship of field color to the wired manuscript base picture of institute.
It is understood that if wired manuscript base picture each region label determine, then label can be specified Color, for example, label 1 is green, label 2 is red, finally can complete institute according to label and the corresponding relationship of field color The colouring of wired manuscript base picture.
The accurate colouring to line manuscript base picture may be implemented in the embodiment of the present application, and the minimum unit painted is exactly one point Cut region, if can accurate cut-off rule manuscript base picture, can be to avoid adjacent area colour contamination;In addition, in the embodiment of the present application, Only need that the label of reference picture is marked, can complete to wired manuscript base picture colouring, the especially present age upper colo(u)r streak Manuscript base as it is more when, the method for the embodiment of the present application can reduce label label workload.
In addition, in a kind of the another of painting methods of line manuscript base picture provided by the embodiments of the present application In one embodiment, the region of target image match with the region of reference picture may include:
The shape feature in each region of line manuscript base picture is extracted according to preset Shape context inner distance algorithm;
The all areas in line manuscript base picture are matched two-by-two according to shape feature.
It should be noted that shape feature may include it is a variety of, the embodiment of the present application does not limit this.
Carrying out matched algorithm to two regions includes Patch-Match algorithm, SIFT feature algorithm, Shape context calculation The many algorithms such as method and Shape context inner distance algorithm, the embodiment of the present application select Shape context inner distance algorithm The matching between two regions in line manuscript base picture is carried out, is had preferably to verify Shape context inner distance algorithm With effect, Patch-Match algorithm, SIFT feature algorithm, Shape context algorithm and shape is respectively adopted in the embodiment of the present application Shape context inner distance algorithm matches same reference picture and same target image, and wherein reference picture is such as Fig. 9 Shown, matching result is respectively as shown in Figure 10, Figure 11, Figure 12 and Figure 13.
In Fig. 9, different gray scales represents different labels;In Figure 10, Figure 11, Figure 12 and Figure 13, different gray scales Also represent different labels, and these labels be respectively by Patch-Match algorithm, SIFT feature algorithm, in shape under What literary algorithm and Shape context inner distance algorithmic match were got, comparison diagram 9, Figure 10, Figure 11, Figure 12 and Figure 13 can be with Find out, it is best to carry out matched effect to two regions using Shape context inner distance algorithm.
Further, the matching process of object region and reference picture region in order to facilitate understanding, will be made below More detailed explanation.Figure 14 is please referred to, all areas provided by the embodiments of the present application in line manuscript base picture are matched two-by-two Embodiment schematic diagram.The embodiment of the present application, which is provided, carries out a matched implementation two-by-two to all areas in line manuscript base picture Example, comprising:
401, for each region of line manuscript base picture, multiple points are taken on zone boundary.
It should be noted that the embodiment of the present application is to taking method to be a little not specifically limited, as long as guaranteeing all areas It follows the example of identical, for example, multiple points can be taken at random, can equidistantly take multiple points.
402, shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes Current point with the shortest distance of other each points on zone boundary inside region and current point with on zone boundary other The angle of point each point shortest distance line and current point tangent line.
Figure 15 is please referred to, one embodiment schematic diagram in the region of the embodiment of the present application middle line manuscript base picture is shown in fig. 5 to be One region, there are two points of p and q on the zone boundary in the region, it is assumed that the point feature for needing to obtain point p, then needing It obtains point p and the shortest distance and p point and other each point shortest distance lines of other each points inside region is cut with current point The angle of line.
Here by taking p point and q point as an example, the shortest distance between p point and q point refers to p point and q point line merely through the region In the case where inside, the shortest distance of line, as shown in figure 15, the dotted line between p point and q point represent shortest distance line, θ generation The angle of shortest distance line and current point tangent line between table p point and q point.
It should be noted that shortest distance line is generally made of a plurality of broken line, when calculating angle, chooses and pass through p The broken line and tangent line of point calculate angle.
403, for each region of line manuscript base picture, obtain multiple shortest distance reference intervals and multiple angle reference areas Between.
It should be noted that in the embodiment of the present application, the siding-to-siding block length of multiple shortest distance reference intervals can be equal, Can not also wait, such as all be 0.5mm, then multiple shortest distance reference intervals may include [0,0.5mm] and [0.5mm, 1mm];Similarly, the siding-to-siding block length of angle reference interval can be equal, can not also wait, specifically be not detailed.
404, it establishes with the one-to-one point vector of point, the dimension for putting vector is equal to shortest distance reference interval number and folder The product of angle reference interval number is put value of the vector in each dimension and is equal to, with current point with other points of zone boundary In, positioned at a shortest distance reference interval and the point number in an angle reference interval.
It is understood that assuming to have chosen 100 points on zone boundary, the number of shortest distance reference interval is 8 A, the number of angle reference interval is 12;By taking a point as an example, the dimension of the corresponding vector of point is then 8*12=96, It is then in addition to the point in the corresponding shortest distance reference interval of each dimension and an angle reference interval, each dimension values Other 99 points, while being located at the number of a shortest distance reference interval and an angle reference interval.
405, the matching value of each point between any two of the region in line manuscript base picture is calculated according to vector.
It should be noted that the calculation method of matching value may include a variety of between two o'clock, such as can be by corresponding two Matching value of the similarity of a vector as the two points, and the similarity of two vectors can be cosine similarity;Also Formula can be passed throughThe matching value of two points is calculated, wherein n represents dimension, and m represents dimension Degree sum, A represent a region, and B represents another region, and h represents dimension values.
406, the matching value of region between any two in line manuscript base picture is calculated according to the matching value of each point.
It should be noted that between region there are many calculation methods of matching value, the embodiment of the present application without limitation, later It will be described in detail with a kind of calculating process of calculation method to matching value between region.
It please refers to Figure 16, the region in line manuscript base picture is calculated between any two according to the matching value of each point in the embodiment of the present application Matching value embodiment schematic diagram.
In this embodiment, the matching value packet of region between any two in line manuscript base picture is calculated according to the matching value of each point It includes:
601, the point matching value in line manuscript base picture between any two region greater than threshold value is set to preset penalty value.
It should be noted that when passing through formulaWhen calculating the matching value of two points, The matching degree of two points is higher, and matching value is smaller instead, so when the matching value of two points is greater than threshold value, it is believed that this two A point is unmatched, therefore the two matching values put are set to preset penalty value.
602, for any two region in line manuscript base picture, all match point combinations for meeting preset condition are obtained, It include from the one group of point selected in points multiple on a zone boundary and from points multiple on another zone boundary with a combination The one group of point selected, two groups of points correspond respectively according to preset direction on respective zone boundary and corresponding two points Matching value is respectively less than threshold value, and preset direction is clockwise or counterclockwise.
It should be noted that two groups of points are due to that will meet one-to-one preset condition, so two in match point combination The number of group point is equal;Assuming that 8 points comprising a region, 8 points comprising another region, then this 8 pairs of points according to It needs to correspond in borderline preset direction and corresponding matching value is less than threshold value, specifically, it is assumed that 8 in a region Number is abcdefgh to a point respectively in the direction of the clock, and number is 8 in another region point respectively in the direction of the clock ABCDEFGH, if respectively using a and B as starting point, a and B, b and C, c and D, d and E, e and F, f and G, g and H, h and A matching value want Less than threshold value.
And the point number being spaced between the point number being spaced between a and b, with A and B may be the same or different, this Shen Please embodiment do not limit this.
603, for each match point combination, the sum of each matching value and corresponding punishment total value in match point group is obtained, is punished Penalizing total value is the product of preset penalty value and penalty number, and penalty number is the number and one group of point midpoint number of multiple points Difference.
It should be noted that if the point number chosen on a zone boundary is 10, and one in match point combination Group point includes 8 points, then penalty number is then 10-8=2.
In the embodiment of the present application, match point combination indicates a kind of matching scheme in two regions, thus one and Indicate a kind of matching degree of matching scheme.
604, using the minimum value of sum as the matching value in two regions.
It is understood that the matching degree with two regions of expression, when the embodiment of the present application selects matching degree maximum Matching value of the sum as the two regions, i.e., using the minimum value of sum as the matching value in final two regions.
By above-mentioned calculating, all there is a matching value between any two region.
Further, for each region of line manuscript base picture, multiple shortest distance reference intervals and multiple angles ginseng are obtained May include: between examination district
For each region of line manuscript base picture, the shortest distance inside region between points is obtained on zone boundary The maximum value of the angle of maximum value and shortest distance line and tangent line;
Average segmentation is carried out according to maximum value of the number of preset shortest distance reference interval to the shortest distance, is obtained more A shortest distance reference interval;
Average segmentation is carried out according to maximum value of the number of preset angle reference interval to angle, obtains multiple angle ginsengs Between examination district.
For example, it is assumed that a region of line manuscript base picture, has taken three points on zone boundary, then any two point is most Short distance includes three kinds of results, it is assumed that is respectively that 10mm, 15mm and 20mm are then selected if necessary to 4 shortest distance reference intervals Carry out average segmentation with 20mm, obtained shortest distance reference interval be respectively [0,0.5mm], [0.5mm, 1mm], [1mm, 1.5mm] and [1.5mm, 2mm];Similarly, multiple angle reference intervals can also be acquired using the above method, not repeated them here to this.
In addition to the above method, multiple shortest distance reference intervals and multiple angles ginseng can also be obtained using preset method It, can successively three preset 0-15 degree, 15-20 degree and 20-30 degree angle reference areas by taking angle reference interval as an example between examination district Between.
Further, each region in target image is determined according to the label in the region of matching result and reference picture Label may include:
Using the label in the region of the smallest reference picture of Region Matching value with target image as object region Label.
It is understood that when the matching value minimum in the region in the region and reference picture of target image, it was demonstrated that the two The similarity in region is maximum, so the embodiment of the present application is using the area label of the smallest reference picture of matching value as target image The label in region, in this way, the label in each region in target image can be determined.
And in a kind of another embodiment of the painting methods of line manuscript base picture provided by the present application, in order to further increase The label accuracy of object region, the method that the embodiment of the present application uses Active Learning will be tied below to according to matching The label in the region of fruit and reference picture determines that the process of the label in each region in target image is specifically introduced.
In the embodiment of the present application, due to needing to carry out operation to label, so label is number, according to matching result and The label in the region of reference picture determines that the label in each region in target image includes:
For any two region in line manuscript base picture, one group of point in matching value match point combination corresponding with matching value is obtained The ratio of midpoint number is as weight;
With the first energy functionMinimum objective function carries out iteration at least once It calculates, after each iterative calculation, selects one of them unmarked region to be marked according to the label in obtained unmarked region Note, and next iteration calculating is carried out after label, after the number of iterations reaches preset times, according to last time iteration meter Remaining all unmarked regions are marked in the label in obtained unmarked region, and unmarked region is that label is undetermined The region of target image, f (j) represent the label in j-th of region, and f (i) represents the label of ith zone, wi,jRepresent i-th of area Domain weight corresponding with j-th of region, i and j are positive integer.
It should be noted that in the embodiment of the present application, being changed with the minimum objective function of the first energy function E (f) In generation, calculates, i.e., the process of one optimizing, wherein f (j) represents the label in j-th of marked region, then means that f (j) is known Label can obtain the label f (i) in one group of unmarked region after each iterative calculation.
For example, it is assumed that reference picture include 5 regions, the label in this 5 regions be it is known, target image also includes 5 A region, the label in this 5 regions be it is unknown, after an iteration calculates, can obtain the first energy function E (f) minimum When, 5 respective labels in region of target image.
However, obtain in the label in 5 regions of target image, it may be vicious, so being obtained according to iterative calculation 5 labels when the region of target image is marked, a region of the embodiment of the present application elder generation selection target image carries out Label, after the completion of to be marked, marked region becomes 6, and the embodiment of the present application carries out second and iterates to calculate, to recalculate Remaining 4 unmarked regions.
It repeats the above process until the number of iterations reaches preset times, it is to be understood that assuming that carrying out 2 iterative calculation Afterwards, marked region becomes 7, and unmarked region becomes 3, and the 2nd iterative calculation can obtain the respective mark in unmarked region Label, the embodiment of the present application then iterate to calculate obtained label according to the 2nd time and successively each unmarked region are marked, finally It then can determine whether the label in each region of target image.
In above process, after an iteration calculates, one of them unlabelled region is only selected to be marked, then again Iterative calculation next time is carried out, is the accuracy in order to guarantee each area label of target image, therefore has to selection wind The smallest unmarked region in danger is marked.
So in a kind of another embodiment of the painting methods of line manuscript base picture provided by the embodiments of the present application, according to The label in obtained unmarked region selects one of them unmarked region to be marked
It is calculated according to preset error estimation algorithm and is selected according to the label in obtained unmarked region to each unmarked The risk that region is marked;
It is marked according to the smallest unmarked region of the label risk of selection in obtained unmarked region.
Further, in order to the unmarked region optimized label as a result, after each iterative calculation, according to To unmarked region label select one of them unmarked region to be marked before, on the embodiment of the present application middle line manuscript base picture The method of color can also include:
According to the syntople between preset MINLP model algorithm and label to obtained unmarked region Label optimizes, and the syntople between the syntople between label and region is corresponding.
It should be noted that in the embodiment of the present application, above-mentioned Optimization Steps are carried out after each iterative calculation, this is removed Except, it can also be carried out after iterative calculation is fully finished.
In the embodiment of the present application, it between the region of target image there are syntople, should also be deposited between corresponding label In syntople, thus according between label syntople and MINLP model algorithm to obtained unmarked area The label in domain optimizes.
In MINLP model algorithm, with the second energy function E=Ematch+λElocalIt is up to objective function,EmatchThe cost energy that unmarked region is marked is represented, i identifies ith zone, and N indicates line The sum of original text image-region, ciIndicate the correct probability of ith zone label, yiIndicate that the corresponding label of ith zone, λ are used for Adjust local restriction ElocalIntensity,ElocalIndicate that local restriction, Near (i) indicate the All neighborhoods in i region, M indicate the syntople of ith zone and neighborhood, yjIndicate j-th of neighborhood of ith zone Label.
In order to verify the validity of MINLP model algorithm, Figure 17 (b) to Figure 17 (e) is please referred to, Figure 17 (b) is The embodiment schematic diagram of reference picture in the embodiment of the present application, Figure 17 (c) are line manuscript base picture to be painted in the embodiment of the present application Another embodiment schematic diagram, Figure 17 (d) is not use in the case where MINLP model algorithm according to Figure 17's (b) The effect diagram that reference picture paints to the line manuscript base picture in Figure 17 (c), Figure 17 (e) are using the secondary rule of MIXED INTEGER The effect diagram painted according to the reference picture of Figure 17 (b) to the line manuscript base picture in Figure 17 (c) in the case where cost-effective method, After comparing above-mentioned a few width figures and can be seen that and optimized using MINLP model algorithm, the accuracy rate of colouring is higher.
In the embodiment of the present application, in order to verify the validity of Active Learning and MINLP model algorithm, respectively To Active Learning and MINLP model algorithm is not used, using Active Learning, using Active Learning and MIXED INTEGER two Label accuracy rate counts in the case of three kinds of secondary planning algorithm, and as shown in Figure 17 (a), in Figure 17 (a), abscissa represents line The quantity of manuscript base picture, ordinate represent label accuracy rate, and the representative of curve 1 does not use Active Learning and MINLP model to calculate The label accuracy rate of method, curve 2 represent the label accuracy rate for using Active Learning, and curve 3, which represents, uses Active Learning and mixing The label accuracy rate of integer Novel Algorithm, by comparison as can be seen that object region can be improved in Active Learning Label accuracy rate, MINLP model algorithm can further increase object region on the basis of Active Learning Label accuracy rate.
It should be noted that the size of λ can please refer to Figure 18, the target when λ takes different value according to being actually adjusted The label accuracy rate of image-region, in Figure 18, abscissa is the quantity of line manuscript base picture, and ordinate is label accuracy rate, from figure 18 can be seen that the label accuracy rate highest when λ is 0.1, therefore it is 0.1 that the embodiment of the present application, which takes λ,.
The device of the embodiment of the present application middle line manuscript base picture colouring is described in detail below, please refers to Figure 19, the application Embodiment provides a kind of structural schematic diagram of one embodiment of the device of line manuscript base picture colouring.
The embodiment of the present application provides a kind of coloring means of line manuscript base picture, comprising:
First acquisition unit 901, for obtaining the wired manuscript base picture of institute to be painted;
Cutting unit 902, for according to preset image segmentation algorithm by each line original text image segmentation multiple regions;
First selecting unit 903, for selecting an at least width line manuscript base picture as reference picture, and will be in addition to reference picture Line manuscript base picture as target image;
Second acquisition unit 904, the label in each region for obtaining reference picture;
Matching unit 905, for being matched two-by-two to all areas in line manuscript base picture;
Tag determination unit 906, for being determined in target image according to the label of matching result and the region of reference picture Each region label;
Upper color element 907, for being carried out according to the preset corresponding relationship of label and field color to the wired manuscript base picture of institute Color.
Further, in another embodiment of the coloring means of online manuscript base picture, matching unit 905 is used for:
The shape feature in each region of line manuscript base picture is extracted according to preset Shape context inner distance algorithm;
The all areas in line manuscript base picture are matched two-by-two according to shape feature.
Further, in another embodiment of the coloring means of online manuscript base picture, matching unit 905 is used for:
For each region of line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes current Point and the shortest distance of other each points on same zone boundary inside region and current point with other points on zone boundary respectively The angle of point shortest distance line and current point tangent line;
The all areas in line manuscript base picture are matched two-by-two according to shape feature.
Further, in another embodiment of the coloring means of online manuscript base picture, matching unit 905 is used for:
For each region of line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes current Point and the shortest distance of other each points on same zone boundary inside region and current point with other points on zone boundary respectively The angle of point shortest distance line and current point tangent line;
For each region of line manuscript base picture, multiple shortest distance reference intervals and multiple angle reference intervals are obtained;
It establishes and puts vector correspondingly with point, the dimension for putting vector is equal to shortest distance reference interval number and angle is joined The product of number between examination district is put value of the vector in each dimension and is equal to, with current point in other points of zone boundary, position In a shortest distance reference interval and the point number in an angle reference interval;
The matching value of each point between any two of the region in line manuscript base picture is calculated according to vector;
The matching value of region between any two in line manuscript base picture is calculated according to the matching value of each point.
Further, in another embodiment of the coloring means of online manuscript base picture, matching unit 905 is used for:
For each region of line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes current Point and the shortest distance of other each points on same zone boundary inside region and current point with other points on zone boundary respectively The angle of point shortest distance line and current point tangent line;
For each region of line manuscript base picture, multiple shortest distance reference intervals and multiple angle reference intervals are obtained;
It establishes and puts vector correspondingly with point, the dimension for putting vector is equal to shortest distance reference interval number and angle is joined The product of number between examination district is put value of the vector in each dimension and is equal to, with current point in other points of zone boundary, position In a shortest distance reference interval and the point number in an angle reference interval;
The matching value of each point between any two of the region in line manuscript base picture is calculated according to vector;
Point matching value in line manuscript base picture between any two region greater than threshold value is set to preset penalty value;
For any two region in line manuscript base picture, all match point combinations for meeting preset condition, match point are obtained Combination includes selecting from the one group of point selected in points multiple on a zone boundary and from points multiple on another zone boundary One group of point, two groups of points respectively on respective zone boundary according to preset direction correspond and corresponding two points matching Value is respectively less than threshold value, and preset direction is clockwise or counterclockwise;
For each match point combination, the sum of each matching value and corresponding punishment total value in match point group is obtained, punishment is total Value is the product of preset penalty value and penalty number, and penalty number is the number of multiple points and the difference of one group of point midpoint number;
Using the minimum value of sum as the matching value in two regions.
Further, in another embodiment of the coloring means of online manuscript base picture, matching unit 905 is used for:
For each region of line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes current Point and the shortest distance of other each points on same zone boundary inside region and current point with other points on zone boundary respectively The angle of point shortest distance line and current point tangent line;
For each region of line manuscript base picture, the shortest distance inside region between points is obtained on zone boundary The maximum value of the angle of maximum value and shortest distance line and tangent line;
Average segmentation is carried out according to maximum value of the number of preset shortest distance reference interval to the shortest distance, is obtained more A shortest distance reference interval;
Average segmentation is carried out according to maximum value of the number of preset angle reference interval to angle, obtains multiple angle ginsengs Between examination district;
It establishes and puts vector correspondingly with point, the dimension for putting vector is equal to shortest distance reference interval number and angle is joined The product of number between examination district is put value of the vector in each dimension and is equal to, with current point in other points of zone boundary, position In a shortest distance reference interval and the point number in an angle reference interval;
The matching value of each point between any two of the region in line manuscript base picture is calculated according to vector;
Point matching value in line manuscript base picture between any two region greater than threshold value is set to preset penalty value;
For any two region in line manuscript base picture, all match point combinations for meeting preset condition, match point are obtained Combination includes selecting from the one group of point selected in points multiple on a zone boundary and from points multiple on another zone boundary One group of point, two groups of points respectively on respective zone boundary according to preset direction correspond and corresponding two points matching Value is respectively less than threshold value, and preset direction is clockwise or counterclockwise;
For each match point combination, the sum of each matching value and corresponding punishment total value in match point group is obtained, punishment is total Value is the product of preset penalty value and penalty number, and penalty number is the number of multiple points and the difference of one group of point midpoint number;
Using the minimum value of sum as the matching value in two regions.
Further, in another embodiment of the coloring means of online manuscript base picture, tag determination unit 906 is used for:
Using the label in the region of the smallest reference picture of Region Matching value with target image as object region Label.
Further, in another embodiment of the coloring means of online manuscript base picture, label is number;
Tag determination unit 906 is used for:
For any two region in line manuscript base picture, one group of point in matching value match point combination corresponding with matching value is obtained The ratio of midpoint number is as weight;
With the first energy functionMinimum objective function carries out iteration at least once It calculates, after each iterative calculation, selects one of them unmarked region to be marked according to the label in obtained unmarked region Note, and next iteration calculating is carried out after label, after the number of iterations reaches preset times, according to last time iteration meter Remaining all unmarked regions are marked in the label in obtained unmarked region, and unmarked region is that label is undetermined The region of target image, f (j) represent the label in j-th of region, and f (i) represents the label of ith zone, wi,jRepresent i-th of area Domain weight corresponding with j-th of region, i and j are positive integer.
Further, in another embodiment of the coloring means of online manuscript base picture, label is number;
Tag determination unit 906 is used for:
For any two region in line manuscript base picture, one group of point in matching value match point combination corresponding with matching value is obtained The ratio of midpoint number is as weight;
With the first energy functionMinimum objective function carries out iteration at least once It calculates, after each iterative calculation, is calculated according to preset error estimation algorithm and selected according to the label in obtained unmarked region Select the risk that each unmarked region is marked;Label risk of selection according to obtained unmarked region is the smallest unmarked Region is marked, and next iteration calculating is carried out after label, after the number of iterations reaches preset times, according to last Remaining all unmarked regions are marked in the label in the unmarked region that an iteration is calculated, and unmarked region is mark The region of undetermined target image is signed, f (j) represents the label in j-th of region, and f (i) represents the label of ith zone, wi,j Ith zone weight corresponding with j-th of region is represented, i and j are positive integer.
Further, in another embodiment of the coloring means of online manuscript base picture, the coloring means of line manuscript base picture are also wrapped It includes:
Optimize unit 908, for according to the syntople between preset MINLP model algorithm and label to To the label in unmarked region optimize, the syntople between the syntople between label and region is corresponding.
Next, the embodiment of the present application also provides a kind of terminal devices, as shown in figure 20, for ease of description, only show Go out part related to the embodiment of the present invention, it is disclosed by specific technical details, please refer to present invention method part. It includes mobile phone, tablet computer, personal digital assistant (Personal Digital that the attribute information, which shows that device can be, Assistant, PDA), point-of-sale terminal (Point of Sales, POS), any terminal device such as vehicle-mounted computer, with attribute information Show device for for mobile phone:
Figure 20 shows the part-structure of mobile phone relevant to attribute information provided in an embodiment of the present invention displaying device Block diagram.With reference to Figure 20, mobile phone includes: radio frequency (Radio Frequency, RF) circuit 2010, memory 2020, input unit 2030, display unit 2040, sensor 2050, voicefrequency circuit 2060, Wireless Fidelity (wireless fidelity, WiFi) mould The components such as block 2070, processor 2080 and power supply 2090.It will be understood by those skilled in the art that mobile phone shown in Figure 20 Structure does not constitute the restriction to mobile phone, may include than illustrating more or fewer components, perhaps combine certain components or Different component layouts.
It is specifically introduced below with reference to each component parts of the Figure 20 to mobile phone:
RF circuit 2010 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station After downlink information receives, handled to processor 2080;In addition, the data for designing uplink are sent to base station.In general, RF circuit 2010 include but is not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier (Low Noise Amplifier, LNA), duplexer etc..In addition, RF circuit 2010 can also be logical with network and other equipment by wireless communication Letter.Any communication standard or agreement, including but not limited to global system for mobile communications (Global can be used in above-mentioned wireless communication System of Mobile communication, GSM), general packet radio service (General Packet Radio Service, GPRS), CDMA (Code Division MultS19P09120le Access, CDMA), wideband code division it is more Location (Wideband Code Division MultS19P09120le Access, WCDMA), long term evolution (Long Term Evolution, LTE), Email, short message service (Short Messaging Service, SMS) etc..
Memory 2020 can be used for storing software program and module, and processor 2080 is stored in memory by operation 2020 software program and module, thereby executing the various function application and data processing of mobile phone.Memory 2020 can be led It to include storing program area and storage data area, wherein storing program area can be needed for storage program area, at least one function Application program (such as sound-playing function, image player function etc.) etc.;Storage data area, which can be stored, uses institute according to mobile phone Data (such as audio data, phone directory etc.) of creation etc..In addition, memory 2020 may include high random access storage Device, can also include nonvolatile memory, and a for example, at least disk memory, flush memory device or other volatibility are solid State memory device.
Input unit 2030 can be used for receiving the number or character information of input, and generate with the user setting of mobile phone with And the related key signals input of function control.Specifically, input unit 2030 may include touch panel 2031 and other inputs Equipment 2032.Touch panel 2031, also referred to as touch screen collect touch operation (such as the user of user on it or nearby Use the behaviour of any suitable object or attachment such as finger, stylus on touch panel 2031 or near touch panel 2031 Make), and corresponding attachment device is driven according to preset formula.Optionally, touch panel 2031 may include touch detection Two parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation band The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it It is converted into contact coordinate, then gives processor 2080, and order that processor 2080 is sent can be received and executed.In addition, Touch panel 2031 can be realized using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves.In addition to touch surface Plate 2031, input unit 2030 can also include other input equipments 2032.Specifically, other input equipments 2032 may include But in being not limited to physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, operating stick etc. It is one or more.
Display unit 2040 can be used for showing information input by user or be supplied to user information and mobile phone it is each Kind menu.Display unit 2040 may include display panel 2041, it is alternatively possible to using liquid crystal display (Liquid Crystal Display, LCD), the forms such as Organic Light Emitting Diode (Organic Light-Emitting Diode, OLED) To configure display panel 2041.Further, touch panel 2031 can cover display panel 2041, when touch panel 2031 detects After arriving touch operation on it or nearby, processor 2080 is sent to determine the type of touch event, is followed by subsequent processing device 2080 provide corresponding visual output according to the type of touch event on display panel 2041.Although in Figure 20, touch surface Plate 2031 and display panel 2041 are the input and input function for realizing mobile phone as two independent components, but certain In embodiment, can be integrated by touch panel 2031 and display panel 2041 and that realizes mobile phone output and input function.
Mobile phone may also include at least one sensor 2050, such as optical sensor, motion sensor and other sensors. Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to ambient light Light and shade adjust the brightness of display panel 2041, proximity sensor can close display panel when mobile phone is moved in one's ear 2041 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (generally three axis) and add The size of speed can detect that size and the direction of gravity when static, can be used to identify application (such as the horizontal/vertical screen of mobile phone posture Switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap) etc.;Also as mobile phone The other sensors such as configurable gyroscope, barometer, hygrometer, thermometer, infrared sensor, details are not described herein.
Voicefrequency circuit 2060, loudspeaker 2061, microphone 2062 can provide the audio interface between user and mobile phone.Audio Electric signal after the audio data received conversion can be transferred to loudspeaker 2061, be converted by loudspeaker 2061 by circuit 2060 For voice signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 2062, by voicefrequency circuit 2060 Audio data is converted to after reception, then by after the processing of audio data output processor 2080, through RF circuit 2010 to be sent to ratio Such as another mobile phone, or audio data is exported to memory 2020 to be further processed.
WiFi belongs to short range wireless transmission technology, and mobile phone can help user's transceiver electronics postal by WiFi module 2070 Part, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Figure 20 is shown WiFi module 2070, but it is understood that, and it is not belonging to must be configured into for mobile phone, it can according to need do not changing completely Become in the range of the essence of invention and omits.
Processor 2080 is the control centre of mobile phone, using the various pieces of various interfaces and connection whole mobile phone, By running or execute the software program and/or module that are stored in memory 2020, and calls and be stored in memory 2020 Interior data execute the various functions and processing data of mobile phone, to carry out integral monitoring to mobile phone.Optionally, processor 2080 may include one or more processing units;Optionally, processor 2080 can integrate application processor and modulation /demodulation processing Device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is mainly located Reason wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 2080.
Mobile phone further includes the power supply 2090 (such as battery) powered to all parts, and optionally, power supply can pass through power supply Management system and processor 2080 are logically contiguous, to realize management charging, electric discharge and power consumption pipe by power-supply management system The functions such as reason.
Although being not shown, mobile phone can also include photographing module, bluetooth module etc., and details are not described herein.
In embodiments of the present invention, processor 2080 included by the terminal device also has aforementioned line manuscript base as colouring The function of device.
The embodiment of the present application also provides a kind of computer storage medium, the computer storage medium is above-mentioned for being stored as Computer software instructions used in the device or server of the colouring of line manuscript base picture comprising for executing as the structure of request synonym Build program designed by device or terminal device.
The embodiment of the present application also provides a kind of computer program product, which includes computer software Instruction, the stream in method which can be loaded to realize above-mentioned line manuscript base picture colouring by processor Journey.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description, The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit It closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, the technical solution of the application is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can be personal computer, server or the network equipment etc.) executes the complete of each embodiment the method for the application Portion or part steps.And storage medium above-mentioned include: USB flash disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic or disk etc. are various can store program The medium of code.
The above, above embodiments are only to illustrate the technical solution of the application, rather than its limitations;Although referring to before Embodiment is stated the application is described in detail, those skilled in the art should understand that: it still can be to preceding Technical solution documented by each embodiment is stated to modify or equivalent replacement of some of the technical features;And these It modifies or replaces, the spirit and scope of each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution.

Claims (10)

1. a kind of painting methods of line manuscript base picture characterized by comprising
Obtain the wired manuscript base picture of institute to be painted;
According to preset image segmentation algorithm by each line original text image segmentation multiple regions;
Select an at least width line manuscript base picture as reference picture, and using the line manuscript base picture in addition to the reference picture as target figure Picture;
Obtain the label in each region of the reference picture;
All areas in described wired manuscript base picture are matched two-by-two;
The label in each region in the target image is determined according to the label in the region of matching result and the reference picture;
It is painted according to label and the preset corresponding relationship of field color to the wired manuscript base picture of institute.
2. the painting methods of line manuscript base picture according to claim 1, which is characterized in that it is described to the line manuscript base as in All areas carry out matching two-by-two
The shape feature in each region of the line manuscript base picture is extracted according to preset Shape context inner distance algorithm;
The all areas in the line manuscript base picture are matched two-by-two according to the shape feature.
3. the painting methods of line manuscript base picture according to claim 2, which is characterized in that it is described according to it is preset in shape under The shape feature that literary inner distance algorithm extracts each region of the line manuscript base picture includes:
For each region of the line manuscript base picture, multiple points are taken on zone boundary;
Shape feature of the point feature of all the points on zone boundary as region is obtained, the point feature of a point includes current Point and the shortest distance of other each points on same zone boundary inside region and current point with other points on zone boundary respectively The angle of point shortest distance line and current point tangent line.
4. the painting methods of line manuscript base picture according to claim 3, which is characterized in that described according to the shape feature pair All areas in the line manuscript base picture carry out matching two-by-two
For each region of the line manuscript base picture, multiple shortest distance reference intervals and multiple angle reference intervals are obtained;
It establishes and is equal to the shortest distance reference interval number and institute with the one-to-one point vector of point, the dimension of described vector The product of angle reference interval number is stated, value of the described vector in each dimension is equal to, with the same zone boundary of current point Other points in, positioned at a shortest distance reference interval and the point number that is located in angle reference interval;
The matching value of each point between any two of the region in the line manuscript base picture is calculated according to described vector;
The matching value of region between any two in the line manuscript base picture is calculated according to the matching value of each point.
5. the painting methods of line manuscript base picture according to claim 4, which is characterized in that the matching according to each point Value calculates the matching value of region between any two in the line manuscript base picture
Point matching value in the line manuscript base picture between any two region greater than threshold value is set to preset penalty value;
For any two region in the line manuscript base picture, all match point combinations for meeting preset condition are obtained, described It include from the one group of point selected in points multiple on a zone boundary and from points multiple on another zone boundary with a combination The one group of point selected, two groups of points correspond respectively according to preset direction on respective zone boundary and corresponding two points Matching value is respectively less than threshold value, and the preset direction is clockwise or counterclockwise;
For each match point combination, the sum of each matching value and corresponding punishment total value in the match point group is obtained, it is described to punish Penalizing total value is the product of the preset penalty value and penalty number, and the penalty number is the number and one group of point of the multiple point The difference of midpoint number;
Using the minimum value of the sum as the matching value in described two regions.
6. the painting methods of line manuscript base picture according to claim 4, which is characterized in that it is described for the line manuscript base as Each region, obtains multiple shortest distance reference intervals and multiple angle reference intervals include:
For each region of the line manuscript base picture, the shortest distance inside region between points is obtained on zone boundary The maximum value of the angle of maximum value and shortest distance line and tangent line;
Average segmentation is carried out according to maximum value of the number of preset shortest distance reference interval to the shortest distance, is obtained more A shortest distance reference interval;
Average segmentation is carried out according to maximum value of the number of preset angle reference interval to the angle, obtains multiple angle ginsengs Between examination district.
7. the painting methods of line manuscript base picture according to claim 5, which is characterized in that described according to matching result and described The label in the region of reference picture determines that the label in each region in the target image includes:
Using the label in the region with the smallest reference picture of the Region Matching value of the target image as the target figure As the label in region.
8. the painting methods of line manuscript base picture according to claim 5, which is characterized in that the label is number;
The label in the region according to matching result and the reference picture determines each region in the target image Label includes:
For any two region in the line manuscript base picture, the matching value match point combination corresponding with the matching value is obtained In one group of point midpoint number ratio as weight;
With the first energy functionMinimum objective function is iterated to calculate at least once, After each iterative calculation, one of them unmarked region is selected to be marked according to the label in obtained unmarked region, and Next iteration calculating is carried out after label, after the number of iterations reaches preset times, according to iterating to calculate for the last time To the label in unmarked region remaining all unmarked regions are marked, the unmarked region is that label is undetermined The region of target image, f (j) represent the label in j-th of region, and f (i) represents the label of ith zone, wi,jRepresent i-th of area Domain weight corresponding with j-th of region, i and j are positive integer.
9. a kind of coloring means of line manuscript base picture characterized by comprising
First acquisition unit, for obtaining the wired manuscript base picture of institute to be painted;
Cutting unit, for according to preset image segmentation algorithm by each line original text image segmentation multiple regions;
First selecting unit, for selecting an at least width line manuscript base picture as reference picture, and will be in addition to the reference picture Line manuscript base picture is as target image;
Second acquisition unit, the label in each region for obtaining the reference picture;
Matching unit, for being matched two-by-two to all areas in described wired manuscript base picture;
Tag determination unit, the label for the region according to matching result and the reference picture determine in the target image Each region label;
Upper color element, for being painted according to the preset corresponding relationship of label and field color to the wired manuscript base picture of institute.
10. a kind of computer readable storage medium, it is stored with instruction in the computer readable storage medium, when it is in computer When upper operation, so that computer executes the method as described in preceding claims 1-8 is any.
CN201910551946.XA 2019-06-21 2019-06-21 A kind of method and device of line manuscript base picture colouring Pending CN110264478A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910551946.XA CN110264478A (en) 2019-06-21 2019-06-21 A kind of method and device of line manuscript base picture colouring

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910551946.XA CN110264478A (en) 2019-06-21 2019-06-21 A kind of method and device of line manuscript base picture colouring

Publications (1)

Publication Number Publication Date
CN110264478A true CN110264478A (en) 2019-09-20

Family

ID=67921020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910551946.XA Pending CN110264478A (en) 2019-06-21 2019-06-21 A kind of method and device of line manuscript base picture colouring

Country Status (1)

Country Link
CN (1) CN110264478A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112967338A (en) * 2019-12-13 2021-06-15 宏达国际电子股份有限公司 Image processing system and image processing method
CN114299184A (en) * 2021-12-30 2022-04-08 青海师范大学 Hidden building colored drawing line manuscript graph coloring method and device based on semantic matching
CN115953597A (en) * 2022-04-25 2023-04-11 北京字跳网络技术有限公司 Image processing method, apparatus, device and medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112967338A (en) * 2019-12-13 2021-06-15 宏达国际电子股份有限公司 Image processing system and image processing method
CN114299184A (en) * 2021-12-30 2022-04-08 青海师范大学 Hidden building colored drawing line manuscript graph coloring method and device based on semantic matching
CN115953597A (en) * 2022-04-25 2023-04-11 北京字跳网络技术有限公司 Image processing method, apparatus, device and medium
CN115953597B (en) * 2022-04-25 2024-04-16 北京字跳网络技术有限公司 Image processing method, device, equipment and medium

Similar Documents

Publication Publication Date Title
EP3944147A1 (en) Target detection method, model training method, device, apparatus and storage medium
CN106156807B (en) Training method and device of convolutional neural network model
CN110232696A (en) A kind of method of image region segmentation, the method and device of model training
CN106792003B (en) Intelligent advertisement insertion method and device and server
CN108280458B (en) Group relation type identification method and device
CN110276344A (en) A kind of method of image segmentation, the method for image recognition and relevant apparatus
CN110264478A (en) A kind of method and device of line manuscript base picture colouring
CN111368934A (en) Image recognition model training method, image recognition method and related device
CN109543195A (en) A kind of method, the method for information processing and the device of text translation
CN104239535A (en) Method and system for matching pictures with characters, server and terminal
CN110210605B (en) Hardware operator matching method and related product
CN107356261B (en) Air navigation aid and Related product
CN111209423B (en) Image management method and device based on electronic album and storage medium
CN109376659A (en) Training method, face critical point detection method, apparatus for face key spot net detection model
CN109556621A (en) A kind of method and relevant device of route planning
CN104867065A (en) Method and equipment for processing orders
CN106874906B (en) Image binarization method and device and terminal
CN110704661A (en) Image classification method and device
CN110069715A (en) A kind of method of information recommendation model training, the method and device of information recommendation
CN108236785A (en) A kind of method and device for obtaining object information
CN110263729A (en) A kind of method of shot boundary detector, model training method and relevant apparatus
CN106204552A (en) The detection method of a kind of video source and device
CN111292394A (en) Image color matching relationship determination method and device
CN108170817A (en) Differentiation video acquiring method, device and the readable storage medium storing program for executing of photo main body
CN110458796A (en) A kind of image labeling method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination