Image blurring method, device and video live streaming system
The target blur range is calculated by statistically analyzing the pixel ratio of the semi-transparent channel image row by row/column. Combined with the dual blur method, the color mismatch problem caused by the uniformity of blur range in image blurring methods is solved, and an adaptive image blurring effect is achieved, which is suitable for live video systems and various terminal devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU FANGSI INFORMATION TECH CO LTD
- Filing Date
- 2022-12-30
- Publication Date
- 2026-06-19
AI Technical Summary
Existing image blurring methods cannot adaptively adjust the blur range in different scenarios, resulting in image color imbalance and affecting the image blurring effect, especially in the process of compositing foreground and background in live video systems.
By statistically analyzing the pixel proportion of connected regions in the semi-transparent channel image row by row/column, the target blur range of each pixel is calculated, and the blur processing is adaptively adjusted according to the pixel proportion. A dual blurring method is used to achieve adaptive blurring operation.
It achieves adaptive adjustment of the image blur range, avoids the problem of color mismatch, improves the image blur effect, is suitable for various terminal devices, and avoids the defects of stripe problem and large amount of computation.
Smart Images

Figure CN116228567B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image blurring method, apparatus, video live streaming system, electronic device, and computer-readable storage medium. Background Technology
[0002] Image blurring is an image smoothing technique that refers to the process of reducing or eliminating high-frequency information such as sharp edges and noise in an image. Image blurring is generally achieved through low-pass filtering, and common image blurring methods include mean blur, Gaussian blur, Kawase blur, and double blur.
[0003] In common blurring methods, the blur range of different pixels in an image is consistent. However, in some live video systems, different regions of the image require different blur ranges under different scenarios. For example, in the process of compositing foreground and background images after green screen keying (assuming the foreground contains a person), it is necessary to blur the semi-transparent channel of the foreground to obtain a mask for further processing of the foreground image, so that the blur range is smaller where the human body is narrower and larger where the human body is wider.
[0004] However, common image blurring methods use globally consistent blurring to process the image. As a result, the mask generated by this blurring process can cause color distortion in the image, which is obviously mismatched with the image content and affects the image blurring effect. Summary of the Invention
[0005] Therefore, it is necessary to provide an image blurring method, apparatus, video live streaming system, electronic device, and computer-readable storage medium to address at least one of the above-mentioned technical deficiencies, so as to improve the effect of image blurring applications.
[0006] An image blurring method, comprising:
[0007] Obtain the semi-transparent channel image of the foreground image;
[0008] The percentage of horizontal pixels in the connected regions of the semi-transparent channel image is calculated row by row, and the percentage of vertical pixels in the connected regions of the semi-transparent channel image is calculated column by column.
[0009] The target blur range for matching each pixel in the semi-transparent channel image is calculated based on the horizontal and vertical pixel ratios.
[0010] The semi-transparent channel image is blurred according to the target blur range.
[0011] In one embodiment, obtaining the semi-transparent channel image of the foreground image includes:
[0012] The input image is truncated to obtain a portrait image, and a semi-transparent channel image of the portrait image is generated to obtain a portrait region image;
[0013] The face region image is obtained by segmenting the input image using face segmentation technology and generating a semi-transparent channel image.
[0014] In one embodiment, the horizontal pixel percentage of connected regions in the semi-transparent channel image is counted row by row, including:
[0015] Count the connected regions of the human portrait image line by line and the number of pixels contained in each connected region;
[0016] The horizontal pixel ratio is calculated by selecting the connected region with the largest number of pixels; wherein, the horizontal pixel ratio is the proportion of the number of pixels in the entire row to the total number of pixels.
[0017] The step of calculating the vertical pixel percentage of connected regions in the semi-transparent channel image column by column includes:
[0018] Count the connected regions of the human portrait image column by column and the number of pixels contained in each connected region;
[0019] The vertical pixel ratio is calculated by selecting the connected region with the largest number of pixels; wherein, the vertical pixel ratio is the proportion of the number of pixels in the entire column to the total number of pixels.
[0020] In one embodiment, the image blurring method further includes:
[0021] Obtain the number of pixels contained in the connected regions within the face region in the face region image line by line; calculate the horizontal pixel ratio of the face connected regions; wherein, the horizontal pixel ratio is the proportion of the number of pixels to the total number of pixels in the entire row;
[0022] Obtain the number of pixels contained in the connected regions within the face region in the face region image column by column; calculate the vertical pixel ratio of the face connected regions; wherein, the vertical pixel ratio is the proportion of the number of pixels to the total number of pixels in the column.
[0023] In one embodiment, calculating the target blur range matching each pixel of the semi-transparent channel image based on the horizontal pixel ratio and the vertical pixel ratio includes:
[0024] For each pixel in the semi-transparent channel image, obtain the horizontal pixel percentage of its row and the vertical pixel percentage of its column.
[0025] The smaller of the horizontal pixel ratio and the vertical pixel ratio is selected as the correlation coefficient;
[0026] The target blur range matching the pixel is calculated based on the correlation coefficient and the basic blur range.
[0027] In one embodiment, the image blurring method further includes:
[0028] Set the minimum fuzzy range;
[0029] When the calculated target blur range is less than the minimum blur range, the minimum blur range is used as the target blur range for that pixel.
[0030] In one embodiment, blurring is performed on each pixel of the semi-transparent channel image according to the target blur range, including:
[0031] Set the kernel size of the convolution-based blurring method according to the target blur range;
[0032] The blurring method is used to blur each pixel of the semi-transparent channel image to obtain the corresponding blurred image.
[0033] In one embodiment, blurring is performed on each pixel of the semi-transparent channel image according to the target blur range, including:
[0034] Set a fixed-size convolution kernel for the convolution-based fuzzy method;
[0035] The corresponding number of downsampling times and sampling step size are calculated based on the blur range of each pixel.
[0036] Set the global downsampling count for the double blur method to the maximum downsampling count among all pixels;
[0037] Double blurring is performed on each pixel of the semi-transparent channel image in parallel.
[0038] An image blurring device, comprising:
[0039] The acquisition module is used to acquire the semi-transparent channel image of the foreground image;
[0040] The statistics module is used to count the horizontal pixel ratio of the connected regions in the semi-transparent channel image row by row, and to count the vertical pixel ratio of the connected regions in the semi-transparent channel image column by column.
[0041] The calculation module is used to calculate the target blur range matched by each pixel point of the semi-transparent channel image based on the horizontal pixel ratio and the vertical pixel ratio;
[0042] The blur module is used to blur each pixel of the semi-transparent channel image according to the target blur range.
[0043] A video live streaming system includes: at least one broadcaster terminal and a live streaming server; wherein the live streaming server is connected to various viewer terminals via a network;
[0044] The broadcaster terminal is used to acquire broadcaster video images and to blur the broadcaster video images using the image blurring method described above.
[0045] The server is used to receive the broadcast video images uploaded by the broadcaster and distribute them to each viewer's terminal for playback.
[0046] An electronic device comprising:
[0047] One or more processors;
[0048] Memory;
[0049] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the image blurring method described above.
[0050] A computer-readable storage medium storing at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded by the processor and executed using the image blurring method described above.
[0051] The aforementioned image blurring method, apparatus, video live streaming system, electronic device, and computer-readable storage medium first acquire a semi-transparent channel image of the foreground image, then statistically analyze the pixel proportions of connected regions row by row / column, and finally calculate the target blur range matching each pixel based on the statistically analyzed pixel proportions, adaptively blurring each pixel of the semi-transparent channel image. This technical solution generates the target blur range matching pixels by statistically analyzing the pixel proportions of connected regions row by row / column, thereby adaptively adjusting the blur range of the image, avoiding the defect of color adjustment effect mismatch caused by the global consistency of the blur range, and improving the color adjustment effect.
[0052] Furthermore, by scanning the connected regions of the image row by row / column, the size of the bright pixel area within the effective mask in each row / column pixel can be obtained. For a foreground image containing a human body, the largest connected region is used to represent the pixels in that row. Where the human body is narrower, the pixel ratio is lower, and where the human body is wider, the pixel ratio is higher. Thus, when obtaining a mask for further processing of the foreground image through image blurring, the blur range can be adjusted according to the pixel ratio, making it easier to implement different color correction schemes.
[0053] Furthermore, based on double blurring, a blurring scheme that enables each pixel to have an adaptive blur range can run well on various terminal devices, avoiding the stripe problem caused by a large sampling step size or the defect of large computational load. It is a high-performance blurring method. Attached Figure Description
[0054] Figure 1 This is a flowchart of an image blurring method according to one embodiment;
[0055] Figure 2 A schematic diagram of a semi-transparent channel image as an example;
[0056] Figure 3 This is a schematic diagram illustrating the segmentation process to obtain a portrait region image and a face region image;
[0057] Figure 4 This is a schematic diagram illustrating an example of fuzzy computation;
[0058] Figure 5 This is a flowchart of an image blurring operation example;
[0059] Figure 6 This is a schematic diagram illustrating a double fuzzy operation;
[0060] Figure 7 This is a schematic diagram of image composition using common blurring image methods;
[0061] Figure 8 This is a schematic diagram of image composition using the blurred image method of this application;
[0062] Figure 9 This is a schematic diagram of the structure of an image blurring device according to one embodiment;
[0063] Figure 10 This is a block diagram of an example electronic device. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0065] In the embodiments of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function. "At least one" refers to one or more, and "multiple" means two or more; for example, multiple objects refer to two or more objects. Words such as "including" or "containing" indicate that the information preceding "including" or "containing" covers the information listed after "including" or "containing" and its equivalents, but does not exclude other information. In the embodiments of this application, "and / or" indicates that three relationships can exist; the character " / " generally indicates that the preceding and following objects have an "or" relationship.
[0066] In this application, image blurring refers to blurring the input sharp image I∈R. H×W×C The corresponding blurred image I is obtained through image processing. blur ∈R H×W×C Where W and H represent the width and height of the image, respectively, the subscript blur indicates blurring, and C represents the number of channels in the input image. The technical solution of this application is mainly applied to the semi-transparent channel image I obtained by foreground image matting of the input image, typically C=1, to achieve color adjustment applications through blurring.
[0067] refer to Figure 1 As shown, Figure 1 This is a flowchart of an image blurring method according to an embodiment, including the following steps:
[0068] S10, Obtain the semi-transparent channel image of the foreground image.
[0069] In this step, a semi-transparent channel image can be generated based on the foreground image of the input image, such as... Figure 2 As shown, Figure 2 This is a schematic diagram of a semi-transparent channel image as an example. The left side is the input image. The foreground image is obtained by keying out the human image and generating the corresponding semi-transparent channel image.
[0070] In order to achieve different color adjustments for the face and body images during the image blurring process, the face image and the body image can be segmented separately, so that image blurring can be performed separately.
[0071] Accordingly, in one embodiment, step S10 may include the following:
[0072] The input image is truncated to obtain a portrait image, and a semi-transparent channel image of the portrait image is generated to obtain a portrait region image; the input image is segmented using face segmentation technology and a semi-transparent channel image is generated to obtain a face region image.
[0073] Specifically, such as Figure 3 As shown, Figure 3 This is an example of segmenting to obtain a portrait region image and a face region image. It demonstrates how, based on a portrait region image I already obtained by the user using matting technology, a face region image F∈R can be obtained through face segmentation technology. H×W This yields the portrait region image and the face region image, allowing for different color adjustments or no color adjustment of the portrait region image and the face region image during the blurring process.
[0074] The technical solution of the above embodiment can obtain the portrait region image and the face region image respectively. Based on this, different blur ranges can be set for the two semi-transparent channel images during image blurring to achieve different blur effects.
[0075] S20, count the horizontal pixel ratio of the connected regions in the semi-transparent channel image row by row, and count the vertical pixel ratio of the connected regions in the semi-transparent channel image column by column.
[0076] In this step, for pixels with brightness in the semi-transparent channel image, the percentage of pixels in the entire row / column containing foreground image content in the connected components is counted row by row / column. These percentages are recorded as the horizontal pixel percentage and the vertical pixel percentage, respectively. A connected component is an image region composed of foreground pixels with the same pixel value and adjacent positions.
[0077] As an example, for a human portrait region image, the statistical method in step S20 can be as follows:
[0078] The number of pixels contained in each connected region of the human portrait image is counted row by row from left to right; the connected region with the largest number of pixels is selected to calculate the horizontal pixel ratio; wherein, the horizontal pixel ratio is the proportion of the number of pixels to the total number of pixels in the row;
[0079] The number of pixels contained in each connected region of the human portrait image is counted column by column from top to bottom; the vertical pixel ratio is calculated by selecting the connected region with the largest number of pixels; wherein, the vertical pixel ratio is the proportion of the number of pixels to the total number of pixels in the column.
[0080] Specifically, in the horizontal proportion statistics, for the h-th (1≤h≤H) row of the human portrait region image, all K rows are counted from left to right. h There are n connected regions and the number of pixels n contained in each connected region. k (1≤k≤K h Select the number of pixels. Largest connected region To represent the connected region of that row, used to calculate the horizontal pixel ratio of the portrait region image, assuming the final calculated ratio value... The horizontal pixel percentage of this row is recorded as S. hor (x,y)∈R H×W In vertical proportional statistics, similar to horizontal statistics, the proportional value of each column of the human portrait region image can be obtained. Record the vertical pixel ratio statistics as S ver (x,y)∈R H×W (x,y) represents the pixel coordinates.
[0081] Furthermore, when calculating the pixel percentage of a face region image, the following steps can also be included:
[0082] Obtain the number of pixels contained in the connected regions within the face region in the face region image line by line; calculate the horizontal pixel ratio of the face connected regions; wherein, the horizontal pixel ratio is the proportion of the number of pixels to the total number of pixels in the entire row.
[0083] Obtain the number of pixels contained in the connected regions within the face region in the face region image column by column; calculate the vertical pixel ratio of the face connected regions; wherein, the vertical pixel ratio is the proportion of the number of pixels to the total number of pixels in the column.
[0084] Specifically, when performing horizontal pixel ratio statistics, if an image F containing a face region is encountered, the connected region corresponding to that face region image is selected. This represents the connected region of pixels in that row, used to calculate the horizontal pixel percentage of the face region image. Correspondingly, when performing vertical pixel percentage statistics, if a face region image F is encountered, the connected region corresponding to that face region image is selected. This represents the connected region of pixels in this column, used to calculate the vertical pixel ratio of the face region image.
[0085] The technical solution of the above embodiments can obtain the size of the bright pixel area in the effective mask of each row / column pixel by scanning the connected regions of the image row by row / column. For a foreground image containing a human body, the largest connected region is used to represent the pixels in that row. The pixel ratio is low in the narrower part of the human body and high in the wider part of the human body. Therefore, when obtaining a mask for further processing of the foreground image by blurring the image, the blur range can be adjusted according to the pixel ratio, which is convenient for implementing different color adjustment schemes.
[0086] S30, calculate the target blur range for each pixel in the semi-transparent channel image based on the horizontal pixel ratio and the vertical pixel ratio.
[0087] In this step, based on the statistical results of the horizontal and vertical pixel ratios, a corresponding blur range is set for each pixel in the portrait area image and the face area image. This allows for adaptive adjustment of the blur range according to the image content, achieving different color correction effects.
[0088] In one embodiment, a method for matching the fuzzy range of a target may include the following:
[0089] For each pixel in the semi-transparent channel image, the horizontal pixel ratio of its row and the vertical pixel ratio of its column are obtained respectively; the smaller of the horizontal pixel ratio and the vertical pixel ratio is selected as the correlation coefficient; the target blur range matching the pixel is calculated based on the correlation coefficient and the basic blur range.
[0090] Furthermore, when calculating the target blur range, a minimum blur range can be set. When the calculated target blur range is less than the minimum blur range, the minimum blur range is used as the target blur range of the pixel.
[0091] Specifically, when outputting a blurred image, each pixel I blur The statistical results of the blur range and horizontal pixel ratio of (x,y) S hor (x,y) and vertical pixel proportion statistics S ver (x,y) related, in this embodiment, S is selected. hor (x,y) and S ver The smaller of (x, y) is used as the correlation coefficient; in practical applications, S can also be calculated. hor (x,y) and S ver The correlation coefficient is obtained by taking the mean of (x,y). Then, the target blur range k of pixel matching is calculated. x,y =max[min(S) hor (x,y),S ver (x,y))·k,k min ], where k represents the basic fuzzy range, k min This indicates the minimum fuzzy range.
[0092] The technical solution of the above embodiments, when generating a blurred image using the image blurring method, can adaptively match the target blur range for any pixel in the image, and the blur range is positively correlated with the pixel ratio of bright pixels in the row and column where it is located, thereby achieving a high-performance color adjustment scheme during the blurring process; by setting the minimum blur range, the minimum blur effect of the image can be guaranteed.
[0093] S40, blur each pixel of the semi-transparent channel image according to the target blur range.
[0094] In this step, each pixel of the portrait region image and the face region image is blurred to obtain a blurred image I. blur This achieves an effect where the blur range of each pixel in a blurred image adapts to the changes in the image content.
[0095] In one embodiment, the method for blurring may include the following steps:
[0096] The kernel size of the convolution-based blurring method is set according to the target blur range; the blurring method is used to blur each pixel of the semi-transparent channel image to obtain the corresponding blurred image.
[0097] For details, please refer to Figure 4 As shown, Figure 4 This is a schematic diagram of an example blurring operation. It shows the process of blurring by segmenting the image into a portrait region and a face region image, with each pixel I... blur The matching of (x,y) is achieved through statistical results S hor (x,y) and S ver The fuzzy range k calculated from (x,y) x,y Apply convolution-based blurring methods (such as Gaussian blur, mean blur, median blur), and determine the blur range k. x, Set the corresponding convolution kernel (sampling range) size so that the blur range of each pixel in the portrait region image and the face region image adaptively follows the changes of the pixel.
[0098] The technical solution of the above embodiment is based on the commonly used convolutional blurring method. During the blurring process, the size of the convolution kernel is continuously adjusted according to the different blur range of each pixel, which can achieve the effect of adaptively changing the blur range.
[0099] Furthermore, in the above embodiments, the larger the required blur range, the more pixels need to be sampled, resulting in a larger computational load. When the computational load is too large, it is difficult to support real-time applications on low-end and mid-range devices. If a fixed convolution kernel size is used and the pixel sampling stride is adjusted to achieve large-range blur, there is a problem of choosing between the size of the convolution kernel (computational load) and the effect. If the convolution kernel is small, there will be stripe problems caused by long-distance sampling. If the convolution kernel is large, there will be a problem of large computational load.
[0100] To achieve high-performance fuzzy processing methods with adaptive fuzzy range, this application also provides a fuzzy processing scheme based on dual fuzziness, as referenced. Figure 5 As shown, Figure 5 This is a flowchart of an image blurring operation according to one embodiment, which may include the following:
[0101] S401, Set a fixed-size convolution kernel for the convolution-based fuzzy method.
[0102] Double blurring is a blurring method that uses a fixed-size convolution kernel and multiple iterations of blurring and downsampling (upsampling) to achieve a large blur range. The blur range is determined by the sampling step size λ of the pixel and the number of downsampling (upsampling) n. Generally speaking, the larger the number of downsampling (upsampling) n and the larger the sampling step size, the larger the blur range.
[0103] S402 calculates the corresponding downsampling (upsampling) times and sampling step size based on the blur range of each pixel.
[0104] Since the number of downsampling (upsampling) and the sampling step size jointly determine the blur range of the double blur, and the target blur range of each pixel is different, a function λ can be constructed in this embodiment. x, ,n x, =f(k) x, ), used to fuzz the target range k x, To calculate the number of downsampling (upsampling) times for each pixel in real time. x, and sampling step size λ x, .
[0105] S403, set the global downsampling count of the double blur method to the maximum downsampling count among all pixels.
[0106] In a GPU-based rendering engine, image blur calculations are performed on each pixel in parallel, with different pixels sharing the same processing logic. Here, for some pixels with smaller target blur ranges, the blur range is amplified by downsampling (or upsampling). Given the globally consistent blur range in dual blurring, this embodiment uses the largest downsampling count among all pixels during the blur calculation process. Set the number of downsampling operations globally.
[0107] S404, Perform double blurring on each pixel of the semi-transparent channel image in parallel.
[0108] According to the number of downsampling times n x,y and sampling step size λ x,y Double blurring is performed during the upsampling process, when calculating the upsampling layer U. i When, even if pixel U i The formula for calculating (x,y) is:
[0109]
[0110] In the formula, D i(x, y) represents the pixel point calculated by downsampling, and Blur represents the blur operator. For pixels with a small blur range, the number of upsampling operations is also less than the maximum number of downsampling operations. Then the pixel blur calculation results can be retrieved in advance.
[0111] like Figure 6 As shown, Figure 6 This is a schematic diagram of a dual blur operation. When performing blur processing with adaptive changes in the blur range, the rendering engine first performs downsampling calculations on each pixel in parallel, and then performs upsampling calculations in parallel. Since some pixels have a small number of samples, the required blur calculation results are calculated in advance. At this time, the required results can be retrieved in advance when the corresponding number of samples is obtained in the blur calculation. As shown in the figure, the required blur calculation results can be retrieved at the U2, U1, or U0 level.
[0112] The technical solution of the above embodiments, based on double blurring, realizes a blurring scheme in which each pixel has an adaptive different blur range. This technical solution can run well on various terminal devices and avoids the defects of stripe problems caused by large sampling step size or large amount of calculation. It is a high-performance blurring calculation method.
[0113] The image blurring method described in the above embodiments can be applied as a general image processing technique in various scenarios, such as the metaverse, film and television creation, short videos, online video live streaming, image editing and creation, etc.
[0114] The following example uses a video live streaming system to illustrate the image compositing process in keying during live streaming. (Reference) Figure 7 As shown, Figure 7 This is a schematic diagram of a common image compositing method using blurring techniques. In live video editing, the video is often shot against a green screen background, and then a suitable background image is added for compositing to obtain the desired live video image. When editing the video image, the first step is to use a green screen keying technique to obtain a semi-transparent channel image of the anchor's portrait. Then, the desired background image is added for compositing, and the composite image is blurred to blend the portrait image with the background image. The blurring process adjusts the brightness and color of the foreground image in the composite image based on the background brightness and color information. However, when using common image blurring methods, because the blur range is globally uniform, all parts of the human image in the image have the same color tone, especially the face, which also carries a significant amount of background color, resulting in a very mismatched composite image.
[0115] After adopting the technical solution provided in this application, refer to Figure 8 As shown, Figure 8This is a schematic diagram of the image compositing method of the present application. Since the blur range of the image can be adaptively adjusted, and the blur range is positively correlated with the size of the connected region in the image, the adjustment range of the foreground can be intelligently adjusted during color correction. This allows the color of the person image edge to be well adjusted in the composite image, and the face area can be adaptively matched with a smaller blur range to avoid large-scale blur affecting the color and brightness of the face area, making the composite image effect very well matched.
[0116] The following describes an embodiment of the image blurring device.
[0117] refer to Figure 9 As shown, Figure 9 This is a schematic diagram of the structure of an image blurring device according to an embodiment, including:
[0118] The acquisition module 10 is used to acquire the semi-transparent channel image of the foreground image;
[0119] The statistics module 20 is used to count the horizontal pixel ratio of the connected regions in the semi-transparent channel image row by row, and to count the vertical pixel ratio of the connected regions in the semi-transparent channel image column by column.
[0120] Calculation module 30 is used to calculate the target blur range matched by each pixel point of the semi-transparent channel image based on the horizontal pixel ratio and the vertical pixel ratio;
[0121] The blur module 40 is used to blur each pixel of the semi-transparent channel image according to the target blur range.
[0122] The image blurring device of this embodiment can execute an image blurring method provided in the embodiments of this application. The implementation principle is similar. The actions performed by each module in the image blurring device in each embodiment of this application correspond to the steps in the image blurring method in each embodiment of this application. For detailed functional descriptions of each module of the image blurring device, please refer to the descriptions in the corresponding image blurring methods shown above. They will not be repeated here.
[0123] The following describes embodiments of a video live streaming system, electronic device, and computer-readable storage medium.
[0124] This application also provides a video live streaming system, which mainly includes at least one broadcaster terminal and a live streaming server. The live streaming server connects to various viewer terminals via a network, and each viewer can watch the broadcaster's video image through their respective viewer terminals. The image blurring scheme provided in this application can be applied to the broadcaster terminal. After capturing the broadcaster's video image through a camera, the broadcaster terminal can obtain the foreground image of the human face, for example, by using green screen keying to obtain the broadcaster's human face image, and then generate a semi-transparent channel image. To add a new background image to the broadcaster's human face image, a mask is added to the semi-transparent channel image of the human face image and blurred, so that the final synthesized broadcaster video image and background image achieve a more seamless matching effect. The broadcaster terminal then uploads the processed broadcaster video image to the server. The server receives the broadcaster video image uploaded by the broadcaster terminal, processes it accordingly, and distributes it to various viewer terminals for playback.
[0125] This application provides a technical solution for an electronic device to implement functions related to image blurring methods.
[0126] In one embodiment, this application provides an electronic device comprising:
[0127] One or more processors;
[0128] Memory;
[0129] One or more applications, wherein the applications are stored in memory and configured to be executed by one or more processors, the applications being configured for the image blurring method of any embodiment.
[0130] like Figure 10 As shown, Figure 10 This is a block diagram of an example electronic device. The electronic device may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc. The device may include one or more of the following components: processing component 1002, memory 1004, power component 1006, multimedia component 1008, audio component 1009, input / output (I / O) interface 1012, sensor component 1014, and communication component 1016.
[0131] The processing component 1002 typically controls the overall operation of the device 1000, such as operations associated with display, telephone calls, data communication, camera operation, and recording operation.
[0132] Memory 1004 is configured to store various types of data to support the operation of device 1000, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0133] The power supply assembly 1006 provides power to the various components of the device 1000.
[0134] Multimedia component 1009 includes a screen that provides an output interface between device 1000 and user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). In some embodiments, multimedia component 1008 includes a front-facing camera and / or a rear-facing camera.
[0135] The audio component 1009 is configured to output and / or input audio signals.
[0136] I / O interface 1012 provides an interface between processing component 1002 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0137] Sensor assembly 1014 includes one or more sensors for providing state assessment of various aspects of device 1000. Sensor assembly 1014 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
[0138] The communication component 1016 is configured to facilitate wired or wireless communication between the device 1000 and other devices. The device 1000 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof.
[0139] This application provides a computer-readable storage medium to implement image blurring methods. The computer-readable storage medium stores at least one instruction, at least one program, code set, or instruction set, which is loaded by a processor and executes the image blurring method of any embodiment.
[0140] In an exemplary embodiment, the computer-readable storage medium can be a non-transitory computer-readable storage medium that includes instructions, such as a memory that includes instructions. For example, a non-transitory computer-readable storage medium can be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0141] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. An image blurring method, characterized in that, include: Obtain the semi-transparent channel image of the foreground image; The percentage of horizontal pixels in the connected regions of the semi-transparent channel image is calculated row by row, and the percentage of vertical pixels in the connected regions of the semi-transparent channel image is calculated column by column. The target blur range for each pixel in the semi-transparent channel image is calculated based on the horizontal and vertical pixel ratios, including: for each pixel in the semi-transparent channel image, obtaining the horizontal pixel ratio of its row and the vertical pixel ratio of its column; selecting the smaller of the horizontal and vertical pixel ratios as the correlation coefficient; and calculating the target blur range for that pixel based on the correlation coefficient and the basic blur range. The semi-transparent channel image is blurred according to the target blur range.
2. The image blurring method according to claim 1, characterized in that, Obtain the semi-transparent channel image of the foreground image, including: The input image is truncated to obtain a portrait image, and a semi-transparent channel image of the portrait image is generated to obtain a portrait region image; The face region image is obtained by segmenting the input image using face segmentation technology and generating a semi-transparent channel image.
3. The image blurring method according to claim 2, characterized in that, The percentage of horizontal pixels in the connected regions of the semi-transparent channel image is calculated line by line, including: Count the connected regions of the human portrait image line by line and the number of pixels contained in each connected region; The horizontal pixel ratio is calculated by selecting the connected region with the largest number of pixels; wherein, the horizontal pixel ratio is the proportion of the number of pixels in the entire row to the total number of pixels. The step of calculating the vertical pixel percentage of connected regions in the semi-transparent channel image column by column includes: Count the connected regions of the human portrait image column by column and the number of pixels contained in each connected region; The vertical pixel ratio is calculated by selecting the connected region with the largest number of pixels; wherein, the vertical pixel ratio is the proportion of the number of pixels in the entire column to the total number of pixels.
4. The image blurring method according to claim 3, characterized in that, Also includes: Obtain the number of pixels contained in the connected regions within the face region in the face region image, line by line. Calculate the horizontal pixel ratio of the connected regions of the face; wherein, the horizontal pixel ratio is the proportion of the number of pixels to the total number of pixels in the entire row; Obtain the number of pixels contained in the connected regions within the face region in the face region image column by column; calculate the vertical pixel ratio of the face connected regions; wherein, the vertical pixel ratio is the proportion of the number of pixels to the total number of pixels in the column.
5. The image blurring method according to claim 1, characterized in that, Also includes: Set the minimum fuzzy range; When the calculated target blur range is less than the minimum blur range, the minimum blur range is used as the target blur range for that pixel.
6. The image blurring method according to any one of claims 1-5, characterized in that, The semi-transparent channel image is blurred according to the target blur range, including: Set the kernel size of the convolution-based blurring method according to the target blur range; The blurring method is used to blur each pixel of the semi-transparent channel image to obtain the corresponding blurred image.
7. The image blurring method according to any one of claims 1-5, characterized in that, The semi-transparent channel image is blurred according to the target blur range, including: Set a fixed-size convolution kernel for the convolution-based fuzzy method; The corresponding number of downsampling times and sampling step size are calculated based on the blur range of each pixel. Set the global downsampling count for the double blur method to the maximum downsampling count among all pixels; Double blurring is performed on each pixel of the semi-transparent channel image in parallel.
8. An image blurring device, characterized in that, include: The acquisition module is used to acquire the semi-transparent channel image of the foreground image; The statistics module is used to count the horizontal pixel ratio of the connected regions in the semi-transparent channel image row by row, and to count the vertical pixel ratio of the connected regions in the semi-transparent channel image column by column. The calculation module is used to calculate the target blur range matched by each pixel of the semi-transparent channel image based on the horizontal pixel ratio and the vertical pixel ratio, including: for each pixel of the semi-transparent channel image, obtaining the horizontal pixel ratio of its row and the vertical pixel ratio of its column; selecting the smaller of the horizontal pixel ratio and the vertical pixel ratio as the correlation coefficient; and calculating the target blur range matched by the pixel based on the correlation coefficient and the basic blur range. The blur module is used to blur each pixel of the semi-transparent channel image according to the target blur range.
9. A video live streaming system, characterized in that, include: At least one broadcaster terminal and a live streaming server; wherein the live streaming server is connected to various viewer terminals via a network; The broadcaster terminal is used to acquire broadcaster video images and to blur the broadcaster video images using the image blurring method described in any one of claims 1-7; The server is used to receive the broadcast video images uploaded by the broadcaster and distribute them to each viewer's terminal for playback.
10. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the image blurring method according to any one of claims 1-7.
11. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or instruction set is loaded by a processor and executed using the image blurring method according to any one of claims 1-7.