Video frame processing method, device, electronic device and storage medium

By obtaining the segmented image position information in the previous video frame, determining and expanding the image area of ​​interest, and inputting it into the image segmentation network, it solves the problem of low video image segmentation accuracy and improves segmentation accuracy and prediction of edge pixels. accuracy.

CN113706555BActive Publication Date: 2024-09-06BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110926912.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-12
Publication Date
2024-09-06
Estimated Expiration
2041-08-12

AI Technical Summary

Technical Problem

In the process of video image segmentation, the existing technology has low segmentation accuracy, especially the inaccurate prediction of edge pixels, which results in low image segmentation accuracy when the segmented object occupies a relatively small proportion in the video frame.

Method used

By obtaining the segmented image position information in the previous video frame, determine the image area of ​​interest, and input it into the image segmentation network, and perform area expansion processing to enlarge the proportion of the segmented object in the video frame, thereby improving segmentation accuracy. Rate.

Benefits of technology

It improves the accuracy of image segmentation, especially when the segmented object occupies a relatively small proportion in the video frame, and enhances the prediction accuracy of edge pixels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113706555B
    Figure CN113706555B
Patent Text Reader

Abstract

The present disclosure discloses a video frame processing method, device, electronic device and storage medium, belonging to the field of video processing technology. The method includes: obtaining a first video frame of a video, the first video frame includes an object to be segmented; obtaining the position information of a first segmented image in a second video frame of the video, the second video frame is a video frame before the first video frame, and the first segmented image is: an image obtained by performing image segmentation on the object to be segmented in the second video frame; based on the position information of the first segmented image, determining an image region of interest in the first video frame, wherein the image region of interest includes an image region of the object to be segmented; inputting the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame. The present disclosure at least solves the problem of low segmentation accuracy in the process of video image segmentation processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of video processing, and in particular to a video frame processing method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of electronic technology, electronic devices such as mobile phones and tablet computers have become popular and indispensable tools in people's daily lives. People can use the cameras of electronic devices to shoot videos, such as video recording and video calls. Among them, in order to meet the needs of users, electronic devices can use image segmentation technology to segment the local image of each video frame in the video, such as image segmentation for cutting out or background replacement, etc.

[0003] At present, in the process of obtaining the first segmented image (such as the face image area in a video call, etc.) from a video through image segmentation technology, the video frame is usually input into the segmentation network to extract features of the video frame, and then the extracted features are used to predict the category information of each pixel point to achieve the segmentation of the first segmented image. However, when the first segmented image accounts for a small proportion of the video frame, errors may occur in the prediction of the category information of the pixel points, especially the prediction of the edge pixels of the first segmented image, resulting in a low segmentation accuracy. Summary of the invention

[0004] The purpose of the embodiments of the present disclosure is to provide a video frame processing method, device, electronic device and storage medium to solve the problem of low segmentation accuracy in the current video image segmentation processing process.

[0005] The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a video frame processing method is provided, the method comprising:

[0007] Acquire a first video frame of a video, wherein the first video frame includes an object to be segmented;

[0008] Acquire position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is: an image obtained by performing image segmentation on the object to be segmented in the second video frame;

[0009] Determine an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented;

[0010] The image of the image region of interest is input into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame.

[0011] In one embodiment, determining the image region of interest in the first video frame based on the position information of the first segmented image includes:

[0012] Acquire a first image region in the first video frame, the position information of which is the same as the position information of the first segmented image;

[0013] Performing region expansion processing on the first image region in the first video frame to obtain a second image region;

[0014] The second image region is determined as an image region of interest.

[0015] In one embodiment, before performing region expansion processing on the first image region in the first video frame to obtain the second image region, the method further includes:

[0016] Obtaining a comparison result between a first boundary of the first segmented image and a second boundary of the second video frame, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; the comparison result is used to indicate whether the first boundary of the first segmented image and the second boundary of the second video frame coincide with each other;

[0017] The performing region expansion processing on the first image region in the first video frame includes:

[0018] When the comparison result indicates that the first boundary coincides with the second boundary, extending the boundary of the first image area to the boundary of the first video frame in the preset direction;

[0019] When the comparison result indicates that the first boundary and the second boundary do not overlap, the boundary of the first image area is expanded in the preset direction according to a preset ratio.

[0020] In one embodiment, the second video frame is a video frame preceding the first video frame;

[0021] The obtaining the position information of the first segmented image in the second video frame of the video includes:

[0022] Acquire the number of the objects to be segmented in the first video frame and the number of the objects to be segmented in the second video frame;

[0023] When the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame, position information of the first segmented image in the second video frame of the video is obtained.

[0024] In one embodiment, after inputting the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame, the method further includes:

[0025] Obtaining position information of the second segmented image in the first video frame;

[0026] Replacing the image of the first video frame with a preset image to generate a third video frame;

[0027] The image in the third image area of ​​the third video frame is replaced with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

[0028] In one embodiment, after inputting the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame, the method further includes:

[0029] The position information of the second segmented image in the first video frame is saved.

[0030] According to a second aspect of an embodiment of the present disclosure, a video frame processing device is provided, including:

[0031] A video frame acquisition module is configured to acquire a first video frame of a video, wherein the first video frame includes an object to be segmented;

[0032] A first position information acquisition module is configured to acquire position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is an image obtained by performing image segmentation on the object to be segmented in the second video frame;

[0033] an image region determination module, configured to determine an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented;

[0034] The segmentation module is configured to input the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame.

[0035] In one embodiment, the image area determination module includes:

[0036] An image region acquisition unit is configured to acquire a first image region in the first video frame whose position information is the same as that of the first segmented image;

[0037] an expansion unit, configured to perform region expansion processing on the first image region in the first video frame to obtain a second image region;

[0038] The image region determining unit is configured to determine the second image region as an image region of interest.

[0039] In one embodiment, the device further comprises:

[0040] a comparison module, configured to obtain a comparison result between a first boundary of the first segmented image and a second boundary of the second video frame, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; and the comparison result is used to indicate whether the first boundary of the first segmented image and the second boundary of the second video frame coincide with each other;

[0041] The expansion unit comprises:

[0042] a first expansion subunit, configured to expand the boundary of the first image area to the boundary of the first video frame in the preset direction when the comparison result indicates that the first boundary coincides with the second boundary;

[0043] The second expansion subunit is configured to expand the boundary of the first image area in the preset direction according to a preset ratio when the comparison result indicates that the first boundary and the second boundary do not overlap.

[0044] In one embodiment, the second video frame is a video frame preceding the first video frame;

[0045] The first location information acquisition module includes:

[0046] a quantity determining unit, configured to obtain the quantity of the objects to be segmented in the first video frame and the quantity of the objects to be segmented in the second video frame;

[0047] The position information acquisition unit is configured to acquire position information of the first segmented image in the second video frame of the video when the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame.

[0048] In one embodiment, the device further comprises:

[0049] A second position information acquisition module is configured to acquire position information of the second segmented image in the first video frame;

[0050] An image replacement module, configured to replace the image of the first video frame with a preset image to generate a third video frame;

[0051] The image pasting module is configured to replace the image in the third image area of ​​the third video frame with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

[0052] In one embodiment, the device further comprises:

[0053] The position information saving module is configured to save the position information of the second segmented image in the first video frame.

[0054] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, which may include:

[0055] processor;

[0056] a memory for storing instructions executable by the processor;

[0057] The processor is configured to execute the instructions to implement the video frame processing method as shown in any one of the embodiments of the first aspect.

[0058] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to implement a video frame processing method as shown in any one of the embodiments of the first aspect.

[0059] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes a computer program stored in a readable storage medium, and at least one processor of a device reads and executes the computer program from the storage medium, so that the device executes the video frame processing method shown in any one of the embodiments of the first aspect.

[0060] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0061] In the disclosed embodiment, by obtaining the position information of the segmented image in the second video frame before the first video frame to be processed, and then determining the image region of interest in the first video frame based on the obtained position information of the segmented image, and then using the image of the image region of interest as the input of the segmentation network, the segmented image in the first video is obtained. In this way, through the video frame processing method of the embodiment of the present application, the image input to the segmentation network is a local image of the first video frame including the segmented object. Compared with inputting the first video frame to the segmentation network, the proportion of the segmented object in the image input to the segmentation network can be magnified in image segmentation, thereby improving the accuracy of image segmentation, especially when the proportion of the segmented object in the first video frame is small.

[0062] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0064] Figure 1 is a flowchart of a video frame processing method according to an exemplary embodiment;

[0065] Figure 2 is a schematic diagram of a video frame according to an exemplary embodiment;

[0066] Figure 3 is a schematic diagram showing a video frame including a first image area according to an exemplary embodiment;

[0067] Figure 4 is a schematic diagram showing a video frame including a second image area according to an exemplary embodiment;

[0068] Figure 5 is a schematic diagram of an image of an image region of interest according to an exemplary embodiment;

[0069] Figure 6 is a structural block diagram of a video frame processing device according to an exemplary embodiment;

[0070] Figure 7 is a structural block diagram of a computing device according to an exemplary embodiment. DETAILED DESCRIPTION

[0071] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0072] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0073] See also Figure 1 , is a flowchart of a video frame processing method according to an exemplary embodiment, the method is applied to an electronic device. Figure 1 As shown, the video frame processing method may specifically include the following steps:

[0074] Step 101: Acquire a first video frame of a video, wherein the first video frame includes an object to be segmented;

[0075] Step 102: obtaining position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is an image obtained by performing image segmentation on the object to be segmented in the second video frame;

[0076] Step 103: determining an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented;

[0077] Step 104: input the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame.

[0078] Based on this, by obtaining the position information of the segmented image in the second video frame before the first video frame to be processed, and then based on the obtained position information of the segmented image, determining the image region of interest in the first video frame, and then using the image of the image region of interest as the input of the segmentation network, the segmented image in the first video is obtained. In this way, through the video frame processing method of the embodiment of the present application, the image input to the segmentation network is a local image of the first video frame including the segmentation object. Compared with inputting the first video frame into the segmentation network, the proportion of the segmentation object in the image input to the segmentation network can be enlarged in image segmentation, thereby improving the accuracy of image segmentation, especially when the proportion of the segmentation object in the first video frame is small.

[0079] The above steps are described in detail below:

[0080] In the above step 101, the electronic device uses the current video frame to be processed as the first video frame during the process of segmenting the video.

[0081] The first video frame may be any video frame except the first video frame in the video.

[0082] In addition, the above-mentioned object to be segmented may be an image of any one or more objects in the first video frame, and the objects may be portraits, animal images, building images or plant images, and so on.

[0083] It should be noted that the above video may be a recorded video; or, the above video may be a video in a video call, then, the above first video frame may be a video frame most recently captured and transmitted by the electronic device.

[0084] For example, during a video call, the electronic device obtains the latest captured video frame of the call video as the first video frame. Figure 2 The video frames shown in the figure are taken, and the portrait in the first video frame is taken as the object to be segmented.

[0085] In the above step 102, when the electronic device needs to perform image segmentation processing on the above first video frame, the electronic device can obtain the position information of the first segmented image of the second video frame.

[0086] The second video frame may be any video frame in the video that is before the first video frame and includes the object to be segmented.

[0087] Specifically, the second video frame is a video frame preceding the first video frame;

[0088] The obtaining the position information of the first segmented image in the second video frame of the video may include:

[0089] Acquire the number of the objects to be segmented in the first video frame and the number of the objects to be segmented in the second video frame;

[0090] When the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame, position information of the first segmented image in the second video frame of the video is obtained.

[0091] Based on this, by comparing the number of objects to be segmented in the first video frame to be segmented and the number of objects to be segmented in the previous video frame, and obtaining the position information of the first segmented image in the previous frame only when the number is the same, the above-mentioned image region of interest is determined, that is, only in the video frame to be segmented in which the number of objects to be segmented is the same as the number of objects to be processed in the previous video frame, image segmentation is achieved by determining the image region of interest, thereby reducing the possibility of inaccurate determination of the image region of interest due to large differences between the image of the video frame to be segmented and the previous video frame.

[0092] Of course, when the number of objects to be segmented in the first video frame is different from the number of objects to be segmented in the second video frame, the electronic device can directly input the first video frame into the segmentation network for image segmentation processing.

[0093] For example, when the electronic device obtains Figure 2 In the case of the first video frame shown, the electronic device obtains the previous video frame of the first video frame and compares whether the number of portraits in the two is the same. If they are the same, the electronic device obtains the position information of the segmented image of the previous video frame of the first video frame to further determine the image area of ​​interest in the first video frame; otherwise, the first video frame is input into the image segmentation network for image segmentation processing.

[0094] In addition, the above-mentioned first segmented image can be an image obtained by performing image segmentation on the above-mentioned object to be segmented in the second video frame, that is, before the above-mentioned step 102, the above-mentioned method can also include: performing image segmentation processing on the second video frame to obtain a segmented image of the above-mentioned object to be segmented in the second video frame (that is, the first segmented image).

[0095] It should be noted that the above-mentioned acquisition of the position information of the first segmented image may be that the electronic device uses the coordinate information of all pixel points covered by the first segmented image in the second video frame as the position information of the above-mentioned first segmented image; or, it may be that the coordinate information of the pixel points through which the boundary of the first segmented image passes in the second video frame is used as the position information of the above-mentioned first segmented image.

[0096] Of course, the above-mentioned acquisition of the position information of the first segmented image can also be that the electronic device first determines the image area including the above-mentioned first segmented image in the second video frame, and then uses the coordinate information of all pixel points covered by the determined image area in the second video frame as the position information of the above-mentioned first segmented image, or uses the coordinate information of the pixel points through which the boundary of the determined image area passes in the second video frame as the position information of the above-mentioned first segmented image.

[0097] For example, the electronic device may obtain Figure 2The segmented image (i.e., the first segmented image) of the previous video frame (i.e., the second video frame) of the first video frame shown in FIG. 1 is used to locate the segmented image of the previous video frame (i.e., the second video frame) in the second video frame. Figure 3 The rectangular image area 31 shown includes a first segmented image, and the coordinate information of the boundary pixel points of the rectangular image area 31 is used as the position information of the above-mentioned first segmented image, wherein the outermost pixel points of the first segmented image in the up, down, left and right directions can be located on the boundary of the rectangular image area 31, that is, the rectangular image area 31 is located by the outermost pixel points of the first segmented image in the up, down, left and right directions.

[0098] In the above step 103, after the electronic device acquires the position information of the above first segmented image, the electronic device may determine the image region of interest in the first video frame based on the position information of the first segmented image.

[0099] The determining of the region of interest (ROI) in the first video frame based on the position information of the first segmented image may be to determine the image region in the first video frame with the same position information as the first segmented image as the region of interest. Figure 3 After the rectangular image area 31 shown, the electronic device can determine the image area in the first video frame that has the same pixels as the rectangular image area 31 as the more interesting image area.

[0100] Alternatively, the above step 103 may include:

[0101] Acquire a first image region in the first video frame, the position information of which is the same as the position information of the first segmented image;

[0102] Performing region expansion processing on the first image region in the first video frame to obtain a second image region;

[0103] The second image region is determined as an image region of interest.

[0104] Based on this, by first determining in the first video frame a first image area whose position information is the same as the position information of the above-mentioned first segmented image, and then expanding the first image area to obtain a second image area, and using the second image area as the above-mentioned image area of ​​interest, the possibility that the segmented object is not within the image area of ​​interest can be reduced, thereby further improving the segmentation accuracy.

[0105] The above-mentioned region expansion processing is performed on the first image region in the first video frame to obtain the second image region, which may be that after the electronic device determines the above-mentioned first image region, the boundary of the first image region is directly expanded in various directions according to a preset ratio to obtain the enlarged second image region. Of course, if the region expanded in a certain direction of the first image region exceeds the boundary of the first video frame, the boundary of the first video frame in this direction is used as the boundary of the second video frame.

[0106] Exemplarily, the electronic device determines the position information in the first video frame and Figure 3 The rectangular image area 31 is the same as the first image area (that is, the image area is also rectangular), and the preset expansion ratio is 10%, then the electronic device expands the rectangular image area 31 by 10% in the four directions of up, down, left and right respectively. If the boundary of the expanded image area in the downward direction exceeds the boundary of the first image area, and the boundaries in the left, right and upward directions do not exceed the boundary of the first image area, then the image area enclosed by the boundaries of the expanded image area in the left, right and upward directions and the boundary of the first image area in the downward direction is determined as the above-mentioned second image area, that is, the image area of ​​interest.

[0107] Alternatively, before performing region expansion processing on the first image region in the first video frame to obtain the second image region, the method may further include:

[0108] Obtaining a comparison result between a first boundary of the first segmented image and a second boundary of the second video frame, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; the comparison result is used to indicate whether the first boundary of the first segmented image and the second boundary of the second video frame coincide with each other;

[0109] The performing region expansion processing on the first image region in the first video frame may include:

[0110] When the comparison result indicates that the first boundary coincides with the second boundary, extending the boundary of the first image area to the boundary of the first video frame in the preset direction;

[0111] When the comparison result indicates that the first boundary and the second boundary do not overlap, the boundary of the first image area is expanded in the preset direction according to a preset ratio.

[0112] Based on this, by comparing whether the boundary of the first segmented image overlaps with the boundary of the second video frame, and selecting different expansion methods to expand the boundary of the first image area according to the comparison result, the expansion of the boundary of the first image area is made more reasonable, which can further reduce the possibility that the segmented object is not within the image area of ​​interest, thereby improving the segmentation accuracy.

[0113] It should be noted that the first image area is a rectangular area, and the preset direction is the width direction or the height direction of the image.

[0114] Exemplarily, the electronic device determines the position information in the first video frame and Figure 3 After the rectangular image area 31 is the same as the first image area (that is, the image area is also rectangular), the electronic device compares whether the boundary of the rectangular image area 31 coincides with the boundary of the second video frame in the up, down, left, and right directions (at this time, the width direction is left or right, and the height direction is upward or downward). Since the boundary of the rectangular image area 31 coincides with the boundary of the second video frame in the downward direction, the boundary of the first video frame in the downward direction is determined as the boundary of the expanded second image area; and if the boundary of the rectangular image area 31 does not coincide with the boundary of the second video frame in the upward, right, and left directions, the boundary of the first image area is moved outward by 10% in the upward, right, and left directions, and the moved boundary is used as the boundary of the second image area in the corresponding direction, and the following is obtained. Figure 4 A rectangular image region 41 (ie, an image region of interest) is shown.

[0115] In the above step 104, after the electronic device determines the image region of interest in the first video frame, the electronic device can extract the image in the image region of interest from the first video frame, and input the extracted image of the image region of interest into the segmentation network, and use the segmentation network to segment the second segmented image of the object to be segmented in the first video frame from the image of the region of interest.

[0116] Among them, when the segmentation network performs segmentation processing on the input image, it first compresses the input image to a preset image size, and then performs segmentation processing on the image compressed to the preset image size. Therefore, when the input image is an image within the above-mentioned image area of ​​interest, compared to the input image being the first video frame, it is possible to enlarge the resolution of the segmented object, thereby improving the segmentation accuracy of the segmentation network.

[0117] It should be noted that, since the segmentation process of the input image through the segmentation network is well known to those skilled in the art, it will not be described in detail here.

[0118] For example, when the electronic device determines Figure 4After the rectangular image area 41 in the first video frame is shown, the electronic device can extract the image of the rectangular image area 41 from the first video frame, such as Figure 5 As shown, the extracted image is input into the segmentation network.

[0119] In the disclosed embodiment, after the electronic device segments the second segmented image from the first video frame through the segmentation network, the electronic device may save the second segmented image to achieve cutout; or, the electronic device may perform other processing on the second segmented image.

[0120] Specifically, after the above step 104, the method may further include:

[0121] Acquire position information of the second segmented image in the first video frame;

[0122] Replacing the image of the first video frame with a preset image to generate a third video frame;

[0123] The image in the third image area of ​​the third video frame is replaced with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

[0124] Based on this, by pasting the second segmented image into the corresponding position of the first video frame after the image is replaced with the preset image, the background replacement of the first video frame can be achieved.

[0125] For example, in an electronic device, a network is divided into Figure 5 After the portrait is segmented out from the input image shown in FIG. 1 (i.e., the second segmented image, and the portrait is restored to its size in the first video frame), the electronic device may Figure 2 The image of the first video frame is replaced with the seascape, and the portrait is pasted into the corresponding position of the seascape image, which is the position of the portrait in the first video frame (ie the position of the second segmented image in the first video frame).

[0126] In addition, after the above step 104, the method may further include: saving image region information of the second segmented image in the first video frame, so that when processing subsequent video frames, the image region of interest can be further determined by the position information of the second segmented image.

[0127] Based on the same inventive concept, the present disclosure also provides a video frame processing device. Figure 4 Provide detailed explanation.

[0128] Figure 6The figure is a schematic diagram of the structure of a video frame processing device according to an exemplary embodiment.

[0129] like Figure 6 As shown, the video frame processing device 600 may specifically include:

[0130] The video frame acquisition module 601 is configured to acquire a first video frame of a video, wherein the first video frame includes an object to be segmented;

[0131] The first position information acquisition module 602 is configured to acquire position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is an image obtained by performing image segmentation on the object to be segmented in the second video frame;

[0132] An image region determination module 603 is configured to determine an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented;

[0133] The segmentation module 604 is configured to input the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame.

[0134] Based on this, by obtaining the position information of the segmented image in the second video frame before the first video frame to be processed, and then based on the obtained position information of the segmented image, determining the image region of interest in the first video frame, and then using the image of the image region of interest as the input of the segmentation network, the segmented image in the first video is obtained. In this way, through the video frame processing method of the embodiment of the present application, the image input to the segmentation network is a local image of the first video frame including the segmentation object. Compared with inputting the first video frame into the segmentation network, the proportion of the segmentation object in the image input to the segmentation network can be enlarged in image segmentation, thereby improving the accuracy of image segmentation, especially when the proportion of the segmentation object in the first video frame is small.

[0135] In one embodiment, the image area determination module 603 includes:

[0136] An image region acquisition unit is configured to acquire a first image region in the first video frame whose position information is the same as that of the first segmented image;

[0137] an expansion unit, configured to perform region expansion processing on the first image region in the first video frame to obtain a second image region;

[0138] The image region determining unit is configured to determine the second image region as an image region of interest.

[0139] Based on this, by first determining in the first video frame a first image area whose position information is the same as the position information of the above-mentioned first segmented image, and then expanding the first image area to obtain a second image area, and using the second image area as the above-mentioned image area of ​​interest, the possibility that the segmented object is not within the image area of ​​interest can be reduced, thereby further improving the segmentation accuracy.

[0140] In one embodiment, the apparatus 600 further includes:

[0141] a comparison module, configured to obtain a comparison result between a first boundary of the first segmented image and a second boundary of the second video frame, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; and the comparison result is used to indicate whether the first boundary of the first segmented image and the second boundary of the second video frame coincide with each other;

[0142] The expansion unit comprises:

[0143] a first expansion subunit, configured to expand the boundary of the first image area to the boundary of the first video frame in the preset direction when the comparison result indicates that the first boundary coincides with the second boundary;

[0144] The second expansion subunit is configured to expand the boundary of the first image area in the preset direction according to a preset ratio when the comparison result indicates that the first boundary and the second boundary do not overlap.

[0145] Based on this, by comparing whether the boundary of the first segmented image overlaps with the boundary of the second video frame, and selecting different expansion methods to expand the boundary of the first image area according to the comparison result, the expansion of the boundary of the first image area is made more reasonable, which can further reduce the possibility that the segmented object is not within the image area of ​​interest, thereby improving the segmentation accuracy.

[0146] In one embodiment, the second video frame is a video frame preceding the first video frame;

[0147] The first location information acquisition module 602 includes:

[0148] a quantity determining unit, configured to obtain the quantity of the objects to be segmented in the first video frame and the quantity of the objects to be segmented in the second video frame;

[0149] The position information acquisition unit is configured to acquire position information of the first segmented image in the second video frame of the video when the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame.

[0150] Based on this, by comparing the number of objects to be segmented in the first video frame to be segmented and the number of objects to be segmented in the previous video frame, and obtaining the position information of the first segmented image in the previous frame only when the number is the same, the above-mentioned image region of interest is determined, that is, only in the video frame to be segmented in which the number of objects to be segmented is the same as the number of objects to be processed in the previous video frame, image segmentation is achieved by determining the image region of interest, thereby reducing the possibility of inaccurate determination of the image region of interest due to large differences between the image of the video frame to be segmented and the previous video frame.

[0151] In one embodiment, the apparatus 600 further includes:

[0152] A second position information acquisition module is configured to acquire position information of the second segmented image in the first video frame;

[0153] An image replacement module, configured to replace the image of the first video frame with a preset image to generate a third video frame;

[0154] The image pasting module is configured to replace the image in the third image area of ​​the third video frame with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

[0155] Based on this, by pasting the second segmented image into the corresponding position of the first video frame after the image is replaced with the preset image, the background replacement of the first video frame can be achieved.

[0156] In one embodiment, the apparatus 600 further includes:

[0157] The position information saving module is configured to save the position information of the second segmented image in the first video frame.

[0158] Based on this, when processing subsequent video frames, the image region of interest can be further determined through the position information of the second segmented image.

[0159] Based on the same inventive concept, the embodiment of the present disclosure further provides an electronic device, specifically combined with Figure 7 Provide detailed explanation.

[0160] Figure 7It is a structural block diagram of a computing device according to an exemplary embodiment.

[0161] like Figure 7 As shown, the computing device 700 is a structural diagram of an exemplary hardware architecture of a computing device capable of implementing the video frame processing method and the video frame processing apparatus according to the embodiments of the present disclosure. The computing device may refer to an electronic device in the embodiments of the present disclosure.

[0162] The computing device 700 may include a processor 701 and a memory 702 storing computer program instructions.

[0163] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0164] The memory 702 may include a large capacity memory for information or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 702 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 702 may be inside or outside the integrated gateway device. In a particular embodiment, the memory 702 is a non-volatile solid-state memory. In a particular embodiment, the memory 702 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory, or a combination of two or more of these.

[0165] The processor 701 reads and executes the computer program instructions stored in the memory 702 to perform the following steps:

[0166] Processor 701 executes acquiring a first video frame of a video, wherein the first video frame includes an object to be segmented;

[0167] Acquire position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is: an image obtained by performing image segmentation on the object to be segmented in the second video frame;

[0168] Determine an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented;

[0169] The image of the image region of interest is input into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame.

[0170] Based on this, by obtaining the position information of the segmented image in the second video frame before the first video frame to be processed, and then based on the obtained position information of the segmented image, determining the image region of interest in the first video frame, and then using the image of the image region of interest as the input of the segmentation network, the segmented image in the first video is obtained. In this way, through the video frame processing method of the embodiment of the present application, the image input to the segmentation network is a local image of the first video frame including the segmentation object. Compared with inputting the first video frame into the segmentation network, the proportion of the segmentation object in the image input to the segmentation network can be enlarged in image segmentation, thereby improving the accuracy of image segmentation, especially when the proportion of the segmentation object in the first video frame is small.

[0171] In one embodiment, the processor 701 executes obtaining a first image region in the first video frame whose position information is the same as the position information of the first segmented image;

[0172] Performing region expansion processing on the first image region in the first video frame to obtain a second image region;

[0173] The second image region is determined as an image region of interest.

[0174] Based on this, by first determining in the first video frame a first image area whose position information is the same as the position information of the above-mentioned first segmented image, and then expanding the first image area to obtain a second image area, and using the second image area as the above-mentioned image area of ​​interest, the possibility that the segmented object is not within the image area of ​​interest can be reduced, thereby further improving the segmentation accuracy.

[0175] In one embodiment, the processor 701 executes to obtain a comparison result of a first boundary of the first segmented image and a second boundary of the second video frame, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; and the comparison result is used to indicate whether the first boundary of the first segmented image coincides with the second boundary of the second video frame;

[0176] When the comparison result indicates that the first boundary coincides with the second boundary, extending the boundary of the first image area to the boundary of the first video frame in the preset direction;

[0177] When the comparison result indicates that the first boundary and the second boundary do not overlap, the boundary of the first image area is expanded in the preset direction according to a preset ratio.

[0178] Based on this, by comparing whether the boundary of the first segmented image overlaps with the boundary of the second video frame, and selecting different expansion methods to expand the boundary of the first image area according to the comparison result, the expansion of the boundary of the first image area is made more reasonable, which can further reduce the possibility that the segmented object is not within the image area of ​​interest, thereby improving the segmentation accuracy.

[0179] In one embodiment, the second video frame is a video frame preceding the first video frame;

[0180] Processor 701 executes obtaining the number of the objects to be segmented in the first video frame and the number of the objects to be segmented in the second video frame;

[0181] When the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame, position information of the first segmented image in the second video frame of the video is obtained.

[0182] Based on this, by comparing the number of objects to be segmented in the first video frame to be segmented and the number of objects to be segmented in the previous video frame, and obtaining the position information of the first segmented image in the previous frame only when the number is the same, the above-mentioned image region of interest is determined, that is, only in the video frame to be segmented in which the number of objects to be segmented is the same as the number of objects to be processed in the previous video frame, image segmentation is achieved by determining the image region of interest, thereby reducing the possibility of inaccurate determination of the image region of interest due to large differences between the image of the video frame to be segmented and the previous video frame.

[0183] In one embodiment, the processor 701 executes obtaining position information of the second segmented image in the first video frame;

[0184] Replacing the image of the first video frame with a preset image to generate a third video frame;

[0185] The image in the third image area of ​​the third video frame is replaced with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

[0186] Based on this, by pasting the second segmented image into the corresponding position of the first video frame after the image is replaced with the preset image, the background replacement of the first video frame can be achieved.

[0187] In one embodiment, the processor 701 executes to save the position information of the second segmented image in the first video frame.

[0188] Based on this, when processing subsequent video frames, the image region of interest can be further determined through the position information of the second segmented image.

[0189] In one example, the computing device 700 may further include a transceiver 703 and a bus 704. Figure 7 As shown, the processor 701, the memory 702 and the transceiver 703 are connected via a bus 704 and communicate with each other.

[0190] Bus 704 includes hardware, software or both.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral control interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 704 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0191] The embodiment of the present disclosure further provides a computer storage medium, in which computer executable instructions are stored. The computer executable instructions are used to implement the video frame processing method described in the embodiment of the present disclosure.

[0192] In some possible implementations, various aspects of the method provided by the present disclosure may also be implemented in the form of a program product, which includes a program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the method according to various exemplary implementations of the present disclosure described above in this specification. For example, the computer device may execute the video frame processing method recorded in the embodiments of the present disclosure.

[0193] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0194] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices, and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable image transmission device to produce a machine, so that the instructions executed by the processor of the computer or other programmable image transmission device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0195] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable image transmission device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0196] These computer program instructions may also be loaded onto a computer or other programmable image transmission device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0197] Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. A video frame processing method, characterized in that: include: Acquire a first video frame of a video, wherein the first video frame includes an object to be segmented; Acquire position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is: an image obtained by performing image segmentation on the object to be segmented in the second video frame; Determine an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented; Inputting the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame; The image region of interest is obtained based on performing region expansion processing on a first image region in the first video frame according to a preset expansion rule, and the first image region is a region in the first video frame with the same position information as the first segmented image; The preset expansion rules include: when the first boundary of the first segmented image coincides with the second boundary of the second video frame, expanding the boundary of the first image area to the boundary of the first video frame in a preset direction; when the first boundary and the second boundary do not coincide, expanding the boundary of the first image area in the preset direction according to a preset ratio; the first boundary and the second boundary are boundaries in the preset direction.

2. The method according to claim 1, characterized in that The determining the image region of interest in the first video frame based on the position information of the first segmented image includes: Acquire a first image region in the first video frame, the position information of which is the same as the position information of the first segmented image; Performing region expansion processing on the first image region in the first video frame to obtain a second image region; The second image region is determined as an image region of interest.

3. The method according to claim 2, characterized in that Before performing region expansion processing on the first image region in the first video frame to obtain the second image region, the method further includes: Obtaining a comparison result between a first boundary of the first segmented image and a second boundary of the second video frame, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; the comparison result is used to indicate whether the first boundary of the first segmented image and the second boundary of the second video frame coincide with each other; The performing region expansion processing on the first image region in the first video frame includes: When the comparison result indicates that the first boundary coincides with the second boundary, extending the boundary of the first image area to the boundary of the first video frame in the preset direction; When the comparison result indicates that the first boundary and the second boundary do not overlap, the boundary of the first image area is expanded in the preset direction according to a preset ratio.

4. The method according to claim 1, characterized in that: The second video frame is a video frame preceding the first video frame; The obtaining the position information of the first segmented image in the second video frame of the video includes: Acquire the number of the objects to be segmented in the first video frame and the number of the objects to be segmented in the second video frame; When the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame, position information of the first segmented image in the second video frame of the video is obtained.

5. The method according to claim 1, characterized in that After inputting the image of the image region of interest into the image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame, the method further includes: Acquire position information of the second segmented image in the first video frame; Replacing the image of the first video frame with a preset image to generate a third video frame; The image in the third image area of ​​the third video frame is replaced with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

6. The method according to claim 1, characterized in that After inputting the image of the image region of interest into the image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame, the method further includes: The position information of the second segmented image in the first video frame is saved.

7. A video frame processing device, characterized in that: include: A video frame acquisition module is configured to acquire a first video frame of a video, wherein the first video frame includes an object to be segmented; A first position information acquisition module is configured to acquire position information of a first segmented image in a second video frame of the video, wherein the second video frame is a video frame before the first video frame, and the first segmented image is an image obtained by performing image segmentation on the object to be segmented in the second video frame; an image region determination module, configured to determine an image region of interest in the first video frame based on the position information of the first segmented image, wherein the image region of interest includes an image region of the object to be segmented; a segmentation module, configured to input the image of the image region of interest into an image segmentation network to obtain a second segmented image of the object to be segmented in the first video frame; The image region of interest is obtained based on performing region expansion processing on a first image region in the first video frame according to a preset expansion rule, and the first image region is a region in the first video frame with the same position information as the first segmented image; The preset expansion rules include: when the first boundary of the first segmented image coincides with the second boundary of the second video frame, expanding the boundary of the first image area to the boundary of the first video frame in a preset direction; when the first boundary and the second boundary do not coincide, expanding the boundary of the first image area in the preset direction according to a preset ratio; the first boundary and the second boundary are boundaries in the preset direction.

8. The device according to claim 7, characterized in that The image area determination module comprises: An image region acquisition unit is configured to acquire a first image region in the first video frame whose position information is the same as that of the first segmented image; an expansion unit, configured to perform region expansion processing on the first image region in the first video frame to obtain a second image region; The image region determining unit is configured to determine the second image region as an image region of interest.

9. The device according to claim 8, characterized in that The device also includes: a comparison module, configured to compare whether a first boundary of the first segmented image coincides with a second boundary of the second video frame, and obtain a comparison result, wherein the first boundary and the second boundary are boundaries in a preset direction, and the preset direction is a width direction or a height direction of the image; The expansion unit comprises: A first expansion subunit is configured to expand the boundary of the first image area to the boundary of the first video frame in the preset direction when the comparison result is that the first boundary coincides with the second boundary; The second expansion subunit is configured to expand the boundary of the first image area in the preset direction according to a preset ratio when the comparison result is that the first boundary and the second boundary do not overlap.

10. The device according to claim 7, characterized in that The second video frame is a video frame preceding the first video frame; The first location information acquisition module includes: a quantity determining unit, configured to obtain the quantity of the objects to be segmented in the first video frame and the quantity of the objects to be segmented in the second video frame; The position information acquisition unit is configured to acquire position information of the first segmented image in the second video frame of the video when the number of the objects to be segmented in the first video frame is the same as the number of the objects to be segmented in the second video frame.

11. The device according to claim 7, characterized in that The device also includes: A second position information acquisition module is configured to acquire position information of the second segmented image in the first video frame; An image replacement module, configured to replace the image of the first video frame with a preset image to generate a third video frame; The image pasting module is configured to replace the image in the third image area of ​​the third video frame with the second segmented image, wherein the first position information of the third image area in the third video frame is the same as the second position information, and the second position information is the position information of the second segmented image in the first video frame.

12. The device according to claim 7, characterized in that The device also includes: The position information saving module is configured to save the position information of the second segmented image in the first video frame.

13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the video frame processing method as described in any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device implements the video frame processing method as described in any one of claims 1 to 6.

15. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a readable storage medium. At least one processor of the device reads and executes the computer program from the storage medium, so that the device implements the video frame processing method according to any one of claims 1 to 6.