Image processing method and device, storage medium, and electronic device
By determining the scene information of the image and mapping and fusion, the problem of unsatisfactory high-dynamic range image processing effect in the prior art is solved, and high-quality imaging of the image is achieved.
Patent Information
- Application Number
- CN202311275915.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-04-04
AI Technical Summary
The prior art is difficult to effectively process high dynamic range images, resulting in unsatisfactory image processing effects in some scenarios.
By determining the scene information of the image, including the scene division threshold and pixel information, the image is mapped and fused to obtain the target image.
Tone mapping and fusion of images are realized, image imaging quality is improved, and the problem of inability to effectively process images in the prior art is solved.
Smart Images

Figure CN119762354A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of images, and in particular, to an image processing method and device, a storage medium, and an electronic device. Background Art
[0002] Due to the limitation of dynamic range of current display devices, it is impossible to directly display high dynamic range images. It is necessary to use tone mapping algorithm for high dynamic range images to compress the dynamic range of images. In actual application, the real scenes in reality are very complex. The tone mapping method works well in some scenes, but not in others; or for a specific scene, some areas in the scene are well processed, but not in others. Summary of the invention
[0003] The embodiments of the present invention provide an image processing method and device, a storage medium, and an electronic device to at least solve the problem in the related art that images cannot be effectively processed.
[0004] According to one embodiment of the present invention, there is provided an image processing method, comprising: determining scene information of the above-mentioned image, wherein the above-mentioned scene information includes a scene division threshold and pixel information, and the above-mentioned scene division threshold is used to represent the relationship between the image information of the above-mentioned image and the scene where the above-mentioned image is located; mapping the above-mentioned image using the above-mentioned pixel information to obtain a mapped image; determining an image fusion coefficient using the above-mentioned scene division threshold; and fusing the above-mentioned mapped image and the above-mentioned image based on the above-mentioned image fusion coefficient to obtain a target image.
[0005] According to another embodiment of the present invention, there is provided an image processing device, comprising: a first determination module, used to determine the scene information of the above-mentioned image, wherein the above-mentioned scene information includes a scene division threshold and pixel information, and the above-mentioned scene division threshold is used to represent the relationship between the image information of the above-mentioned image and the scene where the above-mentioned image is located; a first mapping module, used to map the above-mentioned image using the above-mentioned pixel information to obtain a mapped image; a second determination module, used to determine an image fusion coefficient using the above-mentioned scene division threshold; and a first fusion module, used to fuse the above-mentioned mapped image and the above-mentioned image based on the above-mentioned image fusion coefficient to obtain a target image.
[0006] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.
[0007] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0008] Through the present invention, since the scene information of the image is determined, the scene information includes the scene division threshold and pixel information, and the image is mapped using the pixel information to obtain a mapped image, the image fusion coefficient is determined using the scene division threshold, and the mapped image and the image are fused based on the image fusion coefficient to obtain a target image. Tone mapping and fusion of the image can be achieved, and the imaging quality of the image can be improved. Therefore, the problem that the image cannot be effectively processed in the related art can be solved, and the effect of effectively processing the image can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 is a hardware structure block diagram of a mobile terminal of an image processing method according to an embodiment of the present invention;
[0010] Figure 2 is a flowchart of an image processing method according to an embodiment of the present invention;
[0011] Figure 3 is a schematic diagram of the relationship between tone mapping and a real-world scene according to an embodiment of the present invention;
[0012] Figure 4 is a scene histogram of dark and bright parts of an image according to an embodiment of the present invention;
[0013] Figure 5 is a schematic diagram of a model of a tone mapping algorithm for a high dynamic range image according to an embodiment of the present invention;
[0014] Figure 6 is a schematic diagram of a tone mapping curve according to an embodiment of the present invention;
[0015] Figure 7 is a schematic diagram of a weight curve for fusion of a mapping image Ld and an image Lw according to an embodiment of the present invention;
[0016] Figure 8 is a schematic diagram of weight curve distribution according to an embodiment of the present invention;
[0017] Fig. 9 is a schematic diagram of image quality comparison according to an embodiment of the present invention;
[0018] Fig.10 is an overall algorithm processing flow chart according to an embodiment of the present invention;
[0019] Fig.11 is a structural block diagram of an image processing apparatus according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0022] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of an image processing method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0023] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the image processing method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0024] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0025] In this embodiment, an image processing method is provided. Figure 2 is a flowchart of an image processing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0026] Step S202, determining scene information of the image, wherein the scene information includes a scene division threshold and pixel information, and the scene division threshold is used to represent the relationship between the image information of the image and the scene where the image is located;
[0027] Step S204, mapping the image using the pixel information to obtain a mapped image;
[0028] Step S206, determining the image fusion coefficient using the scene division threshold;
[0029] Step S208, fusing the mapping image and the image based on the image fusion coefficient to obtain a target image.
[0030] The execution subject of the above steps may be a terminal, a server, a specific processor provided in the terminal or the server, or a processor or processing device provided relatively independently from the terminal or the server, but is not limited thereto.
[0031] The execution order of step S204 and step S206 is interchangeable, that is, step S204 may be executed first, and then step S206 may be executed.
[0032] Through the above steps, since the scene information of the image is determined, the scene information includes the scene division threshold and pixel information, and the image is mapped using the pixel information to obtain a mapped image, the image fusion coefficient is determined using the scene division threshold, and the mapped image and the image are fused based on the image fusion coefficient to obtain a target image. Tone mapping and fusion of the image can be achieved, and the imaging quality of the image can be improved. Therefore, the problem that the image cannot be effectively processed in the related art can be solved, and the effect of effectively processing the image can be achieved.
[0033] Optionally, mapping the image includes tone mapping the image. Figure 3, which is a schematic diagram of the relationship between the tone-mapped scene and the real-world scene, where observers 1 and 2 observe the same scene in two different environments. Observer 1 is viewing the image on a monitor after the scene is captured, stored, and tone-mapped. Observer 2 is observing the scene in the real world. The ultimate goal of this embodiment is to match the perception of the tone-mapped scene with the real-world scene, i.e., observers 1 and 2 will perceive the same scene.
[0034] Optionally, the image in this embodiment is a high dynamic range image, and the applied scene can be a high dynamic range imaging (High Dynamic Range Imaging, referred to as HDR) scene. It is mainly image processing for HDR scenes in the image signal processing (Image Signal Processing, referred to as ISP) process. For example, in a scene where the building surface is very dark at night, and the street lights or signs are too bright, or in a backlit sunset scene with a large light ratio, the contrast between the dark and bright parts of the image is more prominent. The scene histogram in this scene is as follows: Figure 4 As shown. The image processing module can be used to process high dynamic range images. The model of the tone mapping algorithm for high dynamic range images is as follows Figure 5 As shown, the model performs dynamic range compression on the image based on the mapping curve, improves the imaging quality of the dark and bright parts of the image, and can ensure that the visual experience of the image after dynamic range compression is as close to the experience of the human eye as possible when the human eye directly observes the scene. Based on scene information, this embodiment can effectively realize weighted fusion of tone mapping curves for HDR scenes, and perform dynamic range compression based on the mapping curve to improve the imaging quality of dark and bright parts. At the same time, compared with complex local information statistics, this embodiment is simple and effective, and has higher computational efficiency.
[0035] In an exemplary embodiment, the scene information includes a scene division threshold, and determining the scene information of an image includes: calculating a normalized histogram of the image; calculating the probability that pixels in the image are divided into preset grayscale levels based on the normalized histogram; using the probability to calculate the average grayscale value of multiple pixels belonging to the preset grayscale level, and the global average grayscale value of all pixels in the image; calculating the inter-class variance of the image according to the probability, the average grayscale value and the global average grayscale value; and determining the scene division threshold based on the inter-class variance.
[0036] Optionally, a normalized histogram of an image is calculated by dividing the count of each attribute on the histogram of the image by the sum of the counts of all attributes.
[0037] Optionally, the grayscale of the image is divided into multiple grayscale levels, and the probability that the pixel belongs to a preset grayscale level is calculated according to the grayscale value of the pixel in the normalized image. The preset grayscale level is a level among the multiple grayscale levels and is set according to images in different scenes.
[0038] Optionally, determining the scene division threshold based on the inter-class variance includes one of the following: determining the k value corresponding to the maximum value of the inter-class variance as the scene division threshold, wherein k is used to represent the histogram statistic corresponding to the maximum value of the inter-class variance; when the inter-class variance includes multiple maximum values, determining the average value of multiple k values corresponding to the multiple maximum values as the scene division threshold.
[0039] Optionally, in a specific embodiment, the image-related information is collected based on the histogram statistics, including determining the scene division threshold SceneKeyValue based on the OSTU algorithm, and determining the maximum pixel value MaxPixel of the input image by pixel comparison, which specifically includes the following steps:
[0040] S1, calculate the normalized histogram of the image, p i , i = 1, 2, ..., L-1 is used to represent each component of the normalized histogram, and L-1 is used to represent the maximum component of the normalized histogram;
[0041] S2, based on For k = 1, 2, ..., L-1, calculate the probability P of a pixel being classified into class k i (k) (corresponding to the above step of calculating the probability that a pixel belongs to a preset gray level according to the gray value of the pixel in the normalized image);
[0042] S3, based on For k=1, 2, ..., L-1, calculate the average gray value m(k) of pixels with gray levels from 0 to k;
[0043] S4, based on Calculate the global grayscale mean m of the image G ;
[0044] S5, based on For k = 1, 2, ..., L-1, calculate the between-class variance
[0045] S6, get the threshold k * , where k * In order to make The maximum k value is such that If the maximum k value is not unique, then the average of each k value is k * ;
[0046] S7, in SceneKeyValue=k * Calculate the separability measure is the global variance;
[0047] S8, determining the maximum pixel value MaxPixel of the image, and determining the dynamic range of the image.
[0048] This embodiment determines the scene division threshold of the image, and can perform effective HDR image mapping processing based on the scene division threshold, thereby improving the imaging quality of the image.
[0049] In an exemplary embodiment, the scene information includes pixel information, and determining the scene information of the image includes: comparing multiple pixel values in the image, and determining the maximum value of the multiple pixel values as the pixel information. Optionally, the pixel information in this embodiment includes the pixel value of each pixel. By determining the maximum value of the pixel values, the dynamic range of the image can be determined.
[0050] In an exemplary embodiment, an image is mapped using pixel information to obtain a mapped image, including: normalizing the image using the pixel information to obtain a brightness value of each pixel in the image; determining a maximum brightness value from the brightness values of each pixel; determining a mapping value corresponding to each pixel in a tone mapping curve using the brightness value of each pixel, the maximum brightness value, and a first preset parameter to obtain a plurality of mapping values, wherein the first preset parameter is a variable that is allowed to be adjusted; and determining an image composed of the plurality of mapping values as a mapped image.
[0051] Optionally, the normalization method for the image in this embodiment is the same as that in the above embodiment and will not be repeated here. The maximum brightness value can be determined from the brightness value of each pixel by using the Logarithmic mapping operator. And the tone mapping curve is calculated using the tone mapping operator. For example, the tone mapping curve is calculated by the following formula: Ld = log(Lw / Lwa+1) / log(Lmax / Lwa+1), where Lw is used to represent the brightness of each pixel in the image after normalization according to MaxPixel, Lmax is used to represent the maximum brightness in the normalized image, and the parameter Lwa (corresponding to the first preset parameter) is an adjustable parameter. Figure 6 , which is a schematic diagram of a tone mapping curve under different values of Lwa. By determining the tone mapping curve of an image, this embodiment can accurately determine the mapping value of each pixel in the tone mapping curve, thereby accurately determining the mapped image.
[0052] In an exemplary embodiment, an image is mapped using pixel information to obtain a mapped image, including: normalizing the image using the pixel information to obtain a brightness value for each pixel in the image; calculating an average brightness value for all pixels in the image based on the brightness value of each pixel in the image; determining a mapping value corresponding to each pixel in a tone mapping curve using the average brightness value and a second preset parameter to obtain a plurality of mapping values, wherein the second preset parameter is a variable that is allowed to be adjusted; and determining an image composed of the plurality of mapping values as a mapped image.
[0053] Optionally, the normalization processing method of the image and the method of determining the brightness value of each pixel in the image in this embodiment are the same as those in the above embodiment, and will not be repeated here. This embodiment mainly uses the form of HDR mapping curve to determine the mapping image. For example, the mapping image is determined using an exponential mapping curve. Among them, Lw is the brightness of each pixel in the normalized image, is the arithmetic mean corresponding to Lw, and k (the second preset parameter) is an adjustable parameter. This embodiment calculates the mapping value of the pixel in the tone mapping curve by the average value of the pixel brightness, which reduces the amount of calculation for image processing and can accurately determine the mapping image.
[0054] In an exemplary embodiment, an image is mapped using pixel information to obtain a mapped image, including: normalizing the image using the pixel information to obtain a brightness value for each pixel in the image; determining a mapping value corresponding to each pixel in a tone mapping curve using the brightness value of each pixel and a third preset parameter to obtain a plurality of mapping values, wherein the third preset parameter is a variable that is allowed to be adjusted; and determining an image composed of the plurality of mapping values as a mapped image.
[0055] Optionally, the normalization method of the image and the method of determining the brightness value of each pixel in the image in this embodiment are the same as those in the above embodiment, and are not described in detail here. This embodiment mainly uses other HDR mapping curves to determine the mapping image. For example, the gamma mapping curve is used to determine the mapping image, Ld = (Lw) γ , γ<1, where Lw is the brightness of each pixel in the normalized image, and γ (the second preset parameter) is an adjustable parameter. This embodiment calculates the mapping value of the pixel in the tone mapping curve by means of the pixel brightness value, reduces the amount of image processing calculation, and can accurately determine the mapped image.
[0056] In an exemplary embodiment, determining an image fusion coefficient using a scene division threshold includes: determining a comparison result between the scene division threshold and a judgment threshold, wherein the judgment threshold includes a first threshold and a second threshold; and determining a coefficient value in a preset Gaussian function as the image fusion coefficient according to the comparison result.
[0057] Optionally, the coefficient value in the preset Gaussian function is determined as the image fusion coefficient according to the comparison result, including: when the scene division threshold is greater than the first threshold, the first coefficient in the preset Gaussian function is determined as the image fusion coefficient; when the scene division threshold is less than the second threshold, the second coefficient in the preset Gaussian function is determined as the image fusion coefficient; when the scene division threshold is less than or equal to the first threshold, and greater than or equal to the second threshold, the coefficient calculated using the scene division threshold, the first threshold, the second threshold, the first coefficient and the second coefficient is determined as the image fusion coefficient.
[0058] Optionally, the image fusion coefficient is the σ coefficient in the Gaussian program. For example, The first threshold th0 and the second threshold th1 are judgment thresholds of the scene division threshold SceneKeyValue, and σ0 and σ1 are preset parameters. This embodiment reduces the amount of calculation and increases the accuracy of determining the mapping image by calculating the image fusion coefficient.
[0059] In an exemplary embodiment, the mapping image and the image are fused based on the image fusion coefficient to obtain the target image, including: determining a weight curve for fusion of the mapping image and the image using the image fusion coefficient, wherein the weight curve is Gaussian distributed; fusing the mapping image and the pixel value after normalization of the image based on the weight curve to obtain the target image. Optionally, according to the scene, the weight curve for fusion of the mapping image Ld and the image Lw is as follows: Figure 7 As shown. Figure 8 As shown, the weight curve is Gaussian GAUSS distribution, the weight curve Among them, α is used to represent the maximum value of the obtained weight curve; μ is used to represent the mathematical expectation. Target image L out =f(Lw)·Ld+(1-f(Lw))·Lw. y, where logarithmic tone curve is used to represent the logarithmic tone curve, linear tone curve is used to represent the linear tone curve, fushion tone curve is used to represent the fusion tone curve, and Gaussian weight is used to represent the Gaussian weight. This embodiment can enhance the display quality of the image by fusing the image. Fig. 9 As shown, the left side is a linear image, the middle is an image after tone mapping using the Logarithmic mapping operator, and the right side is an image fused using the above method. The quality of the fused image is significantly enhanced.
[0060] In a specific embodiment, the overall algorithm flow of the image fusion processing is as follows: Fig.10 As shown, it mainly includes the following steps:
[0061] S1001, obtaining an image to be processed; the image to be processed is as follows: Fig. 9 The image shown on the left side of the center is a line image with relatively dark light;
[0062] S1002, acquiring image statistical information based on a brightness histogram; the brightness histogram is a normalized histogram after normalization processing of the image, which includes brightness values of pixels;
[0063] S1003, obtaining a mapped image according to a tone mapping operator; the mapped image is a mapped image obtained by mapping pixels in the image to a tone mapping curve;
[0064] S1004, calculating the Sigma parameter of the Gaussian fusion curve; the Gaussian fusion curve includes the weight curve mentioned above, and the Sigma parameter includes a fusion coefficient and a plurality of preset judgment thresholds;
[0065] S1005, Gaussian fusion of the tone-mapped image and the linear image, the fusion method is as follows Figure 8 As shown;
[0066] S1006, obtaining a fused image. The fused target image is as follows: Fig. 9 As shown in the image on the right.
[0067] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0068] In this embodiment, an image processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0069] Fig.11 is a structural block diagram of an image processing device according to an embodiment of the present invention. Fig.11 As shown, the device comprises:
[0070] A first determination module 1102 is used to determine scene information of an image, wherein the scene information includes a scene division threshold and pixel information, and the scene division threshold is used to represent the relationship between the image information of the image and the scene where the image is located;
[0071] A first mapping module 1104 is used to map the image using pixel information to obtain a mapped image;
[0072] A second determination module 1106, configured to determine an image fusion coefficient using a scene division threshold;
[0073] The first fusion module 1108 is used to fuse the mapping image and the image based on the image fusion coefficient to obtain the target image.
[0074] In an exemplary embodiment, the above-mentioned first determination module 1102 includes: a first calculation unit, used to calculate the normalized histogram of the image; a first division unit, used to calculate the probability that the pixels in the image are divided into preset gray levels based on the normalized histogram; a second calculation unit, used to calculate the average gray value of multiple pixels belonging to the preset gray level and the global average gray value of all pixels in the image using the probability; a third calculation unit, used to calculate the inter-class variance of the image according to the probability, the average gray value and the global average gray value; the first determination unit, used to determine the scene division threshold based on the inter-class variance.
[0075] In an exemplary embodiment, the above-mentioned first determination unit includes one of the following: a first determination subunit, used to determine the k value corresponding to the maximum value of the inter-class variance as the scene division threshold, wherein k is used to represent the histogram statistic corresponding to the maximum value of the inter-class variance; a second determination subunit, used to determine the average value of multiple k values corresponding to multiple maximum values as the scene division threshold when the inter-class variance includes multiple maximum values.
[0076] In an exemplary embodiment, the first determination module 1102 includes: a second determination unit, configured to compare multiple pixel values in an image and determine a maximum value among the multiple pixel values as pixel information.
[0077] In an exemplary embodiment, the above-mentioned first mapping module includes: a first processing unit, which is used to normalize the image using pixel information to obtain the brightness value of each pixel in the image; a third determination unit, which is used to determine the maximum brightness value from the brightness value of each pixel; a fourth determination unit, which is used to determine the mapping value corresponding to each pixel in the tone mapping curve using the brightness value of each pixel, the maximum brightness value and the first preset parameter to obtain multiple mapping values, wherein the first preset parameter is a variable allowed to be adjusted; a fifth determination unit, which is used to determine the image composed of multiple mapping values as a mapping image.
[0078] In an exemplary embodiment, the above-mentioned first mapping module 1104 includes: a second processing unit, which is used to normalize the image using pixel information to obtain the brightness value of each pixel in the image; a first calculation unit, which is used to calculate the average brightness value of all pixels in the image based on the brightness value of each pixel in the image; a fifth determination unit, which is used to determine the mapping value corresponding to each pixel in the tone mapping curve using the average brightness value and the second preset parameter to obtain multiple mapping values, wherein the second preset parameter is a variable allowed to be adjusted; and a sixth determination unit, which is used to determine the image composed of multiple mapping values as a mapping image.
[0079] In an exemplary embodiment, the above-mentioned first mapping module 1104 includes: a third processing unit, which is used to use pixel information to normalize the image to obtain the brightness value of each pixel in the image; a sixth determination unit, which is used to determine the mapping value corresponding to each pixel in the tone mapping curve using the brightness value of each pixel and the third preset parameter to obtain multiple mapping values, wherein the third preset parameter is a variable allowed to be adjusted; and a seventh determination unit, which is used to determine the image composed of multiple mapping values as a mapping image.
[0080] In an exemplary embodiment, the above-mentioned second determination module 1106 includes: an eighth determination unit, used to determine the comparison result between the scene division threshold and the judgment threshold, wherein the judgment threshold includes a first threshold and a second threshold; a ninth determination unit, used to determine the coefficient value in a preset Gaussian function as the image fusion coefficient according to the comparison result.
[0081] In an exemplary embodiment, the ninth determination unit includes: a third determination subunit, used to determine the first coefficient in a preset Gaussian function as the image fusion coefficient when the scene division threshold is greater than the first threshold; a fourth determination subunit, used to determine the second coefficient in a preset Gaussian function as the image fusion coefficient when the scene division threshold is less than the second threshold; and a first division subunit, used to determine the coefficient calculated using the scene division threshold, the first threshold, the second threshold, the first coefficient and the second coefficient as the image fusion coefficient when the scene division threshold is less than or equal to the first threshold and greater than or equal to the second threshold.
[0082] In an exemplary embodiment, the above-mentioned first fusion module 1108 includes: a tenth determination unit, used to determine the weight curve of the mapped image and the image fusion using the image fusion coefficient, wherein the weight curve is Gaussian distributed; a first fusion unit, used to fuse the mapped image and the pixel value after normalization of the image based on the weight curve to obtain the target image.
[0083] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0084] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0085] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0086] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0087] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0088] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0089] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0090] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An image processing method, characterized in that: include: Determining scene information of the image, wherein the scene information includes a scene division threshold and pixel information, and the scene division threshold is used to represent the relationship between the image information of the image and the scene where the image is located; Mapping the image using the pixel information to obtain a mapped image; Determining an image fusion coefficient using the scene division threshold; The mapped image and the image are fused based on the image fusion coefficient to obtain a target image.
2. The method according to claim 1, characterized in that The scene information includes a scene division threshold, and determining the scene information of the image includes: Calculating a normalized histogram of the image; Calculating the probability that a pixel in the image is classified into a preset gray level based on the normalized histogram; Calculating the average grayscale value of a plurality of pixels belonging to the preset grayscale level and the global average grayscale value of all pixels in the image using the probability; Calculating the inter-class variance of the image according to the probability, the average gray value and the global average gray value; The scene division threshold is determined based on the inter-class variance.
3. The method according to claim 2, characterized in that Determining the scene division threshold based on the inter-class variance includes one of the following: Determine the k value corresponding to the maximum value of the inter-class variance as the scene division threshold, wherein k is used to represent the histogram statistic corresponding to the maximum value of the inter-class variance; In the case where the inter-class variance includes multiple maximum values, an average value of multiple k values corresponding to the multiple maximum values is determined as the scene division threshold.
4. The method according to claim 1, characterized in that: The scene information includes pixel information, and determining the scene information of the image includes: A plurality of pixel values in the image are compared, and a maximum value among the plurality of pixel values is determined as the pixel information.
5. The method according to claim 1, characterized in that Mapping the image using the pixel information to obtain a mapped image includes: Normalizing the image using the pixel information to obtain a brightness value of each pixel in the image; Determining a maximum brightness value from the brightness values of each of the pixels; Determine a mapping value corresponding to each pixel in a tone mapping curve by using the brightness value of each pixel, the maximum brightness value and a first preset parameter to obtain a plurality of mapping values, wherein the first preset parameter is a variable that is allowed to be adjusted; An image composed of a plurality of the mapping values is determined as the mapping image.
6. The method according to claim 1, characterized in that Mapping the image using the pixel information to obtain a mapped image includes: Normalizing the image using the pixel information to obtain a brightness value of each pixel in the image; Calculate the average brightness value of all pixels in the image based on the brightness value of each pixel in the image; Determine a mapping value corresponding to each pixel in a tone mapping curve by using the average brightness value and a second preset parameter to obtain a plurality of mapping values, wherein the second preset parameter is a variable that is allowed to be adjusted; An image composed of a plurality of the mapping values is determined as the mapping image.
7. The method according to claim 1, characterized in that Mapping the image using the pixel information to obtain a mapped image includes: Normalizing the image using the pixel information to obtain a brightness value of each pixel in the image; Determine a mapping value corresponding to each pixel in a tone mapping curve by using the brightness value of each pixel and a third preset parameter to obtain a plurality of mapping values, wherein the third preset parameter is a variable that is allowed to be adjusted; An image composed of a plurality of the mapping values is determined as the mapping image.
8. The method according to claim 1, characterized in that Determining the image fusion coefficient by using the scene division threshold comprises: Determine a comparison result between the scene division threshold and a judgment threshold, wherein the judgment threshold includes a first threshold and a second threshold; According to the comparison result, the coefficient value in the preset Gaussian function is determined as the image fusion coefficient.
9. The method according to claim 8, characterized in that Determining the coefficient value in the preset Gaussian function as the image fusion coefficient according to the comparison result includes: When the scene division threshold is greater than the first threshold, determining the first coefficient in the preset Gaussian function as the image fusion coefficient; When the scene division threshold is less than a second threshold, determining the second coefficient in the preset Gaussian function as the image fusion coefficient; When the scene division threshold is less than or equal to the first threshold and greater than or equal to the second threshold, a coefficient calculated using the scene division threshold, the first threshold, the second threshold, the first coefficient and the second coefficient is determined as the image fusion coefficient.
10. The method according to claim 1, characterized in that The mapping image and the image are fused based on the image fusion coefficient to obtain a target image, comprising: Determining a weight curve for fusion of the mapped image and the image using the image fusion coefficient, wherein the weight curve is Gaussian distributed; The target image is obtained by fusing the mapped image and the pixel values of the image after normalization based on the weight curve.
11. An image processing device, characterized in that: include: A first determination module, configured to determine scene information of the image, wherein the scene information includes a scene division threshold and pixel information, and the scene division threshold is used to represent the relationship between the image information of the image and the scene where the image is located; A first mapping module, used to map the image using the pixel information to obtain a mapped image; A second determination module, used to determine an image fusion coefficient using the scene division threshold; The first fusion module is used to fuse the mapping image and the image based on the image fusion coefficient to obtain a target image.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 10 when executed by a processor.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 10 are implemented.