Image processing method, device and storage medium
By performing image segmentation and targeted image enhancement processing on the image to be processed, and image processing is performed in combination with the difference between the target and the background, the problem of poor image quality in the prior art is solved and the image quality is improved.
Patent Information
- Application Number
- CN202011608764.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2040-12-30
AI Technical Summary
The prior art is difficult to effectively improve image quality, especially when a satisfactory image is taken, the difference between the background and the target leads to poor image quality.
By segmenting the image to be processed, the target area image and the background area image are obtained, and image enhancement processing is performed separately. Then, the enhanced target and background are synthesized into a reference image, and the reference image is processed according to the target difference degree to obtain the final target image.
By targeted image enhancement processing of the target and background and image processing combined with the difference between the target and background, it helps to narrow the difference between the background and the target, thereby improving image quality.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device and storage medium. Background Art
[0002] With the widespread use of electronic devices (such as mobile phones, tablets, etc.), electronic devices can support more and more applications and have more and more powerful functions. Electronic devices are developing in the direction of diversification and personalization, becoming indispensable electronic products in users' lives.
[0003] At present, taking pictures has become an essential function of electronic devices. In most cases, the failure to capture satisfactory images often affects the user experience. Therefore, the problem of how to improve image quality needs to be solved urgently. Summary of the Invention
[0004] The embodiments of the present application provide an image processing method, device, and storage medium, which can improve image quality.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0006] Get the image to be processed;
[0007] Performing image segmentation on the image to be processed to obtain a first target area image and a first background area image;
[0008] performing a first image enhancement process on the first target area image to obtain a second target area image;
[0009] performing a second image enhancement process on the first background area image to obtain a second background area image;
[0010] synthesizing the second target area image and the second background area image into a reference image, and determining a target difference between the second target area image and the second background area image in the reference image;
[0011] The reference image is processed according to the target difference to obtain a target image.
[0012] In a second aspect, an embodiment of the present application provides an image processing device, comprising: an acquisition unit, a segmentation unit, a first image enhancement processing unit, a second image enhancement processing unit, a determination unit, and a processing unit, wherein:
[0013] The acquisition unit is used to acquire the image to be processed;
[0014] The segmentation unit is used to perform image segmentation on the image to be processed to obtain a first target area image and a first background area image;
[0015] The first image enhancement processing unit is configured to perform a first image enhancement process on the first target area image to obtain a second target area image;
[0016] The second image enhancement processing unit is configured to perform a second image enhancement process on the first background area image to obtain a second background area image;
[0017] The determining unit is configured to synthesize the second target area image and the second background area image into a reference image, and determine a target difference between the second target area image and the second background area image in the reference image;
[0018] The processing unit is configured to process the reference image according to the target difference to obtain a target image.
[0019] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for executing the steps of any method of the first aspect of the embodiment of the present application.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0021] In a fifth aspect, embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
[0022] The embodiments of the present application have the following beneficial effects:
[0023] It can be seen that the image processing method, device and storage medium described in the embodiments of the present application obtain an image to be processed, perform image segmentation on the image to be processed to obtain a first target area image and a first background area image, perform a first image enhancement process on the first target area image to obtain a second target area image, perform a second image enhancement process on the first background area image to obtain a second background area image, synthesize the second target area image and the second background area image into a reference image, determine the target difference between the second target area image and the second background area image in the reference image, process the reference image according to the target difference to obtain a target image, on the one hand, segment the target and the background so as to achieve targeted image enhancement processing according to the characteristics of the target and the background, on the other hand, considering the differential enhancement between the target and the background, it may cause an unnatural transition between the target and the background, and then, combining the difference between the target and the background to achieve image processing, helps to reduce the degree of difference between the background and the target, and thus helps to improve the image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0025] Figure 1A This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0026] Figure 1B This is a flowchart of an image processing method provided by an embodiment of the present application;
[0027] Figure 2 is a flowchart of another image processing method provided in an embodiment of the present application;
[0028] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0029] Figure 4 This is a block diagram of the functional units of an image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0031] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0032] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0033] The electronic devices involved in the embodiments of the present application may be electronic devices with communication capabilities or electronic devices without communication capabilities. The electronic devices may include various handheld devices with wireless communication functions, vehicle-mounted devices (driving recorders, in-vehicle cameras, vehicle-mounted speakers, etc.), wearable devices (smart glasses, smart bracelets, smart watches, etc.), computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (UE), mobile stations (MS), terminal devices, etc.
[0034] See Figure 1A , Figure 1AThis is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device includes a processor, memory, a signal processor, a transceiver, a display, a speaker, a microphone, a random access memory (RAM), a camera, a sensor, and a communication module. The memory, signal processor, display, speaker, microphone, RAM, camera, sensor, and communication module are connected to the processor, and the transceiver is connected to the signal processor.
[0035] The display screen may be a liquid crystal display (LCD), an organic or inorganic light-emitting diode (OLED), an active matrix organic light-emitting diode (AMOLED), or the like.
[0036] The camera may be a normal camera or an infrared camera, which is not limited here. The camera may be a front camera or a rear camera, which is not limited here.
[0037] The sensor includes at least one of the following: a light sensor, a gyroscope, an infrared proximity sensor, a fingerprint sensor, a pressure sensor, and the like. The light sensor, also known as an ambient light sensor, is used to detect the brightness of ambient light. The light sensor may include a photosensitive element and an analog-to-digital converter. The photosensitive element is used to convert the collected light signal into an electrical signal, and the analog-to-digital converter is used to convert the electrical signal into a digital signal. Optionally, the light sensor may further include a signal amplifier, which may amplify the electrical signal converted by the photosensitive element and output it to the analog-to-digital converter. The photosensitive element may include at least one of a photodiode, a phototransistor, a photoresistor, and a silicon photocell.
[0038] Among them, the processor is the control center of the electronic device, which uses various interfaces and lines to connect the various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory and calling data stored in the memory, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole.
[0039] The processor may integrate an application processor and a modem processor. The application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily processes wireless communications. It is understood that the modem processor may not be integrated into the processor. The processor may be at least one of the following: an ISP, a CPU, a GPU, an NPU, and the like, without limitation.
[0040] The memory is used to store software programs and / or modules. The processor executes the various functional applications and data processing of the electronic device by running the software programs and / or modules stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one software program required for a function, etc.; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0041] The communication module may be used to implement a communication function, and the communication module may be at least one of the following: an infrared module, a Bluetooth module, a mobile communication module, an NFC module, a Wi-Fi module, etc., which are not limited here.
[0042] The following is a detailed introduction to the embodiments of the present application.
[0043] See also Figure 1B , Figure 1B This is a flow chart of an image processing method provided by the embodiment of the present application, which is applied to Figure 1A The electronic device shown in the figure, as shown in the figure, the image processing method includes the following operations.
[0044] 101. Obtain an image to be processed.
[0045] The image to be processed may be a dark vision image or an overexposed image. The electronic device may control a camera to shoot to obtain the image to be processed.
[0046] 102. Perform image segmentation on the image to be processed to obtain a first target area image and a first background area image.
[0047] Among them, since the image to be processed includes the target and the background, the electronic device can perform image segmentation on the image to be processed to obtain a first target area image and a first background area image. The first target area image is an image of the area where the target is located, and the first background area image is an image of the area where the background is located.
[0048] 103. Perform first image enhancement processing on the first target area image to obtain a second target area image.
[0049] Among them, the electronic device can also perform image enhancement processing on the target separately, that is, the electronic device can perform first image enhancement processing on the first target area image to obtain the second target area image, thereby improving the prominence of the target, helping to improve the image segmentation accuracy and also helping to improve the target recognition accuracy.
[0050] Optionally, the above step 103, performing a first image enhancement process on the first target area image to obtain a second target area image, may include the following steps:
[0051] 31. Determine a target identifier corresponding to the first target area image;
[0052] 32. Determine a first reference image enhancement processing parameter corresponding to the target identifier according to a preset mapping relationship between the identifier and the image enhancement processing parameter;
[0053] 33. Get target shooting parameters;
[0054] 34. Determine a target first adjustment coefficient corresponding to the target shooting parameter according to a preset mapping relationship between the shooting parameter and the first adjustment coefficient;
[0055] 35. Adjust the first reference image enhancement processing parameter according to the target first adjustment coefficient to obtain a first image enhancement processing parameter;
[0056] 36. Perform image enhancement processing on the first target area image according to the first image enhancement processing parameters to obtain the second target area image.
[0057] Different identifiers can be used to mark different types of targets. The identifier can be at least one of the following: a person, a cat, a dog, a cup, the sun, the moon, etc., without limitation here. The electronic device can pre-store a mapping relationship between a preset identifier and an image enhancement processing parameter. The image enhancement processing parameter can be at least one of the following: an image enhancement processing algorithm, a control parameter of the image enhancement processing algorithm, etc., without limitation here. The image enhancement processing algorithm can be at least one of the following: grayscale stretching, histogram equalization, wavelet transform, contourlet transform, fast Fourier transform, Laplace pyramid transform, neural network model, etc., without limitation here. The neural network model can be at least one of the following: a convolutional neural network model, a recurrent neural network model, a fully connected neural network model, a spiking neural network model, etc., without limitation here. The control parameter of the image enhancement processing algorithm is used to adjust the degree of image enhancement. The control parameter can be at least one of the following: image enhancement position, image enhancement degree, etc., without limitation here.
[0058] In addition, the electronic device can also obtain the target shooting parameters of the image to be processed. The target shooting parameters can be at least one of the following: sensitivity ISO, exposure time, white balance parameters, beauty parameters, filter parameters, contrast, etc., which are not limited here. The electronic device can pre-store the mapping relationship between the preset shooting parameters and the first adjustment coefficient. The value range of the first adjustment coefficient can be -0.1 to 0.1. Then, the target first adjustment coefficient corresponding to the target shooting parameter can be determined according to the mapping relationship. Then, the electronic device can adjust the first reference image enhancement processing parameter according to the target first adjustment coefficient to obtain the first image enhancement processing parameter. The specific calculation formula is as follows:
[0059] First image enhancement processing parameter = (1 + target first adjustment coefficient) * first reference image enhancement processing parameter
[0060] Furthermore, the electronic device can perform image enhancement processing on the first target area image based on the first image enhancement processing parameters to obtain the second target area image. In this way, the corresponding image enhancement processing parameters can be selected in combination with the type of target, and the image enhancement processing parameters can be adjusted according to the corresponding shooting parameters, so that the final image enhancement processing method is more adapted to the type of target and the shooting processing effect, thereby helping to improve the target enhancement effect.
[0061] 104. Perform a second image enhancement process on the first background area image to obtain a second background area image.
[0062] The electronic device may separate the target from the background, and may perform image enhancement processing on the background alone, that is, the electronic device may perform second image enhancement processing on the first background area image to obtain a second background area image.
[0063] Optionally, the above step 104, performing a second image enhancement process on the first background area image to obtain a second background area image, may include the following steps:
[0064] 41. Determine the target energy mean square error and target feature point distribution density of the first background area image;
[0065] 42. When the target energy mean square error is within a first preset range and the target feature point distribution density is within a second preset range, use the first background area image as the second background area image;
[0066] 43. When the target energy mean square error is not within the first preset range or the target feature point distribution density is not within the second preset range, determining a target area ratio between the first background area image and the image to be processed;
[0067] 44. Obtain target environment parameters corresponding to the image to be processed;
[0068] 45. Determine a second reference image enhancement processing parameter corresponding to the target environmental parameter according to a preset mapping relationship between the environmental parameter and the image enhancement processing parameter;
[0069] 46. Determine a target second adjustment coefficient corresponding to the target area ratio according to a preset mapping relationship between the area ratio and the second adjustment coefficient;
[0070] 47. Adjust the second reference image enhancement processing parameter according to the target second adjustment coefficient to obtain a second image enhancement processing parameter;
[0071] 48. Perform image enhancement processing on the first background area image according to the second image enhancement processing parameters to obtain the second background area image.
[0072] Among them, the first preset range and the second preset range can be set by the user or by the system default. In a specific implementation, the electronic device can determine the target energy mean square deviation of the first background area image, that is, determine the energy value of each pixel in the first background area image, perform a mean square deviation operation on these energy values, and obtain the target energy mean square deviation. The electronic device can also determine the target feature point distribution density of the first background area image, that is, determine the area of the first background area image and the number of feature points, and use the ratio between the number of feature points and the area of the first background area image as the target feature point distribution density.
[0073] Furthermore, when the target energy mean square deviation is within the first preset range and the target feature point distribution density is within the second preset range, it indicates that background blurring is very likely to be performed. Since background blurring is required, image enhancement processing of the background may not be performed, and the first background area image may be directly used as the second background area image.
[0074] In addition, when the target energy mean square error is not within the first preset range or the target feature point distribution density is not within the second preset range, the electronic device can determine the target area ratio between the first background area image and the image to be processed, and can also obtain the target environment parameters corresponding to the image to be processed, that is, the electronic device can record its corresponding target environment parameters when obtaining the image to be processed. The target environment parameters can be at least one of the following: ambient light brightness, ambient temperature, ambient humidity, magnetic field interference intensity, meteorological values, weather, etc., which are not limited here. The electronic device can pre-store the mapping relationship between the preset environmental parameters and the image enhancement processing parameters. Then, the electronic device can determine the second reference image enhancement processing parameters corresponding to the target environmental parameters according to the mapping relationship between the preset environmental parameters and the image enhancement processing parameters. The description of the image enhancement processing parameters can refer to the above description, and so on.
[0075] Furthermore, the electronic device may also pre-store a mapping relationship between a preset area ratio and a second adjustment coefficient. The value range of the second adjustment coefficient may be -0.08 to 0.08. Then, according to the mapping relationship between the preset area ratio and the second adjustment coefficient, a target second adjustment coefficient corresponding to the target area ratio may be determined. The second reference image enhancement processing parameter may be adjusted according to the target second adjustment coefficient to obtain the second image enhancement processing parameter. The specific calculation formula is as follows:
[0076] Second image enhancement processing parameter = (1 + target second adjustment coefficient) * second reference image enhancement processing parameter
[0077] Finally, the electronic device can perform image enhancement processing on the first background area image according to the second image enhancement processing parameters to obtain the second background area image. Then, it can identify whether the background is blurred through the energy mean square deviation and the feature point distribution density. In addition, in the case of blurring, the background can be kept unprocessed. In the case of non-blurring, the image enhancement processing parameters corresponding to the shooting environment can be obtained, and the image enhancement processing parameters can be adjusted according to the area ratio of the background. The background image enhancement processing is then implemented using the adjusted image enhancement processing parameters. In this way, the background enhancement is more in line with the user's wishes, and the optimal image enhancement processing parameters can be adapted according to the shooting environment, which is more conducive to improving the background image enhancement effect.
[0078] 105. Synthesize the second target area image and the second background area image into a reference image, and determine a target difference between the second target area image and the second background area image in the reference image.
[0079] Since the second target area image and the second background area image are processed using different image enhancement methods, the two can be synthesized to obtain a reference image. Due to the enhanced differentiation between the target and background, the difference between the target and the background is increased. The electronic device can then determine the target difference between the second target area image and the second background area image in the reference image. The degree of this target difference indicates the degree of target prominence and whether the difference between the target and the background needs to be reduced. This achieves a natural transition between different parts of the image and ensures a more natural transition between the target and the background in the image.
[0080] Optionally, the above step 105 of determining the target difference between the second target area image and the second target background area image in the reference image may include the following steps:
[0081] 51. Determine a first average grayscale and a first mean square error of the second target area image;
[0082] 52. Determine a first reference average grayscale based on the first average grayscale and the first mean square error;
[0083] 53. Determine a second average grayscale and a second mean square error of the second background area image;
[0084] 54. Determine a second reference average grayscale based on the second average grayscale and the second mean square error;
[0085] 55. Determine a target absolute value of a difference between the first reference average grayscale and the second reference average grayscale;
[0086] 56. Determine a target difference corresponding to the target absolute value according to a preset mapping relationship between absolute values and differences.
[0087] The electronic device may determine a first average grayscale and a first mean square error of the target area image. Then, the electronic device may optimize the first average grayscale according to a preset mapping relationship between the mean square error and a first optimization factor. The optimization factor may have a value range of -0.02 to 0.02. The specific calculation formula is as follows:
[0088] First reference average grayscale = (1 + first optimization factor) * first average grayscale
[0089] Since the mean square error reflects the degree of fluctuation between adjacent areas of the target, the electronic device can adjust its corresponding average grayscale through the mean square error, which can more accurately reflect the grayscale of the image.
[0090] Furthermore, the electronic device may also determine a second average grayscale and a second mean square error of the second background area image, and determine a second reference average grayscale based on the second average grayscale and the second mean square error. The electronic device may determine a second reference average grayscale based on a mapping relationship between the mean square error and the second optimization factor according to a preset mapping relationship. The optimization factor may range from -0.018 to 0.018, and the specific calculation formula is as follows:
[0091] Second reference average grayscale = (1 + second optimization factor) * second average grayscale
[0092] Furthermore, the electronic device may determine a target absolute value of the difference between the first reference average grayscale and the second reference average grayscale, that is, the specific formula is as follows:
[0093] Target absolute value = |first reference average grayscale - second reference average grayscale|
[0094] Furthermore, the electronic device may also pre-store a preset mapping relationship between absolute values and differences, and then, the target difference corresponding to the target absolute value may be determined according to the preset mapping relationship between absolute values and differences.
[0095] 106. Process the reference image according to the target difference to obtain a target image.
[0096] The electronic device may determine corresponding image processing parameters based on the target difference, and process the reference image based on the image processing parameters to obtain the target image. The processing method may be at least one of the following: smoothing, sharpening, beautification, skin resurfacing, etc., which are not limited here.
[0097] Optionally, the above step 106, processing the reference image according to the target difference to obtain the target image, may include the following steps:
[0098] 61. Determine a target smoothing parameter corresponding to the target difference according to a preset mapping relationship between the difference and the smoothing coefficient;
[0099] 62. Process the reference image according to the target smoothing processing parameters to obtain the target image.
[0100] In a specific implementation, the electronic device can pre-store a mapping relationship between a preset degree of difference and a smoothing coefficient. The smoothing parameter is used to adjust the degree of smoothing, thereby enhancing the difference between the target and the background, resulting in a natural transition between the target and the background, thereby helping to improve image quality. Furthermore, the electronic device can determine a target smoothing parameter corresponding to the target degree of difference based on the mapping relationship between the preset degree of difference and the smoothing coefficient, and process the reference image based on the target smoothing parameter to obtain the target image.
[0101] It can be seen that the image processing method described in the embodiment of the present application performs image segmentation on the image to be processed to obtain a first target area image and a first background area image, performs a first image enhancement process on the first target area image to obtain a second target area image, performs a second image enhancement process on the first background area image to obtain a second background area image, synthesizes the second target area image and the second background area image into a reference image, determines the target difference between the second target area image and the second background area image in the reference image, processes the reference image according to the target difference to obtain a target image, on the one hand, the target and the background are segmented to facilitate targeted image enhancement processing based on the characteristics of the target and the background, on the other hand, considering the differential enhancement between the target and the background, it may cause the transition between the target and the background to be unnatural, and then, combining the difference between the target and the background to achieve image processing helps to reduce the degree of difference between the background and the target, and thus helps to improve the image quality.
[0102] With the above Figure 1B For details on the embodiment shown, please refer to Figure 2 , Figure 2 : This is a flowchart of an image processing method provided by an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the image processing method includes the following steps:
[0103] 201. Obtain an image to be processed.
[0104] 202. Perform image segmentation on the image to be processed to obtain a first target area image and a first background area image.
[0105] 203. Determine an image quality evaluation value of the image to be processed based on the first target area image and the first background area image.
[0106] Among them, the electronic device can combine the difference between the target and the background and the importance of both to conduct targeted image quality evaluation, which is more in line with the image quality evaluation intention when there is a target.
[0107] Optionally, the above step 203, determining the image quality evaluation value of the image to be processed based on the first target area image and the first background area image, may include the following steps:
[0108] 231. Determine a first reference evaluation value of the first target area image;
[0109] 232. Determine a second reference evaluation value of the first background area image;
[0110] 233. Obtain a target identifier corresponding to the first target area image;
[0111] 234. Determine a target first weight pair corresponding to the target identifier according to a preset mapping relationship between the identifier and the first weight pair;
[0112] 235. Determine a target area ratio between the first target area image and the first background area image;
[0113] 236. Determine a target second weight pair corresponding to the target area ratio according to a preset mapping relationship between the area ratio and the second weight pair;
[0114] 237. Perform a weighted operation based on the target first weight pair, the first reference evaluation value, and the second reference evaluation value to obtain a first evaluation value;
[0115] 238. Perform a weighted operation based on the target second weight pair, the first reference evaluation value, and the second reference evaluation value to obtain a second evaluation value;
[0116] 239. Use an average of the first evaluation value and the second evaluation value as an image quality evaluation value of the image to be processed.
[0117] Among them, the electronic device can use at least one image quality evaluation parameter to evaluate the image quality of the first target area image to obtain a first reference evaluation value. The image quality evaluation parameter can be at least one of the following: average gradient, clarity, edge preservation, information entropy, signal-to-noise ratio, etc., which are not limited here. Similarly, the electronic device can also perform image quality evaluation on the first background area image based on at least one image quality evaluation parameter to obtain a second reference evaluation value. The electronic device can also obtain the target identifier corresponding to the first target area image. The electronic device can pre-store a mapping relationship between a preset identifier and a first weight pair, and then, according to the mapping relationship between the preset identifier and the first weight pair, determine the target first weight pair corresponding to the target identifier. The target first weight pair can include two weights, and the two weights correspond to the first reference evaluation value and the second reference evaluation value respectively.
[0118] Furthermore, the electronic device can also determine the target area ratio between the first target area image and the first background area image, and the electronic device can also pre-store the mapping relationship between the preset area ratio and the second weight pair, and then, according to the mapping relationship between the preset area ratio and the second weight pair, determine the target second weight pair corresponding to the target area ratio, and then, according to the target first weight pair, the first reference evaluation value and the second reference evaluation value, a weighted operation can be performed to obtain a first evaluation value, and according to the target second weight pair, the first reference evaluation value and the second reference evaluation value, a weighted operation can be performed to obtain a second evaluation value, and the average of the first evaluation value and the second evaluation value is used as the image quality evaluation value of the image to be processed, and then, on the one hand, the weights corresponding to the target and the background can be assigned in combination with the target identification, and on the other hand, the corresponding weights can be determined in combination with the area ratio between the target and the background, and the target and the background can be associated through these two dimensions, which helps to differentiate the components of the target and the background in a targeted manner to achieve image quality enhancement, and helps to achieve accurate image quality evaluation of the image when a target is present.
[0119] 204. When the image quality evaluation value is less than a preset threshold, perform first image enhancement processing on the first target area image to obtain a second target area image.
[0120] The preset threshold value can be pre-set or set by the system default. When the image quality evaluation value is less than the preset threshold value, it indicates that the target and background need to be enhanced, and then, the subsequent steps can be implemented. Conversely, when the image quality evaluation value is greater than or equal to the preset threshold value, it indicates that the image quality is okay, and image enhancement processing may not be performed on the image.
[0121] 205. Perform second image enhancement processing on the first background area image to obtain a second background area image.
[0122] 206. Synthesize the second target area image and the second background area image into a reference image, and determine a target difference between the second target area image and the second background area image in the reference image.
[0123] 207. Process the reference image according to the target difference to obtain a target image.
[0124] The detailed description of the above steps 201 to 207 can be found in the above Figure 1B The corresponding steps of the described image processing method will not be repeated here.
[0125] It can be seen that the image processing method described in the embodiment of the present application obtains an image to be processed, which includes a target object, performs target extraction on the image to be processed, obtains a target area image corresponding to the target object, performs feature extraction on the target area image, obtains a target feature set, and the target feature set includes a target expression, a target human eye feature set, and a target skin parameter. The target fatigue level is determined based on the target feature set, and the target driving parameters are obtained. According to the mapping relationship between the preset driving parameters and the fatigue threshold, the preset threshold corresponding to the target driving parameters is determined. When the target fatigue level is greater than the preset threshold, a prompt operation is performed. In this way, user characteristics can be extracted and the fatigue level can be analyzed to perform corresponding prompt operations to ensure driving safety.
[0126] With the above Figure 1B 、 Figure 2 For details on the embodiment shown, please refer to Figure 3 , Figure 3 3 is a structural diagram of an electronic device 300 provided in an embodiment of the present application. As shown in the figure, the electronic device 300 includes a processor 310, a memory 320, a communication interface 330, and one or more programs 321. The one or more programs 321 are stored in the memory 320 and are configured to be executed by the processor 310. The one or more programs 321 include instructions for performing the following steps:
[0127] Get the image to be processed;
[0128] Performing image segmentation on the image to be processed to obtain a first target area image and a first background area image;
[0129] performing a first image enhancement process on the first target area image to obtain a second target area image;
[0130] performing a second image enhancement process on the first background area image to obtain a second background area image;
[0131] synthesizing the second target area image and the second background area image into a reference image, and determining a target difference between the second target area image and the second background area image in the reference image;
[0132] The reference image is processed according to the target difference to obtain a target image.
[0133] It can be seen that the electronic device described in the embodiment of the present application obtains an image to be processed, performs image segmentation on the image to be processed, obtains a first target area image and a first background area image, performs a first image enhancement process on the first target area image to obtain a second target area image, performs a second image enhancement process on the first background area image to obtain a second background area image, synthesizes the second target area image and the second background area image into a reference image, determines the target difference between the second target area image and the second background area image in the reference image, processes the reference image according to the target difference, and obtains a target image. On the one hand, the target and the background are segmented to facilitate targeted image enhancement processing based on the characteristics of the target and the background. On the other hand, considering the differential enhancement between the target and the background, it may cause an unnatural transition between the target and the background. Furthermore, image processing is performed in combination with the difference between the target and the background, which helps to reduce the degree of difference between the background and the target, and thus helps to improve the image quality.
[0134] Optionally, in the aspect of performing the first image enhancement processing on the first target area image to obtain the second target area image, the one or more programs 321 include instructions for executing the following steps:
[0135] determining a target identifier corresponding to the first target area image;
[0136] Determining a first reference image enhancement processing parameter corresponding to the target identifier according to a preset mapping relationship between the identifier and the image enhancement processing parameter;
[0137] Get target shooting parameters;
[0138] Determining a target first adjustment coefficient corresponding to the target shooting parameter according to a preset mapping relationship between the shooting parameter and the first adjustment coefficient;
[0139] adjusting the first reference image enhancement processing parameter according to the target first adjustment coefficient to obtain a first image enhancement processing parameter;
[0140] Image enhancement processing is performed on the first target area image according to the first image enhancement processing parameters to obtain the second target area image.
[0141] Optionally, in the aspect of performing the second image enhancement process on the first background area image to obtain the second background area image, the one or more programs 321 include instructions for executing the following steps:
[0142] Determine the target energy mean square error and target feature point distribution density of the first background area image;
[0143] When the target energy mean square error is within a first preset range and the target feature point distribution density is within a second preset range, using the first background area image as the second background area image;
[0144] When the target energy mean square error is not within the first preset range or the target feature point distribution density is not within the second preset range, determining a target area ratio between the first background area image and the image to be processed;
[0145] Obtaining target environment parameters corresponding to the image to be processed;
[0146] Determining second reference image enhancement processing parameters corresponding to the target environmental parameters according to a preset mapping relationship between environmental parameters and image enhancement processing parameters;
[0147] Determining a target second adjustment coefficient corresponding to the target area ratio according to a preset mapping relationship between the area ratio and the second adjustment coefficient;
[0148] adjusting the second reference image enhancement processing parameter according to the target second adjustment coefficient to obtain a second image enhancement processing parameter;
[0149] Image enhancement processing is performed on the first background area image according to the second image enhancement processing parameters to obtain the second background area image.
[0150] Optionally, in determining the target difference between the second target area image and the second target background area image in the reference image, the one or more programs 321 include instructions for performing the following steps:
[0151] determining a first average grayscale and a first mean square error of the second target area image;
[0152] determining a first reference average grayscale according to the first average grayscale and the first mean square error;
[0153] Determine a second average grayscale and a second mean square error of the second background area image;
[0154] determining a second reference average grayscale according to the second average grayscale and the second mean square error;
[0155] determining a target absolute value of a difference between the first reference average grayscale and the second reference average grayscale;
[0156] According to a preset mapping relationship between absolute values and differences, a target difference corresponding to the target absolute value is determined.
[0157] Optionally, in the aspect of processing the reference image according to the target difference to obtain the target image, the one or more programs 321 include instructions for performing the following steps:
[0158] Determining a target smoothing parameter corresponding to the target difference according to a preset mapping relationship between the difference and the smoothing coefficient;
[0159] The reference image is processed according to the target smoothing processing parameters to obtain the target image.
[0160] The above mainly introduces the solution of the embodiment of the present application from the perspective of the execution process of the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0161] The embodiment of the present application can divide the functional units of the electronic device according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0162] Figure 4 4 is a functional unit block diagram of an image processing device 400 involved in an embodiment of the present application. The image processing device 400 is applied to an electronic device, and the device 400 includes: an acquisition unit 401, a segmentation unit 402, a first image enhancement processing unit 403, a second image enhancement processing unit 404, a determination unit 405, and a processing unit 406, wherein:
[0163] The acquisition unit 401 is used to acquire the image to be processed;
[0164] The segmentation unit 402 is configured to perform image segmentation on the image to be processed to obtain a first target area image and a first background area image;
[0165] The first image enhancement processing unit 403 is configured to perform a first image enhancement process on the first target area image to obtain a second target area image;
[0166] The second image enhancement processing unit 404 is configured to perform a second image enhancement process on the first background area image to obtain a second background area image;
[0167] The determining unit 405 is configured to synthesize the second target area image and the second background area image into a reference image, and determine a target difference between the second target area image and the second background area image in the reference image;
[0168] The processing unit 406 is configured to process the reference image according to the target difference to obtain a target image.
[0169] It can be seen that the image processing device described in the embodiment of the present application obtains an image to be processed, performs image segmentation on the image to be processed, obtains a first target area image and a first background area image, performs a first image enhancement process on the first target area image to obtain a second target area image, performs a second image enhancement process on the first background area image to obtain a second background area image, synthesizes the second target area image and the second background area image into a reference image, determines the target difference between the second target area image and the second background area image in the reference image, processes the reference image according to the target difference, and obtains a target image. On the one hand, the target and the background are segmented to facilitate targeted image enhancement processing based on the characteristics of the target and the background. On the other hand, considering the differential enhancement between the target and the background, it may cause an unnatural transition between the target and the background. Furthermore, image processing is performed in combination with the difference between the target and the background, which helps to reduce the degree of difference between the background and the target, and thus helps to improve the image quality.
[0170] Optionally, in performing the first image enhancement processing on the first target area image to obtain the second target area image, the first image enhancement processing unit 403 is specifically configured to:
[0171] determining a target identifier corresponding to the first target area image;
[0172] Determining a first reference image enhancement processing parameter corresponding to the target identifier according to a preset mapping relationship between the identifier and the image enhancement processing parameter;
[0173] Get target shooting parameters;
[0174] Determining a target first adjustment coefficient corresponding to the target shooting parameter according to a preset mapping relationship between the shooting parameter and the first adjustment coefficient;
[0175] adjusting the first reference image enhancement processing parameter according to the target first adjustment coefficient to obtain a first image enhancement processing parameter;
[0176] Image enhancement processing is performed on the first target area image according to the first image enhancement processing parameters to obtain the second target area image.
[0177] Optionally, in performing the second image enhancement processing on the first background area image to obtain the second background area image, the second image enhancement processing unit 404 is specifically configured to:
[0178] Determine the target energy mean square error and target feature point distribution density of the first background area image;
[0179] When the target energy mean square error is within a first preset range and the target feature point distribution density is within a second preset range, using the first background area image as the second background area image;
[0180] When the target energy mean square error is not within the first preset range or the target feature point distribution density is not within the second preset range, determining a target area ratio between the first background area image and the image to be processed;
[0181] Obtaining target environment parameters corresponding to the image to be processed;
[0182] Determining second reference image enhancement processing parameters corresponding to the target environmental parameters according to a preset mapping relationship between environmental parameters and image enhancement processing parameters;
[0183] Determining a target second adjustment coefficient corresponding to the target area ratio according to a preset mapping relationship between the area ratio and the second adjustment coefficient;
[0184] adjusting the second reference image enhancement processing parameter according to the target second adjustment coefficient to obtain a second image enhancement processing parameter;
[0185] Image enhancement processing is performed on the first background area image according to the second image enhancement processing parameters to obtain the second background area image.
[0186] Optionally, in determining the target difference between the second target area image and the second target background area image in the reference image, the determining unit 405 is specifically configured to:
[0187] determining a first average grayscale and a first mean square error of the second target area image;
[0188] determining a first reference average grayscale according to the first average grayscale and the first mean square error;
[0189] Determine a second average grayscale and a second mean square error of the second background area image;
[0190] determining a second reference average grayscale according to the second average grayscale and the second mean square error;
[0191] determining a target absolute value of a difference between the first reference average grayscale and the second reference average grayscale;
[0192] According to a preset mapping relationship between absolute values and differences, a target difference corresponding to the target absolute value is determined.
[0193] Optionally, in the aspect of processing the reference image according to the target difference to obtain the target image, the processing unit 406 is specifically configured to:
[0194] Determining a target smoothing parameter corresponding to the target difference according to a preset mapping relationship between the difference and the smoothing coefficient;
[0195] The reference image is processed according to the target smoothing processing parameters to obtain the target image.
[0196] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0197] The present application also provides a computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the computer may comprise an electronic device.
[0198] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0199] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0200] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0201] The units described above as separate components may or may not be physically separate, and 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 these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0202] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0203] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: various media that can store program codes, 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.
[0204] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0205] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image processing method, characterized in that: The method comprises: Get the image to be processed; Performing image segmentation on the image to be processed to obtain a first target area image and a first background area image; Performing a first image enhancement process on the first target area image to obtain a second target area image; Performing a second image enhancement process on the first background area image to obtain a second background area image; synthesizing the second target area image and the second background area image into a reference image, and determining a target difference between the second target area image and the second background area image in the reference image; Processing the reference image according to the target difference to obtain a target image; Wherein, determining the target difference between the second target area image and the second background area image in the reference image includes: Determine a first average grayscale and a first mean square error of the second target area image; determining a first reference average grayscale according to the first average grayscale and the first mean square error; Determine a second average grayscale and a second mean square error of the second background area image; determining a second reference average grayscale according to the second average grayscale and the second mean square error; determining a target absolute value of a difference between the first reference average grayscale and the second reference average grayscale; Determining a target difference degree corresponding to the target absolute value according to a preset mapping relationship between absolute values and difference degrees; The step of processing the reference image according to the target difference to obtain the target image includes: According to a preset mapping relationship between the difference degree and the smoothing processing coefficient, a target smoothing processing parameter corresponding to the target difference degree is determined; The reference image is processed according to the target smoothing processing parameters to obtain the target image.
2. The method according to claim 1, characterized in that The performing a first image enhancement process on the first target area image to obtain a second target area image includes: Determining a target identifier corresponding to the first target area image; Determining a first reference image enhancement processing parameter corresponding to the target identifier according to a preset mapping relationship between the identifier and the image enhancement processing parameter; Get the target shooting parameters; Determining a target first adjustment coefficient corresponding to the target shooting parameter according to a preset mapping relationship between the shooting parameter and the first adjustment coefficient; adjusting the first reference image enhancement processing parameter according to the target first adjustment coefficient to obtain a first image enhancement processing parameter; The first target area image is subjected to image enhancement processing according to the first image enhancement processing parameter to obtain the second target area image.
3. The method according to claim 1 or 2, characterized in that: The performing second image enhancement processing on the first background area image to obtain a second background area image includes: Determine the target energy mean square error and target feature point distribution density of the first background area image; When the target energy mean square error is within a first preset range and the target feature point distribution density is within a second preset range, using the first background area image as the second background area image; When the target energy mean square error is not within the first preset range or the target feature point distribution density is not within the second preset range, determining a target area ratio between the first background area image and the image to be processed; Acquire target environment parameters corresponding to the image to be processed; Determine a second reference image enhancement processing parameter corresponding to the target environment parameter according to a mapping relationship between the preset environment parameter and the image enhancement processing parameter; Determining a target second adjustment coefficient corresponding to the target area ratio according to a preset mapping relationship between the area ratio and the second adjustment coefficient; adjusting the second reference image enhancement processing parameter according to the target second adjustment coefficient to obtain a second image enhancement processing parameter; The first background area image is subjected to image enhancement processing according to the second image enhancement processing parameters to obtain the second background area image.
4. An image processing device, characterized in that: The device comprises: an acquisition unit, a segmentation unit, a first image enhancement processing unit, a second image enhancement processing unit, a determination unit and a processing unit, wherein the acquisition unit is used to acquire an image to be processed; The segmentation unit is used to perform image segmentation on the image to be processed to obtain a first target area image and a first background area image; The first image enhancement processing unit is used to perform a first image enhancement processing on the first target area image to obtain a second target area image; The second image enhancement processing unit is used to perform a second image enhancement processing on the first background area image to obtain a second background area image; The determining unit is used to synthesize the second target area image and the second background area image into a reference image, and determine the target difference between the second target area image and the second background area image in the reference image; The processing unit is configured to process the reference image according to the target difference to obtain a target image; wherein the determining the target difference between the second target area image and the second background area image in the reference image comprises: Determine a first average grayscale and a first mean square error of the second target area image; determining a first reference average grayscale according to the first average grayscale and the first mean square error; Determine a second average grayscale and a second mean square error of the second background area image; determining a second reference average grayscale according to the second average grayscale and the second mean square error; determining a target absolute value of a difference between the first reference average grayscale and the second reference average grayscale; Determining a target difference degree corresponding to the target absolute value according to a preset mapping relationship between absolute values and difference degrees; The step of processing the reference image according to the target difference to obtain the target image includes: According to a preset mapping relationship between the difference degree and the smoothing processing coefficient, a target smoothing processing parameter corresponding to the target difference degree is determined; The reference image is processed according to the target smoothing processing parameters to obtain the target image.
5. The device according to claim 4, characterized in that In the aspect of performing the first image enhancement processing on the first target area image to obtain the second target area image, the first image enhancement processing unit is specifically used for: Determining a target identifier corresponding to the first target area image; Determining a first reference image enhancement processing parameter corresponding to the target identifier according to a preset mapping relationship between the identifier and the image enhancement processing parameter; Get the target shooting parameters; Determining a target first adjustment coefficient corresponding to the target shooting parameter according to a preset mapping relationship between the shooting parameter and the first adjustment coefficient; adjusting the first reference image enhancement processing parameter according to the target first adjustment coefficient to obtain a first image enhancement processing parameter; The first target area image is subjected to image enhancement processing according to the first image enhancement processing parameter to obtain the second target area image.
6. The device according to claim 4 or 5, characterized in that In the aspect of performing the second image enhancement processing on the first background area image to obtain the second background area image, the second image enhancement processing unit is specifically used for: Determine the target energy mean square error and target feature point distribution density of the first background area image; When the target energy mean square error is within a first preset range and the target feature point distribution density is within a second preset range, using the first background area image as the second background area image; When the target energy mean square error is not within the first preset range or the target feature point distribution density is not within the second preset range, determining a target area ratio between the first background area image and the image to be processed; Acquire target environment parameters corresponding to the image to be processed; Determine a second reference image enhancement processing parameter corresponding to the target environment parameter according to a mapping relationship between the preset environment parameter and the image enhancement processing parameter; Determining a target second adjustment coefficient corresponding to the target area ratio according to a preset mapping relationship between the area ratio and the second adjustment coefficient; adjusting the second reference image enhancement processing parameter according to the target second adjustment coefficient to obtain a second image enhancement processing parameter; The first background area image is subjected to image enhancement processing according to the second image enhancement processing parameters to obtain the second background area image.
7. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Video image processing method and device
CN102446352A
Image processing method and device, electronic equipment and computer readable storage medium
CN111402135A