Image processing method and device, terminal equipment and computer readable storage medium
Patent Information
- Application Number
- CN202011630812.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2040-12-30
AI Technical Summary
Existing noise overlay methods have poor applicability in image blurring processing, involve large computational loads, resulting in low blurring efficiency and increased power consumption of terminal devices.
By obtaining the mask of the image to be processed, the foreground Y-channel image and the background Y-channel image of the blurred image are obtained respectively. The Y-channel noise image is generated and superimposed to obtain the blurred effect image, reducing the amount of computation and processing time.
It improves the efficiency of virtualization processing, reduces the amount of computation and processing time, and reduces the power consumption of terminal devices.
Smart Images

Figure CN114693508B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, and in particular relates to an image processing method, apparatus, terminal device and computer-readable storage medium. Background Technology
[0002] In the current terminal device shooting function, when shooting in portrait mode, the resulting image is usually a blurred image with a clear subject and a blurred background.
[0003] Because images often contain noise during the shooting process, blurring the background of the image can easily worsen the noise consistency of the blurred image, making the blurring effect unrealistic.
[0004] To address the aforementioned issues, noise overlay methods are typically used to improve the noise consistency of the blurred image. Existing noise overlay methods usually involve acquiring the original image to be blurred, collecting the noise signals from the original image, periodically expanding the noise signals, and then overlaying them onto the blurred image to obtain the final blurred image.
[0005] However, the above methods have poor applicability, and the computational load of superposition processing is large, the blurring processing time is long, which increases the power consumption of terminal devices and reduces blurring efficiency. Summary of the Invention
[0006] This application provides an image processing method, apparatus, terminal device, and computer-readable storage medium, which can solve the problems of poor applicability, large computational load, long processing time, and low blurring efficiency of existing noise superposition methods.
[0007] In a first aspect, embodiments of this application provide an image processing method, including:
[0008] Image processing is performed on the image to be processed to obtain a masked and blurred image;
[0009] The foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image are obtained based on the mask.
[0010] Generate a Y-channel noise map based on the foreground Y-channel map;
[0011] The noise image of the Y channel and the background Y channel image are superimposed to obtain a blurred image.
[0012] Secondly, embodiments of this application provide an image processing apparatus, including:
[0013] The processing module is used to perform image processing on the image to be processed, and obtain masked and blurred images;
[0014] The acquisition module is used to obtain the foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image based on the mask.
[0015] The generation module is used to generate a Y-channel noise map based on the foreground Y-channel map;
[0016] The overlay processing module is used to overlay the Y-channel noise image and the background Y-channel image to obtain a blurred image.
[0017] Thirdly, embodiments of this application provide a terminal device, which includes a memory, a processor, and an image processing program stored in the memory and executable on the processor. When the processor executes the image processing program, it implements the image processing method as described in the first aspect above.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing an image processing program, which, when executed by a processor, implements the image processing method as described in the first aspect above.
[0019] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the image processing method described in the first aspect.
[0020] The mask of the image to be processed is obtained by calculation. The foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image are obtained based on the mask. The corresponding Y-channel noise image is generated based on the foreground Y-channel image. The Y-channel noise image and the background Y-channel image are superimposed to obtain the blurred image. This realizes the noise superposition processing operation of the image to be processed based on a single channel, which reduces the amount of calculation and processing time of the blurring process and improves the efficiency of the blurring process.
[0021] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic flowchart of an image processing method provided in an embodiment of this application;
[0024] Figure 2(a) is a schematic diagram of an image containing noise details provided in an embodiment of this application;
[0025] Figure 2(b) is a schematic diagram of an image without noise details provided in another embodiment of this application;
[0026] Figure 3 This is a schematic diagram of a bokeh effect image without noise overlay processing provided in an embodiment of this application;
[0027] Figure 4 This is a schematic diagram of a bokeh effect image provided in another embodiment of this application;
[0028] Figure 5 This is a schematic diagram of the Y-channel noise map provided in an embodiment of this application;
[0029] Figure 6 This is a schematic diagram of the structure of the image processing apparatus provided in the embodiments of this application;
[0030] Figure 7 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. Detailed Implementation
[0031] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0032] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0033] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0034] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0035] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0036] The image processing method provided in this application can be applied to terminal devices such as mobile phones, tablets, and laptops. This application does not impose any restrictions on the specific type of terminal device.
[0037] Figure 1 A schematic flowchart of the image processing method provided in this application is shown. It is provided as an example and not as a limitation. The method can be applied to the mobile phone described above.
[0038] S101. Perform image processing on the image to be processed to obtain a masked and blurred image.
[0039] In practical applications, the image to be processed is acquired by capturing a picture using the camera of the current terminal. The image to be processed refers to the original image that requires image processing. In this embodiment, the image to be processed is set to a preset format, such as YUV format, or RGB format as needed, to facilitate compatibility with terminal devices with different camera types.
[0040] In practical applications, a binocular disparity map corresponding to the image to be processed is obtained, along with the position information of the target focus within the binocular disparity map. A mask for the image to be processed is then calculated based on the binocular disparity map and the target focus position information. Simultaneously, the image to be processed is blurred based on the binocular disparity map and the target focus position information to obtain a blurred image. The mask is used to distinguish the foreground and background of the image. The method for obtaining the target focus position information can be specifically set according to the actual situation. In this embodiment, the target focus is set as the point selected by the user in the binocular disparity map, and the corresponding target focus position information is obtained.
[0041] Figure 2(a) provides a schematic diagram of an image containing noise details;
[0042] Figure 2(b) provides a schematic diagram of an image that does not contain noise details.
[0043] As can be seen from the comparison in Figure 2, the image containing noise details has a high consistency between the foreground and background noise, which makes the transition between the blurred background and foreground edges natural, and the blurring effect is closer to the real optical bokeh effect.
[0044] S102. Obtain the foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image based on the mask.
[0045] In practical applications, based on the mask of the image to be processed, foreground and background distinction operations are performed on the image to be processed and the blurred image, respectively, to obtain the foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image.
[0046] S103. Generate a Y-channel noise map based on the foreground Y-channel map.
[0047] In practical applications, the noise distribution parameters of the foreground Y-channel image are calculated based on the pixel values of the pixels in the image to be processed, and a corresponding Y-channel noise map is generated based on these parameters. The noise distribution parameters of the foreground Y-channel image include the mean and variance of the pixels in the foreground Y-channel image; a Y-channel noise map containing Gaussian noise and white noise can be generated based on the mean and variance of the pixels in the foreground Y-channel image.
[0048] S104. Overlay the noise image of the Y channel and the background Y channel image to obtain a blurred image.
[0049] In practical applications, the pixel values of the pixels in the noise map of the Y channel are superimposed with the pixel values of the pixels in the background Y channel map of the blurred image to update the pixel values of the pixels in the background Y channel map of the blurred image, thereby obtaining the blurred image.
[0050] In practical applications, the pixel Bokeh_Y_B in the background Y channel image of the blurred image can be determined based on the mask. According to the preset formula (i.e. Formula 1), the noise in the Y channel noise image is superimposed on the background Y channel image of the blurred image to obtain the blurred image.
[0051] Bokeh_Y_B i =Bokeh_Y_B i +p*Noise i (Formula 1);
[0052] Among them: Bokeh_Y_B i Noise represents the pixel value of the i-th pixel in the background Y-channel image of the blurred image. i Let p represent the i-th pixel in the noise map of the Y channel. p follows a binomial probability distribution and can randomly take the value 0 or 1.
[0053] like Figure 3As shown, this is a schematic diagram of a bokeh effect without noise overlay processing;
[0054] like Figure 4 As shown, this is a schematic diagram of a blurred image effect.
[0055] By directly blurring the image to be processed, the following results can be obtained: Figure 3 The blurred effect shown is obtained by calculating the noise map of the Y channel, and then the noise map of the Y channel and... Figure 3 The background Y-channel image of the blurred effect shown is subjected to noise overlay processing to obtain the following result: Figure 4 The image shown is a blurred image after overlay processing.
[0056] In one embodiment, step S102 includes:
[0057] S1021. Obtain the binocular disparity map corresponding to the image to be processed, and the position information of the target focus;
[0058] S1022. Calculate the mask for the image to be processed based on the binocular disparity map and position information;
[0059] S1023. Based on the binocular disparity map and position information, the image to be processed is blurred to obtain a blurred image.
[0060] In practical applications, a binocular disparity map corresponding to the image to be processed is obtained, and the position information of the target focus selected by the user in the binocular disparity map is also obtained. Based on the position information of the target focus and the binocular disparity map, the image to be processed is blurred to obtain a blurred image. At the same time, the disparity value of the target focus is calculated with the position of the target focus as the center in the binocular disparity map, and then the mask of the image to be processed is calculated based on the disparity value of the target focus.
[0061] In one embodiment, step S1022 includes:
[0062] Using the location corresponding to the location information as the center, obtain the median value of all pixels in the preset area of the binocular disparity map, and use it as the disparity value of the target focus;
[0063] Calculate the blur kernel radius for each pixel in the image to be processed;
[0064] The blurred image is obtained by blurring each pixel in the image to be processed according to the blur kernel radius.
[0065] A mask is obtained based on the pixel value of each pixel in the blurred image to be processed.
[0066] In practical applications, a preset region is established centered on the location of the target focus in the binocular disparity map (i.e., the location of the target corner point). The median pixel value of all pixels within the preset region is used as the disparity value of the target focus. Based on the disparity value of the target focus, the disparity value of each pixel in the binocular disparity map, and the maximum disparity value among all pixels in the binocular disparity map, the blur kernel radius of each pixel in the image to be processed is calculated. Each pixel is blurred according to its blur kernel radius, resulting in the pixel value of each pixel in the blurred image. Whether a pixel is in the foreground is determined by whether its blur kernel radius is 0 (pixels with a blur kernel radius of 0 are set as foreground, and pixels with a non-zero blur kernel radius are set as background), thus obtaining the mask for the image to be processed. The preset region can be specifically set according to actual needs. For example, the size of the preset region can be set to 1 / 8 of the image to be processed.
[0067] In practical applications, the blur kernel radius r of each pixel in the image to be processed can be calculated using formula (2). i,j As shown in the following formula:
[0068]
[0069] Where: R represents the maximum blur radius (which can be set according to user input data), d i,j The disparity value at pixel (i, j) in the binocular disparity map is represented by d_focus, the disparity value of the target focus is represented by d_max, the maximum disparity value among all pixels in the binocular disparity map is represented by Δd, and the dynamic range of disparity of pixels at the target focus that can be considered as foreground pixels is represented by Δd. Δd can be set according to the specific situation. Based on multiple experiments, it was found that the calculated mask accuracy is highest when Δd = 0.03 * d_max. Therefore, in this embodiment, Δd = 0.03 * d_max is set.
[0070] In one embodiment, step S104 includes:
[0071] S1041. Perform high-pass filtering on the foreground Y-channel image to obtain the filtered foreground Y-channel image;
[0072] S1042. Calculate the pixel difference between the foreground Y channel image and the filtered foreground Y channel image to obtain the noise image of the foreground Y channel.
[0073] S1043. Calculate the noise distribution parameters of the foreground Y channel noise map;
[0074] S1044. Generate the corresponding Y-channel noise map based on the noise distribution parameters.
[0075] In practical applications, a high-pass filter is applied to the foreground Y-channel image of the image to be processed to obtain a filtered foreground Y-channel image. The pixel difference between each pixel in the foreground Y-channel image of the image to be processed and each pixel in the filtered foreground Y-channel image is calculated to obtain the corresponding noise map of the foreground Y-channel. The pixel value of each pixel in the noise map of the foreground Y-channel is the aforementioned pixel difference. Then, based on the pixel values of all pixels in the noise map of the foreground Y-channel, the noise distribution parameters of the pixels in the noise map of the foreground Y-channel are calculated. The corresponding Y-channel noise map is then generated based on these noise distribution parameters. These noise distribution parameters include, but are not limited to, the mean and variance.
[0076] In practical applications, since noise is generally generated by a large number of random disturbances, and based on the central limit theorem, we can assume that the distribution of noise points in the foreground Y-channel noise image follows the Gaussian distribution principle. Therefore, the mean and variance of the foreground Y-channel noise image can be calculated using formulas (3) and (4):
[0077]
[0078]
[0079] Where: υ represents the mean, σ 2 p represents variance. i The pixel value of any pixel in the noise map of the foreground Y channel, where N represents the number of pixels in the noise map of the foreground Y channel.
[0080] In practical applications, the mean and variance of pixels in the foreground Y-channel noise map can be calculated using formulas (5) and (6), resulting in the pixel values of the noise points in the Y-channel noise map and the corresponding generation of the Y-channel noise map:
[0081] noise i =2*MAX*(N(x) i ,[υ,σ 2 ])-0.5) Formula (5);
[0082]
[0083] Among them: noise i x represents the pixel value of any noise point in the Y-channel noise map. i Let x represent a random number. i Take any value between [-255, 255]. MAX represents the maximum noise value of the Y-channel noise map, and its value can be set according to specific needs. Based on multiple experiments, it was found that when MAX = 8, the generated Y-channel noise map has the best effect. Therefore, in this embodiment, MAX = 8 is set.
[0084] It is understandable that the size of the Y-channel noise map generated according to the above formulas (5) and (6) is equal to half the size of the image to be processed. Therefore, the size of the generated Y-channel noise map needs to be enlarged to the size of the image to be processed by the nearest neighbor interpolation algorithm. The nearest neighbor interpolation algorithm makes the gray value of the transformed pixel equal to the gray value of the nearest input pixel.
[0085] like Figure 5 As shown, a schematic diagram of the noise map of the Y channel is provided.
[0086] Figure 5 To generate a Y-channel noise map carrying Gaussian noise and white noise based on the noise distribution parameters of pixels in the foreground Y-channel map.
[0087] In one embodiment, step S1043 includes:
[0088] Based on the pixel value and number of pixels of each pixel in the foreground Y-channel noise map, the noise distribution parameters of the foreground Y-channel noise map are calculated; among them, the noise distribution parameters include the mean and variance.
[0089] In practical applications, the mean and variance of the foreground Y-channel noise map are calculated based on the pixel value of each pixel in the foreground Y-channel noise map and the number of pixels in the foreground Y-channel noise map.
[0090] In one embodiment, step S1044 includes:
[0091] The pixel value of each noise point in the Y channel is calculated based on the mean and variance, and the corresponding Y channel noise map is generated based on the pixel value.
[0092] In practical applications, the mean and variance of pixels in the foreground Y-channel noise map are calculated according to preset formulas to obtain the pixel value of each noise point in the Y-channel, and the corresponding Y-channel noise map is generated based on the pixel values of all noise points. The preset formulas are formulas (5) and (6) mentioned above.
[0093] The mask of the image to be processed is obtained by calculation. The foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image are obtained based on the mask. The corresponding Y-channel noise image is generated based on the foreground Y-channel image. The Y-channel noise image and the background Y-channel image are superimposed to obtain the blurred image. This realizes the noise superposition processing operation of the image to be processed based on a single channel, which reduces the amount of calculation and processing time of the blurring process and improves the efficiency of the blurring process.
[0094] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0095] Corresponding to the image processing method in the above embodiments, Figure 6 A structural block diagram of an image processing apparatus provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0096] Reference Figure 6 The image processing apparatus 100 includes:
[0097] Processing module 101 is used to perform image processing on the image to be processed to obtain a masked and blurred image;
[0098] The acquisition module 102 is used to obtain the foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image according to the mask;
[0099] Generation module 103 is used to generate a Y-channel noise map based on the foreground Y-channel map;
[0100] The overlay processing module 104 is used to overlay the noise image of the Y channel and the background Y channel image to obtain a blurred image.
[0101] In one embodiment, the processing module 101 includes:
[0102] The first acquisition unit is used to acquire the binocular disparity map corresponding to the image to be processed, and the position information of the target focus;
[0103] The first calculation unit is used to calculate the mask based on the binocular disparity map and position information of the image to be processed.
[0104] The blurring processing unit is used to blur the image to be processed based on the binocular disparity map and position information to obtain a blurred image.
[0105] In one embodiment, the first computing unit includes:
[0106] The first acquisition subunit is used to acquire the median of all pixels in a preset area of the binocular disparity map, centered on the position corresponding to the position information, as the disparity value of the target focus;
[0107] The first calculation subunit is used to calculate the blur kernel radius of each pixel in the image to be processed;
[0108] The blurring subunit is used to blur each pixel in the image to be processed according to the blur kernel radius, so as to obtain a blurred image to be processed.
[0109] The second acquisition subunit is used to obtain a mask based on the pixel value of each pixel in the blurred image to be processed.
[0110] In one embodiment, the generation module 104 includes:
[0111] The filtering unit is used to perform high-pass filtering on the foreground Y-channel image to obtain a filtered foreground Y-channel image.
[0112] The second calculation unit is used to calculate the pixel difference between the foreground Y channel image and the filtered foreground Y channel image to obtain the noise image of the foreground Y channel.
[0113] The third calculation unit is used to calculate the noise distribution parameters of the foreground Y-channel noise map;
[0114] The generation unit is used to generate the corresponding Y-channel noise map based on the noise distribution parameters.
[0115] In one embodiment, the third computing unit includes:
[0116] The second calculation subunit is used to calculate the noise distribution parameters of the foreground Y-channel noise map based on the pixel value and number of pixels of each pixel in the foreground Y-channel noise map; wherein, the noise distribution parameters include the mean and variance.
[0117] In one embodiment, the generating unit includes:
[0118] A sub-unit is generated to calculate the pixel value of each noise point in the Y channel based on the mean and variance, and to generate the corresponding Y channel noise map based on the pixel value.
[0119] The mask of the image to be processed is obtained by calculation. The foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image are obtained based on the mask. The corresponding Y-channel noise image is generated based on the foreground Y-channel image. The Y-channel noise image and the background Y-channel image are superimposed to obtain the blurred image. This realizes the noise superposition processing operation of the image to be processed based on a single channel, which reduces the amount of calculation and processing time of the blurring process and improves the efficiency of the blurring process.
[0120] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0121] Figure 7 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Figure 7 As shown, the terminal device 7 of this embodiment includes: at least one processor 70 ( Figure 7(Only one is shown) a processor, a memory 71, and an image processing program 72 stored in the memory 71 and capable of running on at least one processor 70. When the processor 70 executes the image processing program 72, it implements the steps in any of the above-described image processing method embodiments.
[0122] Terminal device 7 can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. This terminal device may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will understand that... Figure 7 The example of terminal device 7 is merely an illustration and does not constitute a limitation on terminal device 7. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0123] The processor 70 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0124] In some embodiments, memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk or memory of the terminal device 7. In other embodiments, memory 71 may be an external storage device of the terminal device 7, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device 7. Furthermore, memory 71 may include both internal storage units and external storage devices of the terminal device 7. Memory 71 is used to store the operating system, applications, bootloader, data, and other programs, such as program code for image processing programs. Memory 71 can also be used to temporarily store data that has been output or will be output.
[0125] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0126] This application also provides a computer-readable storage medium storing an image processing program, which, when executed by a processor, implements the steps described in the various method embodiments above.
[0127] This application provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.
[0128] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by an image processing program instructing related hardware. The image processing program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The image processing program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0129] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0130] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0131] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments 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 coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0132] 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 according to actual needs.
[0133] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. An image processing method, characterized in that, include: Image processing is performed on the image to be processed to obtain a masked and blurred image; The foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image are obtained based on the mask. Generating a Y-channel noise map based on the foreground Y-channel map includes: performing high-pass filtering on the foreground Y-channel map to obtain a filtered foreground Y-channel map; calculating the pixel difference between the foreground Y-channel map and the filtered foreground Y-channel map to obtain a noise map of the foreground Y-channel; calculating the noise distribution parameters of the foreground Y-channel noise map; and generating a corresponding Y-channel noise map based on the noise distribution parameters. The noise image of the Y channel and the background Y channel image are superimposed to obtain a blurred image.
2. The method as described in claim 1, characterized in that, The image processing of the image to be processed to obtain a masked and blurred image includes: Obtain the binocular disparity map corresponding to the image to be processed, and the position information of the target focus; The mask is obtained by calculating the image to be processed based on the binocular disparity map and the position information; The image to be processed is blurred based on the binocular disparity map and the position information to obtain a blurred image.
3. The method as described in claim 2, characterized in that, The step of calculating a mask from the image to be processed based on the binocular disparity map and the position information includes: Using the location corresponding to the location information as the center, the median value of all pixels in the preset area of the binocular disparity map is obtained as the disparity value of the target focus; Calculate the blur kernel radius for each pixel in the image to be processed; Each pixel in the image to be processed is blurred according to the blur kernel radius to obtain a blurred image to be processed. A mask is obtained based on the pixel value of each pixel in the blurred image to be processed.
4. The method as described in claim 1, characterized in that, The calculation of the noise distribution parameters of the foreground Y-channel noise map includes: Based on the pixel value and number of pixels of each pixel in the foreground Y-channel noise map, the noise distribution parameters of the foreground Y-channel noise map are calculated; wherein, the noise distribution parameters include the mean and variance.
5. The method as described in claim 4, characterized in that, The step of generating the corresponding Y-channel noise map based on the noise distribution parameters includes: The pixel value of each noise point in the Y channel is calculated based on the mean and the variance, and the corresponding Y channel noise map is generated based on the pixel value.
6. An image processing apparatus, characterized in that, include: The processing module is used to perform image processing on the image to be processed, and obtain masked and blurred images; The acquisition module is used to obtain the foreground Y-channel image of the image to be processed and the background Y-channel image of the blurred image based on the mask. The generation module is used to generate a Y-channel noise map based on the foreground Y-channel map; The overlay processing module is used to overlay the Y-channel noise image and the background Y-channel image to obtain a blurred image. The generation module includes: A filtering unit is used to perform high-pass filtering on the foreground Y-channel image to obtain a filtered foreground Y-channel image. The second calculation unit is used to calculate the pixel difference between the foreground Y channel image and the filtered foreground Y channel image to obtain the noise image of the foreground Y channel. The third calculation unit is used to calculate the noise distribution parameters of the foreground Y-channel noise map; The generation unit is used to generate a corresponding Y-channel noise map based on the noise distribution parameters.
7. The apparatus as claimed in claim 6, characterized in that, The processing module includes: The first acquisition unit is used to acquire the binocular disparity map corresponding to the image to be processed, and the position information of the target focus; The first calculation unit is used to calculate the image to be processed based on the binocular disparity map and the position information to obtain a mask; The blurring processing unit is used to blur the image to be processed based on the binocular disparity map and the position information to obtain a blurred image.
8. A terminal device, characterized in that, The terminal device includes a memory, a processor, and an image processing program stored in the memory and executable on the processor, wherein the processor, when executing the image processing program, implements the method as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an image processing program that, when executed by a processor, implements the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Background blurring method and device, terminal equipment and computer readable storage medium
CN111127303A
Method and apparatus for processing binocular image
KR1020170091496A
Method and apparatus for incorporating noise pattern into image on which bokeh processing has been performed
US20200051218A1
Methods and apparatus for noise reduction in digital images
US7983511B1
