A kind of processing method of TV subtitling words
Technical field
The present invention relates to captions process field in the video, be specifically related to a kind of processing method of TV subtitling words.
Background technology
Caption system is widely used at video field, also is the pith of using video technique.Because the resolution of TV is lower, is shown as interlacing scan, for obtaining to stablize distinct image, TV subtitling often need carry out special processings such as anti-aliasing and anti-dithering process.By the display device that dot matrix constitutes, image is displayed on the rounded coordinate, and continuity is destroyed, and straightway is shown as stair-stepping a plurality of short line segment, and anti-aliasing technology is used to eliminate this situation.Anti-dither technique can be avoided the flickering jitter phenomenon of line segment that causes because of interlacing scan, this processing of TV subtitling is more than other high-resolution, progressive scanned display device such as computer CRT (Cathode Ray Tube, cathode ray tube) complexity handled in the captions of equipment, can keep the clear profile of former literal through the TV subtitling of these processing.At present, the edge treated of captions all adopts the two dimensional image processing method, introduces various filters in edge of image, can obtain the image of anti-aliasing and anti-shake, and these methods have obtained very successful effect, are widely used in the television program designing.But the CULTURAL PROGRAMME that becomes increasingly abundant proposes higher requirement to captions quality and form, and three-dimensional literal will appear in the TV programme more continually, and existing technology also the method for not finding effectively to handle three-dimensional literal in the TV subtitling.
Summary of the invention
At the defective that exists in the prior art, the processing method that the purpose of this invention is to provide a kind of TV subtitling words, this method can obtain the expansion and the shrinkage curve of literal by calculating, guarantee that result of calculation and original text character wheel exterior feature are consistent, thereby realize the clear demonstration of three-dimensional literal in the TV subtitling; Simultaneously, this method can also realize the effect process of two-dimentional captions, and can make hardware-acceleratedly, reduces amount of calculation, has guaranteed real-time.
For reaching above purpose, the technical solution used in the present invention is: a kind of processing method of TV subtitling words may further comprise the steps:
(1) from character library, obtains the outline data of TV subtitling words, curve data interpolation wherein, consequently straight line array;
(2) calculate the offset linear of text profile in the TV subtitling, offset linear is corresponding to the straightway on the former profile, the expansion of literal or shrink profile and seal, and with former profile not at grade;
(3) set up the expanding noodles and the contraction front of literal, use can reach the texture of anti-aliasing and anti-shake effect and fill expanding noodles and contraction front.
Further, have better effect for making the present invention, in the step (1), obtain the outline data of TV subtitling words from character library, be meant from the font of outline font and obtain outline data, it is crossing that the font in the described character library is that profile does not have.
Further, have better effect, in the step (1), from character library, obtain the outline data of TV subtitling words, and when curve data was converted to the straight line array, the size of straightway was determined by model accuracy after the interpolation for making the present invention.
Further, have better effect for making the present invention, level and smooth for making the turning in the step (2) if angle is greater than 180 degree between the adjacent vector, adopt following two kinds of methods to increase the control point, specific as follows:
(1) length of intersection point of two vectors of distance is to expand and contract by distance on the angular bisector between two vectors this o'clock;
Or (2) this some control point that is curve, on the angular bisector between two vectors, the length of the intersection point of two vectors of distance is to expand and contract by distance.Article one, the starting point of the terminal point of skew line, control point and second skew line constitutes the profile of describing expansion or shrinkage curve.
Further again, for making the present invention have better effect, when angle increases the control point greater than 180 degree between the adjacent vector, if the distance of this control point and calculated expansion point or constriction point is in the model accuracy scope, then merge this control point to expansion point or constriction point, can reduce the quantity that constitutes contoured surface like this, and image is more level and smooth; Do not need to calculate for the straight line that constitutes by coincide point.
Further, have better effect, in the step (2),,, utilize the Z-direction skew, make and divide invisible away from the hand-deliver fork of profile with the intersection of the face of generation if angle is less than 180 degree between the adjacent vector for making the present invention; All points that newly calculate are increased the Z coordinate data, make expansion line, shrinkage front and original text character wheel exterior feature have different Z coordinate.
Further, have better effect for making the present invention, in the step (3), set up the expanding noodles and the contraction front of literal, concrete grammar is as follows:
(1) with the straightway on the former profile and the expansion point that calculates of straightway or constriction point 4 formation face thus.
(2) for the situation of inserting point is arranged, by on the profile a bit with insert curve and constitute face.
Effect of the present invention is: adopt method of the present invention to handle TV subtitling, not only can realize the effect process of two-dimentional captions, and can realize the processing of three-dimensional captions, the expansion that obtains by calculating and the face of contraction, can be used as anti-aliasing and anti-dithering process, it is more clear that TV subtitling ground shows; This method has kept the corresponding relation of former profile point and expansion or constriction point simultaneously, makes things convenient for the later stage to play up operation; And memory consumption reduces; Can realize hardware-acceleratedly, provide the basis for handling in real time; Special effects does not rely on special hardware, and has increased the special effects kind.
Description of drawings
Fig. 1 is the flow chart of the method for the invention;
Fig. 2 is an extension cord schematic diagram of asking straight line;
Fig. 3 be when adjacent vector when the angle of direction of advance is spent less than 180, form cross facet, eliminate the cross facet schematic diagram with the Z buffering area;
Fig. 4 be when adjacent vector when the angle of direction of advance is spent greater than 180, need to add the control point, make the level and smooth schematic diagram in turning.
Embodiment
The invention will be further described below in conjunction with the drawings and specific embodiments.
At first, the literal outside, angle inboard and two vectors are done to give a definition: the text profile outside is an expansion direction, and the inboard is a shrinkage direction.If the outline of literal is counterclockwise, then the left side along direction of advance is the outside, is inboard along the right side of direction of advance; Otherwise, be the outside along the right side of direction of advance, be inboard along the left side of direction of advance.Expanding noodles and contraction front general designation epitaxial surface.Article two, the angle of vector is meant from the second vector in the counterclockwise direction angle article one vector.
In Fig. 2, Fig. 3 and Fig. 4, slightly black solid line is represented text profile, the direction of advance of arrow points text profile, and slightly black dotted line is represented the skew of contour vector; With the dotted line of profile straight line parallel be the expansion line of literal, the dotted line of fifth wheel profile and expansion line is the normal on the profile point.
As shown in Figure 1, a kind of processing method of TV subtitling words may further comprise the steps:
(1) obtain the outline data of TV subtitling words from character library, curve data interpolation wherein, the result is the straight line array.Obtain the outline data of TV subtitling words from character library, be meant from the font of outline font and obtain outline data, it is crossing to require font in this character library to be that profile does not have.From character library, obtain the outline data of TV subtitling words, need be converted to straight line to curve, according to the size of straightway after the model accuracy decision interpolation of expectation.
(2) Fig. 2 supposes all among Fig. 3 and Fig. 4 that the character library profile is a clockwise direction, and calculates the outside, and inboard computational methods similarly.
Calculate the offset linear of text profile in the TV subtitling, offset linear is corresponding to the straightway on the former profile, the expansion of literal or shrink profile and seal, and with former profile not at grade.If angle the situation that adjacent epitaxial surface does not have intersection promptly occurs greater than 180 degree between the adjacent vector, increase the control point, make the turning level and smooth; If angle is less than 180 degree between the adjacent vector, promptly epitaxial surface has intersection, utilizes the Z-direction skew, keeps the intersection information of relevant face; All points that newly calculate are increased the Z coordinate data, make expansion line, shrinkage front and original text character wheel exterior feature have different Z coordinate;
Calculate the method for offset linear:, calculate side-play amount with normal direction along the direction that text profile advances; Each bar straight line of describing profile is calculated two offset points, expansion line and shrinkage front that these 2 definite straight lines are exactly this straight line; End point to profile adopts following method to calculate:
The processing of particular point:
The profile of literal varies, and adjacent two straight lines are pressed vector calculate angle, in two kinds of situation:
The first, as shown in Figure 4,, make the turning level and smooth if angle increases the control point greater than 180 degree with suitable method between adjacent two vectors.The following two kinds of methods of the concrete employing of described suitable method:
1) length of intersection point of two vectors of distance is to expand and contract by distance on the angular bisector between two vectors this o'clock;
Or 2) this some control point that is curve, on the angular bisector between two vectors, the length of the intersection point of two vectors of distance is to expand and the twice of contract by distance.Article one, the starting point of the terminal point of skew line, this control point and second skew line constitutes the profile of describing expansion or shrinkage curve.
Optimization method:, can reduce the quantity that constitutes contoured surface like this, and image is more level and smooth in permissible range if two control point distances of a. can merge.
B. do not need to calculate for the straight line that constitutes by coincide point.
The second, as shown in Figure 3, if angle is less than 180 degree between adjacent two vectors, with the intersection of the face of generation, handle (3) directly set by step.
(3) set up the expanding noodles and the contraction front of literal, use can reach the texture of anti-aliasing and anti-shake effect and fill expanding noodles and contraction front.
Specifically comprise following method:
1) with the straightway on the former profile and the expansion point that calculates of line segment or constriction point 4 formation face thus.
2) for the situation of inserting point is arranged, by on the profile a bit with insert line segment 3 constitute face.
The crossing processing of epitaxial surface: the extension profile that calculates by method of the present invention will produce a large amount of intersections inevitably, between expanding noodles and the expanding noodles, all have crossing situation between expanding noodles and the former figure.If calculate these crosspoints and judge that available point will increase amount of calculation greatly.In the present embodiment, the way of taking the Z buffering area is eliminated invisible point when graphing, extension point and former profile point are separated on Z-direction, utilizes the Z buffering area to judge cross section.
Method of the present invention is not limited to the embodiment described in the embodiment, and those skilled in the art's technical scheme according to the present invention draws other execution mode, belongs to technological innovation scope of the present invention equally.