A method and system for fast rendering of vector graphics on video

By using a preset rectangular area and the vertex coordinates and transformation relationships of standard vector graphics, users can generate real-time vector graphics by clicking input points on the screen. This solves the problem of quickly drawing vector graphics in live competitive TV sports programs and achieves efficient real-time marking effects.

CN122265441APending Publication Date: 2026-06-23SHANGHAI MEDIA TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI MEDIA TECH
Filing Date
2026-03-09
Publication Date
2026-06-23

Smart Images

  • Figure CN122265441A_ABST
    Figure CN122265441A_ABST
Patent Text Reader

Abstract

The application provides a fast drawing method of vector graphics on video, which comprises the following steps: S1, obtaining a second input point input by a user on a second operation plane; S2, obtaining a second vertex coordinate of a second rectangular region on the second plane; S3, obtaining a second conversion relationship between the first rectangular region and the second rectangular region; S4, obtaining a real-time endpoint coordinate of a real-time vector graphics on the second operation plane; and S5, drawing the real-time vector graphics based on the real-time endpoint coordinate. The application has the advantages of setting only the second input point on the screen, drawing the corresponding vector graphics after calculation, facilitating user operation and high real-time performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent video image processing in the broadcasting and television industry, and in particular to a method and system for rapidly drawing vector graphics on video. Background Technology

[0002] In live broadcasts of competitive television sports, the intense competition makes the pace of the footage much faster than in normal lifestyle broadcasts. Unexpected events can occur frequently in an instant, and viewers may sometimes miss the show because details happen too quickly, the intended focus is not on the location of the incident, or the camera doesn't switch to a different scene in time. In such cases, the best solution is for the director to replay the scene to recreate the moment.

[0003] In the process of recreating a scene, besides the host's verbal explanation, a good directional sign can be much more effective. For example, in a football match where an offside has been ruled, visually, three attacking players may appear to be in offside positions, but in reality, only one player is offside. In this case, a red arrow next to that player would be much more intuitive than the host saying "Player number X of team X has been ruled offside." Similarly, in professional car rallies, the skill levels of the drivers are usually quite similar. In the scenes of numerous cars racing, most shots show multiple cars in the same frame, constantly changing positions as they race. Relying solely on color or car number makes it difficult for viewers to quickly locate and track the vehicle mentioned by the host. In such cases, a directional sign is essential to mark the exciting moments of the race in real time.

[0004] For creating directional signs, the first priority is speed. During live broadcasts, once the replay time is determined, the sign locations must be marked quickly. No matter how intense the scene, if it's replayed a minute later, some excited viewers may have lost interest. Secondly, the operation must be simple and clear. Ideally, non-computer professionals should be able to complete the task directly on the original replay screen, or even within the live broadcast, using a mouse and keyboard. For example, the operator responsible for creating the signs could simply tap the touchscreen to set them. Thirdly, the signs need to be able to be marked in real-time according to different event situations. Obviously, directional signs cannot be static rectangles; the drawn graphics must be vector graphics because the position, orientation, and size of the graphics cannot be predicted in advance, and effects such as cutouts and transparency are also required. Sometimes, multiple sets of shapes even need to be predefined, with different shapes used in different scenarios. For example, in a sailing race, it's perfectly acceptable to point a red arrow at a sailboat in the distance. However, in a basketball game, where the focus is usually on close-ups, pointing a sharp arrow at someone would seem overtly aggressive. In such cases, a more neutral, wide arrow or a circular shape would be preferable.

[0005] Therefore, a method is needed for live broadcasts of competitive television sports programs that allows non-computer science personnel to quickly create vector graphics that reflect the real-time event situation. Summary of the Invention

[0006] To quickly mark and describe intense competition situations, this invention provides a method for rapidly drawing vector graphics, applicable to live video streaming scenarios. The method involves pre-setting a first rectangular region and a standard vector graphic on the first operation plane, recording the coordinates of the first vertex of the first rectangular region and the coordinates of the standard endpoints of the standard vector graphic, and recording a first transformation relationship between the first input point in the first rectangular region and the coordinates of the first vertex. The rapid drawing method includes: Step S1: Obtain the second input point entered by the user on the second operation plane; Step S2: Based on the first transformation relationship, obtain the coordinates of the second vertex of the second rectangular region on the second operation plane according to the second input point; Step S3: Obtain the second transformation relationship between the first rectangular region and the second rectangular region based on the coordinates of the first vertex and the coordinates of the second vertex; Step S4: Based on the second transformation relationship, obtain the real-time endpoint coordinates of the real-time vector graphics on the second operation plane according to the standard endpoint coordinates of the standard vector graphics; Step S5: Draw the real-time vector graphic based on the real-time endpoint coordinates, and output the real-time vector graphic and the real-time video content generated in the live video scene. The first operating plane, the second operating plane, and the display plane of the real-time video content are all the same size.

[0007] Preferably, the first input point includes the coordinates of a first starting point and the coordinates of a first ending point; The first transformation relationship is used to represent the proportional relationship between line segments between the coordinates of the first starting point and the coordinates of the plurality of first vertices, and the proportional relationship between line segments between the coordinates of the first ending point and the coordinates of the plurality of first vertices.

[0008] Preferably, the second input point includes the coordinates of a second starting point corresponding to the coordinates of the first starting point, and the coordinates of a second ending point corresponding to the coordinates of the first ending point; Step S2 includes: Step S21: Calculate the length of the first line segment between the coordinates of the second starting point and the coordinates of the second ending point; Step S22: Calculate the length of the second line segment between each second vertex coordinate and the second input point based on the first line segment length and the first transformation relationship; Step S23: Based on the length of the second line segment, calculate the coordinates of each of the second vertices according to the coordinates of the second starting point and the coordinates of the second ending point.

[0009] Preferably, the second transformation relationship is a homography matrix used to represent the transformation relationship between the first rectangular region and the second rectangular region.

[0010] Preferably, step S4 includes: Step S41: Traverse and obtain the coordinates of the standard endpoints; Step S42: Increase the order of the standard endpoint coordinates to obtain the standard endpoint matrix; Step S43: Multiply the standard endpoint matrix with the homography matrix to obtain the real-time endpoint matrix corresponding to the real-time endpoint coordinates, and obtain the real-time endpoint coordinates based on the real-time endpoint matrix.

[0011] Preferably, the connection order relationship between the coordinates of each standard endpoint in the standard vector graphic is pre-recorded; In step S5, the real-time endpoint coordinates are connected sequentially according to the connection order to draw the real-time vector graphic.

[0012] This invention provides a rapid drawing system for vector graphics on video, applicable to live video streaming scenarios. It presets a first rectangular area and a standard vector graphic in the first operation plane, records the coordinates of the first vertex of the first rectangular area and the coordinates of the standard endpoints of the standard vector graphic, and records the first transformation relationship between the first input point in the first rectangular area and the coordinates of the first vertex. The rapid rendering system includes: A storage module is used to store the coordinates of the first vertex, the coordinates of the standard endpoints, and the first transformation relationship; The receiving module is used to acquire the second input point entered by the user on the second operating plane; The first acquisition module, connected to the storage module and the receiving module, is used to acquire the coordinates of the second vertex of the second rectangular region on the second operation plane based on the first conversion relationship and the second input point. The second acquisition module, connected to the storage module and the first acquisition module, is used to acquire a second transformation relationship between the first rectangular region and the second rectangular region based on the first vertex coordinates and the second vertex coordinates; The third acquisition module, connected to the storage module and the second acquisition module, is used to acquire the real-time endpoint coordinates of the real-time vector graphics on the second operation plane based on the second conversion relationship and the standard endpoint coordinates of the standard vector graphics. The drawing module is connected to the third acquisition module, which draws the real-time vector graphics based on the real-time endpoint coordinates, and outputs the real-time vector graphics and the real-time video content generated in the live video scene. The first operating plane, the second operating plane, and the display plane of the real-time video content are all the same size.

[0013] Preferably, the second input point includes the coordinates of a second starting point corresponding to the coordinates of the first starting point, and the coordinates of a second ending point corresponding to the coordinates of the first ending point. The first acquisition module includes: The first calculation unit is used to calculate the length of the first line segment between the coordinates of the second starting point and the coordinates of the second ending point; The second calculation unit, connected to the first calculation unit, is used to calculate the length of the second line segment between each of the coordinates of the second vertex and the second input point based on the first line segment length and the first transformation relationship. The third calculation unit, connected to the second calculation unit, is used to calculate the coordinates of each of the second vertices based on the length of the second line segment, according to the coordinates of the second starting point and the coordinates of the second ending point.

[0014] Preferably, the second transformation relationship is a homography matrix representing the transformation relationship between the first rectangular region and the second rectangular region, and the third acquisition module includes: A traversal unit is used to traverse and obtain the coordinates of the standard endpoints; An order-increasing unit, connected to the traversal unit, is used to increase the order of the standard endpoint coordinates to obtain a standard endpoint matrix; The matrix calculation unit, connected to the order-increasing unit, is used to multiply the standard endpoint matrix with the homography matrix to obtain the real-time endpoint matrix corresponding to the real-time endpoint coordinates, and to obtain the real-time endpoint coordinates based on the real-time endpoint matrix.

[0015] Preferably, the saving module also pre-records the connection order relationship between the coordinates of each standard endpoint in the standard vector graphic, and the drawing module connects the real-time endpoint coordinates sequentially according to the connection order relationship to draw the real-time vector graphic.

[0016] The following beneficial effects can be obtained by using the present invention: By pre-setting the coordinates of the first vertex, the coordinates of the standard endpoints, and the first transformation relationship, users only need to select the second input point on the screen. After calculation, the corresponding real-time vector graphics can be generated, which is convenient for users to operate. Due to its simple operation and short time to obtain vector graphics on the screen, it can meet the high real-time requirements of live sports events. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the rapid drawing method in this invention; Figure 2 This is a schematic diagram of a vector graphic to be drawn in one embodiment of the present invention; Figure 3 This is a schematic diagram of the partially rotated rectangular region in this invention; Figure 4 This is a rendering of the vector graphics created in this invention. Figure 5 This is a schematic diagram of the process for calculating the coordinates of the second vertex in this invention; Figure 6 This is a schematic diagram of the process for obtaining real-time endpoint coordinates in this invention; Figure 7 This is a schematic diagram of the rapid drawing system of the present invention; Figure 8 This is a schematic diagram of the structure of the first acquisition module of the present invention; Figure 9 This is a schematic diagram of the structure of the third acquisition module of the present invention.

[0018] In the attached image: 1. Storage Module, 2. Receiving Module, 3. First Acquisition Module, 31. First Calculation Unit, 32. Second Calculation Unit, 33. Third Calculation Unit, 4. Second Acquisition Module, 5. Third Acquisition Module, 51. Traversal Unit, 52. Order Increasing Unit, 53. Matrix Calculation Unit, 6. Drawing Module Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.

[0021] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the scope of the invention.

[0022] This invention provides a method for quickly drawing vector graphics, applicable to video live streaming scenarios. A first rectangular area and a standard vector graphic are preset in a first operation plane. The coordinates of the first vertex of the first rectangular area and the coordinates of the standard endpoints of the standard vector graphic are recorded, as well as the first transformation relationship between the coordinates of the first input point and the first vertex in the first rectangular area is recorded. Quick drawing methods include: Step S1: Obtain the second input point entered by the user on the second operation plane; Step S2: Based on the first transformation relationship, obtain the coordinates of the second vertex of the second rectangular region on the second operation plane according to the second input point; Step S3: Obtain the second transformation relationship between the first rectangular region and the second rectangular region based on the coordinates of the first vertex and the second vertex; Step S4: Based on the second transformation relationship, obtain the real-time endpoint coordinates of the real-time vector graphics on the second operation plane according to the standard endpoint coordinates of the standard vector graphics; Step S5: Draw real-time vector graphics based on real-time endpoint coordinates, and output the real-time vector graphics and real-time video content generated in the live video streaming scene. The first operating plane, the second operating plane, and the display plane for real-time video content are all the same size.

[0023] In live video streaming scenarios, the live feed is displayed on the screens of viewers' mobile phones, computers, and other electronic devices. Taking live sports broadcasts as an example, the host uses a screen displaying the live video to provide real-time commentary to the audience, and draws vector graphics on their own screen to mark key points of the commentary. These vector graphics are simultaneously displayed on the viewers' screens, assisting the host's explanation. Because the live feed is constantly changing, the host needs to quickly draw vector graphics when analyzing a particular moment. The method provided in this application only requires clicking two points on the host's screen as the second input point to obtain the corresponding vector graphics, meeting the high real-time requirements of live video streaming scenarios.

[0024] Specifically, in the application scenario of this application, since the graphics used for marking need to change according to real-time conditions, and the position, orientation, and size of the graphics cannot be predicted in advance, vector graphics composed of mathematical formulas and geometric elements are used to facilitate calculations for operations such as rotation and scaling of the vector graphics. The types of vector graphics are various arrow graphics and other easily identifiable graphic types.

[0025] Furthermore, the host, as the user, has a screen that includes a first operation plane for operation and a second operation plane for displaying live content. The first operation plane is the user layer, allowing the user to operate directly on the screen. Before drawing vector graphics, a first rectangular area is pre-defined on the first operation plane to obtain the coordinates of four first vertices, and the coordinates of each standard endpoint of the vector graphics to be drawn are input to obtain standard vector graphics. Those skilled in the art should understand that the first rectangular area serves only as a reference area for the vector graphics, providing coordinate references and should not be considered as limiting the range of the vector graphics; part or all of the vector graphics can be outside the rectangular area. Even when the vector graphics are outside the rectangular area, the corresponding second rectangular area can still be calculated, and the real-time endpoint coordinates can be obtained to draw the real-time vector graphics on the second operation plane.

[0026] This application uses a feather arrow as a preferred embodiment for illustration. The solid black lines represent the vector graphics to be drawn, while the dashed black lines represent auxiliary parts. The letters acom form a vertical first rectangular region. With ac as the positive x-axis and am as the positive y-axis, values ​​are assigned to the vertices acom of the first rectangular region, resulting in the coordinates of the four first vertices a(ax, ay), c(cx, cy), o(ox, oy), and m(mx, my).

[0027] like Figure 2 As shown, the letters b, d, f, g, h, i, j, k, l, m, n, and o represent the standard endpoint coordinates of the vector graphics. After the user inputs the coordinates of the corresponding letters and the connection order between the letters, a vector graphic is generated on the first operation plane as shown. Figure 2 The vector graphics shown are stored in the pntPic array, which has a length of 15 and uses Point2f data (i.e., two float values ​​to represent the coordinates).

[0028] Using the standard endpoint coordinates b(bx, by) and n(nx, ny) as the first input points, we obtain the first transformation relationship between these coordinates and the first vertex coordinates, for example... Figure 2 As shown, ab = bc, and the first rectangular region is a vertical rectangle. Therefore, bx = (a.x + cx) / 2, by = (a.y + cy) / 2. Similarly, we can obtain nx = (m.x + ox) / 2, ny = (m.y + oy) / 2.

[0029] In practical use, users can customize the required vector graphics by inputting coordinates and the connection order between coordinates, or directly use preset vector graphics to automatically obtain standard endpoint coordinates and corresponding connection order.

[0030] In step S1, as Figure 3 As shown, the user determines the second input points b and n' by clicking the location on the first operation plane where the vector graphics need to be generated, either by clicking with the mouse or manually clicking the touch screen. These correspond to the first input points b and n respectively, and the coordinates b (bx, by) and n' (n'.x, n'.y) of the second input points are obtained. The line segment bn' is the axis between the second input points.

[0031] In step S2, as Figure 3 As shown, the coordinates of the second vertex are a' and c', which correspond to the coordinates of the first vertex a and c, respectively, and the vertex not in... Figure 3 The coordinates of the second vertex, o' and m', which are not explicitly marked, correspond to the coordinates of the first vertex, o and m, respectively.

[0032] In step S3, as Figure 3 As shown, the solid black line represents the second rectangular area required to obtain the second input point selected by the user, and the dashed black line represents... Figure 2 The first rectangular region shown is for reference. Since b and n' are not necessarily on the same horizontal or vertical line, but rather at an angle to the horizontal or vertical, the following conversion formula can be derived:

[0033] in, bn' is the length of the axis; bn is the vertical length of bn'; nn' is the horizontal length of bn'; by is the ordinate of the second input point b; n'.y is the ordinate of the second input point n'; bx is the x-coordinate of the second input point b; n'.x is the x-coordinate of the second input point n'.

[0034] like Figure 3 As shown, since △bn'n∽△ba'a, the following formula is obtained, which is also part of the transformation formula:

[0035] in, dx is the horizontal offset of a'b; ba' is the length of ba'; bn' is the length of bn'; dy is the vertical offset of a'b.

[0036] Then, the x-coordinate of point a' can be obtained by bx-dx. Similarly, the y-coordinate of point a' can be obtained by b.y+dy, that is, the coordinates of point a' are (bx-bn*ba' / bn', b.y+n'n*ba' / bn').

[0037] In the second rectangular region, a' and c' are symmetrical with respect to point b, and m' and o' are symmetrical with respect to point n'. Without trapezoidal deformation, a' and m' have the same length and direction relative to both points b and n. Similarly, c' and o' have the same length relative to both points b and n'. Therefore, using the method described above for obtaining the coordinates of a', the coordinates of the other three vertices can be calculated as c'(b.x + bn*ba' / bn', by - nn'*ba' / bn'), m'(nx - bn*ba' / bn', n.y + n'n*ba' / bn'), and o'(n.x + bn*ba' / bn', ny - n'n*ba' / bn').

[0038] Furthermore, the second operating plane is a drawing layer. The real-time endpoint coordinates of the vector graphics on the second operating plane are obtained through the second rectangular area formed by a', c', m' and o', and these real-time endpoint coordinates are connected to form vector graphics on the second operating plane.

[0039] In practical applications, the first and second operation planes are virtual planes on the user's screen. Setting the first and second operation planes to the same size ensures that coordinate calculations and transformations are not distorted and simplifies computation. For example... Figure 4 As shown, the upper left corner represents the first rectangular area corresponding to the first operating plane, along with standard vector graphics. The second input point clicked by the user on the second operating plane automatically calculates and generates the corresponding vector graphics, capable of generating vector graphics of arbitrary direction and scale. Real-time video content is displayed on both the second operating plane and the user's display plane. The display plane has the same dimensions as both the first and second operating planes. The vector graphics generated on the second operating plane are mapped to the same positions on the display plane, displaying the same live video content and vector graphics on the viewer's electronic device screen as on the user's screen.

[0040] This invention provides operational convenience. Even those who are not skilled in the art can generate corresponding vector graphics by simply clicking two points on the screen when using the product of this invention. Because the operation time is short, it can meet the high real-time requirements of live sports events.

[0041] In a preferred embodiment of the present invention, the first input point includes the coordinates of a first starting point and the coordinates of a first ending point; The first transformation relationship is used to represent the proportional relationship between line segments between the coordinates of the first starting point and the coordinates of multiple first vertices, as well as the proportional relationship between line segments between the coordinates of the first ending point and the coordinates of multiple first vertices.

[0042] Specifically, as in Figure 2 As shown, b(bx, by) is the coordinate of the first starting point, and n(nx, ny) is the coordinate of the first ending point. Since the mapping relationship between the real-time vector graphics and the standard vector graphics remains unchanged under non-zero scaling in the subsequent matrix operations, satisfying the principle of no loss of generality, the coordinates of the first vertex can be arbitrarily selected. Based on the above proportional relationship of the line segments, the coordinates of all standard endpoints and the length of the line segments can be obtained.

[0043] Furthermore, the standard endpoint coordinates are saved to the pntPic array for subsequent calculations, and the connection order relationship, such as bd, bf, and bn, is saved so that when the corresponding real-time endpoint coordinates are obtained later, they can be connected according to the original letter connection order relationship to form a vector graphic with the same style as the original vector graphic.

[0044] In a preferred embodiment of the present invention, the second input point includes second starting point coordinates corresponding to the first starting point coordinates and second ending point coordinates corresponding to the first ending point coordinates; like Figure 5 As shown, step S2 includes: Step S21: Calculate the length of the first line segment between the coordinates of the second starting point and the coordinates of the second ending point; Step S22: Calculate the length of the second line segment between each second vertex coordinate and the second input point based on the first line segment length and the first transformation relationship; Step S23: Based on the length of the second line segment, calculate the coordinates of each second vertex according to the coordinates of the second starting point and the second ending point.

[0045] Specifically, as in Figure 2As shown, the coordinates of the second starting point are b(bx, by), and the coordinates of the second ending point are n'(n'.x, n'.y). The position of the second rectangular region changes depending on the second input point. The rotation and scaling of the vector graphic is actually the rotation and scaling of the rectangular region. The coordinates of the second vertex of the second rectangular region are calculated by calculating the line segment ratio between the second input point and the first vertex of the first rectangular region. The relevant matrix is ​​established and calculated separately with the standard endpoint coordinates to obtain the corresponding real-time endpoint coordinates. These real-time endpoint coordinates are saved in the same order as the standard endpoint coordinates, and connected in the same connection order as the standard endpoint coordinates. For example, if the standard endpoint coordinate d in the standard vector graphic is only connected to b, then in the real-time vector graphic, the real-time endpoint coordinate d' is also only connected to b'. Finally, a vector graphic with the same style as the original vector graphic is obtained, only the direction and size may be different.

[0046] Furthermore, similarly Figure 3 As shown, the starting point is b, the ending point is n', and the length of the axis bn' is sqrt(bn*bn+n'n*n'n). The length of the rectangle's side is obtained based on the coordinates of the first vertex. Treating the axis as a vector, and with b as the starting point, the axis bn' points to the upper left.

[0047] Furthermore, dx and dy are offsets. Based on the above dx and dy, the corresponding line segment ratios are calculated to obtain the coordinates of the second vertex.

[0048] Furthermore, since the rotation angle relative to the original vector graphic is different, if we continue to rotate counterclockwise around the center of the axis, the calculation methods for dx and dy are the same, but the signs will change. Therefore, we will discuss them separately according to the following cases: When bx <= n'.x and by <= n'.y, the rotation angle is 0 to 90 degrees.

[0049] Then a'.x=bx-dx, a'.y=b.y+dy, c'.x=b.x+dx, c'.y=by-dy, m'.x=nx-dx, m'.y=n.y+dy, o'.x=n.x+dx, o'.y=ny-dy.

[0050] When bx <= n'.x and by > n'.y, the rotation angle is 90~180 degrees.

[0051] Then a'.x=b.x+dx, a'.y=b.y+dy, c'.x=bx-dx, c'.y=by-dy, m'.x=n.x+dx, m'.y=n.y+dy, o'.x=nx-dx, o'.y=ny-dy.

[0052] When bx > n'.x and by <= n'.y, the rotation angle is 180~270 degrees.

[0053] Then a'.x=bx-dx, a'.y=by-dy, c'.x=b.x+dx, c'.y=b.y+dy, m'.x=nx-dx, m'.y=ny-dy, o'.x=n.x+dx, o'.y=n.y+dy.

[0054] When bx > n'.x and by > n'.y, the rotation angle is 270~360 degrees.

[0055] Then a'.x=b.x+dx, a'.y=by-dy, c'.x=bx-dx, c'.y=b.y+dy, m'.x=n.x+dx, m'.y=ny-dy, o'.x=nx-dx, o'.y=n.y+dy.

[0056] In a preferred embodiment of the present invention, the second transformation relationship is a homography matrix used to represent the transformation relationship between the first rectangular region and the second rectangular region.

[0057] Specifically, a homography matrix is ​​a 3×3 matrix that handles the projection transformation relationship between two planes, enabling the mapping of coordinates between the two planes. A homography matrix includes nine parameters. Due to the scale invariance of homogeneous coordinates, one parameter can be reduced by normalization, resulting in a homography matrix consisting of only eight parameters.

[0058] Furthermore, the operations on homography matrices satisfy the principle of non-loss of generality.

[0059] In this invention, the eight parameters of the homography matrix are the coordinates of the four first vertices and the coordinates of the four second vertices. As long as the four coordinates of the first vertices are not on the same straight line and the coordinates of the second vertices correspond one-to-one with the coordinates of the first vertices, the corresponding homography matrix can be automatically calculated by inputting the eight parameters into the getPerspectiveTransform function in the OpenCV open source library.

[0060] In a preferred embodiment of the present invention, such as Figure 6 As shown, step S4 includes: Step S41: Traverse and obtain the standard endpoint coordinates; Step S42: Increase the order of the standard endpoint coordinates to obtain the standard endpoint matrix; Step S43: Multiply the standard endpoint matrix with the homography matrix to obtain the real-time endpoint matrix corresponding to the real-time endpoint coordinates, and obtain the real-time endpoint coordinates based on the real-time endpoint matrix.

[0061] Specifically, the standard endpoint matrix is ​​calculated using the following formula:

[0062] in, A' is the real-time endpoint matrix; A is the standard endpoint matrix; H is the homography matrix; The x-coordinate of the real-time endpoint; The ordinate of the real-time endpoint; w is the homogeneous coordinate scaling factor (set to 1 in actual use). The x-coordinate of the standard endpoint; The ordinate of the standard endpoint; h in the homography matrix 11 The nine parameters are reduced to eight through normalization, consisting of four first vertex coordinates and four second vertex coordinates.

[0063] Specifically, since the homography matrix H is a third-order matrix, in order to calculate the real-time endpoint coordinates, the second-order standard endpoint coordinates need to be increased in order to form a 3×1 column matrix as the standard endpoint matrix, which satisfies the multiplication requirements with the 3×3 homography matrix. The pntPic array is traversed and converted into the form of matrix A as described above according to the saved order. This matrix is ​​then multiplied by the homography matrix, resulting in a 3×1 column matrix as the real-time endpoint matrix. The data from the first row is extracted as the x-coordinates of the real-time endpoint coordinates, and the data from the second row is extracted as the y-coordinates, forming the corresponding real-time endpoint coordinates. These coordinates are then stored in the pntRet array in the order corresponding to the standard endpoint coordinates saved in the pntPic array.

[0064] Furthermore, if you want to calculate the standard endpoint coordinates based on the real-time endpoint coordinates, you only need to calculate and use the transpose of the homography matrix H, and then perform matrix multiplication.

[0065] In a preferred embodiment of the present invention, the connection order relationship between the coordinates of each standard endpoint in the standard vector graphic is pre-recorded; In step S5, the real-time endpoint coordinates are connected sequentially according to the connection order to draw real-time vector graphics.

[0066] Specifically, the points corresponding to the real-time endpoint coordinates are sequentially marked on the second operating plane from the pntRet array. Based on the connection order of the standard endpoint coordinates, the letters of the real-time endpoint coordinates and standard endpoint coordinates are mapped one-to-one, and the coordinates of the corresponding letters are connected to draw the real-time vector graphics. For example, ... Figure 2As shown, the standard endpoint coordinate d is only associated with b. Therefore, in the second operating plane, d', which is associated with d, and b', which is associated with b, will be (in...) Figure 3 (If b' coincides with b) Associate and draw a black solid line, draw black solid lines in sequence to obtain real-time vector graphics.

[0067] This invention provides a rapid drawing system for vector graphics on a video. A first rectangular area and a standard vector graphic are preset on the first operation plane of the screen. The system records the coordinates of the first vertex of the first rectangular area and the coordinates of the standard endpoints of the standard vector graphic, as well as the first transformation relationship between the coordinates of the first input point and the first vertex in the first rectangular area. like Figure 7 As shown, the rapid drawing system includes: Storage module 1 is used to store the coordinates of the first vertex, the coordinates of the standard endpoints, and the first transformation relationship; Receiver module 2 is used to acquire the second input point entered by the user on the second operating plane; The first acquisition module 3, connected to the storage module 1 and the receiving module 2, is used to acquire the coordinates of the second vertex of the second rectangular region on the second operation plane based on the first transformation relationship and the second input point. The second acquisition module 4, connected to the storage module 1 and the first acquisition module 3, is used to acquire the second transformation relationship between the first rectangular region and the second rectangular region based on the first vertex coordinates and the second vertex coordinates; The third acquisition module 5 is connected to the storage module 1 and the second acquisition module 4. Based on the second transformation relationship, it acquires the real-time endpoint coordinates of the real-time vector graphics on the second operation plane according to the standard endpoint coordinates of the standard vector graphics. The drawing module 6 is connected to the third acquisition module 5. It draws real-time vector graphics based on real-time endpoint coordinates and outputs the real-time vector graphics and real-time video content generated in the live video scene. The first operating plane, the second operating plane, and the display plane for real-time video content are all the same size.

[0068] In a preferred embodiment of the present invention, the second input point includes second starting point coordinates corresponding to the first starting point coordinates, and second ending point coordinates corresponding to the first ending point coordinates, such as... Figure 8 As shown, the first acquisition module includes: The first calculation unit 31 is used to calculate the length of the first line segment between the coordinates of the second starting point and the coordinates of the second ending point. The second calculation unit 32 is connected to the first calculation unit 31 and is used to calculate the second line segment length between the second vertex coordinates and the second input point based on the first line segment length and the first transformation relationship. The third calculation unit 33 is connected to the second calculation unit 32 and is used to calculate the coordinates of the second vertex based on the length of the second line segment, according to the coordinates of the second starting point and the second ending point.

[0069] In a preferred embodiment of the present invention, the second transformation relationship is a homography matrix representing the transformation relationship between the first rectangular region and the second rectangular region. The second acquisition module 4 constructs the homography matrix using the coordinates of the first vertex and the coordinates of the second vertex as parameters, such as... Figure 9 As shown, the third acquisition module 5 includes: Traversal unit 51 is used to traverse and obtain the standard endpoint coordinates; The order-increasing unit 52 and the connection traversal unit 51 are used to increase the order of the standard endpoint coordinates to obtain the standard endpoint matrix. The matrix calculation unit 53 is connected to the order-increasing unit 52. It is used to multiply the standard endpoint matrix with the homography matrix to obtain the real-time endpoint matrix corresponding to the real-time endpoint coordinates, and to obtain the real-time endpoint coordinates based on the real-time endpoint matrix.

[0070] In a preferred embodiment of the present invention, the storage module 1 further records the connection order relationship between the coordinates of each standard endpoint in the standard vector graphic in advance, and the drawing module 6 connects the real-time endpoint coordinates in sequence according to the connection order relationship to draw the real-time vector graphic.

[0071] Those skilled in the art should know that the above arbitrary coordinates and connection order relationships can be stored in a program, and the coordinates can be calculated to implement all or part of the steps in the above method embodiments. The program is stored in a computer-readable storage medium, such as ROM / RAM, optical disk, hard disk, etc.

[0072] The above description is merely a preferred embodiment of the present invention and does not limit the implementation and protection scope of the present invention. Those skilled in the art should realize that any equivalent substitutions and obvious changes made based on the description and illustrations of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for rapidly drawing vector graphics on video, applied to live video streaming scenarios, characterized in that, A first rectangular region and a standard vector graphic are preset in the first operation plane. The coordinates of the first vertex of the first rectangular region and the coordinates of the standard endpoints of the standard vector graphic are recorded, as well as the first transformation relationship between the first input point and the first vertex coordinates in the first rectangular region are recorded. The rapid drawing method includes: Step S1: Obtain the second input point entered by the user on the second operation plane; Step S2: Based on the first transformation relationship, obtain the coordinates of the second vertex of the second rectangular region on the second operation plane according to the second input point; Step S3: Obtain the second transformation relationship between the first rectangular region and the second rectangular region based on the coordinates of the first vertex and the coordinates of the second vertex; Step S4: Based on the second transformation relationship, obtain the real-time endpoint coordinates of the real-time vector graphics on the second operation plane according to the standard endpoint coordinates of the standard vector graphics; Step S5: Draw the real-time vector graphic based on the real-time endpoint coordinates, and output the real-time vector graphic and the real-time video content generated in the live video scene. The first operating plane, the second operating plane, and the display plane of the real-time video content are all the same size.

2. The rapid drawing method according to claim 1, characterized in that, The first input point includes the coordinates of the first starting point and the coordinates of the first ending point; The first transformation relationship is used to represent the proportional relationship between line segments between the coordinates of the first starting point and the coordinates of the plurality of first vertices, and the proportional relationship between line segments between the coordinates of the first ending point and the coordinates of the plurality of first vertices.

3. The rapid drawing method according to claim 2, characterized in that, The second input point includes the coordinates of a second starting point corresponding to the coordinates of the first starting point, and the coordinates of a second ending point corresponding to the coordinates of the first ending point; Step S2 includes: Step S21: Calculate the length of the first line segment between the coordinates of the second starting point and the coordinates of the second ending point; Step S22: Calculate the length of the second line segment between each second vertex coordinate and the second input point based on the first line segment length and the first transformation relationship; Step S23: Based on the length of the second line segment, calculate the coordinates of each of the second vertices according to the coordinates of the second starting point and the coordinates of the second ending point.

4. The rapid drawing method according to claim 1, characterized in that, The second transformation relationship is a homography matrix used to represent the transformation relationship between the first rectangular region and the second rectangular region.

5. The rapid drawing method according to claim 4, characterized in that, Step S4 includes: Step S41: Traverse and obtain the coordinates of the standard endpoints; Step S42: Increase the order of the standard endpoint coordinates to obtain the standard endpoint matrix; Step S43: Multiply the standard endpoint matrix with the homography matrix to obtain the real-time endpoint matrix corresponding to the real-time endpoint coordinates, and obtain the real-time endpoint coordinates based on the real-time endpoint matrix.

6. The rapid drawing method according to claim 1, characterized in that, The connection order relationship between the coordinates of each standard endpoint in the standard vector graphic is recorded in advance; In step S5, the real-time endpoint coordinates are connected sequentially according to the connection order to draw the real-time vector graphic.

7. A rapid drawing system for vector graphics on video, applied to live video streaming scenarios, employing the rapid drawing method as described in any one of claims 1-6, characterized in that... A first rectangular region and a standard vector graphic are preset in the first operation plane. The coordinates of the first vertex of the first rectangular region and the coordinates of the standard endpoints of the standard vector graphic are recorded, as well as the first transformation relationship between the first input point and the first vertex coordinates in the first rectangular region are recorded. The rapid rendering system includes: A storage module is used to store the coordinates of the first vertex, the coordinates of the standard endpoints, and the first transformation relationship; The receiving module is used to acquire the second input point entered by the user on the second operating plane; The first acquisition module, connected to the storage module and the receiving module, is used to acquire the coordinates of the second vertex of the second rectangular region on the second operation plane based on the first conversion relationship and the second input point. The second acquisition module, connected to the storage module and the first acquisition module, is used to acquire a second transformation relationship between the first rectangular region and the second rectangular region based on the first vertex coordinates and the second vertex coordinates; The third acquisition module, connected to the storage module and the second acquisition module, is used to acquire the real-time endpoint coordinates of the real-time vector graphics on the second operation plane based on the second conversion relationship and the standard endpoint coordinates of the standard vector graphics. The drawing module is connected to the third acquisition module, which draws the real-time vector graphics based on the real-time endpoint coordinates, and outputs the real-time vector graphics and the real-time video content generated in the live video scene. The first operating plane, the second operating plane, and the display plane of the real-time video content are all the same size.

8. The rapid drawing system according to claim 7, characterized in that, The second input point includes the coordinates of a second starting point corresponding to the coordinates of the first starting point, and the coordinates of a second ending point corresponding to the coordinates of the first ending point. The first acquisition module includes: The first calculation unit is used to calculate the length of the first line segment between the coordinates of the second starting point and the coordinates of the second ending point; The second calculation unit, connected to the first calculation unit, is used to calculate the length of the second line segment between each of the coordinates of the second vertex and the second input point based on the first line segment length and the first transformation relationship. The third calculation unit, connected to the second calculation unit, is used to calculate the coordinates of each of the second vertices based on the length of the second line segment, according to the coordinates of the second starting point and the coordinates of the second ending point.

9. The rapid drawing system according to claim 7, characterized in that, The second transformation relationship is a homography matrix used to represent the transformation relationship between the first rectangular region and the second rectangular region, and the third acquisition module includes: A traversal unit is used to traverse and obtain the coordinates of the standard endpoints; An order-increasing unit, connected to the traversal unit, is used to increase the order of the standard endpoint coordinates to obtain a standard endpoint matrix; The matrix calculation unit, connected to the order-increasing unit, is used to multiply the standard endpoint matrix with the homography matrix to obtain the real-time endpoint matrix corresponding to the real-time endpoint coordinates, and to obtain the real-time endpoint coordinates based on the real-time endpoint matrix.

10. The rapid drawing system according to claim 7, characterized in that, The storage module also pre-records the connection order relationship between the coordinates of each standard endpoint in the standard vector graphic, and the drawing module connects the real-time endpoint coordinates sequentially according to the connection order relationship to draw the real-time vector graphic.