Offline video background processing method, system and readable storage medium

Through the offline video background processing method, the probability distribution of the video frame image and the optical flow estimation algorithm are used to generate an intermediate background image to cover the video frame, which solves the problem of video background replacement in the existing technology that consumes a lot of computing power and time, and achieves fast and efficient Video background processing.

CN118524258BActive Publication Date: 2024-10-18HANGZHOU TINGSONG INFORMATION TECHNOLOGY CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202411000595.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-10-18
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

The existing technology consumes a lot of computing power and time in the process of replacing the video image background, and cannot achieve rapid replacement. It is especially inefficient under low hardware configuration conditions.

Method used

An offline video background processing method is proposed to reduce the need for accurate recognition and background image outline generation by acquiring video frame images, identifying target image probability distributions, generating multiple reserved areas of different sizes, generating intermediate background images and covering video frames. , using sampling time and optical flow estimation algorithms to optimize the processing process.

Benefits of technology

It achieves fast video background processing, reduces hardware configuration requirements, and improves processing efficiency and effects. Users can obtain results of different precisions by adjusting the sampling rate and retaining area levels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118524258B_ABST
    Figure CN118524258B_ABST
Patent Text Reader

Abstract

The present invention discloses an offline video background processing method, system and readable storage medium. The method comprises: acquiring an offline video and sampling according to a set rule to obtain a plurality of frames of video images; identifying a target image and counting the probability of the target image appearing at each position in the video image, generating and distributing a plurality of reserved areas of different sizes in the video image according to the position probability; selecting a target background image with the same shape and size as the video image and successively removing reserved areas of different sizes to respectively generate a plurality of intermediate background images; respectively retrieving the intermediate background images associated with the corresponding sampled video images, covering each frame of the video image with the intermediate background images, and completing the background processing of the offline video. The above-mentioned video processing implementation process does not need to process the video images of all frames, can effectively improve the video processing efficiency, and the user can flexibly adjust the accuracy of the video background processing according to the hardware configuration thereof, and has wide applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video image processing, and more specifically, to an off-line video background processing method, system and readable storage medium. Background Art

[0002] In practice, we often need to process the background of the acquired offline video, such as blurring the background environment or directly replacing it with a specific image after extracting the target image. The current common practice is to first accurately extract and separate the target image (such as human image, vehicle image) from the background in each video frame, and then merge the target image with the set background image to finally achieve background replacement of the video image.

[0003] Combined with the current advances in artificial intelligence technology, the above process requires a large amount of computing power to generate corresponding processing models based on convolutional neural networks (CNN) or fully convolutional networks (FCN), and ultimately accurately separate the target image from the original background environment image through target detection and image segmentation of video images.

[0004] Although the target image processed by the above method steps can be well integrated with the replaced background, the entire processing process requires a lot of computing power and time, and it is impossible to achieve rapid replacement of the video background environment. Summary of the invention

[0005] In view of the problem that video image background replacement in actual application requires a lot of time and computing power, the first purpose of this application is to propose an offline video background processing method, which can quickly process offline video backgrounds, with high speed and without consuming too much computing power, and can improve the problem of low efficiency of video background processing under low hardware configuration conditions; to achieve the above method, the second purpose of this application is to provide an offline video background processing system, and the third purpose is to protect a computer-readable storage medium. The specific scheme is as follows:

[0006] An offline video background processing method, comprising:

[0007] Obtain offline video and sample it according to set rules to obtain several frames of video images;

[0008] Identify a target image from a plurality of frames of the video image and count the probability of the target image appearing at each position in the video image;

[0009] Based on the probability distribution of the position of the target image in the video image, generating a plurality of reserved areas of different sizes in the video image;

[0010] A target background image having the same shape and size as the video image is selected and retention areas of different sizes are successively removed to generate multiple intermediate background images respectively;

[0011] Compare, obtain and associate and store a plurality of frames of the video images and their corresponding intermediate background images;

[0012] The offline video is divided into multiple sub-video segments based on the sampling time, and the intermediate background images associated with the sampled video images corresponding to each sub-video segment are retrieved respectively. The above intermediate background images are used to cover the video images of each frame in the sub-video segment to complete the background processing of the offline video.

[0013] Through the above technical solution, the position of the target image in the video image in each time period of the offline video can be quickly determined, and the background image contour required in each time period of the offline video can be calculated, and then the background image with the specific contour is used to cover all the video frame images contained in the offline video of the corresponding time period, so as to complete the background replacement or blurring of the offline video. The above processing process does not require accurate identification of the target image in each frame image, nor does it require the generation of a large number of accurate background image contours, which can greatly shorten the time of offline video background processing and reduce the hardware configuration required for the video background processing system. In practice, users can obtain background processing effects of different precisions by adjusting the sampling rate or the number of levels of the reserved area.

[0014] Furthermore, the offline video is obtained and sampled according to the set rules to obtain several frames of video images, including:

[0015] Sampling the offline video once according to a set time interval to obtain several frames of initial video images;

[0016] Identify a target image from the plurality of frames of initial video images and mark at least one feature point in the target image;

[0017] Compare and calculate the difference between the position coordinates of the feature points in two adjacent frames of initial video images. If the difference does not exceed a set threshold, use the already acquired initial video images as the sampled video images. If the difference exceeds the set threshold, perform additional sampling once between the frame times corresponding to the two adjacent frames of initial video images, and then re-compare and calculate the difference until the difference between the position coordinates of the feature points in the two adjacent frames of video images is less than the set threshold.

[0018] and / or,

[0019] Parse at least three adjacent frames of initial video images, obtain the position coordinates of feature points in each frame of the initial video image and connect them to generate a position change curve of the feature points. If the position change curve matches the set curve, additional sampling is performed between the frame times corresponding to the adjacent frames of the initial video image; if the position change curve does not match the set curve, the several frames of initial video images that have been obtained are used as the sampled video images.

[0020] Through the above technical solution, the probability of significant deviation in the estimated probability distribution of the position of the target image in the video image due to the excessively large video sampling time interval can be reduced, which helps to improve the accuracy of the position of the reserved areas at each level, so that the contour of the intermediate background image generated later can be more consistent with the target image, and the processed video background and the target image are more naturally combined. By identifying and judging the position change curve of the feature points in the target image, the motion trajectory of the target image within the video sampling interval can be estimated, and then the possible position of the target image in the video image can be predicted. Finally, according to the above motion trajectory and the possible position, it is decided whether to supplement the sampling. It can also improve the accuracy of the intermediate background image generated later to cover the original video background image, and improve the effect of video background processing.

[0021] Furthermore, the offline video is obtained and sampled according to the set rules to obtain several frames of video images, including:

[0022] Establish the correlation between the audio spectrum morphology and the sound source movement;

[0023] Get offline video and parse it to get the corresponding sound source audio spectrum;

[0024] Identifying the spectral form representing the sound source motion in the audio spectrum and its corresponding motion time;

[0025] Sampling the offline video once according to a set time interval to obtain several frames of initial video images;

[0026] Sub-sampling the offline video according to the motion time to obtain several frames of supplementary video images;

[0027] The several frames of video images are generated by combining the several frames of initial video images with the supplementary video images based on the sampling time.

[0028] Through the above technical solution, the audio corresponding to the offline video can be analyzed to determine the time of the sound source movement, and then the offline video corresponding to the above time can be supplemented with samples. This can reduce the probability of sampling distortion caused by the change in the probability distribution of the target image position due to the movement of the sound source, and improve the accuracy of the intermediate background image generated later.

[0029] Furthermore, identifying a target image from a plurality of frames of the video image and counting the probability of the target image appearing at each position in the video image includes:

[0030] Based on several frames of video images, the deep learning network is used to perform image segmentation and target detection on the video images;

[0031] Detect and determine the target image and its contour features according to the user's click selection operation;

[0032] Selecting set points in the target image as feature points and counting the position coordinates of each feature point in each frame of the video image;

[0033] According to the relative position relationship between each feature point and the contour feature of the target image, a plurality of associated feature points for characterizing the location of the target image are generated and stored as a three-dimensional data set of position coordinates-frame time;

[0034] Based on the above three-dimensional data set, the number of occurrences of feature points at each position in the video image is counted, and the probability of the target image appearing at each position in the video image is calculated.

[0035] Through the above technical solution, we first use several frames of sampled video images combined with a deep learning algorithm to obtain and confirm the approximate outline of the target image, and then calculate the possible positions of the target image-associated feature points in the video image based on the position distribution of the feature points in the target image in the video image, and finally obtain the number of occurrences of the feature points at each position in the video image and then calculate the probability of occurrence. The above process does not require precise clipping of the outer contour of the target image, but only needs to roughly obtain the contour of the target image, thereby ensuring that the subsequently generated intermediate background image does not cover the target image that needs to be retained, and quickly completes the background replacement of the video image, taking into account the efficiency of video background processing and the computing power of the system hardware configuration. In practice, users can adjust the accuracy of image segmentation by setting the number of iterations of the above deep learning network.

[0036] Furthermore, the generating of a plurality of intermediate background images includes:

[0037] Obtain two adjacent frames of video images and determine and generate a motion trend function of a target image in the video image based on an optical flow estimation algorithm;

[0038] Based on the motion trend function and the sampling time interval, a correction value of the reserved area in each non-sampled video image frame between two adjacent video image frames is calculated and obtained;

[0039] Adjust the shape and size of the reserved area by using the correction value and store the adjusted reserved area in association with each frame of non-sampled video image;

[0040] The corresponding reserved area is cut out from each frame of non-sampled video image to generate a plurality of the intermediate background images.

[0041] Through the above technical scheme, an optical flow estimation algorithm is used to calculate the motion trend of the target image in two adjacent frames of sampled video images and generate a motion trend function based on this, thereby generating an intermediate background image that is more suitable for each frame of non-sampled video images between two adjacent frames of sampled video images. Since the above optical flow estimation algorithm is only for two adjacent frames of sampled video images, it does not consume too much additional computing power. While ensuring the video processing efficiency, it can significantly improve the accuracy of the later intermediate background image covering the video image background, thereby improving the video background processing effect.

[0042] Furthermore, using the intermediate background image to cover each frame of the video image in the sub-video segment also includes:

[0043] The edge contour coordinates of the middle background image in the covered video image are obtained, and the image within a set range on both sides of the edge contour of the middle background image is blurred using a Gaussian blur algorithm.

[0044] Through the above technical solution, the transition between the newly generated video image background and the target image can be made more natural, thereby improving the effect of video background processing.

[0045] Furthermore, the generating of multiple intermediate background images further includes:

[0046] The optical flow direction of the video image and the feature value of the corresponding intermediate background image are stored in association;

[0047] The optical flow direction is obtained based on the optical flow estimation algorithm, and the feature value of the intermediate background image corresponding to the current frame video image is adjusted.

[0048] Through the above technical solution, when the target image in the video image moves in different directions, the characteristic values ​​of the intermediate background image, such as brightness, contrast and other parameters, will change accordingly, thereby focusing the user's vision on the target image, reducing the sense of separation between the intermediate background image and the target image from the user's subjective perception, and improving the processing effect of the video background.

[0049] An offline video background processing system, comprising:

[0050] A storage unit configured to store the offline video data and target background image data to be processed;

[0051] A video sampling unit is configured to obtain an offline video and sample it according to a set rule to obtain a plurality of frames of video images;

[0052] A probability statistics unit, configured to identify a target image from a plurality of frames of the video image and to count the probability of the target image appearing at each position in the video image;

[0053] The intermediate background image generating unit is configured to generate a plurality of reserved areas of different sizes in the video image based on the position probability distribution of the target image in the video image, select the target background image having the same shape and size as the video image and successively remove the reserved areas of different sizes to generate a plurality of intermediate background images respectively;

[0054] The video background processing unit is configured to divide the offline video into a plurality of sub-video segments based on the sampling time, respectively retrieve the intermediate background images associated with the sampled video images corresponding to each sub-video segment, and use the intermediate background images to cover each frame of the video image in the sub-video segment to complete the background processing of the offline video;

[0055] Wherein, the video sampling unit comprises:

[0056] A basic sampling subunit is configured to sample the offline video once according to a set time interval to obtain a plurality of frames of initial video images;

[0057] a feature point marking subunit, configured to identify a target image from the plurality of frames of initial video images and mark at least one feature point in the target image;

[0058] The first supplementary sampling subunit is configured to detect the difference in position coordinates of the same feature point in two adjacent frames of video images, and / or the motion trajectory of the feature point in at least three adjacent frames of video images, and determine whether to perform supplementary sampling based on the judgment of the above difference or motion trajectory, and output the video image obtained by the supplementary sampling to the video background processing unit.

[0059] Furthermore, the offline video data includes audio data and video data, and the storage unit also stores each audio spectrum morphology data and its corresponding sound source motion data;

[0060] The system further comprises:

[0061] A sound source motion determination subunit is configured to obtain an offline video and parse it to obtain a corresponding sound source audio spectrum, identify and output a spectrum form representing a sound source motion in the audio spectrum and its corresponding motion time;

[0062] A second supplementary sampling subunit is configured to perform secondary sampling on the offline video according to the motion time, obtain a plurality of frames of supplementary video images, and output the supplementary video images to the video background processing unit;

[0063] The intermediate background image generating unit comprises:

[0064] The target image motion trend determination subunit is configured to obtain two adjacent frames of video images and determine and generate a motion trend function of the target image in the video image based on an optical flow estimation algorithm;

[0065] A correction value generating unit is configured to calculate and obtain the correction value of the reserved area in each non-sampled video image frame between two adjacent video image frames based on the motion trend function and the sampling time interval;

[0066] The intermediate background image correction subunit is configured to adjust the shape and size of the reserved area by using the correction value, and remove the corresponding reserved area from each frame of non-sampled video image to generate a plurality of the intermediate background images.

[0067] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned offline video background processing method when executed by a processor.

[0068] Compared with the prior art, the present invention has the following beneficial effects:

[0069] (1) By setting rules to sample offline videos to obtain several frames of video images, the position of the target image in each period of the offline video is quickly determined, and the required background image contour in each period of the offline video is calculated. Then, the background image with a specific contour is used to cover all the video frame images contained in the offline video of the corresponding period, so that the background replacement or blurring of the offline video can be completed. The entire implementation process does not require processing of all frames of video images, which can effectively improve the video processing efficiency;

[0070] (2) The processing process does not require accurate recognition of the target image in each frame, nor does it require the generation of a large number of accurate background image contours. This can greatly shorten the time for offline video background processing and reduce the hardware configuration required for the video background processing system.

[0071] (3) By adjusting the sampling rate or the number of levels of the retained area, users can obtain background processing effects of different precisions, which is flexibly applicable to different hardware configurations. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 It is a schematic diagram of the overall process of the method of the present invention;

[0073] Figure 2 Schematic diagram of the implementation method of video sampling (I);

[0074] Figure 3 Schematic diagram of the implementation method of video sampling (II);

[0075] Figure 4 A schematic diagram of a method for sampling an offline video based on an audio spectrum;

[0076] Figure 5 A schematic diagram of supplementary sampling of offline video based on audio spectrum;

[0077] Figure 6 A schematic diagram of a method for obtaining the probability of a target image appearing at each position in a video image;

[0078] Figure 7 A schematic diagram of the relationship among the target image, the video image and the reserved area;

[0079] Figure 8 A schematic diagram of a method for optimizing and generating multiple intermediate background images according to an optical flow estimation algorithm;

[0080] Fig. 9 A schematic diagram of processing the background of an offline video;

[0081] Fig.10 This is a schematic diagram of the connection relationship of the core functional units of the system of this application.

[0082] Reference numerals: 100, storage unit; 200, video sampling unit; 300, probability statistics unit; 400, intermediate background image generation unit; 500, video background processing unit. DETAILED DESCRIPTION

[0083] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the attached Figure 1-Figure 10 Shown in.

[0084] 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.

[0085] It should be pointed out that the offline video background processing method described in the implementation mode of the present application is particularly suitable for video scenes in which the position coordinates of the target image relative to the overall video image do not change significantly or change slowly, such as teaching lecture videos, news interview videos in which the core position of the target person is relatively fixed, etc.

[0086] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0087] An offline video background processing method, such as Figure 1 As shown, it mainly includes the following steps:

[0088] S100, acquiring offline video and sampling according to a set rule to obtain a number of video frames;

[0089] S200, identifying a target image from a plurality of frames of the video image and counting the probability of the target image appearing at each position in the video image;

[0090] S300, generating a plurality of reserved areas of different sizes in the video image based on the probability distribution of the position of the target image in the video image;

[0091] S400, selecting a target background image with the same shape and size as the video image and successively removing reserved areas of different sizes to generate a plurality of intermediate background images respectively;

[0092] S500, comparing, acquiring and associating and storing a plurality of frames of the video image and their corresponding intermediate background images;

[0093] S600, dividing the offline video into multiple sub-video segments based on the sampling time, respectively retrieving the intermediate background image associated with the sampled video image corresponding to each sub-video segment, and using the intermediate background image to cover each frame of the video image in the sub-video segment to complete the background processing of the offline video.

[0094] In one embodiment, the above step S100 is as follows: Figure 2 As shown, the offline video is obtained and sampled according to the set rules to obtain several frames of video images, including:

[0095] S110, sampling the offline video once according to the set time interval to obtain several frames of initial video images. For example, the common video frame rate is 24 frames / second or 30 frames / second, then according to the set time interval, such as uniformly collecting 3 frames of video images per second as the initial video images.

[0096] S120, identify the target image from the several frames of initial video images and mark at least one feature point in the target image. In the embodiment of the present application, the target image can be identified by using a fully convolutional neural network (Fully Convolutional Network) to perform image segmentation and target detection on several frames of initial video images. After the target image is confirmed, at least one feature point in the target image is selected, such as a pixel with a specific grayscale value, or a pixel with a specific label. The above pixel point label is generated during the image segmentation and target recognition process. Its meaning is to mark the pixels in the image so that pixels belonging to the same type of object are assigned the same label. In the embodiment of the present application, the above label can be directly used as the marking information of the feature point. Preferably, the number of feature points is not less than 3 and the above feature points are not located on the same straight line, so as to determine at least one feature surface through the above at least 3 feature points.

[0097] S131, compare and calculate the difference between the position coordinates of the feature points in two adjacent frames of initial video images:

[0098] S1310, if the difference does not exceed the set threshold, using the already acquired initial video image frames as the sampled video images;

[0099] S1311, if the difference exceeds the set threshold, then supplement sampling once between the frame times corresponding to the two adjacent frames of the initial video image as a supplementary initial video image, and then execute step S131, re-compare and calculate the difference between the position coordinates of the feature points in the two adjacent frames of the initial video image, until the difference between the position coordinates of the feature points in the two adjacent frames of the video image is less than the set threshold. The time node of the above supplementary sampling is preferably the middle time point of the frame time corresponding to the current two adjacent frames of the initial video image.

[0100] The difference of the position coordinates of the feature points in the two adjacent frames of the initial video image in the above step S131, wherein the position coordinates are a two-dimensional coordinate system established based on the display screen parameters of the video image, and the minimum scale unit of the x-axis and y-axis of the above two-dimensional coordinate system is the video pixel point. For example, the resolution of 4K video is 4096*2160, and the scale lengths of the x-axis and y-axis are 4096 and 2160 respectively. Through the above scheme, the displacement direction and distance of the feature points in the two adjacent frames of the initial video image, that is, the difference, can be intuitively calculated.

[0101] During the video image sampling process, the position of the person or object corresponding to the target image may occasionally change dramatically. The above step S131 can reduce the probability of a significant deviation in the estimated probability distribution of the target image's position in the video image due to a large video sampling time interval, thereby helping to improve the accuracy of the positions of the reserved areas at each level.

[0102] The above steps S1310-S1311 mainly determine whether to supplement sampling based on the position change of the feature points in the target image. In practice, there are still certain limitations. For example, when the sampling time interval of the video image is long, the position coordinates of the person or object corresponding to the target image may change between two adjacent sampling time nodes, but the position coordinates of the target image at the two sampling time nodes before and after remain unchanged. In order to reduce or avoid the occurrence of sampling omissions in the above situation, in another embodiment, Figure 3 As shown, the offline video is obtained and sampled according to the set rules to obtain several frames of video images, including:

[0103] S110, sampling the offline video once according to a set time interval to obtain a plurality of frames of initial video images;

[0104] S120, identifying a target image from the plurality of frames of initial video images and marking at least one feature point in the target image;

[0105] S132, parsing at least three adjacent initial video images, obtaining the position coordinates of feature points in each frame of the initial video image and connecting them to generate a position change curve of the feature points:

[0106] S1320, if the position change curve matches the set curve, additional sampling is performed once between the frame times corresponding to the initial video images of adjacent frames;

[0107] S1321: If the position change curve does not match the set curve, several frames of initial video images that have been acquired are used as sampled video images.

[0108] In the lecture teaching video, the position change curve of the feature point is normally a closed loop curve. For example, after the lecture teacher makes a certain action, his body will return to the initial position state. Therefore, in the above steps S132 and S1320, the change curve and the set curve include the shape of the curve and the size of the area enclosed by the curve. The larger the area, the larger the range of the lecture teacher's activities. When it is detected that the curve shape is significantly different from the setting or the plane area enclosed by the closed loop curve is too large, the number of sampling is increased.

[0109] The above two sampling implementation methods can be performed separately or in combination. For example, after the additional sampling in step S131, it is judged in step S132 to determine whether additional sampling is needed according to the judgment result.

[0110] The several frames of video images obtained by the above implementation can adapt to the situation where the position coordinates of the target image change in a short period of time, so that the contour of the intermediate background image generated later is more consistent with the target image, and the processed video background and the target image are combined more naturally.

[0111] Since the video background processing method described in this application is mainly for offline videos, and usually, the audio and video data of offline videos are stored separately and independently, in practice, the efficiency of audio recognition and processing under the same computing power configuration conditions is much faster than the efficiency of video image recognition. At the same time, it is also found in practice that when the voice of the person corresponding to the target image changes, the action state will often change accordingly. For example, the voice and body movements of the lecturer are basically changed synchronously when teaching the course. Based on this, in a specific embodiment, the acquisition of offline video described in step S100 of this application and sampling according to the set rules to obtain several frames of video images, combined with Figure 4 and Figure 5 As shown, it also includes:

[0112] S140, establishing and storing an association relationship between the audio spectrum form and the sound source action, for example, associating and storing the audio spectrum corresponding to the voice "Please welcome this student" with the arm extension action and head deflection action of the sound source.

[0113] S141, acquiring an offline video and parsing it to obtain a corresponding sound source audio spectrum.

[0114] S142, identifying the spectral form characterizing the movement of the sound source in the audio spectrum and its corresponding movement time. For example, by combining the spectral form with the Doppler effect of the sound frequency, it can be determined whether the sound source is moving. The prior art has disclosed an acoustic signal analysis algorithm based on the Doppler effect, wherein the Doppler effect is one of the important principles in acoustic signal analysis. The movement state of the sound source is inferred by measuring the frequency of the sound wave, and its specific implementation process will not be repeated here.

[0115] The above steps S210 and S220 can be directly implemented through supporting audio analysis software.

[0116] S143, sampling the offline video once according to the set time interval to obtain several frames of initial video images.

[0117] S144, performing secondary sampling on the offline video according to the motion time to obtain a plurality of frames of supplementary video images, wherein the secondary sampling is carried out at a specific time interval or video frame interval, and the sampling range covers the time period corresponding to the spectrum representing the motion of the sound source in the audio spectrum.

[0118] S145 , combining several frames of initial video images with the supplementary video images based on the sampling time to generate the several frames of video images.

[0119] The above steps can be found in Figure 5 , the upper part is the audio spectrum diagram, and the lower part is the video sampling points, where the circular sampling points are marked as primary sampling points and the vertical strip sampling points are marked as secondary sampling points.

[0120] The above technical solution can analyze the audio corresponding to the offline video, determine the time of the sound source movement, and then perform supplementary sampling on the offline video corresponding to the above time. This can reduce the probability of sampling distortion caused by the change in the probability distribution of the target image position due to the movement of the sound source, and improve the accuracy of the intermediate background image generated later.

[0121] Step S200, identifying a target image from a plurality of frames of the video image and counting the probability of the target image appearing at each position in the video image, combining Figure 6 and Figure 7 As shown, further comprising:

[0122] S210, performing image segmentation and target detection on the video image through a deep learning network based on a plurality of video image frames.

[0123] S220, detecting and determining the target image and its contour features according to the user's click selection operation.

[0124] S230, select the set points in the target image as feature points and count the position coordinates of each feature point in each frame of video image. In practical applications, the above feature points are configured as sites that are easier to identify during image recognition, such as images of human eyes, nose and other parts.

[0125] S240, based on the relative positional relationship between each feature point and the target image contour feature, a plurality of associated feature points for characterizing the location of the target image are generated and stored as a three-dimensional data set of position coordinates-frame time. The data stored in the three-dimensional data set is used to record the position coordinates of each feature point in each frame of the video image, so as to facilitate the later statistical distribution of each feature point.

[0126] The above-mentioned associated feature points are locations calculated by a specific algorithm based on the position coordinates of the above-mentioned feature points. For example, the pupils and nose tip of the target person are selected as feature points. After obtaining the original position relationship between the above-mentioned three feature points and the facial contour of the target person, the position of the edge of the facial contour of the target person can be calculated based on the real-time position relationship of the above-mentioned three feature points. Similarly, multiple associated feature points can be evenly generated in the area enclosed by the above-mentioned facial contour edge.

[0127] S250, based on the three-dimensional data set, counting the number of occurrences of feature points at each position in the video image, and calculating the probability of the target image appearing at each position in the video image.

[0128] Following the above step S250, step S300 generates a plurality of reserved areas of different sizes in the video image such as Figure 7 As shown, according to the different occurrence probabilities of the target image at each position in the video image, multi-level reserved areas of different sizes are generated.

[0129] It can be seen from the above steps that in the implementation mode of the present application, the approximate outline of the target image is first obtained and confirmed by using a plurality of frames of sampled video images in combination with a deep learning algorithm, and then the possible positions of the associated feature points of the target image in the video image are calculated based on the position distribution of the feature points in the target image in the video image, and finally the number of occurrences of the feature points at each position in the video image is obtained and then the probability of occurrence is calculated. The above process does not require precise cutting of the outer contour of the target image, but only requires roughly obtaining the contour of the target image, thereby ensuring that the subsequently generated intermediate background image does not cover the target image that needs to be retained, and quickly completing the background replacement of the video image, taking into account the efficiency of video background processing and the tolerance of the system hardware computing power.

[0130] In practice, users can adjust the accuracy of image segmentation by setting the number of iterations of the above deep learning network. In theory, the more iterations, the higher the accuracy of image segmentation, but the more time and computing power are consumed.

[0131] For offline videos without image switching, the position of the target image in the video image will not suddenly change. Therefore, in order to improve the accuracy of the later intermediate background image covering the video image background and improve the video background processing effect, multiple intermediate background images are generated in step S400, such as Figure 8 As shown, specifically including:

[0132] S410, obtaining two adjacent frames of video images and determining and generating a motion trend function of a target image in the video image based on an optical flow estimation algorithm, wherein the motion trend function is a function that characterizes the motion trajectory of the target image. Since the optical flow estimation algorithm has many applications in video processing, its specific principle will not be described here.

[0133] S420, based on the above motion trend function and the sampling time interval, calculate and obtain the correction value of the reserved area in each non-sampled video image frame between two adjacent video image frames, that is, the actual possible position of the video image. For example, the motion trend function of feature point A in the Y-axis direction of the two-dimensional coordinate system is Y A =0.7T A +13, of which T A is the frame time, then when we know T A The value of can be used to calculate the new coordinate of feature point A in the Y-axis direction.

[0134] S430: adjusting the shape and size of the reserved area by using the correction value and storing the adjusted reserved area in association with each frame of non-sampled video image.

[0135] S440, removing the corresponding reserved area from each frame of the non-sampled video image to generate a plurality of the intermediate background images.

[0136] The above scheme uses an optical flow estimation algorithm to calculate the motion trend of the target image in two adjacent frames of sampled video images and generates a motion trend function based on this, thereby generating an intermediate background image that is more suitable for each frame of non-sampled video images between two adjacent frames of sampled video images. Since the above optical flow estimation algorithm is only for two adjacent frames of sampled video images, it does not consume too much additional computing power, thereby ensuring the video processing efficiency while significantly improving it.

[0137] In order to make the transition between the newly generated video image background and the target image more natural and improve the effect of video background processing, when the intermediate background image is used to cover each frame of the video image in the sub-video segment, it also includes:

[0138] S450, obtaining the edge contour coordinates of the middle background image in the covered video image, and using a Gaussian blur algorithm to perform blur processing on the image within a set range on both sides of the edge contour of the middle background image.

[0139] In order to reduce the sense of separation between the intermediate background image and the target image from the user's subjective perception and improve the processing effect of the video background, generating multiple intermediate background images also includes the following steps:

[0140] S460, storing the optical flow direction of the video image and the feature value of the corresponding intermediate background image in association;

[0141] S470, obtaining the optical flow direction based on the optical flow estimation algorithm, and adjusting the feature value of the intermediate background image corresponding to the current frame video image.

[0142] The characteristic values ​​of the intermediate background image in the above steps include, but are not limited to, parameters of brightness, contrast, hue, and color. By adjusting the above parameters, slight guidance of the user's attention can be achieved.

[0143] like Fig. 9 The figure shows the implementation diagram of step S600. Each sub-video segment respectively retrieves the intermediate background image associated with the corresponding sampled video image, and uses the intermediate background image to cover each frame of the video image in the sub-video segment, thereby finally completing the background processing of the offline video.

[0144] To implement the above-mentioned offline video background processing method, the present application also proposes an offline video background processing system, such as Fig.10 , mainly includes: a storage unit 100, a video sampling unit 200, a probability statistics unit 300, an intermediate background image generation unit 400 and a video background processing unit 500.

[0145] The storage unit 100 is configured to store the offline video data to be processed, the target background image data and the related intermediate temporarily generated data. The offline video data is divided into video data and audio data, which are stored separately. The target background image refers to a picture with specific information and shape and size.

[0146] The video sampling unit 200 is configured to obtain offline videos and sample them according to a set rule to obtain a plurality of frames of video images. In detail, the video sampling unit 200 at least includes a basic sampling subunit, a feature point marking subunit and a first supplementary sampling subunit.

[0147] The basic sampling subunit is configured to sample the offline video once according to a set time interval, obtain several frames of initial video images and output them to the storage unit 100 for temporary storage, and the above sampling time interval is set to an integer multiple of the interval between two adjacent frames of video images. The feature point marking subunit is configured to identify the target image from the several frames of initial video images and mark at least one feature point in the target image. In practical applications, the above feature point marking subunit is configured with an image recognition module to identify certain site images with specific parameters in the video image, such as human eye images. The first supplementary sampling subunit is configured to detect the position coordinate difference of the same feature point in two adjacent frames of video images, and / or the motion trajectory of the feature point in at least three adjacent frames of video images, and determine whether to supplement the sampling based on the judgment of the above difference or motion trajectory, and temporarily store the video image obtained by the supplementary sampling and output it to the video background processing unit 500.

[0148] The probability statistics unit 300 is configured to identify a target image from a plurality of frames of the video image and to count the probability of the target image appearing at each position in the video image. The intermediate background image generation unit 400 is configured to generate a plurality of reserved areas of different sizes in the video image based on the probability distribution of the position of the target image in the video image, such as Figure 7 As shown, a target background image having the same shape and size as the video image is selected and retained areas of different sizes are successively removed to generate multiple intermediate background images.

[0149] Combination Fig. 9 As shown, the video background processing unit 500 is configured to divide the offline video into multiple sub-video segments based on the sampling time, respectively retrieve the intermediate background image associated with the sampled video image corresponding to each sub-video segment, and use the above-mentioned intermediate background image to cover each frame of the video image in the sub-video segment to complete the background processing of the offline video.

[0150] In order to capture the position change of the target image at a more accurate time, in the embodiment of the present application, the storage unit 100 also stores various audio spectrum morphological data and its corresponding sound source motion data. The above audio spectrum morphological data is stored in the storage unit 100 in the form of a data set.

[0151] The offline video background processing system described in the present application also includes a sound source motion determination subunit and a second supplementary sampling subunit. The sound source motion determination subunit is configured to obtain the offline video and parse it to obtain the corresponding sound source audio spectrum, identify and output the spectral form representing the sound source motion in the audio spectrum and its corresponding motion time, and the above motion time corresponds to the frame time of the video image. Figure 5 As shown, the second supplementary sampling subunit is configured to perform secondary sampling on the offline video according to the motion time, obtain several frames of supplementary video images, and output the supplementary video images to the video background processing unit 500.

[0152] In order to improve the accuracy of the intermediate background image, the intermediate background image generating unit 400 further includes a target image motion trend determining subunit, a correction value generating unit and an intermediate background image correcting subunit.

[0153] The target image motion trend determination subunit is configured to obtain two adjacent frames of video images and determine and generate a motion trend function of the target image in the video image based on an optical flow estimation algorithm. The correction value generation unit is configured to calculate and obtain the correction value of the reserved area in each frame of non-sampled video image between two adjacent frames of video images based on the above-mentioned motion trend function and the sampling time interval. The intermediate background image correction subunit is configured to adjust the shape and size of the reserved area by the correction value, and remove the corresponding reserved area from each frame of non-sampled video image to generate a plurality of the intermediate background images.

[0154] Finally, the present application also proposes a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the offline video background processing method as described above are implemented. The computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., includes a number of instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0155] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. An offline video background processing method, characterized in that: include: Obtain offline video and sample it according to set rules to obtain several frames of video images; Identify a target image from a plurality of frames of the video image and count the probability of the target image appearing at each position in the video image; Based on the probability distribution of the position of the target image in the video image, generating a plurality of reserved areas of different sizes in the video image; A target background image having the same shape and size as the video image is selected and retention areas of different sizes are successively removed to generate multiple intermediate background images respectively; Compare, obtain and associate and store a plurality of frames of the video images and their corresponding intermediate background images; The offline video is divided into a plurality of sub-video segments based on the sampling time, and the intermediate background images associated with the sampled video images corresponding to the sub-video segments are retrieved respectively, and the above intermediate background images are used to cover the video images of each frame in the sub-video segment to complete the background processing of the offline video; The step of identifying a target image from a plurality of frames of the video image and counting the probability of the target image appearing at each position in the video image includes: Based on several frames of video images, the deep learning network is used to perform image segmentation and target detection on the video images; Detect and determine the target image and its contour features according to the user's click selection operation; Selecting set points in the target image as feature points and counting the position coordinates of each feature point in each frame of the video image; According to the relative position relationship between each feature point and the contour feature of the target image, a plurality of associated feature points for representing the location of the target image are generated and stored as a three-dimensional data set of position coordinates-frame time; Based on the three-dimensional data set, the number of occurrences of feature points at each position in the video image is counted, and the probability of the target image appearing at each position in the video image is calculated; The generating of a plurality of intermediate background images comprises: Obtain two adjacent frames of video images and determine and generate a motion trend function of a target image in the video image based on an optical flow estimation algorithm; Based on the motion trend function and the sampling time interval, a correction value of the reserved area in each non-sampled video image frame between two adjacent video image frames is calculated and obtained; Adjust the shape and size of the reserved area by using the correction value and store the adjusted reserved area in association with each frame of non-sampled video image; Cut out the corresponding reserved area from each frame of non-sampled video image to generate a plurality of intermediate background images; The generating of a plurality of intermediate background images further comprises: The optical flow direction of the video image and the feature value of the corresponding intermediate background image are stored in association; The optical flow direction is obtained based on the optical flow estimation algorithm, and the feature value of the intermediate background image corresponding to the current frame video image is adjusted.

2. The offline video background processing method according to claim 1, characterized in that: Get offline video and sample several frames of video images according to the set rules, including: Sampling the offline video once according to a set time interval to obtain several frames of initial video images; Identify a target image from the plurality of frames of initial video images and mark at least one feature point in the target image; Compare and calculate the difference between the position coordinates of the feature points in two adjacent frames of initial video images. If the difference does not exceed a set threshold, use the already acquired frames of initial video images as the sampled video images; if the difference exceeds the set threshold, perform additional sampling once between the frame times corresponding to the two adjacent frames of initial video images, and then re-compare and calculate the difference until the difference between the position coordinates of the feature points in the two adjacent frames of video images is less than the set threshold; and / or Parse at least three adjacent frames of initial video images, obtain the position coordinates of feature points in each frame of the initial video image and connect them to generate a position change curve of the feature points. If the position change curve matches the set curve, additional sampling is performed between the frame times corresponding to the adjacent frames of the initial video image; if the position change curve does not match the set curve, the several frames of initial video images that have been obtained are used as the sampled video images.

3. The offline video background processing method according to claim 1, characterized in that: Get offline video and sample several frames of video images according to the set rules, including: Establish the correlation between the audio spectrum morphology and the sound source movement; Get offline video and parse it to get the corresponding sound source audio spectrum; Identifying the spectral form representing the sound source motion in the audio spectrum and its corresponding motion time; Sampling the offline video once according to a set time interval to obtain several frames of initial video images; Sub-sampling the offline video according to the motion time to obtain several frames of supplementary video images; The several frames of video images are generated by combining the several frames of initial video images with the supplementary video images based on the sampling time.

4. The offline video background processing method according to claim 1, characterized in that: Using the intermediate background image to cover each frame of the video image in the sub-video segment also includes: The edge contour coordinates of the middle background image in the covered video image are obtained, and the image within a set range on both sides of the edge contour of the middle background image is blurred using a Gaussian blur algorithm.

5. An offline video background processing system, characterized in that: include: A storage unit (100) configured to store offline video data to be processed and target background image data; A video sampling unit (200) is configured to obtain an offline video and sample it according to a set rule to obtain a plurality of frames of video images; A probability statistics unit (300) is configured to identify a target image from a plurality of frames of video images and to count the probability of the target image appearing at each position in the video image; wherein identifying a target image from a plurality of frames of video images and to count the probability of the target image appearing at each position in the video image comprises: Based on several frames of video images, the deep learning network is used to perform image segmentation and target detection on the video images; Detect and determine the target image and its contour features according to the user's click selection operation; Selecting set points in the target image as feature points and counting the position coordinates of each feature point in each frame of the video image; According to the relative position relationship between each feature point and the contour feature of the target image, a plurality of associated feature points for representing the location of the target image are generated and stored as a three-dimensional data set of position coordinates-frame time; Based on the three-dimensional data set, the number of occurrences of feature points at each position in the video image is counted, and the probability of the target image appearing at each position in the video image is calculated; An intermediate background image generating unit (400) is configured to generate a plurality of reserved areas of different sizes in the video image based on the position probability distribution of the target image in the video image, select a target background image of the same shape and size as the video image and successively remove the reserved areas of different sizes to generate a plurality of intermediate background images respectively; The video background processing unit (500) is configured to divide the offline video into a plurality of sub-video segments based on the sampling time, respectively retrieve the intermediate background image associated with the sampled video image corresponding to each sub-video segment, and use the intermediate background image to cover each frame of the video image in the sub-video segment to complete the background processing of the offline video; Wherein, the video sampling unit (200) comprises: A basic sampling subunit is configured to sample the offline video once according to a set time interval to obtain a plurality of frames of initial video images; a feature point marking subunit, configured to identify a target image from the plurality of frames of initial video images and mark at least one feature point in the target image; A first supplementary sampling subunit is configured to detect a position coordinate difference of a same feature point in two adjacent frames of video images, and / or a motion trajectory of a feature point in at least three adjacent frames of video images, and determine whether to perform supplementary sampling based on a determination of the above-mentioned difference or motion trajectory, and output the video image obtained by the supplementary sampling to the video background processing unit (500); The offline video data includes audio data and video data, and the storage unit (100) also stores various audio spectrum morphology data and corresponding sound source motion data; The system further comprises: A sound source motion determination subunit is configured to obtain an offline video and parse it to obtain a corresponding sound source audio spectrum, identify and output a spectrum form representing a sound source motion in the audio spectrum and its corresponding motion time; A second supplementary sampling subunit is configured to perform secondary sampling on the offline video according to the motion time, obtain a plurality of frames of supplementary video images, and output the supplementary video images to the video background processing unit (500); The intermediate background image generating unit (400) comprises: The target image motion trend determination subunit is configured to obtain two adjacent frames of video images and determine and generate a motion trend function of the target image in the video image based on an optical flow estimation algorithm; A correction value generating unit is configured to calculate and obtain the correction value of the reserved area in each non-sampled video image frame between two adjacent video image frames based on the motion trend function and the sampling time interval; The intermediate background image correction subunit is configured to adjust the shape and size of the reserved area by the correction value, associate the adjusted reserved area with each frame of non-sampled video image and store it, and remove the corresponding reserved area from each frame of non-sampled video image to generate a plurality of the intermediate background images; The step of generating a plurality of intermediate background images further includes: The optical flow direction of the video image and the feature value of the corresponding intermediate background image are stored in association; The optical flow direction is obtained based on the optical flow estimation algorithm, and the feature value of the intermediate background image corresponding to the current frame video image is adjusted.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the offline video background processing method as described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Image processing method, image synthesis method and related device

    CN111080656A

  • Image background replacement method, device and equipment and storage medium

    CN111292337A

  • Video processing method and device, video display method and device, and storage medium

    CN111556278A

  • Image processing method and device, electronic equipment and storage medium

    CN112884664A

  • Video processing method and device

    CN116193193A