Method, system and readable storage medium for real-time replacement of background environment of online video
By predicting the target object's action nodes and generating virtual target images, combined with image segmentation and optical flow algorithms, it solves the problem of difficulty in simultaneously improving background replacement quality and delay in video conferencing, and achieves efficient and stable video background processing.
Patent Information
- Application Number
- CN202411139501.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-20
AI Technical Summary
When the existing technology replaces the video background in real-time online during a video conference, it is difficult to improve the background processing quality and reduce the video delay at the same time, resulting in blurred or stuck edges of the target image in the video frame.
By obtaining the behavioral characteristic data of the target object, predict the action nodes and generate virtual target images, combine the image segmentation and target detection algorithms, compare the similarity of the action nodes, select the appropriate target image to fuse with the preset background, and use multi-line parallel processing and lighting Streaming algorithms improve video frame processing efficiency.
Without significantly increasing the video background processing time, it improves the quality of video background processing, avoids image edge blur and video freezes, and ensures the accuracy and stability of background replacement.
Smart Images

Figure CN118660122B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video image processing, and more specifically, to a method and system for real-time replacement of the background environment of an online video and a readable storage medium. Background Art
[0002] With the rise of online office, remote video conferences are becoming more and more frequent. When participating in video conferences, video conference users often want to blur or replace the video background to avoid personal privacy leakage and make the video conference appear more formal.
[0003] The current real-time online video background replacement mainly includes: using a deep learning algorithm to identify the target image (foreground image) and background image in the video image in real time, performing foreground segmentation on the video frame to obtain the target image mask and foreground image, and then performing image fusion of the target image foreground with the preset background image to obtain the video frame after background replacement. In order to ensure the efficiency of video background processing and reduce the delay of video conferencing, the existing technology usually uploads the video signal collected from the first terminal to the cloud, and then the cloud server spends a certain amount of time to process the above video, and finally transmits the processed video to the second terminal via the communication network for presentation.
[0004] In specific practice, the inventors found that for application scenarios such as video conferencing, according to whether the start and end states of an action of the user (i.e., the target object) are the same or similar, the actions of the target object can be divided into two categories in a short time. One is periodic actions, such as when the target object walks, the arm swings to the maximum angle (action endpoint) and then returns to the initial position, the target object's head deflects from the initial position to a set angle, that is, after reaching the action endpoint, it returns to the initial position, the target object's arm changes from a bent state to an extended state (the action endpoint is the arm in an extended state) and finally changes to the initial bent state, etc.; the other is non-periodic actions, such as the target object directly leaving the video acquisition area. For the periodic actions of the target object, each action node can be predicted in a short time.
[0005] Since foreground segmentation and image fusion of video images require a lot of computing power, once the position of the target image changes rapidly compared to the background image, the edge of the target image in the video frame after background processing will become blurred, the video will freeze, and even a brief unprocessed real environment background will appear in the video. If the above problems are to be overcome under specific computing power conditions, the delay of video communication will inevitably increase or the quality of video background processing will be reduced. Summary of the invention
[0006] In view of the problem that it is difficult to simultaneously improve the quality of video conference background processing and reduce video delay in actual applications, the first purpose of this application is to propose a real-time replacement method for the background environment of online videos, which can improve the quality of video background processing without significantly increasing the video background processing time in combination with user behavior characteristics. To achieve the above method, the second purpose of this application is to provide a real-time replacement system for the background environment of online videos. The specific scheme is as follows:
[0007] A method for real-time replacement of background environment of online video, comprising:
[0008] Obtain each action node of the target object and the relationship between them, and store them as behavior feature data;
[0009] Acquire a video frame image and generate a first target image and a background image through image segmentation and target detection algorithms;
[0010] Analyze and obtain a first action node of the target object at a first moment from the first target image, and obtain a second action node of the target object at a second moment after a set time period according to the behavior feature data;
[0011] Based on the first action node and the corresponding first target image, generating a second target image corresponding to the second action node;
[0012] Compare the action node of the target object at the second moment with the second action node, and if the similarity between the two is higher than a set threshold, fuse the second target image corresponding to the second action node with the preset background image to generate a video frame image after background replacement; if the similarity between the two is lower than the set threshold, generate a second target image based on the action node of the target object at the second moment, and fuse the second target image with the preset background image to generate a video frame image after background replacement;
[0013] The step of obtaining each action node of the target object includes:
[0014] Selecting a specific location on the target object in the video frame image as a reference point to calibrate the action node of the target object and store it;
[0015] Based on at least one complete action cycle of the target object, collecting the reference point position coordinates at a set time interval to generate the action node;
[0016] The association between the action nodes includes the sequential relationship and interval duration of the action nodes;
[0017] The number of second action nodes corresponding to the first action node is one or more.
[0018] Through the above technical solution, the action node of the target object at the next moment is predicted according to the behavioral feature data of the target object, and at least one virtual target image is generated thereby, and then the target image at the current moment is merged with the preset background image by comparing the action nodes to obtain a video frame. The above process can generate multiple target images in advance and there is no need to perform precise image segmentation and target detection during the generation process. It is only necessary to directly call the action node at the next moment corresponding to the action node at the current moment and then perform image derivation. Compared with directly using the image optical flow estimation algorithm for processing, the processing speed is faster, and when the time interval between adjacent action nodes is lower than the set value, the quality of background processing can also be effectively guaranteed.
[0019] Furthermore, the number of the second action nodes is multiple;
[0020] The association between the action nodes also includes the probability distribution of the first action node transitioning to the second action node respectively;
[0021] Sort each of the second action nodes according to the probability distribution, and generate a second target image corresponding to each of the second action nodes;
[0022] Wherein, obtaining the probability distribution includes:
[0023] Collect historical video data of the target object and classify each video scene to obtain video image data of the target object in each video scene;
[0024] Analyze and obtain the periodic actions of the target object from each video image data and classify the actions, and set reference points for calibrating action nodes for each type of action;
[0025] Collect the position coordinate information of each reference point at a set frequency, and establish a tree-like hierarchical diagram with time as the hierarchy and the corresponding relationship between action nodes in each hierarchy as the connecting line;
[0026] The corresponding relationships and the times of the action nodes at each level in multiple similar actions of the target object are counted to calculate the probability distribution.
[0027] Through the above technical solution, when generating the second target image, the second action node with the highest transition probability to the first action node can be obtained first, so that the second target image can be processed and generated in a short time, shortening the video frame processing time and ensuring the video frame quality with the highest probability. A periodic action of the target object is decomposed into multiple action nodes and stored in the form of a tree hierarchy diagram, which is convenient for storage and also convenient for quickly finding the second action node corresponding to the first action node during later image processing, thereby improving the processing efficiency of the video frame.
[0028] Furthermore, the method further comprises:
[0029] Acquire multiple second action nodes corresponding to the first action node based on the behavior feature data of the target object;
[0030] Generate a plurality of second target images respectively corresponding to the second action nodes by multi-line parallel processing according to the number of the second action nodes;
[0031] Based on the optical flow algorithm, the displacement vector of the target image between the first moment and the second moment is obtained and decomposed on the x-axis and y-axis to obtain the ratio L of the displacement components;
[0032] Acquire the action node at the second moment and compare it with the plurality of the second action nodes, select the second target image corresponding to the second action node with the highest similarity and merge it with the preset background image;
[0033] There are multiple reference points used to calibrate the action nodes, and the similarity calculation method between adjacent action nodes is as follows:
[0034]
[0035] In the above formula, X is the sum of the absolute values of the deviations between the coordinate position of the actual action node at the second moment and the coordinate position corresponding to the second action node, and its size is used to characterize the similarity between the action nodes and to be compared with a set threshold; δi and δk are the differences between the coordinate positions of the reference points corresponding to the actual action node at the second moment and the coordinate positions of the reference points corresponding to the second action node on the x-axis and y-axis, respectively; M and N are the acceptance weights of the x-axis and y-axis, respectively, which are obtained by the set algorithm based on the ratio L of the above-mentioned displacement components.
[0036] Through the above technical solution, when the first action node corresponds to multiple second action nodes at the next moment, multiple second target images can be generated based on the second action node in a short time, and the determination of the similarity between the actual action node and the second action node is completed synchronously, and finally the second target image corresponding to the second action node similar to the actual action node is selected and merged with the preset background image, which can effectively ensure the processing quality of the background of the video frame image. By synchronously introducing the optical flow algorithm, the displacement vector direction of the video image between the previous and next moments (which is the real data) can be judged, and thus the corresponding weight is given when determining the similarity of the action nodes, thereby increasing the reliability of the similarity determination and improving the quality of the video background processing.
[0037] Furthermore, the method further comprises:
[0038] Obtaining and determining the active area and the static area of the target image from the first moment to the second moment based on the probability distribution of the transition from the first action node to each of the second action nodes and the position coordinate difference of the reference point in the first action node and the second action node, and associating the confidence probability;
[0039] According to the active area, the static area and the confidence probability associated therewith, the video frame image is partitioned into a plurality of processing image areas;
[0040] An independent image processing algorithm is configured for each processing area and multi-line parallel processing is performed to obtain the local target image and background image in each processing area;
[0041] The local target images in each processed image area are spliced and integrated to form the first target image.
[0042] Through the above technical solution, different processing areas can be delineated for the video frame images according to the prediction of the target object's action, thereby performing multi-line processing on the video frame images and configuring the algorithm computing power in a more targeted manner to improve processing efficiency.
[0043] Furthermore, the partitioning of the video frame image into a plurality of processing image regions further includes:
[0044] Establish and store the linkage relationship between the reference points corresponding to the action nodes of various actions;
[0045] Determining a position change probability of an associated action node based on a position coordinate relationship between the first action node and its corresponding second action node;
[0046] Based on the above position change probability, the video frame image is partitioned to form a plurality of processing image regions.
[0047] Through the above technical solution, the video frame image partitioning can be made more accurate, so that more computing resources can be allocated to the activity area to ensure the generation quality of the first target image.
[0048] Furthermore, the method further comprises:
[0049] Based on the active area and the static area and their associated confidence probabilities, the video frame image is divided into a plurality of fixed image regions;
[0050] Based on the tree-like hierarchical graph, in the same video scene, action nodes at action endpoints are obtained from the action nodes contained in various periodic actions of the target object, and marked as end nodes;
[0051] Acquire and store a second target image generated based on the end node and a set number of subsequent action nodes, and / or divide the second target image into parts of the second target image according to its distribution in each image area and store them;
[0052] Determine whether the first action node is an end node. If it is an end node, directly call the second target image generated by the subsequent set number of action nodes of the end node or the second target image is partially merged with the preset background image to generate a video frame image after background replacement.
[0053] Through the above technical solution, for the periodic action of the target object, the trend of its action node can be determined within the set time after its action node reaches the action endpoint. Therefore, the second target image or a part thereof generated by a set number of action nodes after the end node can be used as the target image and directly merged with the preset background image, which can effectively improve the processing efficiency of the video frame and ensure the processing quality. At the same time, it can avoid the situation where the background replacement fails due to the drastic change in the position of the target image near the action endpoint.
[0054] Furthermore, each action node is actually represented as an array consisting of coordinate data of each reference point;
[0055] The action nodes contained in the same category of actions are stored in the cloud database in the form of a tree diagram and are stored in association with the video scene numbers.
[0056] A real-time background environment replacement system for online videos, comprising:
[0057] A behavior characteristic data acquisition unit, configured to acquire each action node of the target object and the associations therebetween, and store them as behavior characteristic data of the target object;
[0058] The first target image generation unit is configured to obtain a video frame image and generate a first target image and a background image through image segmentation and target detection algorithms. The core configuration of the first target image generation unit is an image segmentation algorithm and a target detection algorithm model;
[0059] A second target image generating unit is configured to obtain a first action node of the target object at a first moment by parsing the first target image, and to obtain a second action node of the target object at a second moment after a set time period according to the behavior feature data, and then generate a second target image corresponding to the second action node based on the first action node and the corresponding first target image;
[0060] an action node comparison unit, configured to compare the action node of the target object at the second moment with the second action node, and output a first control signal if the similarity between the two is higher than a set threshold; and output a second control signal if the similarity between the two is lower than the set threshold;
[0061] an image fusion unit, receiving and responding to the first control signal and the second control signal, fusing the second target image corresponding to the second action node with the preset background image to generate a video frame image after the background is replaced; or generating a second target image based on the action node of the target object at the second moment, and fusing the second target image with the preset background image to generate a video frame image after the background is replaced;
[0062] The actual representation form of each action node is an array consisting of the coordinate data of each reference point;
[0063] The association between the action nodes includes the sequential relationship and interval duration of the action nodes, as well as the probability of transitioning from the current action node to the next action node.
[0064] Furthermore, the system also includes:
[0065] an image partitioning unit, configured to obtain and determine an active area and a static area of a target image from a first moment to a second moment based on a probability distribution of transitions from the first action node to each of the second action nodes and a position coordinate difference between reference points in the first action node and the second action node, and partition the video frame image into a plurality of processing image areas based on the active area and the static area;
[0066] An image region processing unit is configured to configure an independent image processing algorithm for each processing image region and perform multi-line parallel processing to obtain a local target image and a background image in each processing image region;
[0067] The image stitching unit is configured to stitch and integrate the processed local target images in each processed image area to form the first target image.
[0068] A computer-readable storage medium stores a computer program for executing the above-mentioned method for real-time replacement of the background environment of an online video.
[0069] Compared with the prior art, the present invention has the following beneficial effects:
[0070] By analyzing the target object's behavioral feature data, the action node (second action node) of the target object at the current moment, that is, a set time (second moment) after the first moment, is obtained, and at least one corresponding target image is generated in advance by the above action node. Then, when the time is about to reach the second moment, according to the similarity between the actual action node and the second action node, the corresponding target image and the preset background image are selected and fused to finally generate a video frame image. Even if the target object's action changes frequently, the above method can still combine user behavior characteristics to improve the quality of video background processing without significantly increasing the video background processing time, and there will be no situation where the image edges become blurred, the video freezes, or even the unprocessed real environment background appears briefly. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is a schematic diagram of the overall process of the method of the present invention;
[0072] Figure 2 It is a schematic diagram of the association of various action nodes contained in the same category of actions;
[0073] Figure 3 A schematic diagram for obtaining a probability distribution of the first action node transitioning to each second action node;
[0074] Figure 4 A schematic diagram of partitioning a video frame image;
[0075] Figure 5 A schematic diagram of a method for partitioning a video frame image;
[0076] Figure 6 It is a brief framework schematic diagram of the system of the present invention.
[0077] Figure numerals: 1, processing area; 2, target image; 3, background image; 4, active area; 5, static area; 60, behavior feature data acquisition unit; 61, first target image generation unit; 62, second target image generation unit; 63, action node comparison unit; 64, image fusion unit; 71, initial action node; 72, intermediate action node. DETAILED DESCRIPTION
[0078] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the attached Figure 1-6 Shown in.
[0079] In the description of this specification, the description with reference to the terms "certain embodiments", "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0080] The present invention will be further described in detail below in conjunction with embodiments and figures, but the embodiments of the present invention are not limited thereto.
[0081] A method for real-time replacement of background environment of online video, such as Figure 1 As shown, it mainly includes the following steps:
[0082] S100, obtaining each action node of the target object and the relationship between them, and storing them as the target object, that is, the behavior characteristic data of the user. The above action nodes are obtained by decomposing the action of the target object, and are used to represent the coordinate position of the set reference point on the target object at each time.
[0083] S200, acquiring a video frame image and generating a first target image and a background image 3 through image segmentation and target detection algorithms;
[0084] S300, obtaining a first action node of a target object at a first moment by parsing the first target image, and obtaining a second action node of the target object at a second moment after a set time period according to the behavior feature data;
[0085] S400, generating a second target image corresponding to the second action node based on the first action node and the corresponding first target image;
[0086] S500, comparing the action node of the target object at the second moment with the second action node:
[0087] S510, if the similarity between the two is higher than a set threshold, performing image fusion on the second target image corresponding to the second action node and the preset background image 3 to generate a video frame image after background replacement;
[0088] S520, if the similarity between the two is lower than the set threshold, a second target image is generated based on the action node of the target object at the second moment, and the second target image is fused with the preset background image 3 to generate a video frame image after background replacement, that is, the set target image 2 is generated and fused with the preset background image 3 in accordance with the prior art.
[0089] In practice, the user's behavior feature data in a specific video scene is associated with the user ID and the video scene classification number and stored in a cloud database. In step S100, obtaining each action node of the target object specifically includes:
[0090] S110, selecting a specific location on the target object in the video frame image as a reference point to calibrate the action node of the target object and storing it.
[0091] S120, based on at least one complete action cycle of the target object, collecting the reference point position coordinates at a set time interval to generate the action node;
[0092] In step S110, the reference point can be a pixel point with a specific pixel value, or a pixel area with a specific pixel value, or a pixel area with a specific corresponding relationship between the pixel values of each pixel point in the area, such as selecting a black block with a pixel value of 0 in a video frame image as a reference point. By identifying and locating the coordinates of the reference point, the overall or local movement of the target object can be known. In step S120, a complete action cycle refers to the target object completing a periodic action, such as the head returning to the initial position after deflecting from the initial position to a set angle during a video conference. The set time interval can be adjusted according to the video processing quality requirements and the processing hardware performance configuration.
[0093] In practice, in order to enable the reference points to accurately reflect the overall or partial actions of the target object, the number of the above reference points is multiple, and thus the actual representation form of the above action nodes is an array consisting of a set of coordinate data of each reference point. It should be pointed out that the coordinate systems corresponding to the coordinate positions involved in the implementation of the present application are all established based on the video frame image, and the pixel coordinate system can be directly used.
[0094] In step S100, Figure 2 As shown, the association between the action nodes includes the sequential relationship and interval duration of the action nodes. In detail, the number of second action nodes corresponding to the first action node is one or more, that is, there may be multiple different actions after a certain action of the target object.
[0095] In step S200, a video frame image is obtained and a first target image and a background image 3 are generated through image segmentation and target detection algorithms, wherein the target image 2 is a foreground image. The specific working principle and process of the image segmentation and target detection algorithm have been disclosed in practice and will not be described here.
[0096] In step S300, the first action node of the target object at the first moment can be directly obtained by identifying a set reference point in the video frame image, such as identifying a pixel area where the sum of pixel values is a specific value. In the embodiment of the present application, preferably, the first action node is obtained by parsing the first target image, and the above-mentioned analysis, in addition to obtaining the reference point by image recognition, also includes: calculating the relative position relationship between each reference point and the edge of the target image 2, and obtaining a function for characterizing the relative position relationship between the reference point and the edge of the target image 2, such as the image perspective function in image processing, so that after obtaining the second action node, the second target image can be accurately derived based on the above function.
[0097] Combination Figure 2 As shown, in actual applications, most of the second action nodes have multiple numbers. When the first action node is completed, there are many different situations in which the first action node transitions to the second action node, that is, the probability of each second action node occurring is not the same.
[0098] To this end, in the implementation of the present application, the association between each action node also includes the probability distribution of the above-mentioned first action node transitioning to each second action node. The second action nodes are sorted according to the probability distribution, and the second action nodes with a high probability of occurrence are ranked in front, and then the second target image corresponding to the second action node is generated. Therefore, when the computing power configuration is constant, the second target image corresponding to the second action node with a high probability of occurrence can be generated preferentially.
[0099] Detailed, such as Figure 3 As shown, obtaining the probability distribution includes:
[0100] S130, collect historical video data of the target object and classify each video scene, and obtain video image data of the target object in each video scene. The above historical video data can be the video data of the same target object, that is, the same user in each video conference stored in the cloud, or it can be the video conference data currently in progress. The classification of video scenes includes different time, background environment, participant data and other information. Practical statistics show that in the same video scene, the actions of the target object are very similar, so the actions of the target object can be counted and more accurate predictions can be made through historical video data.
[0101] S140, analyzing and obtaining the periodic actions of the target object from each video image data and classifying the actions, and setting reference points for calibrating action nodes for each type of action.
[0102] S150, such as Figure 2 As shown, the position coordinate information of each reference point is collected at a set frequency, and a tree-like hierarchical diagram is established with time as the level and the corresponding relationship between the action nodes of each level as the connecting line. Figure 2 The two ends are initial action nodes 71 or end nodes, and the middle is an intermediate action node 72 with a set time interval.
[0103] S160, counting the correspondence between action nodes at each level and their times in multiple similar actions of the target object, and calculating the probability distribution. Figure 2 As shown, the probability that the first action node at the first level transitions to the second action node at the second level is 100%, while the probability that the first action node at the second level transitions to the three second action nodes at the second level at the next moment is 33%.
[0104] The above technical solution can give priority to obtaining the second action node with the highest transition probability with the first action node when generating the second target image, so that the second target image can be processed and generated in a short time, shortening the video frame processing time and ensuring the video frame quality with the highest probability. A periodic action of the target object is decomposed into multiple action nodes and stored in the form of a tree-like hierarchical graph, which is convenient for storage and also convenient for quickly finding the second action node corresponding to the first action node during later image processing, thereby improving the processing efficiency of the video frame.
[0105] In the implementation manner of the present application, in order to further improve the processing efficiency of the video frame image, the real-time background environment replacement method of the online video also includes:
[0106] S410, acquiring a plurality of second action nodes corresponding to the first action node based on the behavior characteristic data of the target object.
[0107] S420: Perform multi-line parallel processing according to the number of the second action nodes to generate a plurality of second target images respectively corresponding to the second action nodes.
[0108] S510, based on the optical flow algorithm, the displacement vector of the target image 2 between the first moment and the second moment is obtained and decomposed on the x-axis and y-axis to obtain the ratio L of the displacement components. In the prior art, the optical flow algorithm has been widely used, and its basic working principle is: based on a basic pixel intensity matrix, a function I(x,y,t) is defined, where the x,y pixel coordinates correspond to the t-frame moment. The I(x,y,t) function defines the precise pixel intensity of the corresponding position (x,y) at the t-th frame. Assuming that the displacement of the target between two adjacent frames does not change the pixel intensity belonging to the determined target, then I(x,y,t)= I(x+△x,y+△y,t+△t). From the above formula, it can be seen that the basis of the optical flow algorithm is actually the calculation of the motion components of the target reference pixel on the x and y axes. In the embodiment of the present application, △t is the time interval between the first moment and the second moment, and the ratio L=△x / △y. The above ratio L can reflect the actual displacement direction of the target image 2 in a relatively macroscopic way.
[0109] S520, obtaining the action node at the second moment and comparing it with the plurality of the second action nodes, selecting the second target image corresponding to the second action node with the highest similarity and merging it with the preset background image 3.
[0110] In this implementation, there are multiple reference points for calibrating action nodes. The similarity calculation method between adjacent action nodes, that is, action nodes with a continuous relationship, is as follows:
[0111]
[0112] In the above formula, X is the sum of the absolute values of the deviations between the coordinate position of the actual action node at the second moment and the coordinate position corresponding to the second action node, and its size is used to characterize the similarity between the action nodes and to compare with a set threshold; δi and δk are the differences between the coordinate position of the reference point corresponding to the actual action node at the second moment and the coordinate position of each reference point corresponding to the second action node on the x-axis and y-axis, respectively.
[0113] M and N are the confidence weights of the differences on the x-axis and y-axis, respectively, which are obtained through a set algorithm based on the ratio L of the aforementioned displacement components. For example, the ratio L obtained by the optical flow algorithm is 0.8, that is, the displacement of the target image 2 in the y-axis direction is greater than its displacement in the x-axis direction. Therefore, when making similarity judgments, M and N can be set to 0.4 and 0.5, respectively, that is, the displacement of each reference point in the y-axis direction is more confident.
[0114] When the first action node corresponds to multiple second action nodes at the next moment, multiple second target images can be generated based on the second action node in a short time, and the determination of the similarity between the actual action node and the second action node is completed synchronously, and finally the second target image corresponding to the second action node similar to the actual action node is selected and merged with the preset background image 3, which can effectively ensure the processing quality of the video frame image background. By synchronously introducing the optical flow algorithm, the displacement vector direction of the video image between the previous and next moments can be determined, and thus the corresponding weight is given when determining the similarity of the action nodes, thereby increasing the reliability of the similarity determination and improving the quality of the video background processing.
[0115] In order to further improve the processing efficiency of video frame images during online video, combined with the scene characteristics of video conferencing, the real-time background environment replacement method for online video described in this application is combined with Figure 4 and Figure 5 As shown, it also includes:
[0116] S210, obtaining and determining the active area 4 and the static area 5 of the target image 2 from the first moment to the second moment based on the probability distribution of the transition from the first action node to each of the second action nodes and the difference in position coordinates of the reference points in the first action node and the second action node, and associating the confidence probability.
[0117] S220 , partitioning the video frame image into a plurality of processing regions 1 according to the active region 4 , the static region 5 and the confidence probabilities associated therewith, each region corresponding to a different confidence probability.
[0118] S230, configure an independent image processing algorithm for each processing area 1 and perform multi-line parallel processing to obtain a local target image 2 and a background image 3 in each processing area 1. The difference between the independent image processing algorithms mainly includes the accuracy of generating the foreground image and the background image 3. Less computing power and the number of iterations of the deep learning algorithm are configured in the static area 5, and more computing power is configured in the active area 4, thereby improving the generation accuracy of the target image 2 in the active area 4.
[0119] S240, stitching and integrating the processed local target images 2 in each processed image area 1 to form the first target image.
[0120] In the above step S220, the video frame image is partitioned into a plurality of processing regions 1, and further includes:
[0121] S221, establishing and storing linkage relationships between reference points corresponding to action nodes of various actions, for example, a change in the wrist position of the target object will cause a change in the palm position.
[0122] S222, determining a position change probability of an associated action node based on a position coordinate relationship between the first action node and its corresponding second action node;
[0123] S223, partitioning the video frame image into multiple processing regions 1 based on the above position change probability.
[0124] The above technical solution can make the video frame image partitioning more accurate, thereby allocating more computing resources to the activity area 4 to ensure the generation quality of the first target image.
[0125] By analyzing the historical video data, for the periodic action of the target object, the trend of the action node can be determined within the set time after the action node reaches the action endpoint, so that the second target image or its part generated by the set number of action nodes after the end node can be used as the target image 2 and directly merged with the preset background image 3. Based on the video frame image partitioning scheme in the above step S220, the real-time background environment replacement method of the online video described in the present application also includes:
[0126] S211 , based on the active area 4 and the static area 5 and their associated confidence probabilities, the video frame image is divided into a plurality of fixed image regions.
[0127] S212, based on the tree-like hierarchical diagram, obtain action nodes at action endpoints from action nodes contained in various periodic actions of the target object in the same video scene, and mark them as end nodes.
[0128] S213, obtaining and storing a second target image generated based on the end node and a subsequent set number of action nodes, and / or dividing the second target image into second target image parts according to its distribution in each image area and storing them.
[0129] S214, determine whether the first action node is an end node. If it is an end node, directly call the second target image generated by the subsequent set number of action nodes of the end node or the second target image is partially merged with the preset background image 3 to generate a video frame image after the background is replaced.
[0130] The above scheme can effectively improve the processing efficiency of the video frames and ensure the processing quality, and at the same time can avoid the situation where the background replacement fails due to the drastic change of the position of the target image 2 near the action endpoint.
[0131] A real-time background replacement system for online videos, such as Figure 6 As shown, it mainly includes a behavior feature data acquisition unit 60, a first target image generation unit, a second target image generation unit, an action node comparison unit 63 and an image fusion unit 64.
[0132] The behavior characteristic data acquisition unit 60 is configured to acquire the action nodes of the target object and the associations therebetween, and store them as the behavior characteristic data of the target object. The actual representation form of each action node is an array consisting of a set of coordinate data of each reference point. The associations between the action nodes include the sequential relationship and interval duration of each action node, as well as the probability of transitioning from the current action node to the next action node. The above behavior characteristic data is stored in a cloud database.
[0133] The first target image generation unit is configured to obtain a video frame image and generate a first target image and a background image 3 through image segmentation and target detection algorithms. The core configuration of the first target image generation unit is an image segmentation algorithm and a target detection algorithm model.
[0134] The second target image generation unit is configured to parse and obtain a first action node of the target object at a first moment from the first target image, and obtain a second action node of the target object at a second moment after a set time period according to the behavior feature data, and then generate a second target image corresponding to the second action node based on the first action node and the corresponding first target image.
[0135] The action node comparison unit 63 is configured to compare the action node of the target object at the second moment with the second action node, and output a first control signal if the similarity between the two is higher than a set threshold; and output a second control signal if the similarity between the two is lower than the set threshold.
[0136] The image fusion unit 64 receives and responds to the first control signal and the second control signal, fuses the second target image corresponding to the second action node with the preset background image 3 to generate a video frame image after the background is replaced; or generates a second target image based on the action node of the target object at the second moment, and fuses the second target image with the preset background image 3 to generate a video frame image after the background is replaced.
[0137] In order to further improve the processing efficiency of video frame images, the system described in the implementation mode of the present application also includes: an image partitioning unit, an image area processing unit and an image stitching unit.
[0138] The image partitioning unit is configured to obtain and determine the active area 4 and the static area 5 of the target image 2 from the first moment to the second moment according to the probability distribution of the transition from the first action node to each of the second action nodes and the position coordinate difference of the reference point in the first action node and the second action node, and partition the video frame image according to the active area 4 and the static area 5 to form a plurality of processing regions 1. The specific implementation of the above-mentioned probability distribution has been described above. Preferably, in the implementation of the present application, the video frame image is divided into a plurality of fixed processing regions 1, and then by calculating the position coordinate difference of the reference point in the previous and next action nodes, it is determined whether the processing region 1 is a static region 5.
[0139] The image region processing unit is configured to configure an independent image processing algorithm for each processing image region 1 according to the number of image region divisions of the video frame image, and perform multi-line parallel processing to obtain the local target image 2 and background image 3 in each processing image region 1. The difference between the image processing algorithms corresponding to each processing image region 1 mainly lies in the number of internal iterations during algorithm execution and the accuracy of the final image obtained. The image stitching unit is configured to stitch and integrate the processed local target images 2 in each processing image region 1 to form the first target image.
[0140] The embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program for executing the real-time background replacement method of online video described in any of the above embodiments. The above computer-readable storage medium includes but is not limited to a disk storage, a CD-ROM, an optical storage, etc.
[0141] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A method for real-time replacement of background environment of online video, characterized in that: include: Obtain each action node of the target object and the relationship between them, and store them as behavior feature data; Acquire a video frame image and generate a first target image and a background image through image segmentation and target detection algorithms; Acquire a first action node of the target object at a first moment, and acquire a second action node of the target object at a second moment after a set time period according to the behavior characteristic data; Based on the first action node and the corresponding first target image, generating a second target image corresponding to the second action node; Compare the action node of the target object at the second moment with the second action node, and if the similarity between the two is higher than a set threshold, fuse the second target image corresponding to the second action node with the preset background image to generate a video frame image after background replacement; if the similarity between the two is lower than the set threshold, generate a second target image based on the action node of the target object at the second moment, and fuse the second target image with the preset background image to generate a video frame image after background replacement; The step of obtaining each action node of the target object includes: Selecting a specific location on the target object in the video frame image as a reference point to calibrate the action node of the target object and store it; Based on at least one complete action cycle of the target object, collecting the reference point position coordinates at a set time interval to generate the action node; The association between the action nodes includes the sequential relationship and interval duration of the action nodes; The number of second action nodes corresponding to the first action node is one or more.
2. The method for real-time replacement of the background environment of online video according to claim 1, characterized in that: The number of the second action nodes is multiple; The association between the action nodes also includes the probability distribution of the first action node transitioning to the second action node respectively; Sort each of the second action nodes according to the probability distribution, and generate a second target image corresponding to each of the second action nodes; Wherein, obtaining the probability distribution includes: Collect historical video data of the target object and classify each video scene to obtain video image data of the target object in each video scene; Analyze and obtain the periodic actions of the target object from each video image data and classify the actions, and set reference points for calibrating action nodes for each type of action; Collect the position coordinate information of each reference point at a set frequency, and establish a tree-like hierarchical diagram with time as the hierarchy and the corresponding relationship between action nodes in each hierarchy as the connecting line; The corresponding relationships and the times of the action nodes at each level in multiple similar actions of the target object are counted to calculate the probability distribution.
3. The method for real-time replacement of the background environment of online video according to claim 2, characterized in that: The method further comprises: Acquire multiple second action nodes corresponding to the first action node based on the behavior feature data of the target object; Generate a plurality of second target images respectively corresponding to the second action nodes by multi-line parallel processing according to the number of the second action nodes; Based on the optical flow algorithm, the displacement vector of the target image between the first moment and the second moment is obtained and decomposed on the x-axis and y-axis to obtain the ratio L of the displacement components; Acquire the action node at the second moment and compare it with the plurality of the second action nodes, select the second target image corresponding to the second action node with the highest similarity and merge it with the preset background image; There are multiple reference points used to calibrate the action nodes, and the similarity calculation method between adjacent action nodes is as follows: In the above formula, X is the sum of the absolute values of the deviations between the coordinate position of the actual action node at the second moment and the coordinate position corresponding to the second action node, and its size is used to characterize the similarity between the action nodes and to be compared with a set threshold; δi and δk are the differences between the coordinate positions of the reference points corresponding to the actual action node at the second moment and the coordinate positions of the reference points corresponding to the second action node on the x-axis and y-axis, respectively; M and N are the acceptance weights of the x-axis and y-axis, respectively, which are obtained by the set algorithm based on the ratio L of the above-mentioned displacement components.
4. The method for real-time replacement of the background environment of online video according to claim 2, characterized in that: The method further comprises: Obtaining and determining the active area (4) and the static area (5) of the target image (2) from the first moment to the second moment based on the probability distribution of the transition from the first action node to each of the second action nodes and the position coordinate difference of the reference point in the first action node and the second action node, and associating the confidence probability; According to the active area (4), the static area (5) and the confidence probability associated therewith, the video frame image is partitioned to form a plurality of processing image areas (1); An independent image processing algorithm is configured for each processing image area (1) and multi-line parallel processing is performed to obtain a local target image (2) and a background image (3) in each processing image area (1); The local target images (2) in each processed image area (1) are spliced and integrated to form the first target image.
5. The method for real-time replacement of background environment of online video according to claim 4, characterized in that: The step of partitioning the video frame image into a plurality of processing image regions (1) further comprises: Establish and store the linkage relationship between the reference points corresponding to the action nodes of various actions; Determining a position change probability of an associated action node based on a position coordinate relationship between the first action node and its corresponding second action node; Based on the above position change probability, the video frame image is partitioned to form a plurality of processing image regions (1).
6. The method for real-time replacement of background environment of online video according to claim 4, characterized in that: The method further comprises: Based on the active area (4) and the static area (5) and their associated confidence probabilities, the video frame image is divided into a plurality of fixed image areas; Based on the tree-like hierarchical graph, in the same video scene, action nodes at action endpoints are obtained from the action nodes contained in various periodic actions of the target object, and marked as end nodes; Acquire and store a second target image generated based on the end node and a set number of subsequent action nodes, and / or divide the second target image into parts of the second target image according to its distribution in each image area and store them; Determine whether the first action node is an end node. If it is an end node, directly call the second target image generated by the subsequent set number of action nodes of the end node or the second target image is partially merged with the preset background image (3) to generate a video frame image after the background is replaced.
7. The method for real-time replacement of background environment of online video according to claim 2, characterized in that: The actual representation form of each action node is an array consisting of the coordinate data of each reference point; The action nodes contained in the same category of actions are stored in the cloud database in the form of a tree diagram and are stored in association with the video scene numbers.
8. A real-time background replacement system for online videos, characterized in that: include: A behavior characteristic data acquisition unit (60), configured to acquire each action node of the target object and the associations therebetween, and store them as behavior characteristic data of the target object; A first target image generation unit is configured to obtain a video frame image and generate a first target image and a background image (3) through an image segmentation and target detection algorithm. The core configuration of the first target image generation unit is an image segmentation algorithm and a target detection algorithm model. A second target image generating unit is configured to obtain a first action node of the target object at a first moment by parsing the first target image, and to obtain a second action node of the target object at a second moment after a set time period according to the behavior feature data, and then generate a second target image corresponding to the second action node based on the first action node and the corresponding first target image; an action node comparison unit (63), configured to compare the action node of the target object at the second moment with the second action node, and output a first control signal if the similarity between the two is higher than a set threshold; and output a second control signal if the similarity between the two is lower than the set threshold; An image fusion unit (64) receives and responds to the first control signal and the second control signal, fuses the second target image corresponding to the second action node with the preset background image (3) to generate a video frame image after the background is replaced; or generates a second target image based on the action node of the target object at the second moment, and fuses the second target image with the preset background image (3) to generate a video frame image after the background is replaced; The actual representation form of each action node is an array consisting of the coordinate data of each reference point; The association between the action nodes includes the sequential relationship and interval duration of the action nodes, as well as the probability of transitioning from the current action node to the next action node.
9. The system for real-time background replacement of online videos according to claim 8, characterized in that: Also includes: An image partitioning unit is configured to obtain and determine an active area (4) and a static area (5) of a target image (2) from a first moment to a second moment based on a probability distribution of transitions from the first action node to each of the second action nodes and a position coordinate difference between reference points in the first action node and the second action node, and partition the video frame image into a plurality of processing image areas (1) based on the active area (4) and the static area (5); An image region processing unit is configured to configure an independent image processing algorithm for each processing image region (1) and perform multi-line parallel processing to obtain a local target image (2) and a background image (3) in each processing image region (1); The image stitching unit is configured to stitch and integrate the processed local target images (2) in each processed image area (1) to form the first target image.
10. A computer-readable storage medium, characterized in that: The computer program stored therein is used to execute the method for real-time replacement of the background environment of an online video as described in any one of claims 1-7.
Citation Information
Patent Citations
Video synthesis method, model training method and related device
CN109951654A
Image background replacement method and system, electronic equipment and storage medium
CN113409188A
Picture background replacement method and device, medium and equipment
CN114399524A
Human action recognition, storage and retrieval by combining edge and cloud computing to maintain privacy
CN116110116A
Background replacement method and device, computer equipment and storage medium
CN116156092A
