Video image region detection method, device and storage medium

By dividing and detecting video frames into regions, the distribution of color and grayscale images is determined, and the color image is rendered using transparency information. This solves the problem of inconsistent video rendering effects and achieves high-quality video playback.

CN116664601BActive Publication Date: 2026-04-21GUANGZHOU FANGGUI INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGZHOU FANGGUI INFORMATION TECHNOLOGY CO LTD
Filing Date
2023-06-28
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In live streaming systems, different video formats can lead to issues where the video rendering results do not meet expectations.

Method used

By dividing the video frame into multiple regions, the system detects whether the video frame is a valid frame, determines the distribution of color and grayscale images in multiple regions, and uses the transparency information of the grayscale image to render the color image.

Benefits of technology

This ensures that the video rendering effect is consistent with expectations, thus improving the video playback quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116664601B_ABST
    Figure CN116664601B_ABST
Patent Text Reader

Abstract

This application discloses a video image region detection method, device, and storage medium. The method includes: acquiring a video frame; dividing the video frame into multiple regions; detecting the divided regions to determine whether the video frame is a valid video frame; if so, determining the region containing the color image and the region containing the grayscale image of the video frame within the multiple regions; the grayscale image is used to represent the transparency information of the color image, so that the color image can be rendered in conjunction with the transparency information. Through the above method, this application can detect the distribution of video image regions, thereby correctly rendering the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to video image region detection methods, devices and storage media. Background Technology

[0002] With the widespread adoption of smart devices and the development of communication technologies, society has entered an era of intelligent interconnection. Faster network communication speeds allow people to easily access the internet using smart devices, directly driving the rapid development of live streaming technology. This rapid development enables people to overcome spatial barriers, broaden their horizons, and allow people in different regions to communicate and interact instantly, greatly enriching their lives.

[0003] Live streaming systems often involve video playback; for example, gift effects can be played as videos, and video animations can present more details. However, the video formats designed by each designer may differ, resulting in the video rendering not achieving the desired effect. Summary of the Invention

[0004] The main technical problem addressed in this application is to provide a video image region detection method, device, and storage medium that can detect the distribution of video image regions, thereby correctly rendering the video.

[0005] To address the aforementioned technical problems, this application provides a video image detection method, comprising: acquiring a video frame and dividing the video frame into multiple regions; detecting the divided regions to determine whether the video frame is a valid video frame; if so, determining the region where the color image of the video frame is located and the region where the grayscale image is located within the multiple regions; the grayscale image is used to characterize the transparency information of the color image, so that the color image can be rendered by combining the transparency information when rendering the color image.

[0006] To solve the above-mentioned technical problems, the second technical solution adopted in this application is: to provide a computer device, which includes: a processor, a memory, and a communication circuit; the communication circuit and the memory are respectively coupled to the processor, the memory is used to store computer programs, and the processor is used to read and execute computer programs to implement the method of the first technical solution of this application as described above.

[0007] To solve the above-mentioned technical problems, the third technical solution adopted in this application is to provide a computer-readable storage medium that stores a computer program that can be read and executed by a processor to implement the method of the first technical solution of this application as described above.

[0008] The beneficial effects of this application are as follows: Unlike the prior art, by acquiring video frames, dividing the video frames into multiple regions, and detecting the multiple regions, it is determined whether the video frame is a valid video frame. If so, the regions where the color image and grayscale image of the video frame are located are determined in the multiple regions. This allows the transparency of the color image to be correctly extracted from the grayscale image of the video, so that the correct transparency information can be combined when rendering the color image to render the color image correctly, thereby ensuring the quality of video playback. Attached Figure Description

[0009] Figure 1 This is a flowchart illustrating an embodiment of the video image region detection method of this application;

[0010] Figure 2 This is a schematic diagram of video frame region division in an embodiment of the video image region detection method of this application;

[0011] Figure 3 This is a schematic diagram of video frame extraction in an embodiment of the video image region detection method of this application;

[0012] Figure 4 This is a first schematic diagram of the video frame region distribution in an embodiment of the video image region detection method of this application;

[0013] Figure 5 This is a second schematic diagram of the video frame region distribution in an embodiment of the video image region detection method of this application;

[0014] Figure 6 This is a third schematic diagram of the video frame region distribution in an embodiment of the video image region detection method of this application;

[0015] Figure 7 This is a schematic flowchart of another embodiment of the video image region detection method of this application;

[0016] Figure 8 This is a schematic diagram of the circuit structure of an embodiment of a computer device;

[0017] Figure 9 This is a schematic diagram of the circuit structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0019] The inventors of this application, through long-term research, have discovered that in scenarios such as live streaming, to enrich the live streaming experience, it is often necessary to dynamically insert corresponding elements, such as text or images, into the playing video. While some animation formats, such as Y2A or SVGA, can easily achieve this element insertion effect, video formats generally offer superior display quality and can achieve more sophisticated effects. MP4 format videos, in particular, can achieve more impressive effects and provide a WYSIWYG (What You See Is What You Get) experience. However, during video rendering, differences in video formats can lead to discrepancies between the rendered video and the expected result. To achieve correct video rendering, this application proposes the following embodiments.

[0020] like Figure 1 As shown, the video image region detection method embodiment of this application can be executed by a client. The region detection method described therein can include: S100: acquiring a video frame and dividing the video frame into multiple regions; S200: detecting the multiple regions to determine whether the video frame is a valid video frame; S300: if so, determining the region where the color image of the video frame is located and the region where the grayscale image is located in the multiple regions; the grayscale image is used to represent the transparency information of the color image so that the color image can be rendered in combination with the transparency information when rendering the color image.

[0021] By acquiring video frames, the video frames are divided into multiple regions, and the divided regions are detected to determine whether the video frame is a valid video frame. If it is, the regions where the color image and grayscale image of the video frame are located are determined among the multiple regions. This allows the transparency of the color image to be correctly extracted from the grayscale image of the video, so that the correct transparency information can be combined when rendering the color image to render the color image correctly, so as to play the corresponding video effect correctly and ensure the quality of video playback.

[0022] The following is a detailed description of embodiments of the video image region detection method.

[0023] S100: Acquire video frames and divide the video frames into multiple regions.

[0024] For example, when a visual effects designer wants to see the effect of a video they've created, they can upload the video to the client. Once the client receives the video, it can process it to display the rendered effect on the client's display screen, allowing the designer to view the result.

[0025] Since videos may contain parts that have no practical significance for special effects after production, such as reserving a certain amount of time at the beginning and end of the video to indicate the start and end, and since the effective frames of a video are composed of color images and grayscale images, in order to detect the distribution areas of color and grayscale images in the video, the pixels of the video can be extracted and analyzed to determine the effective parts of the video and the distribution areas of color and grayscale images.

[0026] To improve detection efficiency, after acquiring a video frame, the client can divide the video frame into multiple regions, such as dividing it into four quadrants (see reference). Figure 2 Then, the pixels in each region are analyzed separately.

[0027] S200: Detects multiple regions to determine whether a video frame is a valid video frame.

[0028] As mentioned earlier, invalid video frames exist, meaning frames that have no practical significance for rendering the video; for example, a video frame where all pixels are completely black. Since invalid video frames do not contain color images, they are meaningless for determining the distribution area of ​​color images. Therefore, after acquiring a video frame, the client can first determine whether the video frame is a valid video frame, and then further determine the valid video frames to obtain the areas in the video containing color images and the areas in the video containing grayscale images.

[0029] Optionally, after obtaining an invalid video frame, the client needs to re-acquire the video frame in order to obtain a valid video frame. For details, please refer to the following steps included after S200:

[0030] S240: Extract the next video frame according to the preset step size, and determine whether the video frame is a valid video frame.

[0031] For example, if the preset step size is 3 and the first 5 seconds of the video are invalid video frames, after the client obtains the video, it first obtains the first frame of the video, determines that it is not an invalid video frame, then obtains the fourth frame, which is also determined to be an invalid video frame, and then obtains the seventh frame, which is determined to be a valid video frame. The client can then perform detection on the distribution of video frame regions.

[0032] like Figure 3 As shown, the client can extract the next video frame according to a preset step size. This is more efficient than extracting the next video frame one by one, and can quickly locate the valid video frame. Furthermore, it allows for handling of multiple invalid video frames extracted; for example, after four invalid video frames are extracted, the original video can be played directly to reduce the slowdown in response speed caused by too many invalid video frames.

[0033] Optionally, to determine whether a video frame is valid after dividing the region, refer to the following steps included in S200:

[0034] S210: Extract multiple pixels within each region.

[0035] S220: Use the color channel values ​​of multiple pixels to determine whether there are colored pixels in the corresponding area.

[0036] Since the difference between valid and invalid video frames is that invalid video frames do not contain color images, the color channel values ​​of pixels in each region can be used to determine whether a video frame is valid.

[0037] After dividing the video frame into regions, the client can extract multiple pixels within each region. Then, it can use the color channel values ​​of these pixels to determine if any colored pixels exist in each region. The color channel values ​​can be RGB or YUV values.

[0038] When the client extracts pixels within each region, it can do so according to a pattern, randomly extract several pixels from the region, or extract several pixels from the center of the region outwards.

[0039] Optionally, the determination of whether a corresponding region contains colored pixels can be based on different color channel values. For example, the first implementation can use the difference between color channel values ​​for determination. The second implementation can use the ratio between color channel values ​​for determination. The third implementation can use the range of color channel values ​​for determination. For a description of the first implementation, please refer to the following steps included in S220:

[0040] S221: Determine whether the difference between the sub-channel components of the color channel value of each pixel exceeds a preset difference.

[0041] Optionally, when using the RGB values ​​of a pixel for determination, the difference between the RGB sub-channel components can be used to determine whether it is a colored pixel, as shown in the following steps included in S221:

[0042] S2211: Determine whether the difference between the RGB components of each pixel exceeds the preset difference.

[0043] A pixel is classified as grayscale when its R, G, and B values ​​are equal. However, if the differences between the RGB channel components of a pixel do not exceed a preset difference, the pixel appears as "fake grayscale," indistinguishable to the human eye. Therefore, the client can classify a pixel as grayscale if the differences between its RGB sub-channel components do not exceed a preset difference. This preset difference can be 10. When the differences between the sub-channel components of a pixel exceed 10, the pixel is classified as a color pixel.

[0044] After determining whether the difference between the sub-channel components of the color channel value of each pixel exceeds a preset difference, if the difference exceeds the preset difference, it indicates that the pixel is a color pixel, and the region where the pixel is located contains color pixels. If the difference between the sub-channel components of each extracted pixel in the region does not exceed the preset difference, it indicates that the region does not contain color pixels. For details, please refer to the following steps after S221:

[0045] S222: If the limit is exceeded, then the region is determined to contain colored pixels.

[0046] S223: If not exceeded, then the determination area does not contain any colored pixels.

[0047] By determining whether a video frame is valid or invalid, the presence of colored pixels within a region can be used to determine its validity. If no colored pixels are found in any region, the video frame is invalid, and the next video frame can be extracted according to a preset step size.

[0048] In addition to using the difference between the sub-channel components of the color channel of a pixel to determine whether a pixel is a colored pixel, the ratio between the sub-channel components can also be used for determination. For a description of the second implementation method, please refer to the following steps included in S200:

[0049] S225: Calculate the ratio between the sub-channel components of the color channel value of each pixel.

[0050] S226: Determine whether the ratio is within the preset threshold range.

[0051] S227: If not located, then the determination area contains colored pixels.

[0052] S228: If it is located, then the determination area does not contain any colored pixels.

[0053] After extracting a pixel, the client can obtain the values ​​of each sub-channel component of the pixel's color channel. For example, it can obtain the pixel's R, G, and B values. Since the difference between the sub-channel components is within a preset range to determine if the pixel is a grayscale pixel, the ratio between the sub-channel components is also within a preset range to determine if the pixel is a grayscale pixel. When the ratio between the components is within the preset range, the pixel is determined to be a grayscale pixel. When the ratio between the components is outside the preset range, the pixel is determined to be a color pixel.

[0054] In addition to RGB values, other types of color channel values, such as YUV values, can also be used to determine whether a pixel is a colored pixel. For details on the third implementation method, please refer to the following steps included in S220:

[0055] S224: Determine whether the sub-channel components of the color channel value of each pixel exceed the preset range.

[0056] Optionally, when using the YUV values ​​of a pixel for determination, the range of each sub-channel component of the UV can be used to determine whether it is a color pixel. For details, please refer to the following steps included in S224:

[0057] S2241: Determine whether the UV component of each pixel exceeds the preset range.

[0058] For example, if the UV components of a pixel are in the range of [118, 138] or [123, 133], the pixel is determined to be a grayscale pixel. If the UV components of a pixel are not in the range of [118, 138] or [123, 133], the pixel is determined to be a color pixel.

[0059] When determining whether the values ​​of each sub-channel component of the color channel value of each pixel are within a preset range, if they are not within the preset range, it indicates that the pixel is a colored pixel, and the region where the pixel is located contains colored pixels. If the values ​​of each sub-channel component of each extracted pixel in the region are within the preset range, it indicates that the region does not contain colored pixels. For details, please refer to the following steps after S221:

[0060] S222: If the limit is exceeded, then the region is determined to contain colored pixels.

[0061] S223: If not exceeded, then the determination area does not contain any colored pixels.

[0062] By determining whether a video frame is valid or invalid, the presence or absence of colored pixels within a region can be used to determine its validity. If no colored pixels are found in any region, the video frame is invalid. The next video frame can then be extracted according to a preset step size, as described in the following steps after S220:

[0063] S230: If at least one region contains colored pixels, the video frame is determined to be a valid video frame.

[0064] Since valid video frames contain color images, while invalid video frames do not, after determining whether there are color pixels in each region, if there are color pixels in at least one region, it means that the video frame contains a color image, which is a valid video frame.

[0065] After obtaining valid video frames, the regions containing the color image and the grayscale image can be determined using these frames. Transparency information can then be extracted from the grayscale image region to render the color image from the region containing the color image. See the following steps after S200 for details:

[0066] S300: If so, determine the region where the color image of the video frame is located and the region where the grayscale image is located in multiple regions; the grayscale image is used to characterize the transparency information of the color image so that the color image can be rendered in combination with the transparency information when rendering the color image.

[0067] Because video designers may use different formats due to personal habits or design company regulations, the resulting videos may be in various formats. (Reference) Figures 4 to 6 , Figure 4 The color image region 11 shown is located on the left side of the image, and the grayscale image region 12 is located on the right side of the image. Figure 5 In the video shown, the color image region 11 is located on the right side of the image, while the grayscale image region 12 is located on the left side of the image. Figure 6 In the video shown, the color image area is located at the top of the image, and the grayscale image area 12 is located at the bottom of the image.

[0068] Optionally, pixel information can be used to determine the regions where the color image and grayscale image of the video frame are located, as shown in the following steps included in S300:

[0069] S310: Obtain pixel information from multiple regions.

[0070] S320: Determine the region where the color image of the video frame is located and the region where the grayscale image is located based on the pixel information of each region.

[0071] As mentioned earlier, when determining whether a video frame is valid, the video frame can be divided into multiple regions. Pixels within each region can be extracted to determine if any colored pixels exist within that region. Regions containing colored images contain colored pixels, while regions containing grayscale images contain grayscale pixels. Therefore, the regions containing the colored and grayscale images of a video frame can be determined based on the pixel information of each region.

[0072] Optionally, the pixel distribution of each region can be determined through the pixel information of each region. Then, the pixel distribution can be used to determine whether a region is a color image region or a grayscale image region. See the following steps included in S320 for details:

[0073] S321: Determine the pixel distribution results of each region based on the pixel information of each region.

[0074] Optionally, the steps included in S321 for determining the pixel distribution results of each region based on the pixel information of each region can be referred to:

[0075] S325: Determine whether all pixels in a region are grayscale pixels based on the pixel information of all pixels in each region.

[0076] S326: If so, the pixel distribution result is that all pixels in the region are grayscale pixels.

[0077] S327: If not, the pixel distribution result is that at least one pixel in the region is a colored pixel.

[0078] When the divided region belongs to the region where the color image is located, since the color image must contain color pixels, the pixel distribution result can be that at least one pixel in the divided region is a color pixel.

[0079] When the divided region belongs to the region of the grayscale image, since all pixels in the grayscale image are grayscale pixels, the pixel distribution result can be that all pixels in the divided region are grayscale pixels.

[0080] Therefore, the client can determine the pixel distribution results of each region based on the pixel information.

[0081] After determining the pixel distribution results of each region based on the pixel information of each region, the regions where the color image and the grayscale image are located can be determined based on the pixel distribution results. See the following steps after S321:

[0082] S322: Determine the regions where the color image and the grayscale image are located based on the pixel distribution results.

[0083] Optionally, as mentioned above, regarding how to determine whether a region is the location of a color image or a grayscale image based on the pixel distribution results, please refer to the following steps included in S322:

[0084] S323: If the pixel distribution result shows that at least one pixel in the region is a colored pixel, then the region is determined to be the region where the color image is located.

[0085] S324: If the pixel distribution result is that all pixels in a region are grayscale pixels, then the region is determined to be the region where the grayscale image is located.

[0086] Since video is composed of color and grayscale images, meaning that color and grayscale images are independently distributed within video frames rather than interleaved, determining the pixel distribution in each region allows us to ascertain whether the color image is located on the left, right, top, or bottom of the video, thus enabling accurate video rendering.

[0087] For example, after the client obtains a valid video frame from the video, it divides the valid video frame into four regions. If there are colored pixels in the upper left and lower left regions, it means that the left side of the video frame is a color image, and the right side is a grayscale image. When implementing the video effect, transparency information can be extracted from the right image region, and this transparency information can be used to render the color image.

[0088] Optionally, after determining the regions containing the color image and the grayscale image, the client can extract transparency information from the grayscale image, thereby making the corresponding pixels in the color image transparent, and rendering the video to the desired effect. See the following steps after S300:

[0089] S400: Obtain transparency information from the region where the grayscale image is located.

[0090] S500: Renders the color image in the area where the color image is located based on transparency information.

[0091] In addition to rendering the video on the client side, this application embodiment can also use the server as the execution entity, whereby the client sends the video uploaded by the designer to the server so that the server can perform region detection and render the video.

[0092] like Figure 7As shown, after a user uploads a video from the client, the server can render the video designed by the designer and then send it to the client for playback. During rendering, differences in video formats may prevent the video from achieving the desired effect. Therefore, the video can be divided into multiple regions, and these regions can be detected to determine if a video frame is a valid video frame. If so, the regions containing the color image and the grayscale image of the video frame are identified within these regions. Then, transparency information is extracted from the grayscale image region, and the color image is rendered based on this transparency information. For details, please refer to the description of the client in the embodiments of the video image region detection method of this application.

[0093] like Figure 8 As shown in the embodiments of the computer device described in this application, the computer device 100 can be the client described above. The computer device 100 may include a processor 110, a memory 120, and a communication circuit 130.

[0094] The memory 120 is used to store computer programs and may be ROM (Read-Only Memory), RAM (Random Access Memory), or other types of storage devices. Specifically, the memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory is used to store at least one line of program code.

[0095] Processor 110 is used to control the operation of computer device 100. Processor 110 may also be referred to as CPU (Central Processing Unit). Processor 110 may be an integrated circuit chip with signal processing capabilities. Processor 110 may also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The general-purpose processor may be a microprocessor, or processor 110 may be any conventional processor.

[0096] The processor 110 is used to execute the computer program stored in the memory 120 to implement the video image region detection method described in the embodiments of the video image region detection method of this application.

[0097] The computer device 100 may also include a communication circuit 130, which is a device or circuit used by the computer device 100 to communicate with external devices, so that the processor 110 can interact with external devices via the communication circuit 130.

[0098] For a detailed description of the functions and execution processes of each functional module or component in the computer device embodiments of this application, please refer to the description in the above embodiments of the video image region detection method of this application, which will not be repeated here.

[0099] In the several embodiments provided in this application, it should be understood that the disclosed computer device 100 and virtual background generation method can be implemented in other ways. For example, the embodiments of the computer device 100 described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0100] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0101] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0102] See Figure 9If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in computer-readable storage medium 200. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions / computer programs to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this invention. The aforementioned storage medium includes various media such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks, as well as electronic terminals such as computers, mobile phones, laptops, tablets, and cameras that have the aforementioned storage media.

[0103] The description of the execution process of program data in computer-readable storage media can be found in the above-described embodiments of the video image region detection method of this application, and will not be repeated here.

[0104] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A method for detecting regions in a video image, characterized in that, include: Acquire video frames and divide the video frames into multiple regions; The multiple regions are detected to determine whether the video frame is a valid video frame. If so, then the region where the color image of the valid video frame is located and the region where the grayscale image is located are determined in the plurality of regions; the grayscale image is used to characterize the transparency information of the color image, so that the color image can be rendered in combination with the transparency information when rendering the color image; The step of determining the region containing the color image and the region containing the grayscale image of the video frame in the plurality of regions includes: Obtain pixel information from the multiple regions; The regions containing the color image and the grayscale image of the video frame are determined based on the pixel information of each region. The step of determining the region containing the color image and the region containing the grayscale image of the video frame based on the pixel information of each region includes: The pixel distribution result of each region is determined based on the pixel information of each region; Based on the pixel distribution results, determine the region where the color image is located and the region where the grayscale image is located; Determining the region containing the color image and the region containing the grayscale image based on the pixel distribution includes: If the pixel distribution result indicates that at least one pixel in the region is a colored pixel, then the region is determined to be the region where the colored image is located. If the pixel distribution result indicates that all pixels in the region are grayscale pixels, then the region is determined to be the region where the grayscale image is located. The step of detecting the divided multiple regions to determine whether the video frame is a valid video frame includes: Extract multiple pixels within each region; The presence of colored pixels in the corresponding region is determined by using the color channel values ​​of the plurality of pixels. If at least one of the regions contains the colored pixel, then the video frame is determined to be a valid video frame.

2. The method according to claim 1, characterized in that, The determination of the pixel distribution result of each region based on the pixel information of each region includes: Based on the pixel information of all pixels in each region, determine whether all pixels in the region are grayscale pixels; If so, the pixel distribution result is that all pixels in the region are grayscale pixels; If not, the pixel distribution result is that at least one pixel in the region is a colored pixel.

3. The method according to claim 1, characterized in that, The step of determining whether a corresponding region contains colored pixels using the color channel values ​​of the plurality of pixels includes: Determine whether the difference between the sub-channel components of the color channel value of each pixel exceeds a preset difference; If the number exceeds the limit, it is determined that the colored pixel exists in the region. If the limit is not exceeded, it is determined that the area does not contain the colored pixel.

4. The method according to claim 3, characterized in that, The step of determining whether the difference between the sub-channel components of the color channel value of each pixel exceeds a preset difference includes: Determine whether the difference between the RGB components of each pixel exceeds a preset difference.

5. The method according to claim 1, characterized in that, The step of determining whether a corresponding region contains colored pixels using the color channel values ​​of the plurality of pixels includes: Determine whether each sub-channel component of the color channel value of each pixel exceeds a preset range; If the number exceeds the limit, it is determined that the colored pixel exists in the region. If the limit is not exceeded, it is determined that the area does not contain the colored pixel.

6. The method according to claim 5, characterized in that, The step of determining whether each sub-channel component of the color channel value of each pixel exceeds a preset range includes: Determine whether the UV component of each pixel exceeds a preset range.

7. The method according to claim 1, characterized in that, The step of determining whether a corresponding region contains colored pixels using the color channel values ​​of the plurality of pixels includes: Calculate the ratio between the sub-channel components of the color channel value for each pixel; Determine whether the ratio is within a preset threshold range; If it is not located, then it is determined that the colored pixel exists in the area; If it is located in the specified area, then it is determined that the specified colored pixel does not exist in the specified area.

8. The method according to claim 1, characterized in that, After determining whether the video frame is a valid video frame, the process includes: If not, extract the next video frame according to the preset step size, and determine whether the video frame is a valid video frame.

9. The method according to claim 1, characterized in that, After determining the region containing the color image and the region containing the grayscale image of the video frame in the plurality of regions, the process includes: The transparency information is obtained from the region where the grayscale image is located; The color image is rendered in the region where the color image is located based on the transparency information.

10. A computer device, characterized in that, include: A processor, a memory, and a communication circuit; the communication circuit and the memory are respectively coupled to the processor, the memory is used to store a computer program, and the processor is used to read and execute the computer program to implement the method as described in any one of claims 1-9.

11. A computer-readable storage medium, characterized in that, The device contains a computer program that can be read and executed by a processor to implement the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Video color mode detection method and device and computer readable storage medium

    CN109889824A

  • Image data processing method and device

    CN110149550A