A method and system for video window background rendering
By dividing the canvas into free areas to draw the background during video conference recording, the problem of CPU performance waste caused by rectangular window coverage is solved, achieving effective utilization of CPU resources and simplifying the efficiency of image generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 上海赛连信息科技有限公司
- Filing Date
- 2024-05-08
- Publication Date
- 2026-07-21
AI Technical Summary
During video conference recording, when generating a frame, the rectangular window covering the background area causes unnecessary background drawing operations to consume CPU resources, resulting in performance waste.
By dividing the canvas into free areas not occupied by rectangular windows and drawing the background in these areas, unnecessary background drawing is avoided.
It reduces CPU performance consumption, simplifies the image generation process, and lowers code complexity and potential error risks.
Smart Images

Figure CN118413704B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer video conferencing, and more specifically, to a method and system for drawing the background of a video window. Background Technology
[0002] During video conference recording, generating a single frame typically involves several steps: first, creating a blank canvas; then, drawing the background image on the entire blank canvas; next, drawing a rectangular window to display the video image based on the layout information; and finally, overlaying various elements such as the terminal name and a watermark. In this process, the background drawn in the first step is often covered by the actual image of the rectangular window, causing the previous background drawing operations to consume CPU resources. This means that some CPU resources are wasted. Summary of the Invention
[0003] This invention proposes a method for drawing the background of a video window to avoid drawing useless backgrounds, thereby reducing CPU performance consumption.
[0004] In a first aspect, the present invention provides a method for drawing the background of a video window, comprising: Set the layout of the rectangular window on the canvas to display the video feed; Divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The background content corresponding to the rectangular free area is drawn on the rectangular free area.
[0005] In a second aspect, the present invention provides a system for drawing the background of a video window, comprising: The acquisition module is used to obtain the coordinates of the diagonal endpoints of the canvas and the coordinates of the diagonal endpoints of the rectangular window on the canvas used to display the video image. The partitioning module is used to divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The drawing module is used to draw the image content corresponding to the rectangular free area on the background image.
[0006] The beneficial technical effects of this invention are as follows: 1. Reduced unnecessary background drawing: By drawing the background only in areas not covered by the window, unnecessary drawing operations are eliminated, reducing CPU performance consumption. 2. Simplified screen generation process: By pre-defining the layout and clarifying which areas need background drawing, the logic of screen generation is simplified. This simplification may help reduce code complexity and potential error risks. Attached Figure Description
[0007] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0008] Figure 1 A flowchart illustrating a method for drawing a video window background provided in an embodiment of the present invention; Figure 2 This is a flowchart of a method for determining the coordinates of the diagonal endpoints of a rectangular free area according to Embodiment 1 of the present invention. Figure 3-4 This is a schematic diagram illustrating the effect of dividing a rectangular free area according to Embodiment 1 of the present invention; Figure 5 This is a flowchart of the method for determining the coordinates of the diagonal endpoints of a rectangular free area according to Embodiment 2 of the present invention; Figure 6-7 This is a schematic diagram illustrating the effect of dividing a rectangular free area according to Embodiment 2 of the present invention; Figure 8-9 A schematic diagram of the system for drawing the video window background provided by the present invention. Detailed Implementation
[0009] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Invention Overview This invention divides the unoccupied area of the canvas into multiple rectangular free areas, and then draws the background image on these areas. Regarding the division of the rectangular free areas, this invention covers two methods. One method involves progressively determining the endpoint coordinates of the final rectangular free area and optimizing space utilization by merging adjacent areas. The other method involves first dividing the entire canvas area into the smallest rectangular units, then excluding the smallest rectangular units occupied by the rectangular window; the remaining smallest rectangular units are the rectangular free areas. These smallest rectangular units are then merged all at once to form the final rectangular free areas.
[0011] Drawing the background image on a defined rectangular free area avoids the CPU drawing useless backgrounds and reduces CPU resource waste.
[0012] Exemplary methods Figure 1 This is a flowchart illustrating a method for drawing the background of a video window as provided in this embodiment.
[0013] Step S101: Set the layout of the rectangular window on the canvas to display the video image.
[0014] Step S102: Divide the free area on the canvas not occupied by the rectangular window into multiple rectangular free areas. The specific process for dividing the rectangular free areas is as follows: Figure 2 As shown: Step S201: Obtain the coordinates of the diagonal endpoints of the rectangular window and the diagonal endpoints of the canvas.
[0015] After determining the specific position of the rectangular window on the canvas, it is necessary to obtain the coordinates of its diagonal endpoints. These two diagonal endpoints can be the top-left and bottom-right corners, or the top-right and bottom-left corners. Simultaneously, it is also necessary to obtain the coordinates of the diagonal endpoints of the entire canvas. The purpose of obtaining the diagonal endpoint coordinates in this invention is to obtain the two parallel lines in the x-direction and two parallel lines in the y-direction that constitute a rectangle. The closed space formed by these four parallel lines constitutes a rectangle. Since the diagonal endpoint coordinates of a rectangle include the coordinates of the intersections of these four parallel lines with the x-axis and y-axis, a rectangle can be determined using the diagonal endpoint coordinates.
[0016] Step S202: Count the y-values in the coordinates of all diagonal endpoints, and sort all y-values by size to form a series of y-values.
[0017] Collect all the y-values at the diagonal endpoints of the canvas and rectangular window, and sort them by size to form an ordered series of y-values. For example... Figure 3 As shown, sorting all y-values of the canvas and rectangular windows A, B, C, and D by size yields the following series of y-values:
[0018] Step S203: Determine the coordinates of the diagonal endpoints of the rectangular free area between adjacent y-values based on the coordinates of adjacent y-values and their diagonal endpoints in the y-value series.
[0019] Based on the series of y-values, two adjacent y-values are sequentially selected to form a bar-shaped area on the canvas. The bar-shaped area is the region enclosed by the extension lines of two adjacent y-values and the boundary of the canvas.
[0020] like Figure 3 As shown, in the series of y-values y1, y2, y3, y4, y5, y6, y7, two adjacent y-values are sequentially selected to form a bar region. For example... Figure 3In the diagram, rectangular free area 1 is a strip region formed by y1-y2; rectangular free areas 2 and 3 are part of the strip region formed by y2-y3; rectangular free areas 4, 5, and 6 are part of the strip region formed by y3-y4; rectangular free areas 7 and 8 are part of the strip region formed by y4-y5; rectangular free areas 9 and 10 are part of the strip region formed by y5-y6; and rectangular free area 11 is the strip region formed by y6-y7.
[0021] The relative position of each rectangular window to each strip region is determined based on the coordinates of the diagonal endpoints.
[0022] Specifically, it is determined whether the coordinate interval formed by two adjacent y-values corresponding to the bar region is entirely within the coordinate interval formed by two y-coordinate values at the diagonal endpoints of the rectangular window. If they are entirely within this interval, the relative position of the rectangular window and the bar region meets the first condition. In other words, it is determined whether the bar region completely passes through the rectangular window.
[0023] like Figure 3 As shown, the coordinate interval [y4, y5] is entirely within the coordinate interval [y2, y5] corresponding to rectangular window B, but not entirely within the coordinate interval [y3, y4] corresponding to rectangular window D. This indicates that the strip region formed by y4-y5 completely passes through rectangular window B, and its relative position meets the first condition. It also indicates that the relative position between the strip region formed by y4-y5 and rectangular window D does not meet the first condition.
[0024] Calculate the x-coordinates of the diagonal endpoints of all rectangular windows whose relative positions meet the first condition, and generate a series of x-values that correspond one-to-one with the bar region. Add the x-coordinates of the canvas's diagonal endpoints to this series of x-values, and sort the coordinates in the series by size. Then, delete any duplicate coordinate values in the series.
[0025] like Figure 3 As shown: For the strip region formed by y1-y2, there is no rectangular window that meets the first condition. The corresponding x-value series only contains the x-coordinate values x1 and x7 of the opposite corners of the canvas. After sorting them by size, the final x-value series is as follows:
[0026] For the bar region formed by y2-y3, there are rectangular windows A and B that meet the first condition. Therefore, the corresponding x-value series at this time contains the data x1, x1, x3, x5, x6, and x7. Since the x-value series contains two identical x1 values, deleting x1 from the x-value series yields the final x-value series as follows:
[0027] For the strip region formed by y3-y4, rectangular windows D and B satisfy the first condition, and the corresponding series of x values are:
[0028] For the strip region formed by y4-y5, the rectangular window that meets the first condition is rectangular window B, and the corresponding series of x values is as follows:
[0029] For the strip region formed by y5-y6, there is a rectangular window C that meets the first condition, and the corresponding series of x values are:
[0030] For the strip region formed by y6-y7, there is no rectangular window that meets the first condition, and the corresponding series of x values are as follows:
[0031] Extract the coordinates of the odd-numbered positions in the x-value series and the coordinates of the adjacent even-numbered positions. These coordinates, along with the coordinates of the adjacent y-values corresponding to the strip region, form the coordinates of the diagonal endpoints of the rectangular free area.
[0032] by Figure 3 Taking the series of x-values corresponding to the bar region formed by y2-y3 as an example: take x3, x5 and y2, y3 in sequence to form... Figure 3 The coordinates of the diagonal endpoints of the free area 2 of the rectangle; taking x6, x7 and y2, y3 to form... Figure 3 The coordinates of the diagonal endpoints of the free rectangular area 2 are determined. Following the same method, the coordinates of the diagonal endpoints of the free rectangular areas of the other strip areas are determined, ultimately yielding the coordinates of the diagonal endpoints of all free rectangular areas on the canvas, such as... Figure 3 The coordinates of the diagonal endpoints of the shaded area enclosed by the thick black frame.
[0033] The x and y values of the diagonal endpoints of the rectangular free area can be arbitrarily combined to form the coordinates of the two diagonal endpoints. Figure 3 Taking the rectangular free area 2 as an example: the coordinates of its diagonal endpoints can be (x3, y2) and (x5, y3), or (x3, y3) and (x5, y2). Any combination of diagonal endpoint coordinates can define the corresponding rectangular free area on the canvas.
[0034] Step S204: Find at least two sets of diagonal endpoint coordinates with the same x value in the diagonal endpoint coordinates of the rectangular free area, and determine whether their y coordinate values are adjacent in the y value series. If they are adjacent, merge the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates to generate a new rectangular free area.
[0035] You can find several rectangular free areas that meet the merging criteria and merge them while determining the coordinates of the diagonal endpoints of the rectangular free areas. Alternatively, you can start searching for rectangular free areas that can be merged after determining the coordinates of the diagonal endpoints of all the rectangular free areas on the canvas.
[0036] Specifically, if the x-values of the diagonal endpoints of at least two groups of rectangular free areas are the same, it indicates that the lengths of the at least two groups of rectangular free areas are the same. If the y-coordinate values of the at least two groups of rectangular free areas are adjacent in the y-value series, it indicates that the at least two groups of rectangular free areas are vertically adjacent on the canvas. At least two groups of rectangular free areas of the same length that are vertically adjacent on the canvas can be merged into a larger rectangular free area. This is achieved by taking the maximum and minimum y-coordinate values from several y-coordinate values of the at least two groups of rectangular free areas of the same length that are vertically adjacent on the canvas, and combining these maximum and minimum y-coordinate values with the same x-coordinate value to form the diagonal endpoint coordinates of the merged rectangular free area.
[0037] like Figure 3 As shown, the x-coordinates of rectangular free areas 2 and 5 are both x3 and x5, and their y-coordinates y2, y3, and y4 are adjacent in the y-series. Therefore, rectangular free areas 2 and 5 have the same length and are adjacent vertically, and can be merged into a new rectangular free area. After merging, we get... Figure 4 The empty areas of the medium rectangle are 2-5. Similarly, Figure 3 The rectangular empty regions 3, 6, and 8 in the image are merged to obtain the result. Figure 4 The free area of the middle rectangle is 3-6-8.
[0038] The specific integration process is as follows Figure 3 Taking rectangular empty regions 2 and 5 as examples: the corresponding y-coordinate values of the two rectangular empty regions are y2, y3, and y4, with the smallest y-coordinate being y2 and the largest being y4. The x-coordinate values of both rectangular empty regions are x3 and x5. Therefore, we can obtain... Figure 4 The coordinates of the opposite corners of the free area 2-5 in the middle rectangle are (x3, y2) and (x5, y4), or (x3, y4) and (x5, y2).
[0039] Step S205: Collect the coordinates of the diagonal endpoints of the rectangular free areas obtained through fusion and the rectangular free areas that did not participate in fusion, and use them for drawing the background image.
[0040] Step S103: Draw the image content corresponding to the rectangular free area on the background image onto the rectangular free area. For example... Figure 4 As shown, based on the coordinates of the diagonal endpoints of the rectangular free areas 1, 2-5, 3-6-8, 4, 7, 9, 10, and 11, the content of the corresponding rectangular free area is determined in the background image and drawn on the corresponding rectangular free area.
[0041] This embodiment obtains a series of y-values by sorting the y-coordinates of the canvas and the rectangular window. Two adjacent y-values are taken as a bar region, and rectangular empty regions are divided within each bar region according to the coordinates of the canvas and the rectangular window. During the division process, if at least two sets of rectangular empty regions of the same length and adjacent to each other are found, they are merged to obtain the final rectangular empty region.
[0042] Alternatively, this embodiment can also obtain a series of x-values by sorting the x-coordinate values of the canvas and the rectangular window. Two adjacent x-values are taken as a bar region, and rectangular empty regions are divided within each bar region according to the coordinates of the canvas and the rectangular window. During the division process, if at least two sets of rectangular empty regions with the same height and adjacent left and right sides are found, they are merged to obtain the final rectangular empty region.
[0043] Example 2 This invention also provides another method for determining the background of a video window, the steps of which are as follows: Figure 1 As shown.
[0044] Step S101: Set the layout of the rectangular window on the canvas to display the video image.
[0045] Step S102: Divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas.
[0046] Step S103: Draw the image content corresponding to the rectangular free area on the background image.
[0047] The difference from Embodiment 1 is that step S102 specifically includes, as follows: Figure 5 The steps shown are as follows: S501: Sort the x-values of the diagonal endpoints of all the rectangular windows and canvases in order of size, and generate an x-coordinate table.
[0048] like Figure 6 or Figure 7As shown, the x-coordinate values of the canvas and the four rectangular windows (non-shaded areas) shown in the image are obtained sequentially, namely x1, x2, x3, x4, x5, x6, and x7. The seven obtained x-coordinate values are then sorted by size to generate an x-coordinate table.
[0049] S502: Sort the y-values of the diagonal endpoints of all the rectangular windows and canvases in order of size, and generate a y-coordinate table.
[0050] like Figure 6 or Figure 7 As shown, the y-coordinate values of the canvas and the four rectangular windows (non-shaded areas) shown in the image are obtained sequentially, namely y1, y2, y3, y4, y5, y6, and y7. The seven obtained y-coordinate values are then sorted by size to generate a y-coordinate table.
[0051] S503: Based on the x-coordinate table and the y-coordinate table, determine the coordinates of the diagonal endpoints of all rectangular regions divided by the extensions of these x-coordinates and y-coordinates in the y and x directions, respectively.
[0052] like Figure 6 or Figure 7 As shown, the extensions of y1, y2, y3, y4, y5, y6, and y7 in the x-direction and the extensions of x1, x2, x3, x4, x5, x6, and x7 in the y-direction together form the rectangular areas numbered 1-36 on the canvas.
[0053] The diagonal coordinates of each rectangular region are taken from the two adjacent x values and the two adjacent y values as the diagonal endpoint coordinates of the corresponding rectangular window. That is, any two lines parallel to the y-axis passing through adjacent x values in the x-system list and any two lines parallel to the x-axis passing through adjacent y values in the y-system list constitute the smallest rectangular unit in the canvas.
[0054] For example, such as Figure 6 or Figure 7 As shown, x1 and x2 are adjacent in the x-coordinate table, and y3 and y4 are adjacent in the y-coordinate table. These two sets of coordinate values together form the coordinates of the diagonal endpoints of rectangular region 13. Similarly, any two adjacent x-values in the x-coordinate table combined with any two adjacent y-values in the y-coordinate table together form... Figure 6 and Figure 7 The coordinates of the diagonal endpoints of the rectangular regions numbered 1-36 in the table.
[0055] S504: The rectangular area remaining after excluding the rectangular window in all rectangular areas is the rectangular free area.
[0056] Because all the rectangular regions obtained in step S503 include not only the rectangular free areas but also the area occupied by the rectangular window on the canvas, it is necessary to exclude the area occupied by the rectangular window from all the rectangular regions. The remaining rectangular regions are the rectangular free areas used to draw the background image. Specifically, this can be determined by checking whether the coordinates of the diagonal endpoints of the rectangular region are within the range of the coordinates of the diagonal endpoints of the rectangular window, thus determining whether the corresponding rectangular region is occupied by the rectangular window and excluding it.
[0057] like Figure 6 or Figure 7 As shown in the figure, the corresponding x-coordinate ranges and y-coordinate ranges of the four rectangular windows (non-shaded areas) are [x2,x3]-[y2,y3], [x2,x3]-[y3,y4], [x3,x4]-[y5-y6], and [x5,x6]-[y2,y5], respectively. Examining the 36 rectangular regions in the figure, we find that rectangular region 8 is within the coordinate range of [x2,x3]-[y2,y3], rectangular region 14 is within the coordinate range of [x2,x3]-[y3,y4], rectangular region 27 is within the coordinate range of [x3,x4]-[y5-y6], and rectangular regions 11, 17, and 23 are within the coordinate range of [x5,x6]-[y2,y5]. Therefore, these rectangular regions are occupied by the rectangular windows. Excluding them, the remaining rectangular regions (shaded areas in the figure) are the free rectangular areas used to draw the background image.
[0058] Through observation Figure 6 and Figure 7 It can be observed that the rectangular free areas can be merged to obtain fewer rectangular free areas, thus reducing the number of diagonal endpoint coordinates of the cached rectangular free areas.
[0059] The specific fusion method can be to first perform horizontal fusion along the x-direction and then vertical fusion along the y-direction to obtain the final effect, such as... Figure 6 The area enclosed by the thick black frame. Alternatively, you can merge the elements vertically first and then horizontally to achieve the desired result. Figure 7 The area enclosed by the thick black frame. Each rectangular area enclosed by the thick black frame is merged into a new rectangular free area.
[0060] Specifically, rectangles with the same diagonal x or y values for all available rectangular areas are listed, and then the y or x values of the same azimuth angle of the listed rectangles are sorted by size. It is then determined whether the sorted y or x values are adjacent and consecutive values in the y-coordinate table or x-coordinate table. If the sorted y or x values for the same azimuth angle are adjacent and consecutive values in the y-coordinate table or x-coordinate table, the available rectangular areas corresponding to the same azimuth angle with adjacent consecutive y or x values are merged.
[0061] For example, such as Figure 6 As shown, Figure 6 The merging process involves first merging horizontally (x-direction) and then vertically (y-direction). Therefore, first, several rectangular free areas with the same diagonal endpoint y-value and consecutive x-values in the x-coordinate table are merged horizontally. Then, several rectangular free areas with the same diagonal endpoint x-value and consecutive y-values in the y-coordinate table after horizontal merging are merged vertically to obtain the final result. Figure 6 The area enclosed by the thick black frame is the final rectangular free area.
[0062] Figure 6 The y-values of the empty rectangular regions 1-6 are the same. Sort their x-values by their top-left corners to get the order x1, x2, x3, x4, x5, x6, and sort them by their bottom-right corners to get the order x2, x3, x4, x5, x6, x7. Comparison shows that the order of the x-values in any direction matches the order in the x-coordinate table, indicating that the empty rectangular regions 1-6 are adjacent and can be merged to obtain a larger empty rectangular region. Therefore, they are merged horizontally to obtain a rectangular empty region with diagonal endpoints at coordinates (x1, y1) - (x7, y2). The horizontal merging of the other empty rectangular regions follows the same principle.
[0063] After horizontally merging all the rectangular free areas in the canvas, then vertically merge them.
[0064] For example, Figure 6 The rectangular free area with diagonal endpoints (x3, y2) - (x5, y3) is obtained by horizontally merging rectangular areas 9 and 10. Similarly, the rectangular free area with diagonal endpoints (x3, y3) - (x5, y4) is obtained by horizontally merging rectangular areas 15 and 16. These two rectangular free areas have the same x-coordinate value, and their y-coordinate values in the same direction, after sorting, are found to be consistent with the order in the y-coordinate table. Therefore, they are vertically merged to obtain the rectangular free area with diagonal endpoints (x3, y2) - (x5, y4).
[0065] Figure 7 The principle of vertical fusion followed by horizontal fusion is shown. Figure 6The fusion principle is similar. First, several rectangular free areas with the same x-value at all diagonal endpoints and consecutive y-values in the y-coordinate table are merged horizontally. Then, several rectangular free areas with the same y-value at all diagonal endpoints and consecutive x-values in the x-coordinate table after vertical fusion are merged horizontally to obtain the final result. Figure 7 The area enclosed by the thick black frame is the final rectangular free area.
[0066] This embodiment generates two coordinate tables by statistically analyzing the x and y coordinate values of rectangular windows on the canvas and sorting them. Adjacent data in these tables are then used to form rectangular regions. The rectangular windows are then excluded. Next, by examining the x or y coordinates of the empty rectangular regions, adjacent empty rectangular regions with the same boundary are merged to ultimately form valid empty rectangular regions.
[0067] The main difference between Example 1 and Example 2 lies in the method and order of steps for processing the free area. Example 1 determines the endpoint coordinates of each final rectangular free area step-by-step during the division process. That is, the final area shape and boundaries are considered at each division, and adjacent areas are continuously adjusted and merged during the division process to gradually generate the final rectangular free area. Example 2 first divides the entire free area on the canvas into the smallest rectangular units. Then, by excluding the smallest rectangular units occupied by the rectangular window, the remaining rectangular areas are the rectangular free areas. These are then merged all at once to ultimately form a larger rectangular free area.
[0068] In Example 1, the rectangular window area was excluded during the process of determining the rectangular free area. The position and shape of the rectangular window area were considered during the division, directly resulting in the final rectangular free area. In Example 2, however, the entire free area was determined first, and then the window area was excluded. This method excludes unnecessary parts after division, and then merges or adjusts them to obtain the final rectangular free area. Therefore, Example 1's division method avoids the window area from the beginning, while Example 2 performs the exclusion process after division.
[0069] Exemplary device Accordingly, embodiments of the present invention also provide a system for drawing the background of a video window, such as... Figure 8 As shown, it includes the acquisition module 8-1, the division module 8-2, and the drawing module 8-3.
[0070] Module 8-1 is used to obtain the coordinates of the diagonal endpoints of the canvas and the coordinates of the diagonal endpoints of the rectangular window on the canvas used to display the video image. The partitioning module 8-2 is used to divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The drawing module 8-3 is used to draw the image content on the background image that corresponds to the rectangular free area on the rectangular free area.
[0071] The segmentation module 8-2 further includes a statistics unit 8-21, an endpoint determination unit 8-22, a fusion unit 8-23, and a collection unit 8-24. Statistical unit 8-21 is used to count the y-values in the coordinates of all diagonal endpoints and sort all y-values to form a series of y-values.
[0072] Endpoint determination unit 8-22 is used to determine the coordinates of the diagonal endpoints of the rectangular free area between adjacent y values based on the coordinates of adjacent y values and diagonal endpoints in the y-value series.
[0073] Endpoint determination unit 8-22, based on a sorted series of y-values, sequentially selects two adjacent y-values to form a bar-shaped region on the canvas. It determines the relative position of each rectangular window to each bar-shaped region based on the coordinates of the diagonal endpoints. It counts the x-coordinates of the diagonal endpoints of all rectangular windows whose relative positions meet a first condition, and generates a series of x-values corresponding one-to-one with each bar-shaped region. The first condition is: the coordinate interval formed by two adjacent y-values corresponding to the bar-shaped region is entirely within the coordinate interval formed by two y-coordinate values of the diagonal endpoints of the rectangular windows. The x-coordinates of the canvas's diagonal endpoints are also placed in the x-value series, and the coordinate values in the x-value series are sorted by size. Identical coordinate values in the x-value series are deleted.
[0074] Endpoint determination unit 8-22 extracts the coordinates of the odd-numbered positions in the x-value series and the coordinates of the adjacent even-numbered positions, and respectively forms the coordinates of the diagonal endpoints of the rectangular free area with the coordinates of the adjacent y-values corresponding to the strip area.
[0075] The fusion unit 8-23 is used to find at least two sets of diagonal endpoint coordinates with the same x-value in the diagonal endpoint coordinates of the rectangular free area, and to determine whether their y-coordinate values are adjacent in the y-value series. If they are adjacent, the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates are merged to generate a new rectangular free area. The largest and smallest y-coordinate values are selected from several adjacent y-coordinate values in the y-value series; the largest and smallest y-coordinate values are combined with the same x-coordinate values to form the diagonal endpoint coordinates of the merged rectangular free area.
[0076] Collection unit 8-24 is used to collect the coordinates of the diagonal endpoints of the rectangular free areas obtained through fusion and the rectangular free areas that did not participate in fusion, and use them for drawing the background image.
[0077] This invention also provides another system for drawing video window backgrounds, such as... Figure 9 As shown, it includes the acquisition module 9-1, the division module 9-2, and the drawing module 9-3.
[0078] Module 9-1 is used to obtain the coordinates of the diagonal endpoints of the canvas and the coordinates of the diagonal endpoints of the rectangular window on the canvas used to display the video image.
[0079] The partitioning module 9-2 is used to divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas.
[0080] The drawing module 9-3 is used to draw the image content corresponding to the rectangular free area on the background image.
[0081] The partitioning module 9-2 also includes a sorting unit 9-21, a determining unit 9-22, an exclusion unit 9-23, and a fusion unit 9-24.
[0082] Sorting unit 9-21 is used to sort the x-values of the diagonal endpoint coordinates of all the rectangular windows and canvas in order of size to generate an x-coordinate table; and to sort the y-values of the diagonal endpoint coordinates of all the rectangular windows and canvas in order of size to generate a y-coordinate table.
[0083] Determining unit 9-22 is used to determine the coordinates of the diagonal endpoints of all rectangular regions divided by the extensions of these x and y coordinates in the y and x directions, respectively, based on the x-coordinate table and the y-coordinate table. Determining unit 9-22 takes any two adjacent x values and two adjacent y values from the x-coordinate table and the y-coordinate table as the diagonal coordinate values of the rectangular region.
[0084] Exclusion unit 9-23 is used to exclude the rectangular window from all rectangular areas, and the remaining rectangular area is the rectangular free area. Exclusion unit 9-23 excludes rectangular areas whose diagonal endpoint coordinates are within the range of the diagonal endpoint coordinates of the rectangular window.
[0085] The fusion unit 9-24 is used to list all rectangles with the same diagonal x or y values in their free areas, merge adjacent free areas, and update the diagonal coordinates of all free areas after fusion; or it is used to list all rectangles with the same diagonal y or x values in their free areas, merge adjacent free areas, and update the diagonal coordinates of all free areas after fusion.
[0086] The operation of merging adjacent rectangular free areas by the fusion unit 9-24 includes: listing all rectangles with the same diagonal x or y values; sorting the listed rectangles by the y or x values of the same azimuth angle; determining whether the sorted y or x values are adjacent and consecutive values in the y or x coordinate table; and merging the rectangular free areas corresponding to the same azimuth angle of adjacent and consecutive y or x values if the sorted y or x values are adjacent and consecutive values in the y or x coordinate table.
[0087] While the spirit and principles of the invention have been described with reference to several specific embodiments, it should be understood that the invention is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for ease of description. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
[0088] This invention provides: 1. A method for drawing the background of a video window, comprising: Set the layout of the rectangular window on the canvas to display the video feed; Divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The background content corresponding to the rectangular free area is drawn on the rectangular free area.
[0089] 2. According to the method described in item 1, the step of dividing the free area on the canvas not occupied by the rectangular window into multiple rectangular free areas further includes: Obtain the coordinates of the diagonal endpoints of the rectangular window and the diagonal endpoints of the canvas; Count the y-values at all diagonal endpoints and sort all y-values to form a series of y-values; Based on the coordinates of adjacent y-values and their diagonal endpoints in the y-value series, determine the coordinates of the diagonal endpoints of the rectangular free area between adjacent y-values; Find at least two sets of diagonal endpoint coordinates with the same x value in the diagonal endpoint coordinates of the rectangular free area, and determine whether their y coordinate values are adjacent in the y value series. If they are adjacent, merge the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates to generate a new rectangular free area. The coordinates of the diagonal endpoints of the rectangular free areas obtained through fusion and the rectangular free areas that were not fused are collected and used for drawing the background image.
[0090] 3. According to the method described in item 2, the step of determining the coordinates of the diagonal endpoints of the rectangular free area between adjacent y-values based on the coordinates of adjacent y-values and the diagonal endpoints in the y-value series further includes the following steps, including: Based on the sorted series of y values, two adjacent y values are taken in sequence to form a bar area on the canvas; The relative position of each rectangular window to each strip region is determined based on the coordinates of the diagonal endpoints. Calculate the x-coordinate values of the diagonal endpoints of all rectangular windows whose relative positions meet the first condition, and generate a series of x-values that correspond one-to-one with the strip region; The x-coordinate values of the diagonal endpoints of the canvas are also placed in the x-value series, and the coordinate values in the x-value series are sorted by size. Delete identical coordinate values from the series of x values; Extract the coordinates of the odd-numbered positions in the x-value series and the coordinates of the adjacent even-numbered positions. These coordinates, along with the coordinates of the adjacent y-values corresponding to the strip region, form the coordinates of the diagonal endpoints of the rectangular free area.
[0091] 4. According to the method described in item 3, the first condition specifically includes: The coordinate interval formed by two adjacent y values corresponding to the strip region is entirely located within the coordinate interval formed by the two y coordinate values of the diagonal endpoints of the rectangular window.
[0092] 5. According to the method described in item 2, the step of determining whether the y-coordinates of at least two sets of diagonal endpoint coordinates with the same x-values in the diagonal endpoint coordinates of the rectangular free area are adjacent in the y-value series, and merging the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates to generate a new rectangular free area, further includes the following steps: Among several adjacent y-coordinate values in the y-value series, select the largest and smallest y-coordinate values; The maximum and minimum y-coordinate values, along with the same x-coordinate values, constitute the coordinates of the diagonal endpoints of the merged rectangular free area.
[0093] 6. According to the method described in item 1, wherein: The step of dividing the free area on the canvas not occupied by the rectangular window into multiple rectangular free areas also includes the following steps: Sort the x-values of the diagonal endpoints of all the rectangular windows and canvases in ascending order to generate an x-coordinate table; Sort the y-values of the diagonal endpoints of all the rectangular windows and canvases in ascending order to generate a y-coordinate table; Based on the x-coordinate table and the y-coordinate table, determine the coordinates of the diagonal endpoints of all rectangular regions divided by the extensions of these x-coordinates and y-coordinates in the y and x directions, respectively; The rectangular area remaining after excluding the rectangular window from all the rectangular areas is the rectangular free area.
[0094] 7. According to the method described in item 6, wherein: Take any two adjacent x values and two adjacent y values from the x-coordinate table and y-coordinate table as the diagonal coordinate values of the rectangular region.
[0095] 8. According to the method described in item 6, all rectangular free areas with the same diagonal x or y value are listed, adjacent rectangular free areas are merged, and the diagonal coordinates of all merged rectangular free areas are updated.
[0096] 9. According to the method described in item 8, all rectangular free areas with the same diagonal y-coordinate or x-coordinate are listed, adjacent rectangular free areas are merged, and the diagonal coordinates of all merged rectangular free areas are updated.
[0097] 10. The method according to item 8 or 9, wherein the step of merging adjacent rectangular free areas further includes: List all rectangles with the same diagonal x or y coordinates in their free areas; Sort the rectangles by the y-values or x-values of the same azimuth angle. Determine whether the y-values or x-values are consecutive values in the y-coordinate table or x-coordinate table; If the y-values or x-values of the same azimuth angle are consecutive values in the y-coordinate table or x-coordinate table, then the rectangular free areas corresponding to the same azimuth angle of the consecutive y-values or x-values are merged.
[0098] 11. The method according to item 6, wherein the step of defining the rectangular region remaining after excluding the rectangular window from all rectangular regions as the rectangular free region further includes: Exclude the rectangular region whose diagonal endpoint coordinates are within the range of the diagonal endpoint coordinates of the rectangular window.
[0099] 12. A system for drawing the background of a video window, comprising: The acquisition module is used to obtain the coordinates of the diagonal endpoints of the canvas and the coordinates of the diagonal endpoints of the rectangular window on the canvas used to display the video image. The partitioning module is used to divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The drawing module is used to draw the image content corresponding to the rectangular free area on the background image.
[0100] 13. The system according to item 12, wherein the partitioning module further includes: The statistical unit is used to count the y-values at all diagonal endpoints and sort all y-values to form a series of y-values. The endpoint determination unit is used to determine the coordinates of the diagonal endpoints of the rectangular free area between adjacent y-values based on the coordinates of adjacent y-values and the diagonal endpoints in the y-value series. The fusion unit is used to find at least two sets of diagonal endpoint coordinates with the same x value in the diagonal endpoint coordinates of the rectangular free area, determine whether their y coordinate values are adjacent in the y value series, and if they are adjacent, merge the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates to generate a new rectangular free area. The collection unit is used to collect the coordinates of the diagonal endpoints of the rectangular free areas obtained through fusion and the rectangular free areas that did not participate in fusion, and then use them for drawing the background image.
[0101] 14. The system according to item 13, wherein the specific operation of the endpoint determination unit includes: Based on the sorted series of y values, two adjacent y values are taken in sequence to form a bar area on the canvas; The relative position of each rectangular window to each strip region is determined based on the coordinates of the diagonal endpoints. Calculate the x-coordinates of the diagonal endpoints of all rectangular windows whose relative positions meet the first condition, and generate a series of x-values that correspond one-to-one with the strip region; The x-coordinate values of the diagonal endpoints of the canvas are also placed in the x-value series, and the coordinate values in the x-value series are sorted by size. Delete identical coordinate values from the series of x values; Extract the coordinates of the odd-numbered positions in the x-value series and the coordinates of the adjacent even-numbered positions. These coordinates, along with the coordinates of the adjacent y-values corresponding to the strip region, form the coordinates of the diagonal endpoints of the rectangular free area.
[0102] 15. According to the system described in item 14, the first condition specifically includes: the coordinate interval formed by two adjacent y values corresponding to the strip region is entirely located within the coordinate interval formed by two y coordinate values of the diagonal endpoints of the rectangular window.
[0103] 16. The system according to item 14, wherein the specific operation of the fusion unit further includes: Among several adjacent y-coordinate values in the y-value series, select the largest and smallest y-coordinate values; The maximum and minimum y-coordinate values, along with the same x-coordinate values, constitute the coordinates of the diagonal endpoints of the merged rectangular free area.
[0104] 17. The system according to item 12, wherein the partitioning module further includes: The sorting unit is used to sort the x-values of the diagonal endpoint coordinates of all the rectangular windows and canvas in order of size to generate an x-coordinate table; and to sort the y-values of the diagonal endpoint coordinates of all the rectangular windows and canvas in order of size to generate a y-coordinate table. The determining unit is configured to determine, based on the x-coordinate table and the y-coordinate table, the coordinates of the diagonal endpoints of all rectangular regions divided by the extensions of these x-coordinates and y-coordinates in the y and x directions, respectively; The exclusion unit is used to exclude the rectangular window from all rectangular areas, and the remaining rectangular area is the rectangular free area.
[0105] 18. According to the system described in item 17, wherein the determining unit takes any two adjacent x values and two adjacent y values from the x-coordinate table and the y-coordinate table as the diagonal coordinate values of the rectangular region.
[0106] 19. According to the system of item 18, the operation of the exclusion unit specifically includes: excluding all rectangular regions whose diagonal endpoint coordinates are within the range of the diagonal endpoint coordinates of the rectangular window.
[0107] 20. The system according to item 17, wherein the partitioning module further includes a fusion unit; The fusion unit is used to list rectangles with the same diagonal x or y values for all rectangular free areas, merge adjacent rectangular free areas, and update the diagonal coordinates of all merged rectangular free areas; or The fusion unit is used to list all rectangles with the same diagonal y-value or x-value of their free areas, merge adjacent free areas, and update the diagonal coordinates of all the merged free areas.
[0108] 21. According to the system of item 20, the operation of merging adjacent rectangular free areas by the merging unit further includes: List all rectangles with the same diagonal x or y coordinates in their free areas; Sort the rectangles by the y-values or x-values of the same azimuth angle. Determine whether the y-values or x-values are consecutive values in the y-coordinate table or x-coordinate table; If the y-values or x-values of the same azimuth angle are consecutive values in the y-coordinate table or x-coordinate table, then the rectangular free areas corresponding to the same azimuth angle of the consecutive y-values or x-values are merged.
Claims
1. A method for drawing the background of a video window, comprising: Set the layout of the rectangular window on the canvas to display the video feed; Obtain the coordinates of the diagonal endpoints of the rectangular window and the diagonal endpoints of the canvas; Count the y-values at all diagonal endpoints and sort all y-values to form a series of y-values; Based on the sorted series of y values, two adjacent y values are sequentially selected to form a bar area on the canvas. The relative position of each bar area to the rectangular window is determined according to the coordinates of the diagonal endpoints of the rectangular window, and the coordinates of the diagonal endpoints of the rectangular free areas that meet the conditions in the bar area are determined. Find at least two sets of diagonal endpoint coordinates with the same x value in the diagonal endpoint coordinates of the rectangular free area, and determine whether their y coordinate values are adjacent in the y value series. If they are adjacent, merge the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates to generate a new rectangular free area. The coordinates of the diagonal endpoints of the rectangular free areas obtained through fusion and the rectangular free areas that did not participate in fusion are collected and used for drawing the background image; Divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The background content corresponding to the rectangular free area is drawn on the rectangular free area.
2. The method according to claim 1, wherein the step of determining the coordinates of the diagonal endpoints of the rectangular free area that meets the conditions in the strip region further includes the following steps, including: Calculate the x-coordinate values of the diagonal endpoints of all rectangular windows whose relative positions meet the first condition, and generate a series of x-values that correspond one-to-one with the strip region; The x-coordinate values of the diagonal endpoints of the canvas are also placed in the x-value series, and the coordinate values in the x-value series are sorted by size. Delete identical coordinate values from the series of x values; Extract the coordinates of the odd-numbered positions in the x-value series and the coordinates of the adjacent even-numbered positions. These coordinates, along with the coordinates of the adjacent y-values corresponding to the strip region, form the coordinates of the diagonal endpoints of the rectangular free area.
3. The method according to claim 2, wherein the first condition specifically includes: The coordinate interval formed by two adjacent y values corresponding to the strip region is entirely located within the coordinate interval formed by the two y coordinate values of the diagonal endpoints of the rectangular window.
4. The method according to claim 1, wherein the step of determining whether the y-coordinates of at least two sets of diagonal endpoint coordinates with the same x-values in the diagonal endpoint coordinates of the rectangular free area are adjacent in the y-value series, and merging the rectangular free areas corresponding to the at least two sets of diagonal endpoint coordinates to generate a new rectangular free area, further includes the following steps: Among several adjacent y-coordinate values in the y-value series, select the largest and smallest y-coordinate values; The maximum and minimum y-coordinate values are combined with the same x-coordinate values to form the diagonal endpoint coordinates of the merged rectangular free area.
5. The method according to claim 1, wherein: The step of dividing the free area on the canvas not occupied by the rectangular window into multiple rectangular free areas also includes the following steps: Sort the x-values of the diagonal endpoints of all the rectangular windows and canvases in ascending order to generate an x-coordinate table; Sort the y-values of the diagonal endpoints of all the rectangular windows and canvases in ascending order to generate a y-coordinate table; Based on the x-coordinate table and the y-coordinate table, determine the coordinates of the diagonal endpoints of all rectangular regions divided by the extensions of these x-coordinates and y-coordinates in the y and x directions, respectively; The rectangular area remaining after excluding the rectangular window from all the rectangular areas is the rectangular free area.
6. The method according to claim 5, wherein: Take any two adjacent x values and two adjacent y values from the x-coordinate table and y-coordinate table as the diagonal coordinate values of the rectangular region.
7. The method according to claim 5, wherein rectangles with the same diagonal x or y value for all rectangular free areas are listed, adjacent rectangular free areas are merged, and the diagonal coordinates of all merged rectangular free areas are updated.
8. The method according to claim 7, wherein rectangles with the same diagonal y-coordinate or x-coordinate of all rectangular free areas are listed, adjacent rectangular free areas are merged, and the diagonal coordinates of all merged rectangular free areas are updated.
9. The method according to claim 7 or 8, wherein the step of merging adjacent rectangular free areas further comprises: List all rectangles with the same diagonal x or y coordinates in their free areas; Sort the rectangles by the y-values or x-values of the same azimuth angle. Determine whether the y-values or x-values are consecutive values in the y-coordinate table or x-coordinate table; If the y-values or x-values of the same azimuth angle are consecutive values in the y-coordinate table or x-coordinate table, then the rectangular free areas corresponding to the same azimuth angle of the consecutive y-values or x-values are merged.
10. The method of claim 5, wherein the step of defining the rectangular region remaining after excluding the rectangular window from all rectangular regions as the rectangular free region further comprises: Exclude the rectangular region whose diagonal endpoint coordinates are within the range of the diagonal endpoint coordinates of the rectangular window.
11. A system for drawing the background of a video window, comprising: The acquisition module is used to obtain the coordinates of the diagonal endpoints of the canvas and the coordinates of the diagonal endpoints of the rectangular window on the canvas used to display the video image. The partitioning module is used to divide the free area on the canvas that is not occupied by the rectangular window into multiple rectangular free areas; The drawing module is used to draw the image content on the background image that corresponds to the rectangular free area on the rectangular free area; The partitioning module further includes: The statistical unit is used to statistically analyze and sort the y-values in the coordinates of all diagonal endpoints to form a series of y-values; The endpoint determination unit is used to form a bar region by taking two adjacent y values in sequence based on the sorted series of y values, and to determine the relative position of each bar region and the rectangular window according to the coordinates of the diagonal endpoints of the rectangular window, and to determine the coordinates of the diagonal endpoints of the rectangular free areas that meet the conditions in the bar region. The fusion unit is used to find at least two sets of diagonal endpoint coordinates with the same x value in the diagonal endpoint coordinates of the rectangular free area, and to determine whether their y coordinate values are adjacent in the y value series. If so, the at least two sets of corresponding rectangular free areas are merged to generate a new rectangular free area. The collection unit is used to collect the rectangular free areas obtained through fusion and the rectangular free areas that did not participate in fusion as a final set of rectangular free areas, and provide them to the drawing module for drawing the background image.
12. The system according to claim 11, wherein the specific operation of the endpoint determination unit includes: Calculate the x-coordinates of the diagonal endpoints of all rectangular windows whose relative positions meet the first condition, and generate a series of x-values that correspond one-to-one with the strip region; The x-coordinate values of the diagonal endpoints of the canvas are also placed in the x-value series, and the coordinate values in the x-value series are sorted by size. Delete identical coordinate values from the series of x values; Extract the coordinates of the odd-numbered positions in the x-value series and the coordinates of the adjacent even-numbered positions. These coordinates, along with the coordinates of the adjacent y-values corresponding to the strip region, form the coordinates of the diagonal endpoints of the rectangular free area.
13. The system of claim 12, wherein the first condition specifically includes: The coordinate interval formed by two adjacent y values corresponding to the strip region is entirely located within the coordinate interval formed by the two y coordinate values of the diagonal endpoints of the rectangular window.
14. The system according to claim 12, wherein, The specific operations of the fusion unit also include: Among several adjacent y-coordinate values in the y-value series, select the largest and smallest y-coordinate values; The maximum and minimum y-coordinate values are combined with the same x-coordinate values to form the diagonal endpoint coordinates of the merged rectangular free area.
15. The system according to claim 11, wherein the partitioning module further comprises: The sorting unit is used to sort the x-values of the diagonal endpoints of all the rectangular windows and canvases in order of size, and generate an x-coordinate table. And to sort the y-values of the diagonal endpoint coordinates of all the rectangular windows and canvases in order of size to generate a y-coordinate table; The determining unit is configured to determine, based on the x-coordinate table and the y-coordinate table, the coordinates of the diagonal endpoints of all rectangular regions divided by the extensions of these x-coordinates and y-coordinates in the y and x directions, respectively; The exclusion unit is used to exclude the rectangular window from all rectangular areas, and the remaining rectangular area is the rectangular free area.
16. The system according to claim 15, wherein the determining unit takes any two adjacent x values and two adjacent y values from the x-coordinate table and the y-coordinate table as the diagonal coordinate values of the rectangular region.
17. The system of claim 16, wherein the operation of the exclusion unit specifically includes: Exclude the rectangular region whose diagonal endpoint coordinates are within the range of the diagonal endpoint coordinates of the rectangular window.
18. The system according to claim 15, wherein the partitioning module further comprises a fusion unit; The fusion unit is used to list rectangles with the same diagonal x or y values for all rectangular free areas, merge adjacent rectangular free areas, and update the diagonal coordinates of all merged rectangular free areas; or The fusion unit is used to list all rectangles with the same diagonal y-value or x-value of their free areas, merge adjacent free areas, and update the diagonal coordinates of all the merged free areas.
19. The system according to claim 18, wherein the operation of the fusion unit merging adjacent rectangular free areas further includes: List all rectangles with the same diagonal x or y coordinates in their free areas; Sort the rectangles by the y-values or x-values of the same azimuth angle. Determine whether the y-values or x-values are consecutive values in the y-coordinate table or x-coordinate table; If the y-values or x-values of the same azimuth angle are consecutive values in the y-coordinate table or x-coordinate table, then the rectangular free areas corresponding to the same azimuth angle of the consecutive y-values or x-values are merged.