CN101894363B - Patched garbage mask border rendering method - Google Patents

Patched garbage mask border rendering method Download PDF

Info

Publication number
CN101894363B
CN101894363B CN2009100847356A CN200910084735A CN101894363B CN 101894363 B CN101894363 B CN 101894363B CN 2009100847356 A CN2009100847356 A CN 2009100847356A CN 200910084735 A CN200910084735 A CN 200910084735A CN 101894363 B CN101894363 B CN 101894363B
Authority
CN
China
Prior art keywords
border
point
boundary
sub
coordinate
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.)
Expired - Fee Related
Application number
CN2009100847356A
Other languages
Chinese (zh)
Other versions
CN101894363A (en
Inventor
见良
郑鹏程
刘铁华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Digital Video Beijing Ltd
Original Assignee
China Digital Video Beijing 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 China Digital Video Beijing Ltd filed Critical China Digital Video Beijing Ltd
Priority to CN2009100847356A priority Critical patent/CN101894363B/en
Publication of CN101894363A publication Critical patent/CN101894363A/en
Application granted granted Critical
Publication of CN101894363B publication Critical patent/CN101894363B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention belongs to the image/video processing technology, and particularly relates to a patched garbage mask border rendering method. The method comprises the following steps of: dividing all Bezier curves in a garbage mask into a plurality of sub segments; determining an external direction of the garbage mask; then calculating external border distances and internal border distances of all segment points according to the information of border points; and finally, drawing an external/internal border and an external/internal angle border corresponding to an initial endpoint of each Bezier curve taken as a unit. The method divides the external/internal border and the external/internal angle border corresponding to the initial endpoint of each Bezier curve into a plurality of triangular patches so that the rendered border is smoother and clearer and the regulation and control of the operation are more flexible.

Description

A kind of garbage mask border rendering method of tiled
Technical field
The invention belongs to the image/video treatment technology, be specifically related to a kind of garbage mask border rendering method of tiled.
Background technology
In the image/video process software, image/video is synthesized or carries out mask process during special effect processing is a kind of demand very widely.Common this mask can generate out or obtain out from the mask images of a special use through the key stunt; But so under many circumstances mask is not enough; Also need be used for creating out a mask through the method for manual drawing, this mask generally is referred to as garbage mask.
A garbage mask is made up of some orderly end points (end point); Per two continuous end points constitute a curve; Along the working direction of end points order positive dirction, otherwise be contrary direction, each end points has two reference mark (control point); One is forward reference mark (forward control point); One is reverse reference mark (backward control point), and the forward reference mark is used to control the shape that it belongs to the forward curve of end points, and reverse reference mark is used to control the shape that it belongs to the reverse curve of end points.Therefore, the shape of each bar curve is by two end points and two reference mark decisions, and they are actually three Beizer curves, and a garbage mask is described out by the closed curve that some three Beizer curves constitute.It is following to describe three Beizer curves with parametric equation:
x(t)=a x·t 3+b x·t 2+c x·t+d x
y(t)=a y·t 3+b y·t 2+c y·t+d y
T is the parameter of parametric equation in the following formula, and its scope is [0,1], a x, b xA series of coefficients are that the coordinate by the end points of this curve and reference mark determines out.
Except the fundamental element of describing a garbage mask is arranged: the Bezier extra curvature of end points and its defined; The element that control garbage mask boundary shape also will be arranged; This element is referred to as frontier point (edgepoint); Frontier point has two attributes: position (position) and distance (distance); The parameter position of this frontier point of determining positions on garbage mask boundary curve, garbage mask boundary curve all is made up of the Bezier curve, and the parameter value (parameter value of parametric equation) of the position attribution of the frontier point Bezier curve that it was positioned at just adds the sequence number of this Bezier curve; Such as a position is that 1.6 frontier point just means it between second and the 3rd curve that end points constituted of garbage mask (starting point is 0), and is on parametric t is that aspect of 0.6; Distance has determined the distance of the normal direction of the point of this frontier point above curve away from curve, and it is an outer boundary point that distance is represented this for positive number, is used for confirming the outer boundary shape of garbage mask; Then representing this for negative is an inner boundary point, is used for confirming the inner boundary shape of garbage mask.The border of whole garbage mask is decided by the shape that inner and outer boundary point institute envelope comes out.
So; How is the outside of a garbage mask distinguished with inner? Here; Still be that right side (counter clockwise direction or CW in other words conj.or perhaps) stipulates which side is the outside of garbage mask along the left side that positive dirction is seen generally, and it is called outside direction with Bezier curve among the garbage mask.Left side such as our regulation curve is an outside direction, that is to say that so the Bezier curve is the perimeter of garbage mask along the left side that positive dirction is seen, the right side is an interior zone.
Each frontier point has two coordinates, is respectively coordinate on coordinate and the border on the curve.Coordinate is meant the coordinate of that point of the correspondence of this frontier point on garbage mask on the curve, and this can directly obtain through its position attribution and the parametric equation of its place Bezier curve; The normal direction of that point that coordinate is meant the correspondence of this frontier point above garbage mask on the border is away from the coordinate of its that point so far away apart from attribute of curve; It can perhaps be rotated counterclockwise 90 degree (for the outer boundary point clockwise through the tangent line side of coordinate points on the curve; If the outside direction of garbage mask is the left side then is rotated counterclockwise; Otherwise turn clockwise, so then just in time opposite to inner boundary point) squint again that it so far calculates coordinate on its border apart from attribute.So coordinate is (x on the curve of a frontier point if calculated 0, y 0) and this unit tangent vector be (x t, y t), it is following to calculate on its border Coordinate Calculation method so:
x′=x 0+dist·(x t·cos(θ)-y t·sin(θ))
y′=y 0+dist·(x t·sin(θ)+y t·cos(θ))
In the following formula, dist representes the absolute value of this frontier point apart from attribute, and θ is-pi/2 or pi/2, and this depends on and turns clockwise or be rotated counterclockwise.Fig. 2 has shown a garbage mask and its frontier point.Garbage mask among Fig. 2 has 5 end points, three frontier points.Its outside direction is the left side, can find out that frontier point A and frontier point C are outer boundary points and frontier point B is an inner boundary point.
Creating this garbage mask generally is the curve of drawing a closure through the user, and filling the gray-scale map that this closed curve obtains then is exactly a garbage mask.It is too stiff to fill closed curve gray-scale map border afterwards; Make it seem more level and smooth so need carry out certain modification to the border; General in addition also will control the length of border transition makes the border look certain thickness is arranged; In order to realize that these most of softwares tend to use morphologic contraction and expansion algorithm and Gaussian Blur Processing Algorithm; But such implementation method can cause that whole garbage mask seems too fuzzy when fog-level is bigger, and its border is also more fixing in addition, the lack flexible ability of regulation and control.
Summary of the invention
The objective of the invention is to defective, a kind of garbage mask border rendering method of tiled is provided, make the garbage mask border after playing up more clear, control more flexible to prior art.
Technical scheme of the present invention is following: a kind of garbage mask border rendering method of tiled comprises the steps:
(1) all the Bezier curves among the garbage mask is divided into plurality of sub segments;
(2) confirm the outside direction of garbage mask;
(3) go out the outer boundary distance and the inner boundary distance of all waypoints according to the information calculations of frontier point;
(4) be that its corresponding outer/inner border outer/inner arm of angle circle corresponding with its initial end points is drawn by unit with every Bezier curve.
Further, the garbage mask border rendering method of aforesaid tiled, wherein; It is following in the step (1) the Bezier curve to be divided into the method for plurality of sub segments: for a Bezier curve, advance forward for step-length by 1/30, calculate the position tangent line vector of current this point; And carry out dot product with the unit tangent vector of this vector and previous fixed waypoint and calculate; If the value that draws is less than threshold value cos (2.5 π/180), then current point is just confirmed as a waypoint, and not so this point is just ignored in the past; Continue then by 1/30 step-length this process of repetition of advancing forward, up to the end of this Bezier curve.
Further, the garbage mask border rendering method of aforesaid tiled, wherein, the step of the outside direction of definite garbage mask is following in the step (2):
1. calculate the bounding box of garbage mask, obtain the maximum y value of bounding box and the intermediate value yc of minimum y value then;
2. find out this horizontal line of y=yc and the intersection point of all Bezier curves above the garbage mask, and find out leftmost that intersection point in these intersection points;
3. obtain the tangent line vector of leftmost that intersection point in its Bezier curve, carry out the cross product computing with the unit vector of x axle positive dirction then, if the z value of cross product operation result greater than 0 then outside direction is the right side, otherwise is the left side.
Further, the garbage mask border rendering method of aforesaid tiled, wherein; The fall into a trap outer boundary distance of calculating waypoint and the method for inner boundary distance of step (3) is: that minimum outer/inner frontier point of position attribution numerical value begins above garbage mask; Find next outer/inner the frontier point adjacent with it, the position attribution of establishing these two frontier points is respectively p0 and p1, is respectively d0 and d1 apart from attribute; Travel through all waypoints between these two frontier points; Outer/inner frontier distance computing formula of each waypoint is d=d0+ (p-p0)/(p1-p0) (d1-d0), and wherein, p is the position of the waypoint that calculated.
Further; The garbage mask border rendering method of aforesaid tiled; Wherein, Corresponding outer/inner arm of angle circle of the initial end points of Bezier curve described in the step (4) is meant the forward tangent line and the inconsistent fan-like pattern border of causing of reverse tangential direction of this end points, and perpendicular to the forward tangent line and the reverse tangent line of this end points, the length of waist is outer/inner frontier distance of this end points to two waists on this fan-like pattern border respectively; The method of drawing outer/inner arm of angle circle is: with this fan-like pattern boundary demarcation is some tri patchs; Calculate the gray-scale value on these tri patch summits then; Gray-scale value for that corresponding summit of end points is 1; For outer/inner borderline summit gray-scale value is exactly 0, utilizes gouraud shading colorize method to play up these tri patchs then.
Further; The garbage mask border rendering method of aforesaid tiled; Wherein, The method on outer/inner the border that the drafting Bezier curve described in the step (4) is corresponding is: to each sub-line segment, find position attribution all frontier points between the starting and ending waypoint of this sub-line segment; Obtain each frontier point outside/coordinate on the inner boundary; With the summit of coordinate points and outer/inner the borderline coordinate points of frontier point on curve, calculate the gray-scale value on these tri patch summits as tri patch; Utilize gouraud shading colorize method to play up these tri patchs then.
Further; The garbage mask border rendering method of aforesaid tiled; Wherein, When drawing the corresponding outer boundary of Bezier curve in the step (4),, always calculate coordinate on its outer boundary according to coordinate on its curve and its external parties apart from attribute and current garbage mask for the outer boundary point between the starting and ending waypoint of each sub-line segment; For the inner boundary point between the starting and ending waypoint of each sub-line segment; Obtain its outer boundary distance according to the broad sense outer boundary point of its front and the outer boundary of broad sense outer boundary point at the back apart from carrying out linear interpolation; And then calculating coordinate on its outer boundary, described broad sense outer boundary point comprises that outer boundary puts coordinate points on the outer boundary corresponding with waypoint of coordinate points on the pairing border.
Further; The garbage mask border rendering method of aforesaid tiled; Wherein, When drawing the corresponding inner boundary of Bezier curve in the step (4),, always calculate coordinate on its inner boundary according to coordinate on its curve and its internal side apart from attribute and current garbage mask for the inner boundary point between the starting and ending waypoint of each sub-line segment; For the outer boundary point between the starting and ending waypoint of each sub-line segment; Obtain its inner boundary distance according to the broad sense inner boundary point of its front and the inner boundary of broad sense inner boundary point at the back apart from carrying out linear interpolation; And then calculating coordinate on its inner boundary, described broad sense inner boundary point comprises that inner boundary puts coordinate points on the inner boundary corresponding with waypoint of coordinate points on the pairing border.
Further again; The garbage mask border rendering method of aforesaid tiled, wherein, in the step (4) in the process of drawing outer/inner corresponding border of Bezier curve; Each sub-line segment is divided into plurality of sections by all frontier points between its starting and ending waypoint; The outer boundary of each section constitutes a quadrilateral, and each quadrilateral on average is divided into the experimental process quadrilateral along the trend of Bezier curve, and the quantity computation method of division is following: establish the length that l0 represents this quadrilateral before waist; L1 represents the length of that waist of back, so sub-quadrilateral quantity Count = Max ( 1 , Ceil ( | l 1 - l 0 | ( l 0 + l 1 ) 2 · 0.2 ) ) ; Calculate this a little tetragonal apex coordinate and gray-scale value through linear interpolation after drawing sub-quadrilateral quantity; And then utilize identical method that each sub-quadrilateral is divided into the plurality of sub quadrilateral again along Bezier normal to curve direction, just can whole quadrilateral be divided into the plurality of sub quadrilateral at last; Each sub-quadrilateral is divided into two adjacent tri patchs, utilizes gouraud shading colorize method to play up these tri patchs.
Beneficial effect of the present invention is following: the garbage mask border rendering method of tiled provided by the present invention; Realized the self-adaptation division of the sub-line segment of Bezier curve among the garbage mask; Outer/inner the border that every Bezier curve is corresponding is divided into some tri patchs with corresponding outer/inner arm of angle circle of its initial end points; Utilize gouraud shading colorize method to play up these tri patchs, make the border of playing up more level and smooth, clear, more flexible to the regulation and control of operation.
Description of drawings
Fig. 1 is a method flow diagram of the present invention;
Fig. 2 is end points and the frontier point synoptic diagram of garbage mask;
Fig. 3 is the synoptic diagram of tri patch for the corresponding outer corners boundary demarcation of the end points of Bezier curve;
Fig. 4 is that frontier point and waypoint coordinate on outer boundary and inner boundary concern synoptic diagram;
Fig. 5 is rendering effect figure of the present invention.
Embodiment
Below in conjunction with accompanying drawing and specific embodiment the present invention is carried out detailed description.
As shown in Figure 1, the garbage mask border rendering method of a kind of tiled provided by the present invention comprises the steps:
(1) all the Bezier curves among the garbage mask is divided into plurality of sub segments;
(2) confirm the outside direction of garbage mask;
(3) go out the outer boundary distance and the inner boundary distance of all waypoints according to the information calculations of frontier point;
(4) be that its corresponding outer/inner border outer/inner arm of angle circle corresponding with its initial end points is drawn by unit with every Bezier curve.
In said method, at first to carry out the segmentation of Beizer curve among the garbage mask.Because for playing up of the processing border of tiled; Must the Bezier curve be divided into some continuous sub-line segments; Come this Beizer curve of approximate representation with this a little line segment; The tie point of these line segments is referred to as waypoint (segment point), and a Beizer curve among the garbage mask has two waypoints at least, just its initial end points and end caps.The method that the most simply a Bezier curve is divided into plurality of sub segments is exactly evenly to divide by the parametric t of this Bezier parametric equation; If can cause the very low curve of a lot of curvature to divide a lot of waypoints in vain too much but like this get; Reduced the speed of the processing of some algorithms of back, if but get and under the very high situation of curvature, can cause the curve level and smooth inadequately very little again.The present invention adopts the method for dynamic division; Specific algorithm is following: for a Bezier curve, regulation is divided into 30 sub-line segments at most, that is to say that step-length minimum between the waypoint is 1/30; Advance forward for step-length by 1/30; Calculate the position tangent line vector of current this point, and carry out dot product calculating, if the value that draws is less than threshold value cos (2.5 π/180) with the unit tangent vector of this vector and previous fixed waypoint (t=0 must be a waypoint); Then current point is just confirmed as a waypoint; Not so this point is just ignored in the past, then no matter be that which kind of situation all continues by 1/30 step-length this process of repetition of marching forward, up to the end of going to this Bezier curve (t=1 also must be a waypoint).The benefit of dividing waypoint like this is if the sub-line segment that curvature of curve very low (or even straight line) is divided so will seldom even have only one section, and the sub-line segment of the high more division of curvature of curve is just many more, so this method is adaptive.
Next will distinguish outside and the inside of garbage mask.The present invention still is that right side (counter clockwise direction or CW in other words conj.or perhaps) stipulates which side is the outside of garbage mask along the left side that positive dirction is seen with Bezier curve among the garbage mask, and this is called outside direction.Left side such as the regulation curve is an outside direction, that is to say that so the Bezier curve is the perimeter of garbagemask along the left side that positive dirction is seen, the right side is an interior zone.In order to confirm the outside direction of a garbage mask, following algorithm is arranged:
1. calculate the bounding box (bounding box) of garbage mask, obtain the maximum y value of bounding box and the intermediate value yc of minimum y value then.
In order to ask the bounding box of a garbage mask, at first to obtain the bounding box of each bar Bezier curve among the garbage mask.Concrete solution procedure is following: for the maximum/minimum value of horizontal direction, at first calculate x (0) and x (1), then x (t) asked the single order derived function, x ' (t)=3a xT 2+ 2b xT+c x, find the solution (t)=0 real root in t ∈ [0,1] of x '; And then the functional value that these real roots are corresponding and the value of x (0) and x (1) compare; Just can obtain x (t) in t ∈ [0,1] interval maximal value and minimum value, the left margin and the right margin of Here it is this Bezier curve bounding box.In like manner, calculate y (t), can obtain the coboundary and the lower boundary of bounding box in t ∈ [0,1] interval maximal value and minimum value.Solve so after the bounding box of left and right sides curve among the garbage mask, we just possibly obtain the bounding box boundary value of whole garbage mask according to the boundary value under the left side of these bounding boxs/the rightest/go up most/again.
2. find out this horizontal line of y=yc and the intersection point (in asking the process of friendship, being actually the intersection point of the sub-line segment of asking this horizontal line and this Bezier curve) of all Bezier curves above the garbage mask, and find out leftmost that intersection point in these intersection points.
3. obtain the tangent line vector of leftmost that intersection point in its Bezier curve, carry out the cross product computing with the unit vector of x axle positive dirction then, if the z value of cross product operation result greater than 0 then outside direction is the right side, otherwise is the left side.
Before carrying out specifically the playing up of garbage mask border, also need calculate pairing outer boundary distance of waypoint and inner boundary distance on all Bezier curves, these two numerical value are used in order to constitute whole inside and outside boundary curve.Because frontier point has only determined the position of several discrete frontier points, but it can't confirm the shape of inner boundary or the outer boundary of whole garbage mask, therefore also can't play up whole border.And the pairing outer boundary distance of waypoint and inner boundary distance is just for the inner boundary that can confirm whole garbage mask or the needed data of shape of outer boundary; According to the pairing outer boundary distance of each waypoint and inner boundary distance just can with background technology on the computation bound point border introduced the similar method of coordinate calculate coordinate on the corresponding inner and outer boundary of each waypoint, thereby these coordinate points are coupled together the whole inside/outside of formation border.Below just introduce how to calculate pairing outer boundary distance of each waypoint and inner boundary distance; That minimum outer/inner frontier point of position attribution numerical value begins above garbage mask; Find next outer/inner the frontier point adjacent with it; The position attribution of supposing these two frontier points is respectively p0 and p1, is respectively d0 and d1 apart from attribute (frontier point is away from the distance on border), travels through all waypoints between these two frontier points; Outer/inner frontier distance of each segmentation can calculate like this: the position of supposing this waypoint is p, so its outer/inner frontier distance d=d0+ (p-p0)/(p1-p0) (d1-d0).Handle all frontier points successively by this method and to the last get back to outer/inner the frontier distance that first frontier point can calculate all waypoints.
Introduce the border of how playing up garbage mask with the method for tiled below, concrete method is: travel through in order that each end points E plays up its pairing border of pairing forward Bezier curve among the garbage mask.Be divided into following two steps:
1) plays up outer/inner arm of angle circle of this end points
Arm of angle circle is meant the forward tangent line and the inconsistent fan-like pattern border of causing of reverse tangential direction of this end points; Two waists on this fan-like pattern border are respectively perpendicular to the forward tangent line and the reverse tangent line of this end points; The length of waist is exactly outer/inner frontier distance of this end points, and Fig. 3 is the synoptic diagram on an outer corners border.With this fan-like pattern boundary demarcation is some tri patchs; In the present embodiment arm of angle circle is divided into 20 fixing tri patchs; Calculate the gray-scale value on these tri patch summits then; Gray-scale value for that corresponding summit of end points is 1, is exactly 0 for the summit gray-scale value on the outer boundary, utilizes gouraud shading colorize method to play up these tri patchs then and gets final product.
2) play up outer/inner border of this end points forward curve
Playing up outer/inner border of this end points forward curve will handle each sub-line segment of this end points forward curve as follows: find position attribution all frontier points between the starting and ending waypoint of this sub-line segment; These frontier points are the outer boundary point a bit, and some then is the inner boundary point.When playing up outer boundary; For the outer boundary point between the starting and ending waypoint of each sub-line segment; Always calculate coordinate (referring to the description in the background technology) on its outer boundary according to coordinate on its curve and its external parties apart from attribute and current garbage mask, coordinate points in the back will be as the summit of tri patch on coordinate points and the border on its curve; For the inner boundary point between the starting and ending waypoint of each sub-line segment; Can not directly use on its border coordinate points as the summit of tri patch; Because its direction is anti-, need obtains its outer boundary distance apart from carrying out linear interpolation according to the outer boundary of the broad sense outer boundary point of its front (comprise outer boundary put coordinate points on the outer boundary corresponding of coordinate points on the pairing border) and the broad sense outer boundary point of back, and then calculate coordinate on its outer boundary with waypoint; Position attribution such as certain inner boundary point is p; The position of that broad sense outer boundary point of its front is p0, and distance is d0, and the position of that broad sense outer boundary point of its back is p1; Distance is d1; Its outer boundary is apart from d=d0+ (p-p0)/(p1-p0) (d1-d0) so, just can calculate coordinate on its outer boundary so like this, thereby can use on its curve on the coordinate points and outer boundary coordinate points as the summit of tri patch.
When playing up the inner boundary of Bezier curve correspondence; For the inner boundary point between the starting and ending waypoint of each sub-line segment, always calculate coordinate (referring to the description in the background technology) on its inner boundary according to coordinate on its curve and its internal side apart from attribute and current garbagemask; For the outer boundary point between the starting and ending waypoint of each sub-line segment; Obtain its inner boundary distance according to the broad sense inner boundary point of its front and the inner boundary of broad sense inner boundary point at the back apart from carrying out linear interpolation; And then calculating coordinate on its inner boundary, concrete grammar and above-mentioned situation when playing up outer boundary are similar.
Fig. 4 has shown an instantiation, as can be seen from Figure 4,3 frontier points is arranged between two continuous waypoints, and two outer boundary points are wherein arranged, and an inner boundary point is arranged.So just be divided into 4 sections to this line segment, the outer boundary of each section can constitute a quadrilateral, next will play up these quadrilaterals exactly.But before playing up, at first to confirm the gray-scale value on these quadrilateral summits.Its gray-scale value of summit for being positioned on the outer boundary must be 0; Obtain for then need between 0 to 1, carrying out linear interpolation with the ratio of its outer boundary distance and inner boundary distance on the summit on the curve.Attention: the frontier distance that outer boundary point is put coordinate points on the border externally at the frontier distance of coordinate points on the inner boundary or inner boundary is that the frontier distance interpolation through its adjacent broad sense inside/outside frontier point obtains, and obtains apart from interpolation such as the outer boundary distance of the inner boundary point C outer boundary by outer boundary point A and outer boundary point B.
These quadrilaterals to have been played up exactly so; The present invention plays up it with the method that simply these quadrilaterals is divided into two tri patchs; Because the situation of tangible ladder sense is arranged at the critical place that can occur two tri patchs in some cases; Therefore will these quadrilaterals further be subdivided into the plurality of sub quadrilateral again, divided method is following: at first this quadrilateral on average is divided into the experimental process quadrilateral along the trend of Bezier curve, concrete quantity of dividing can be calculated like this: suppose that l0 represents the length of this quadrilateral before waist; L1 represents the length of that waist of back, so sub-quadrilateral quantity Count = Max ( 1 , Ceil ( | l 1 - l 0 | ( l 0 + l 1 ) 2 · 0.2 ) ) . Just can calculate this a little tetragonal apex coordinate and gray-scale value after drawing sub-quadrilateral quantity through linear interpolation.And then utilize similar method that each sub-quadrilateral is divided into the plurality of sub quadrilateral along Bezier normal to curve direction, just can whole quadrilateral be divided into the plurality of sub quadrilateral at last.Afterwards each sub-quadrilateral being divided into two adjacent tri patchs utilizes gouraud shading colorize method to play up these tri patchs to get final product then.
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 embodiment, belongs to innovation scope of the present invention equally.

Claims (7)

1. the garbage mask border rendering method of a tiled comprises the steps:
(1) all the Bezier curves among the garbage mask is divided into plurality of sub segments;
(2) confirm the outside direction of garbage mask;
(3) go out the outer boundary distance and the inner boundary distance of all waypoints according to the information calculations of frontier point;
(4) be that its corresponding outer/inner border outer/inner arm of angle circle corresponding with its initial end points is drawn by unit with every Bezier curve;
Corresponding outer/inner arm of angle circle of the initial end points of described Bezier curve is meant the forward tangent line and the inconsistent fan-like pattern border of causing of reverse tangential direction of this end points; Perpendicular to the forward tangent line and the reverse tangent line of this end points, the length of waist is outer/inner frontier distance of this end points to two waists on this fan-like pattern border respectively; The method of drawing outer/inner arm of angle circle is: with this fan-like pattern boundary demarcation is some tri patchs; Calculate the gray-scale value on these tri patch summits then; Gray-scale value for that corresponding summit of end points is 1; For outer/inner borderline summit gray-scale value is exactly 0, utilizes gouraud shading colorize method to play up these tri patchs then;
The method on outer/inner the border that described drafting Bezier curve is corresponding is: to each sub-line segment, find position attribution all frontier points between the starting and ending waypoint of this sub-line segment; Obtain each frontier point outside/coordinate on the inner boundary; With the summit of coordinate points and outer/inner the borderline coordinate points of frontier point on curve, calculate the gray-scale value on these tri patch summits as tri patch; Utilize gouraud shading colorize method to play up these tri patchs then.
2. the garbage mask border rendering method of tiled as claimed in claim 1; It is characterized in that: it is following in the step (1) the Bezier curve to be divided into the method for plurality of sub segments: for a Bezier curve, advance forward for step-length by 1/30, calculate the position tangent line vector of current this point; And carry out dot product with the unit tangent vector of this vector and previous fixed waypoint and calculate; If the value that draws is less than threshold value cos (2.5 π/180), then current point is just confirmed as a waypoint, and not so this point is just ignored in the past; Continue then by 1/30 step-length this process of repetition of advancing forward, up to the end of this Bezier curve.
3. according to claim 1 or claim 2 the garbage mask border rendering method of tiled is characterized in that: the step of outside direction of confirming garbage mask in the step (2) is following:
1. calculate the bounding box of garbage mask, obtain the maximum y value of bounding box and the intermediate value yc of minimum y value then;
2. find out this horizontal line of y=yc and the intersection point of all Bezier curves above the garbage mask, and find out leftmost that intersection point in these intersection points;
3. obtain the tangent line vector of leftmost that intersection point in its Bezier curve, carry out the cross product computing with the unit vector of x axle positive dirction then, if the z value of cross product operation result greater than 0 then outside direction is the right side, otherwise is the left side.
4. according to claim 1 or claim 2 the garbage mask border rendering method of tiled; It is characterized in that: the fall into a trap outer boundary distance of calculating waypoint and the method for inner boundary distance of step (3) is: that minimum outer/inner frontier point of position attribution numerical value begins above garbage mask; Find next outer/inner the frontier point adjacent with it; If the position attribution of these two frontier points is respectively p0 and p1; Apart from attribute is respectively d0 and d1, travels through all waypoints between these two frontier points, and outer/inner frontier distance computing formula of each waypoint is d=d0+ (p-p0)/(p1-p0) (d1-d0); Wherein, p is the position of the waypoint that calculated.
5. the ga rbage ma s k border rendering method of tiled as claimed in claim 1; It is characterized in that: when drawing the outer boundary of Bezier curve correspondence in the step (4); For the outer boundary point between the starting and ending waypoint of each sub-line segment, always calculate coordinate on its outer boundary according to coordinate on its curve and its external parties apart from attribute and current garbage mask; For the inner boundary point between the starting and ending waypoint of each sub-line segment; Obtain its outer boundary distance according to the broad sense outer boundary point of its front and the outer boundary of broad sense outer boundary point at the back apart from carrying out linear interpolation; And then calculating coordinate on its outer boundary, described broad sense outer boundary point comprises that outer boundary puts coordinate points on the outer boundary corresponding with waypoint of coordinate points on the pairing border.
6. the garbage mask border rendering method of tiled as claimed in claim 1; It is characterized in that: when drawing the inner boundary of Bezier curve correspondence in the step (4); For the inner boundary point between the starting and ending waypoint of each sub-line segment, always calculate coordinate on its inner boundary according to coordinate on its curve and its internal side apart from attribute and current garbage mask; For the outer boundary point between the starting and ending waypoint of each sub-line segment; Obtain its inner boundary distance according to the broad sense inner boundary point of its front and the inner boundary of broad sense inner boundary point at the back apart from carrying out linear interpolation; And then calculating coordinate on its inner boundary, described broad sense inner boundary point comprises that inner boundary puts coordinate points on the inner boundary corresponding with waypoint of coordinate points on the pairing border.
7. the garbage mask border rendering method of tiled as claimed in claim 1; It is characterized in that: in the step (4) in the process of drawing outer/inner corresponding border of Bezier curve; Each sub-line segment is divided into plurality of sections by all frontier points between its starting and ending waypoint; The outer boundary of each section constitutes a quadrilateral; Each quadrilateral on average is divided into the experimental process quadrilateral along the trend of Bezier curve; The quantity computation method of dividing is following: establish the length that l0 represents this quadrilateral before waist; L1 represents the length of that waist of back; So sub-quadrilateral quantity
Figure FSB00000714734600031
calculates this a little tetragonal apex coordinate and gray-scale value through linear interpolation after drawing sub-quadrilateral quantity; And then utilize identical method that each sub-quadrilateral is divided into the plurality of sub quadrilateral again along Bezier normal to curve direction, just can whole quadrilateral be divided into the plurality of sub quadrilateral at last; Each sub-quadrilateral is divided into two adjacent tri patchs, utilizes gouraud shading colorize method to play up these tri patchs.
CN2009100847356A 2009-05-20 2009-05-20 Patched garbage mask border rendering method Expired - Fee Related CN101894363B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009100847356A CN101894363B (en) 2009-05-20 2009-05-20 Patched garbage mask border rendering method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100847356A CN101894363B (en) 2009-05-20 2009-05-20 Patched garbage mask border rendering method

Publications (2)

Publication Number Publication Date
CN101894363A CN101894363A (en) 2010-11-24
CN101894363B true CN101894363B (en) 2012-06-06

Family

ID=43103546

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100847356A Expired - Fee Related CN101894363B (en) 2009-05-20 2009-05-20 Patched garbage mask border rendering method

Country Status (1)

Country Link
CN (1) CN101894363B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102657587B1 (en) * 2016-11-21 2024-04-15 삼성전자주식회사 Method and apparatus for rendering a curve
CN108717354B (en) * 2018-05-17 2021-12-17 广州多益网络股份有限公司 Method and device for acquiring rendering data of mobile game and storage equipment
CN111292422A (en) * 2020-03-02 2020-06-16 上海索辰信息科技有限公司 Method for improving grid generation quality based on surface normal
CN112509131B (en) * 2020-11-20 2022-12-06 上海莉莉丝网络科技有限公司 Rendering method, system and computer readable storage medium for map area boundary in game map
CN113888566B (en) * 2021-09-29 2022-05-10 推想医疗科技股份有限公司 Target contour curve determination method and device, electronic equipment and storage medium
CN117726722B (en) * 2023-04-20 2024-09-24 书行科技(北京)有限公司 Special effect generation method, device and equipment for video image and readable storage medium

Also Published As

Publication number Publication date
CN101894363A (en) 2010-11-24

Similar Documents

Publication Publication Date Title
CN101894363B (en) Patched garbage mask border rendering method
Coquillart Computing offsets of B-spline curves
CN101950427B (en) Vector line segment contouring method applicable to mobile terminal
CN113199479B (en) Track generation method and device, electronic equipment, storage medium and 3D camera
CN105551081A (en) Virtual gum triangular mesh algorithm construction and follow-up algorithm
CN104318600A (en) Method for achieving role treading track animation by using Bezier curve
CN107230255A (en) A kind of method of dental restoration based on common template
CN113199480A (en) Trajectory generation method and apparatus, electronic device, storage medium, and 3D camera
CN111459160B (en) Large-scale track smoothing method for unmanned washing and sweeping vehicle on open road
CN102768764B (en) It is a kind of that the smooth method of figure is made based on Bezier
CN104183008A (en) Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method
CN102298787A (en) Control method and control system for animation object motion
CN113189934A (en) Trajectory generation method and apparatus, electronic device, storage medium, and 3D camera
US20090153578A1 (en) Apparatus for proccessing effect using style lines
CN101394489B (en) Subtitle rendering efficiency bottle neck automatically positioning method based on template and parameter step length
CN104616327A (en) Tessellation based tinter simplifying method and device and graphic rendering method
CN103559721B (en) A kind of triangulation rapid image fusion method based on image gradient
CN101764939B (en) Texture mapping method based on pixel space mask matrix
CN101764940B (en) Subtitle rendering method based on pixel space mask matrix model
CN102306388B (en) Method and device for preventing stroke shape from deforming
CN101894360B (en) Multi-CPU garbage mask rendering method
CN101764935B (en) Form gradient radial color filling method based on pixel space mask matrix
CN115063324A (en) Boundary line smooth extrapolation method for data sparse island
JP2007018092A (en) Computer graphics drawing method and drawing device
CN100389424C (en) Auto measuring method of last based on geodesic curve

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: BEIJING CULTURAL AND SCIENTIFIC FINANCING LEASE CO

Free format text: FORMER OWNER: XIN'AOTE(BEIJING) VIDEO TECHNOLOGY CO., LTD.

Effective date: 20150326

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100080 HAIDIAN, BEIJING TO: 100044 SHUNYI, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20150326

Address after: 100044, room 2, building 1, No. 401, Golden Sail Road, Beijing, Shunyi District

Patentee after: Beijing culture science and technology finance leasing Limited by Share Ltd

Address before: 100080 Beijing city Haidian District xicaochang No. 1 Beijing Silicon Valley computer city 15 1501-1506 room

Patentee before: China Digital Video (Beijing) Limited

TR01 Transfer of patent right

Effective date of registration: 20170930

Address after: 100143 Beijing city Haidian District xicaochang No. 1 Silicon Valley computer city 15 1501-1506 room

Patentee after: China Digital Video (Beijing) Limited

Address before: 100044, room 2, building 1, No. 401, Golden Sail Road, Beijing, Shunyi District

Patentee before: Beijing culture science and technology finance leasing Limited by Share Ltd

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

Granted publication date: 20120606

Termination date: 20170520

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