Image adjusting method and electronic equipment

By analyzing the saturation and pixel values ​​of the target pixel points in the first image, determining the target intensity parameters, and adjusting the contrast of the second image, the problem of image contrast reduction in the backlight shooting scene is solved, and the image quality is improved.

CN120070277AActive Publication Date: 2025-05-30HONOR DEVICE CO LTD
View PDF 21 Cites 0 Cited by

Patent Information

Application Number
CN202311739678.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-11-23
Filing Date
2023-12-15
Publication Date
2025-05-30
Estimated Expiration
2043-12-15

AI Technical Summary

Technical Problem

In backlight shooting scenes, the contrast of the image is easily reduced, resulting in poor shooting results.

Method used

By analyzing the saturation and pixel values ​​of the target pixel points in the first image, the target intensity parameters are determined, and the contrast of the second image is adjusted to ensure that the image has good contrast in various scenarios.

Benefits of technology

Effectively improve the contrast of images in backlight shooting scenes, ensuring the image quality output by camera applications in terminal devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070277A_ABST
    Figure CN120070277A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image adjusting method and electronic equipment, and relates to the technical field of terminals. The method comprises the following steps: determining saturation corresponding to each target pixel point according to a pixel value of each target pixel point in a first image; and according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point, determining a target intensity parameter of a negative effect corresponding to the first image, the negative effect being caused by the contrast of the first image. And determining a target contrast parameter according to the target intensity parameter and a preset intensity threshold. And adjusting the contrast of the second image according to the target contrast parameter. Therefore, the contrast of the second image is adjusted according to the target contrast parameter, so that the contrast adjustment of the second image can be effectively ensured to be accurate and meet the actual adjustment requirement of the second image, and the output image of the camera application in the terminal equipment can have good contrast performance in various scenes.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims the priority of a Chinese patent application with the application number 202311582005.5 and the application title "Image Adjustment Method and Terminal Device" submitted to the Chinese Patent Office on November 23, 2023. The entire content of which is incorporated herein by reference. Technical Field

[0002] This application relates to the field of terminal technologies, and in particular, to an image adjustment method and an electronic device. Background Art

[0003] With the continuous development of terminal device technologies, current terminal devices usually have the function of image shooting.

[0004] In daily life, there is a scenario of backlight shooting in image shooting. Backlight shooting is a situation where the subject to be photographed is exactly between the light source and the lens. When shooting in backlight, due to the bright light in the picture, it may bring about a situation of reducing the contrast of the picture, resulting in poor shooting image effects. Summary of the Invention

[0005] Embodiments of this application provide an image adjustment method and an electronic device, which are applied to the field of terminal technologies to ensure that the images output by the camera application have good contrast in various scenarios.

[0006] In a first aspect, embodiments of this application propose an image adjustment method. The method includes:

[0007] Determine the saturation corresponding to each target pixel point in the first image according to the pixel values of the respective target pixel points in the first image;

[0008] Determine the target intensity parameter of the negative effect corresponding to the first image according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point, where the negative effect is caused by the contrast of the first image;

[0009] Determine the target contrast parameter according to the target intensity parameter and a preset intensity threshold;

[0010] Adjust the contrast of the second image according to the target contrast parameter.

[0011] In this implementation manner, the target intensity parameter of the first image is determined according to the saturation and pixel value of the target pixel points in the first image, where the target intensity parameter can specifically represent the performance effect of the negative effect in the first image. Then, the target contrast parameter is determined according to the target intensity parameter and the preset intensity threshold. Then, the contrast of the second image is adjusted according to the target contrast parameter, so that it can effectively ensure that the contrast adjustment of the targeted second image is accurate and meets the actual adjustment requirements of the second image, thereby ensuring that the output image of the camera application in the terminal device can have good contrast performance in various scenarios.

[0012] In a possible implementation manner, determining the target intensity parameter of the negative effect corresponding to the first image according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point includes:

[0013] For any one target pixel point, determine the single-pixel intensity parameter corresponding to the target pixel point according to the saturation of the target pixel point and the pixel value of the target pixel point;

[0014] Determine the target intensity parameter of the negative effect corresponding to the first image according to the single-pixel intensity parameters corresponding to each target pixel point.

[0015] In this implementation manner, by first determining the single-pixel intensity parameter of each pixel point and then determining the target intensity parameter of the first image based on the single-pixel intensity parameter, the effective and accurate determination of the target intensity parameter of the first image can be realized step by step.

[0016] In a possible implementation manner, determining the target intensity parameter of the negative effect corresponding to the first image according to the single-pixel intensity parameters corresponding to each target pixel point includes:

[0017] Take the average value of the single-pixel intensity parameters corresponding to each target pixel point as the target intensity parameter of the negative effect corresponding to the first image.

[0018] In a possible implementation manner, the single-pixel intensity parameter is inversely proportional to the saturation of the target pixel point; and,

[0019] The single-pixel intensity parameter is directly proportional to the maximum value of the pixel value of the target pixel point.

[0020] In this implementation manner, by setting the proportional relationship between the single-pixel intensity parameter, the saturation, and the pixel point, it can be ensured that the single-pixel intensity parameter can effectively reflect the performance degree of the negative effect corresponding to each pixel point.

[0021] In a possible implementation, determining the single-pixel intensity parameter corresponding to a target pixel point according to the saturation of the target pixel point and the pixel value of the target pixel point includes:

[0022] Determining a target ratio according to the ratio of the maximum value of the pixel value of the target pixel point to a first value, where the first value is the maximum value of the pixel value;

[0023] Determining the single-pixel intensity parameter corresponding to the target pixel point according to the difference between the target ratio and the saturation of the target pixel point.

[0024] In this implementation, by determining the single-pixel intensity parameter according to the above steps, it is possible to quickly and accurately obtain the single-pixel intensity parameter corresponding to each pixel point on the basis of satisfying the proportional relationship between the single-pixel intensity parameter and the corresponding parameter introduced above.

[0025] In a possible implementation, after determining the target intensity parameter of the negative effect corresponding to the first image according to the saturation and pixel value corresponding to each target pixel point, the method further includes:

[0026] Performing normalization processing on the target intensity parameter to adjust the target intensity parameter to a value within a preset range.

[0027] In this way, it is possible to achieve unified processing of the data range where the target intensity parameter is located, and further ensure that no matter which image is concerned, the same set of standards can be used to measure the magnitude of the target intensity parameter.

[0028] In a possible implementation, determining the target contrast parameter according to the target intensity parameter and a preset intensity threshold includes:

[0029] Obtaining an initial contrast parameter and an adjustment step;

[0030] If the target intensity parameter is greater than or equal to the preset intensity threshold, determining the initial contrast parameter as the target contrast parameter; or,

[0031] If the target intensity parameter is less than the preset intensity threshold, adjusting the initial contrast parameter according to the adjustment step to obtain the target contrast parameter.

[0032] In a possible implementation, adjusting the initial contrast parameter according to the adjustment step to obtain the target contrast parameter includes:

[0033] Determining the difference between the target intensity parameter and the preset intensity threshold;

[0034] Determining an adjustment value according to the difference and the adjustment step;

[0035] Determine the sum of the initial contrast parameter and the adjustment value as the target contrast parameter.

[0036] In this implementation, the initial contrast parameter is adjusted only when the target intensity parameter indicates that the negative effect of the first image is obvious, so as to adjust the contrast of the second image according to the adjusted target contrast parameter, thereby specifically eliminating or alleviating the negative effect caused by the low contrast in the second image. At the same time, when the target intensity parameter indicates that the negative effect of the first image is not obvious, the contrast of the second image is directly adjusted according to the initial contrast parameter, avoiding the problem of poor contrast performance caused by making additional contrast adjustments to the second image when the negative effect does not need to be adjusted.

[0037] In a possible implementation, the generation time of the second image is later than that of the first image.

[0038] For example, the first image is one of multiple preview images captured by the camera application; or, the first image is one of multiple captured images, and the multiple captured images are captured by the camera application in response to a user operation on the capture control.

[0039] And also for example, the second image is an image obtained by fusing multiple captured images.

[0040] In this implementation, by setting the specific selection of the first image and the second image, it can be ensured that the processing of eliminating the negative effect is performed on the output image that the camera application will finally output. And it is ensured that the determined target intensity parameter can be effectively applied in the contrast adjustment stage of the second image, thereby ensuring the orderly and effective execution of the contrast adjustment.

[0041] In a possible implementation, the method further includes:

[0042] Perform face detection on the first image and determine the face frame area in the first image;

[0043] Determine the pixel points within the face frame area in the first image as the target pixel points.

[0044] In this implementation, the target intensity parameter can be determined based on the pixel points in the face area, so as to specifically measure the degree of manifestation of the negative effect in the face area. So that when the degree of manifestation of the negative effect in the face area is relatively serious, the special processing for the negative effect is performed, thereby improving the pertinence and necessity of the contrast adjustment to a certain extent. In other words, for an image in which the manifestation of the negative effect in the face area is not obvious, the special processing for the negative effect can be omitted, so the power consumption of the terminal device can be saved to a certain extent.

[0045] In a second aspect, an embodiment of the present application provides an image adjustment device, which may be an electronic device, or a chip or a chip system within the electronic device. The image adjustment device may include a display unit and a processing unit. When the image adjustment device is an electronic device, the display unit may be a display screen. The display unit is configured to perform the display step so that the electronic device implements an image adjustment method described in the first aspect or any one of the possible implementation manners of the first aspect. When the image adjustment device is an electronic device, the processing unit may be a processor. The image adjustment device may further include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit so that the electronic device implements an image adjustment method described in the first aspect or any one of the possible implementation manners of the first aspect. When the image adjustment device is a chip or a chip system within the electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the electronic device implements an image adjustment method described in the first aspect or any one of the possible implementation manners of the first aspect. The storage unit may be a storage unit within the chip (e.g., registers, caches, etc.), or a storage unit outside the chip within the electronic device (e.g., read-only memory, random access memory, etc.).

[0046] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory. The memory is used to store code instructions, and the processor is used to run the code instructions to execute the method described in the first aspect or any one of the possible implementation manners of the first aspect.

[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are run on a computer, the computer is caused to execute the method described in the first aspect or any one of the possible implementation manners of the first aspect.

[0048] In a fifth aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program is run on a computer, the computer is caused to execute the method described in the first aspect or any one of the possible implementation manners of the first aspect.

[0049] In a sixth aspect, the present application provides a chip or a chip system, which includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected by a line. The at least one processor is used to run a computer program or instructions to execute the method described in the first aspect or any one of the possible implementation manners of the first aspect. Among them, the communication interface in the chip may be an input / output interface, a pin, a circuit, etc.

[0050] In a possible implementation, the chip or chip system described above in this application further includes at least one memory, and instructions are stored in the at least one memory. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or may be a storage unit of the chip (such as a read-only memory, a random access memory, etc.).

[0051] It should be understood that the technical solutions of the second to sixth aspects of this application correspond to those of the first aspect of this application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar and will not be elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 Schematic diagram of the effect of contrast provided by an embodiment of this application;

[0053] Figure 2 Schematic diagram of the scene of image capture provided by an embodiment of this application;

[0054] Figure 3 Schematic diagram of the negative effect provided by an embodiment of this application Figure 1 ;

[0055] Figure 4 Schematic diagram of the negative effect provided by an embodiment of this application Figure 2 ;

[0056] Figure 5 Schematic diagram of the hardware structure of a terminal device provided by an embodiment of this application;

[0057] Figure 6 Schematic diagram of the software structure of a terminal device provided by an embodiment of this application;

[0058] Figure 7 Schematic diagram of image selection provided by an embodiment of this application;

[0059] Figure 8 Schematic diagram of the processing process of image fusion provided by an embodiment of this application;

[0060] Figure 9 Schematic diagram of the flow of the image adjustment method provided by an embodiment of this application Figure 1 ;

[0061] Figure 10 Schematic diagram of the target pixel points of the first image provided by this application;

[0062] Figure 11 Schematic diagram of the flow of the image adjustment method provided by an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0063] To facilitate a clear description of the technical solutions of the embodiments of the present application, the following briefly introduces some terms and technologies involved in the embodiments of the present application:

[0064] 1. Contrast

[0065] The contrast of an image can be understood as the degree of brightness difference between the bright area and the dark area in the image. If there is an obvious difference between the bright area and the dark area in an image, then the contrast of this image is relatively high. On the contrary, if the difference between the bright area and the dark area is small, then the contrast is low. In image processing, contrast can affect the clarity and visual effect of the image.

[0066] If the contrast is high enough, then there will be more gradual change levels from black to white in the image, and the details and colors of the image will be more rich and clear. Exemplarily, if the contrast of an image is enhanced, then the bright area in the image will become brighter and the dark area will become darker.

[0067] If the contrast is low, it means that the difference degree between the bright area and the dark area in the image is small, and correspondingly, the number of gradual change levels from black to white in the image is less, resulting in the details and colors in the image being difficult to identify. Specifically, when the contrast of an image is low, due to the small number of gradual change levels from black to white, the image will present a hazy effect, that is, the image appears gray and the details are difficult to identify.

[0068] For example, it can be referred to Figure 1 to understand the influence of high and low contrast on the image, Figure 1 which is a schematic diagram of the effect of contrast provided for the embodiments of the present application.

[0069] As Figure 1 shown, for the same image, if the contrast of the image is low, it presents the effect shown in (a) in Figure 1 , that is, the overall image shows a grayish effect, and the details and colors are also difficult to identify.

[0070] However, if the contrast of the image is high, it presents the effect shown in (b) in Figure 1 , that is, the details and colors of the image will be more rich and clear.

[0071] It can be understood that Figure 1 the "high" and "low" of the contrast introduced in Figure 1 are relative to each other with the two images provided in

[0072] 2. Saturation

[0073] Saturation refers to the vividness of a color and can also be called purity. The higher the saturation of an image, the more vivid the colors presented in the image.

[0074] 3. HDR Fusion

[0075] The HDR (high dynamic range) fusion algorithm is an image processing technology that improves the color and detail problems caused by non-uniform brightness in images. It fuses multiple images taken with different brightness levels into a single high-dynamic-range image, thereby improving the colors in the image and enhancing the details. It is a very effective image enhancement technology.

[0076] The HDR fusion algorithm uses multiple photos with different brightness levels as the original images. Each of these images can be represented by pixel gray values, thereby constructing an image with a wider range, in order to have stronger contrast, more gray values, and more details. At the same time, a richer scale transformation space can also be obtained. By using image and contrast stretching algorithms, etc., the image can be made clearer. By using the HDR fusion algorithm, the sharpness and dynamic range of the image can be increased, thereby achieving the brightness enhancement processing of HDR images.

[0077] 4. Other Terms

[0078] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and roles. For example, the first chip and the second chip are only used to distinguish different chips and do not limit their order. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and terms such as "first" and "second" do not necessarily mean different.

[0079] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in this application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.

[0080] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (item)" or its similar expression refers to any combination of these items, including any combination of a single item or multiple items. For example, at least one (item) of a, b, or c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, and c may be single or multiple.

[0081] 5. Electronic device

[0082] The electronic device in the embodiments of the present application may include a handheld device with an image capture function, a vehicle-mounted device, etc. For example, some electronic devices are: mobile phone, tablet computer, handheld computer, laptop computer, mobile internet device (MID), wearable device, virtual reality (VR) device, augmented reality (AR) device, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, cellular phone, cordless phone, session initiation protocol (SIP) phone, wireless local loop (WLL) station, personal digital assistant (PDA), handheld device with wireless communication function, computing device or other processing device connected to a wireless modem, vehicle-mounted device, wearable device, terminal device in a 5G network, or terminal device in a future evolved public land mobile network (PLMN), etc. The embodiments of the present application are not limited thereto.

[0083] By way of example and not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. A wearable device, also known as a wearable intelligent device, is a general term for devices developed by applying wearable technology to the intelligent design of daily wear, such as glasses, gloves, watches, clothing, shoes, etc.

[0084] The electronic device in the embodiments of the present application may also be referred to as: terminal device, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile platform, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, etc.

[0085] In the embodiments of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also known as main memory). The operating system can be any one or more computer operating systems that implement service processing through processes, for example, Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system, etc. The application layer includes applications such as a browser, an address book, a word processing software, an instant messaging software, etc.

[0086] Currently, terminal devices usually have the function of image shooting. Exemplarily, a sensor module and a lens may be included in the terminal device to achieve the purpose of image shooting.

[0087] To better understand the technical solution of the present application, the related technologies involved in the present application will be further introduced in detail below.

[0088] When using an electronic device for image shooting, there is an image shooting scenario of backlight shooting. Backlight is a situation where the subject to be photographed is exactly between the light source and the lens. For example, reference can be made to Figure 2 to understand the backlight shooting scenario. Figure 2 This is a schematic diagram of the image shooting scenario for the embodiments of the present application.

[0089] As Figure 2 shown, when the user is backlit and uses the front camera for image shooting, this situation where the subject 202 is between the light source 203 and the lens 201 may occur.

[0090] Figure 2 Exemplary is a scenario where the user uses the front camera to take an image. When the user uses the rear camera to take an image, it is also possible that the subject to be photographed is located between the light source and the lens as introduced above.

[0091] In the case of backlighting shooting introduced above, since the subject to be photographed is located between the lens and the light source, it is very likely that the contrast of the image in the picture is poorly presented.

[0092] Exemplarily, when the quality of the sensor module in the terminal device is poor, if an image is taken in the backlighting scenario introduced above, due to the bright light in the picture, for example, non-imaging light from the sun or other strong light sources shines on the lens of the camera, resulting in problems such as lens flare and halos, and accompanied by a significant reduction in the contrast of the picture. It should be understood that the "reduction" of the contrast introduced here is compared with the contrast of the image collected when taking an image in a non-backlighting scenario. That is to say, usually, for the same shooting object, the contrast of the image taken in the backlighting scenario is less than the contrast of the image taken in the non-backlighting scenario.

[0093] Based on the above introduction, it can be understood that when the contrast of the image is low, the image will have a hazy effect. Then, for an image containing a portrait, a low contrast will cause negative effects such as the portrait in the picture looking blurred and whitish. The blurred effect can be understood as a hazy effect appearing on the portrait part, and the whitish effect can be understood as the overall color of the portrait part being whitish.

[0094] However, it should be understood that the whitish here is still due to the hazy effect of the image, resulting in the image looking gray and presenting a whitish effect. It can be understood by analogy with the fact that when observing the surrounding environment with the human eye in a foggy weather, the environment will look whitish, but in fact, it still presents a hazy gray effect. Or it can also be referred to Figure 1 Understand, refer to Figure 1 It can be determined that Figure 1 (a) in Figure 1 compared with (b) in

[0095] In one implementation, the negative effects mentioned in the present application are related effects caused by the low contrast of the image. For example, when the contrast is less than the preset contrast, it can be considered that the contrast of the image is low. At this time, the negative effects that appear in the image are the negative effects introduced in the present application. Alternatively, specifically, in the case of backlit shooting, due to the influence of the backlit scene, the contrast of the picture is low, and thus the image performance effects caused thereby can be determined as the negative effects in the present application.

[0096] That is to say, the negative effects introduced in the present application can be understood as the effects caused by the low contrast of the image, where "low contrast" can be quantified as, for example, the contrast of the image being less than the preset contrast. Therefore, all the effects that appear in the image due to the low contrast of the image can be the negative effects introduced in the present application. The low contrast can be caused by the above-mentioned backlit shooting scene, or can also be caused by other reasons, and this embodiment does not limit this.

[0097] Exemplarily, the negative effects can include the image being too white and the image being hazy as introduced above, and this embodiment does not limit the specific negative effects.

[0098] In the present application, the negative effects such as the image being hazy and too white presented can be solved by adjusting the contrast of the image.

[0099] In one implementation, the low contrast introduced above may cause negative effects in the portrait part of the image. Therefore, the contrast of the image can be adjusted to alleviate or eliminate the negative effects in the portrait part of the image. For example, reference can be made to Figure 3 to understand the implementation of adjusting the negative effects in the portrait part of the image. Figure 3 This is a schematic illustration of the negative effects provided by the embodiments of the present application. Figure 1 .

[0100] Figure 3 (a) in shows an image. By reference to Figure 3 it can be determined that the image may include a portrait, and in the portrait part, the face may have the negative effects of being hazy and too white as introduced above. In Figure 3 such negative effects are indicated by shading in (a).

[0101] Then, by adjusting the contrast of the image, the negative effects in the face part can be eliminated or alleviated to a certain extent, thereby obtaining the adjusted image shown in (b) in Figure 3 . The negative effects in the face part can be eliminated or alleviated.

[0102] The current article specifically introduces the negative effect of reduced contrast on the portrait part of the picture, so the above Figure 3 The elimination of negative effects on the face part (the implementation method of the analogy portrait part is the same) is exemplified.

[0103] However, in reality, the reduction in contrast may cause the above-mentioned negative effects to appear on the entire image, not just on the portrait part or the face part. Therefore, in the actual implementation process, adjusting the contrast of the image can also alleviate or eliminate the negative effects on the entire image.

[0104] For example, you can refer to Figure 4 Understand the implementation of adjusting the negative effects of the entire image, Figure 4 The negative effects of the embodiments of the present invention are shown in FIG. Figure 2 .

[0105] Figure 4 (a) in the figure shows an image, refer to Figure 4 It is certain that the image may include a portrait, but in fact the entire image may have the negative effects of blurring and whitening as described above. Figure 4 This negative effect is indicated by shading in (a).

[0106] Then we can adjust the contrast of the image to eliminate or alleviate the negative effects in the image to a certain extent, thus obtaining Figure 4 The adjusted image shown in (b) in FIG. The negative effects of the entire image can be eliminated or alleviated.

[0107] In the actual implementation process, which part of the image has the negative effect depends on the actual image generation situation, and this embodiment does not limit this. In short, the technical solution of the present application can alleviate or eliminate the negative effect caused by too low contrast in the image.

[0108] The following is a further introduction to the negative elimination of the portrait part. In order to solve the problem of negative effects on the portrait part of the image in the backlit shooting scene described above, resulting in poor performance of the image containing the portrait, it is usually necessary to perform contrast adjustment on the image (the same concept as contrast adjustment) to increase the contrast of the image as much as possible to offset the negative effects described above to a certain extent.

[0109] Currently, when performing contrast debugging on an image in related technologies, it is usually based on the iso (sensitivity), luxindex (brightness index), or adrc_gain (dark part brightening coefficient) of the image to measure whether the portrait part in the image needs to be contrast-debugged, and then the contrast of the image is adjusted based on these parameters. Among them, adrc in adrc_gain is automatic dynamic range compression, and gain represents gain.

[0110] However, none of the above-mentioned parameters are used to directly measure the degree of the negative effects caused by the low contrast introduced above. Therefore, using the above-mentioned parameters to measure whether an image needs to be contrast-debugged and then performing contrast debugging based on these parameters will result in a situation where the contrast after debugging is too low or too high in some shooting scenarios.

[0111] Based on this, the present application proposes the following technical concept: propose an intensity parameter for characterizing the intensity of the negative effects of the portrait part in the image, and then dynamically adjust the contrast of the portrait part in the image based on this intensity parameter, so as to effectively improve the accuracy of contrast debugging, so that the portrait images for different shooting scenarios can all have a good contrast.

[0112] The technical solution provided by the present application can be applied to a terminal device. First, the terminal device will be briefly introduced below.

[0113] Exemplarily, Figure 5 FIG. is a schematic hardware structure diagram of a terminal device provided by an embodiment of the present application.

[0114] The terminal device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0115] Among them, the processor 110 may include one or more processing units. Among them, different processing units may be independent devices or integrated in one or more processors. A memory may also be provided in the processor 110 for storing instructions and data.

[0116] The terminal device implements the display function through the GPU, the display screen 194, the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering.

[0117] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the terminal device may include one or N display screens 194, where N is a positive integer greater than 1.

[0118] The terminal device can implement camera functions such as shooting and video recording through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.

[0119] The camera 193 is used to capture still images or videos. In some embodiments, the terminal device may include one or N cameras 193, where N is a positive integer greater than 1.

[0120] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera sensor. The light signal is converted into an electrical signal, and the camera sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.

[0121] It can be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only for illustrative purposes and does not constitute a limitation on the structure of the terminal device. In other embodiments of the present application, the terminal device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0122] The software system of the above terminal device may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, a system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the terminal device.

[0123] Exemplarily, Figure 6 This is a schematic diagram of the software structure of a terminal device provided in the embodiments of the present application.

[0124] Such as Figure 6As shown, the layered architecture divides software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through interfaces. In some embodiments, the system may include an application layer, an application framework layer, a hardware abstraction layer (HAL), a driver layer, and a hardware layer.

[0125] It should be noted that the embodiments of this application take the Android system as an example. In other operating systems (such as the HarmonyOS, iOS system, etc.), as long as the functions implemented by each functional module are similar to those of the embodiments of this application, the solution of this application can also be implemented.

[0126] Among them, the application layer may include a series of application packages. As Figure 6 shown, the application packages may include applications such as the camera and the gallery. Among them, the camera application is an application for implementing the image capture function introduced in this application. And, after the image is captured, the user can view the captured image in the gallery application.

[0127] And the application layer may also include the calendar, phone, map, navigation, mailbox, social, wireless local area networks (WLAN), Bluetooth, music, video, short message, lock screen application, settings application. Of course, the application layer may also include other application packages, such as third-party applications such as payment applications, shopping applications, bank applications, and social applications, which are not limited in this application.

[0128] Among them, the application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. For example, as Figure 6 shown, the application framework layer may include a camera access interface. The camera access interface may include a camera management and a camera device. Among them, the camera management can be used to provide an access interface for managing the camera, and the camera device can be used to provide an interface for accessing the camera.

[0129] And, the application framework layer may also include some predefined functions. For example, it may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, and a camera server unit, etc., which are not restricted in the embodiments of this application. Among them, the camera server unit of the application framework layer can be started at the startup stage of the terminal device and can be used to transfer and save the relevant information of the camera.

[0130] Moreover, the hardware abstraction layer is used to abstract the hardware, encapsulate the Linux kernel driver, provide an interface upward, and shield the implementation details of the lower-layer hardware. For example, the hardware abstraction layer may include Figure 6 the camera hardware abstraction layer, other hardware device abstraction layers, and the camera algorithm library as shown.

[0131] Among them, the camera hardware abstraction layer may include camera device 1, camera device 2, etc. The camera hardware abstraction layer can be connected to the camera algorithm library, and the camera hardware abstraction layer can call the algorithms in the camera algorithm library.

[0132] The camera algorithm library may include algorithm instructions such as camera algorithms and image algorithms, and execute some image processing steps. Exemplarily, in the camera algorithm library, for example, a first algorithm or a first algorithm set may be included, where the first algorithm or the first algorithm set is used to implement the relevant processing for the contrast debugging of portrait images introduced in this application.

[0133] Or it can also be understood that a processing unit is included in the HAL layer, where the processing unit is used to implement the relevant processing for the contrast debugging of portrait images introduced in this application.

[0134] Moreover, the driver layer is used to provide drivers for different hardware devices. For example, the driver layer may include a camera driver, a digital signal processor driver, and a graphics processor driver. The camera driver is the driver layer of the camera device and is mainly responsible for the interaction with the hardware module.

[0135] Moreover, the hardware layer may include sensors, image processors, digital signal processors, graphics processors, memories, and other hardware devices. It is used to interact with the camera driver to achieve the purpose of image shooting.

[0136] During the photo-taking process, for example, the camera application in the application layer can respond to the user operation and send an image acquisition instruction to the camera device in the camera access interface, where the image acquisition includes image acquisition in the preview stage and images in the shooting stage. Then the camera device sends relevant instructions to the camera HAL, the camera HAL sends relevant instructions to the camera device driver, and the camera device driver interacts with the relevant sensors and processors in the hardware layer to complete the purpose of image shooting.

[0137] After the image acquisition is completed, it is necessary to go through the opposite data flow as introduced above to display the acquired image in the camera application or the gallery application. Among them, in the opposite data flow, the acquired image can also be further processed in some hierarchical structures.

[0138] For example, it can be set that the HAL layer will further process the captured image. Exemplarily, the HAL layer can, for example, call the first algorithm or the first algorithm set in the camera algorithm library, and combine the interaction content with the relevant drivers in the driver layer and the relevant hardware units in the hardware layer to perform the contrast debugging introduced in this application on the captured image, so that the contrast of the finally presented output image performs well.

[0139] Based on the above introduction, the specific implementation of the contrast debugging for images provided in this application will be described below.

[0140] In this application, an intensity parameter for characterizing the negative effect in an image is provided. Therefore, the relevant implementation of the intensity parameter will be introduced first. Exemplarily, the intensity parameter in this application can also be understood as the blurring intensity, which is used to measure the blurring intensity of the portrait area (or face area) in the image, or can also be used to measure the overall blurring intensity of the image.

[0141] In one implementation, the technical solution of this application is to perform contrast adjustment on the to-be-displayed image to be output. The to-be-displayed image is the image generated after the camera application responds to the click operation on the capture button when the user clicks the capture button. By performing contrast adjustment on the to-be-displayed image, it can be ensured that the contrast of the finally captured output image performs well.

[0142] Then, in order to ensure that the contrast adjustment of the to-be-displayed image can be achieved, the intensity parameter of the negative effect can be determined in advance before the to-be-displayed image is generated, and then the contrast of the to-be-displayed image can be directly adjusted according to the intensity parameter, and the output image that can be output after the adjustment can be obtained.

[0143] Exemplarily, in this application, the to-be-displayed image that needs to perform contrast adjustment can be called the second image, and the image generated before the second image for determining the intensity parameter can be called the first image. First, the selection methods of the first image and the second image will be briefly introduced below in combination with Figure 7 a simple introduction to the selection methods of the first image and the second image, Figure 7 which is a schematic diagram of image selection provided for the embodiments of this application.

[0144] As Figure 7 shown, assume that the user clicks the capture button at time t1. Then, before time t1, it is in the capture preview stage, and after time t1, it is in the stage of generating the to-be-displayed image.

[0145] Among them, in the capture preview stage, the camera of the terminal device continuously captures images to generate a preview stream, that is, multiple images are included in the preview stream. As Figure 7As shown, for example, the preview stream includes image a1, image a2, image a3, and so on.

[0146] Moreover, during the image generation stage, the camera application in the terminal device can continuously capture n captured images (n is an integer greater than or equal to 1) in response to a user operation on the capture button. For example, in Figure 7 the example, the terminal device continuously captures 6 captured images. After that, the terminal device can perform a fusion process on at least some of the n captured images to obtain Figure 7 the fused image to be displayed as shown. The image to be displayed introduced here is also the second image that needs to have its contrast adjusted.

[0147] In one possible implementation, when selecting the first image for determining the intensity parameter, an image can be selected from the preview stream as the first image. Exemplarily, any image in the preview stream can be determined as the first image, or alternatively, any image in the preview stream whose time interval from the t1 moment is less than a preset duration can be determined as the first image.

[0148] Or, the first image can also be selected from the n captured images continuously captured in response to the user operation on the capture button. Exemplarily, the m-th image among the n continuously captured images can be determined as the reference image, and then the reference image is used as the first image introduced in this application. For example, in Figure 7 the example, the 3rd image among the 6 continuously captured images is determined as the reference image. Therefore, the reference image b3 can be used as the first image introduced in this application.

[0149] In the actual implementation process, m can be pre-set, where m is an integer greater than or equal to 1 and less than or equal to n.

[0150] Or, any one of the n continuously captured images can also be determined as the first image, and this embodiment does not limit this.

[0151] Next, in combination with Figure 8 the reason for determining the intensity parameter based on the first image and then adjusting the contrast of the second image according to the intensity parameter (that is, the image for determining the intensity parameter and the image for applying the intensity parameter are not the same). Instead of directly determining the intensity parameter based on the second image and then determining the contrast of the second image according to the intensity parameter (that is, the image for determining the intensity parameter and the image for applying the intensity parameter are the same) will be further introduced. Figure 8 This is a schematic diagram of the processing process of image fusion provided by the embodiment of this application.

[0152] As Figure 8As shown, after collecting consecutive n captured images in response to a user operation on a photographing button (i.e., images b1 to b6 in Figure 8 ), the consecutive n captured images can first be subjected to a fusion process to obtain an initial fused image.

[0153] Exemplarily, the fusion process introduced here can be the HDR fusion introduced above. Therefore, after image fusion, it is usually necessary to adjust the brightness of the fused image to obtain an image with normal brightness conditions.

[0154] In Figure 8 , the initial fused image has not been subjected to brightness adjustment yet. Therefore, the initial fused image actually appears very dark and does not conform to human eye judgment, that is, it does not conform to the brightness conditions of the real scene observed by the human eye. Therefore, the brightness information in the initial fused image has not been processed and its brightness information is inaccurate.

[0155] Continuing to refer to Figure 8 , after the initial fused image is obtained by fusion, the next step is to adjust the brightness of the initial fused image. The purpose of the brightness adjustment is to brighten the dark areas in the image and darken the bright areas so that the brightness effect in the image conforms to human eye judgment. The contrast adjustment introduced in this application is completed in the brightness adjustment stage. It can also be understood that the contrast adjustment is an adjustment operation in the brightness adjustment stage.

[0156] After the brightness of the initial fused image is adjusted, other image parameter adjustment processes can also be performed to obtain the Figure 8 shown final fused image, where the final fused image is the output image of the final image after photographing introduced above. If the user views the photographing result in the gallery application, the image viewed is the final fused image introduced here.

[0157] Then, based on the current situation introduced, if the intensity parameter is determined according to the second image, then there are the following two options currently:

[0158] The first option is to determine the intensity parameter according to the Figure 8 shown initial fused image. However, since the brightness information of the initial fused image has not been processed, the brightness information of the initial fused image is inaccurate, and thus the intensity parameter determined according to the initial fused image is also inaccurate.

[0159] Therefore, the intensity parameter cannot be determined according to the initial fused image.

[0160] The second option is to determine according to Figure 8The final fused image shown is used to determine the intensity parameter. However, the contrast adjustment has been processed before obtaining the final fused image. Therefore, after obtaining the final fused image, determining the contrast parameter based on the final fused image can no longer be applied to the contrast adjustment of the final fused image.

[0161] Therefore, although the intensity parameter determined based on the final fused image is accurate, it cannot be applied to the contrast adjustment.

[0162] Based on the above analysis, it can be determined that in this embodiment, the intensity parameter cannot be determined according to the second image. To achieve the contrast adjustment of the second image, the intensity parameter needs to be determined in advance. Therefore, in this embodiment, it is selected to determine the intensity parameter according to the first image, and then adjust the contrast of the second image according to the intensity parameter.

[0163] Among them, the generation time of the first image is before the second image. Therefore, it can be ensured that the intensity parameter generated according to the first image is in time for application in the contrast parameter adjustment of the second image. And, the first image in this embodiment is either the image in the preview stream introduced above or the reference image introduced above. Therefore, the first image can be obtained without undergoing fusion processing. Correspondingly, no related adjustment operations after fusion processing are required for the first image. Therefore, the generation speed of the first image is relatively fast, and correspondingly, the speed of determining the intensity parameter according to the first image is also relatively fast. So, it can be ensured that the intensity parameter determined according to the first image can be effectively applied to the brightness adjustment of the second image. And determining the mask image and the gain image in advance can also improve the speed of contrast adjustment for the second image.

[0164] And, the contrast adjustment introduced in this embodiment is completed in Figure 8 the brightness adjustment stage introduced above. Therefore, the intensity parameter actually adjusted in this embodiment is Figure 8 the contrast of the initial fused image shown. Therefore, the second image that needs to be contrast-adjusted introduced in this embodiment is the initial fused image introduced here, and the initial fused image and the to-be-displayed image introduced above are the same concept.

[0165] After the brightness adjustment of the initial fused image, the Figure 8 final fused image shown will be obtained. The final fused image is the output image of the camera application program's final image output.

[0166] The relevant implementations of the first image and the second image are introduced above. Next, the specific implementation of determining the intensity parameter will be introduced.

[0167] After determining the first image, the intensity parameter can be determined based on the first image. In one implementation, the preview image in the preview stream introduced above, as well as the n captured images captured continuously, can all be YUV images. Among them, YUV is a color encoding mode, where Y represents luminance, that is, the grayscale value, and UV represent chrominance and chroma respectively.

[0168] Therefore, the first image in this embodiment may also be a YUV image. For the convenience of subsequent processing, for example, the first image in YUV format can be converted to the RGB space to obtain the first image in RGB format, and then subsequent processing is performed based on the first image in RBG format. Among them, RBG is also a color encoding mode, where R represents Red, G represents Green, and B represents Blue.

[0169] On this basis, the implementation of determining the intensity parameter according to the first image will be introduced below in combination with Figure 9 and Figure 10 The implementation of determining the intensity parameter according to the first image will be introduced. Figure 9 is a schematic flowchart of the image adjustment method provided by the embodiment of the present application. Figure 10 is a schematic diagram of the target pixel points of the first image provided by the present application.

[0170] As Figure 9 shown, the method includes:

[0171] 1. For each target pixel point in the first image, determine whether the target pixel point is overexposed, and filter out the overexposed target pixel points.

[0172] First, the target pixel points will be introduced. The target pixel points in this embodiment are the pixel points used to determine the target intensity parameter of the first image.

[0173] In one implementation, the target intensity parameter in this embodiment is to characterize the intensity of the negative effect of the face part in the image. Therefore, for example, a face detection algorithm can be used to perform face detection on the first image to obtain the position of the face detection frame (or called the face box) in the first image. Then, for example, the pixel points in the first image located within the face detection frame can be determined as the target pixel points.

[0174] Alternatively, the target intensity parameter in this embodiment can also be to characterize the intensity of the negative effect of the portrait part in the image. Therefore, for example, a portrait detection algorithm can be used to perform portrait detection on the first image to obtain the position of the portrait area in the first image. Then, for example, the pixel points in the first image located within the portrait area can be determined as the target pixel points.

[0175] Among them, for the steps of converting the first image in YUV format to the first image in RGB format introduced above, and the steps of performing face detection or portrait detection on the first image introduced in this embodiment, the execution order of these two steps can be adjusted according to actual needs, and this embodiment does not limit this.

[0176] Alternatively, the target intensity parameter in this embodiment can also be used to represent the intensity of the negative effect of the overall image. Therefore, each pixel point in the first image can also be determined as the target pixel point.

[0177] Therefore, in the actual implementation process, for which area in the first image to measure the intensity of the negative effect, the pixel points in this area are determined as the target pixel points in this embodiment. Then, in this embodiment, the target pixel points can also be defined as the pixel points in the target area within the first image, where the target area is the area that needs to measure the negative effect, or in other words, the target intensity parameter of the first image is used to represent the intensity of the negative effect of the target area.

[0178] After clarifying the concept of the target pixel points, in order to improve the processing efficiency and data validity, for example, the target pixel points can also be filtered.

[0179] Exemplarily, for any one target pixel point, the exposure parameter of the target pixel point can be compared with a preset exposure threshold. If the exposure parameter is greater than the preset exposure threshold, it can be determined that the target pixel point is overexposed. Among them, the overexposed target pixel points are over-white in the picture, and it doesn't make much sense to process this type of target pixel points. Therefore, the overexposed target pixel points can be filtered out to reduce the subsequent data processing volume.

[0180] 2. Determine the saturation corresponding to each target pixel point according to the pixel values of each target pixel point in the first image.

[0181] It should be noted that the above-introduced step of filtering the target pixel points is optional. Whether to filter the target pixel points depends on actual needs. Even if the step of filtering the target pixel points is not executed, it does not affect the subsequent execution of this solution.

[0182] If the target pixel points are filtered, then the subsequent data processing is performed based on all the target pixel points. If the target pixel points are filtered, then the subsequent data processing can be performed based on the filtered target pixel points.

[0183] For example, it can be understood with reference to Figure 9 for the subsequent processing, in Figure 9Sixteen pixel points are schematically shown, for example, these sixteen pixel points are all target pixel points in the first image. As Figure 9 shown, in this embodiment, the saturation corresponding to each target pixel point can be determined according to the pixel values of the respective target pixel points in the first image.

[0184] Among them, the first image can be an image in RBG format. Therefore, for each target pixel point, its pixel value includes an R value, a G value, and a B value. In the process of determining the saturation of the target pixel point, the maximum value and the minimum value of the pixel value of each target pixel point can be determined respectively.

[0185] Exemplarily, for any target pixel point, the maximum value among its R value, G value, and B value can be determined as the maximum value of the pixel value, where the maximum value of the pixel value can be expressed as, for example, maxValue = MAX3(R, G, B), and MAX3(R, G, B) means taking the maximum value among the R value, G value, and B value of the target pixel point.

[0186] And, for any target pixel point, the minimum value among its R value, G value, and B value can be determined as the minimum value of the pixel value, where the minimum value of the pixel value can be expressed as, for example, minValue = MIN3(R, G, B), and MIN3(R, G, B) means taking the minimum value among the R value, G value, and B value of the target pixel point.

[0187] For example, further understanding can be made with reference to Figure 10 As Figure 10 shown, it is assumed that sixteen target pixel points of the first image are shown, and one square represents one target pixel point. It is assumed that the pixel value of the first target pixel point among them is Figure 6 as shown in (12, 65, 144). Specifically, the R value is 12, the G value is 65, and the B value is 144. Then, for this target pixel point, the maximum value of its pixel value can be determined as 144, and the minimum value of the pixel value can be determined as 12.

[0188] For any target pixel point, after determining the maximum value and the minimum value of the pixel value, the saturation of the target pixel point can be determined according to the maximum value and the minimum value here.

[0189] Exemplarily, the difference between the maximum value maxValue and the minimum value minValue of the pixel value can be determined first, and then the ratio of the determined difference to the maximum value of the pixel value can be determined as the saturation.

[0190] For example, it can be expressed as the following formula (1):

[0191] Saturation = (maxValue - minValue) / maxValue, Formula 1

[0192] Among them, Saturation represents the saturation of the target pixel. In the actual implementation process, the implementation method for determining saturation is not limited to Formula 1 introduced above. Equivalent transformation can be performed on the basis of Formula 1 above, or corresponding parameters can be added on the basis of Formula 1 above, and the same purpose can also be achieved.

[0193] In addition, the implementation of determining the saturation of the pixel is not limited to the method introduced above. Any method for determining saturation can be referred to to execute the current step, and this embodiment does not limit this.

[0194] 3. For any target pixel, determine the single-pixel intensity parameter of the target pixel according to the saturation of the target pixel and the pixel value of the target pixel.

[0195] In one implementation, after determining the saturation of the target pixel and the pixel value of the target pixel, the single-pixel intensity parameter of each target pixel can be determined first according to the saturation and the pixel value, where the single-pixel intensity parameter is used to indicate the intensity of the negative effect corresponding to a single target pixel.

[0196] Through a large amount of data research by the inventor, it is found that the lower the saturation of the image, the more obvious the negative effect presented by the image, or the stronger the effect of the negative effect. For example, the degree of blurriness and / or whiteness shown in the image is more serious. In addition, the smaller the pixel value of a single pixel in the image, the more obvious the effect of the negative effect presented by the image, or the stronger the effect of the negative effect. For example, the degree of blurriness and / or whiteness shown in the image is more serious.

[0197] In fact, through logical reasoning, it can also be found that when the saturation of the image is lower and the pixel value of the pixel in the image is smaller, the degree of negative effects such as blurriness and whiteness presented by the image is naturally more obvious.

[0198] The pixel value of a single pixel introduced here can be the maximum value of the three pixel values of the R value, G value, and B value of the pixel, or it can also be the average value of the three pixel values of the pixel, or it can also be the minimum value, etc. This embodiment does not limit this. The following will be described by taking the maximum value as an example.

[0199] Then it can be summarized as the following rule: The intensity of the negative effect presented by the image is in a direct proportional relationship with the maximum value of the pixel values of each pixel in the image, and the intensity of the negative effect presented by the image is in an inverse proportional relationship with the saturation of the image.

[0200] Furthermore, for a single pixel, the single-pixel intensity parameter is inversely proportional to the saturation of the target pixel; and the single-pixel intensity parameter is directly proportional to the maximum value of the pixel value of the target pixel.

[0201] For example, according to the proportional relationships introduced here, the single-pixel intensity parameter of the target pixel can be determined based on the saturation of the target pixel and the maximum value of the pixel value of the target pixel.

[0202] Exemplarily, the ratio of the maximum value of the pixel value of the target pixel to the first value can be determined as the target ratio, where the first value is the maximum value of the pixel value. For example, when the value range of the pixel value is 0 to 255, the first value is 255.

[0203] The reason for taking the ratio of the maximum value of the pixel value and the first value to obtain the target ratio and then using the target ratio to participate in subsequent calculations is that the maximum value of the pixel value is usually a relatively large value compared to the saturation. In order to avoid the large value of the maximum value of the pixel value having a large impact on the calculation result of the intensity parameter, resulting in the impact of the saturation on the calculation result of the intensity parameter being completely overridden, it is necessary to adjust the maximum value of the pixel value to a suitable range before performing subsequent calculations.

[0204] After that, for example, the difference between the ratio and the saturation can be determined as the single-pixel intensity parameter of the target pixel. The above calculation process can be expressed as the following formula two, for example:

[0205] Hp = maxValue / 255 – Saturation Formula Two

[0206] Where Hp represents the single-pixel intensity parameter of a single target pixel. In the actual implementation process, the implementation method for determining the single-pixel intensity parameter of a single target pixel is not limited to Formula Two introduced above. Equivalent deformations can be performed on the basis of Formula Two, or corresponding parameters can be added on the basis of Formula Two, and the same purpose can also be achieved.

[0207] Or, as long as it is ensured that the single-pixel intensity parameter is directly proportional to the maximum value of the pixel value and the single-pixel intensity parameter is inversely proportional to the saturation, any possible formula can be extended on this basis.

[0208] 4. Determine the target intensity parameter of the first image according to the single-pixel intensity parameters corresponding to each target pixel.

[0209] In a possible implementation manner, for example, the average value of the single-pixel intensity parameters Hp corresponding to each target pixel can be determined as the target intensity parameter of the first image. For example, H can be used to represent the target intensity parameter of the first image.

[0210] In the actual implementation process, in addition to determining the target intensity parameter of the first image by the method of calculating the average as introduced above, for example, the target intensity parameter of the first image can also be determined by calculating the median, calculating the mode, etc.

[0211] After that, for example, the target intensity parameter of the first image introduced above can be multiplied by 100 to normalize the target intensity parameter of the first image to the preset range of 0-100, which is convenient for subsequent processing. Or, it can be normalized to any required preset range according to actual needs, and this embodiment does not limit this.

[0212] In this embodiment, for each target pixel point in the first image, the saturation of the target pixel point is first determined according to its pixel value, and then the single-pixel intensity parameter of each target pixel point is determined according to the saturation of the target pixel point and the maximum value of the pixel value of the target pixel point. Since it starts from the perspective of saturation and the perspective of pixel value to determine the single-pixel intensity parameter of each target pixel point, referring to the influence of saturation and pixel value on the manifestation degree of negative effects introduced above, the single-pixel intensity parameter can effectively measure the negative effect corresponding to a single pixel. Then, the target intensity parameter of the first image is determined according to the single-pixel intensity parameters of each target pixel point, so that the target intensity parameter that can be used to intuitively reflect the manifestation degree of the negative effect of the first image can be obtained.

[0213] The above embodiment introduces the implementation of first determining the single-pixel intensity parameter corresponding to each target pixel point, and then determining the target intensity parameter of the first image according to the single-pixel intensity parameters of each target pixel point. In another implementation manner, for example, the average maximum value corresponding to the first image can also be determined according to the maximum value of the pixel values of each target pixel point. And the average saturation corresponding to the first image is determined according to the saturation of each target pixel point. Then, according to the average maximum value and the average saturation, analogous to formula two introduced above, the target intensity parameter of the first image is directly obtained, and the effect is similar.

[0214] After determining the target intensity parameter based on the first image, the contrast of the second image can be adjusted according to the target intensity parameter. First, as can be understood from the above Figure 8 introduction, contrast adjustment is a processing step that already exists before the camera application outputs an image. That is to say, regardless of whether the second image needs to be specially processed to eliminate negative effects, it has to go through contrast adjustment.

[0215] The difference is that if no special processing for negative effects is required for the second image, then only the contrast of the second image needs to be adjusted according to the preset initial contrast parameter. The contrast parameter in this embodiment is a parameter for adjusting the image contrast. Moreover, the initial contrast parameter is preset. If the contrast is adjusted according to the initial contrast parameter, then the same contrast adjustment is performed for any image.

[0216] However, if special processing for negative effects is required for the second image, adjusting the contrast according to the initial contrast parameter cannot achieve the purpose of eliminating or alleviating the negative effects. Therefore, it is necessary to first update the initial contrast parameter, and then perform the contrast adjustment for the second image according to the updated contrast parameter.

[0217] Therefore, it is necessary to measure whether special processing for negative effects needs to be performed on the second image during the contrast adjustment stage. In this embodiment, the larger the target intensity parameter of the first image, the more obvious the manifestation of the negative effect in the first image. Since the first image and the second image are images collected in the same shooting scene and the collection times are very close, the target intensity parameter of the first image can be used to measure whether special processing for negative effects needs to be performed on the second image.

[0218] Exemplarily, a preset intensity threshold Hs can be set for the target intensity parameter, and then the target intensity parameter H of the first image can be compared with the preset intensity threshold Hs.

[0219] If the target intensity parameter H of the first image is less than the preset intensity threshold Hs, it can be determined that the manifestation of the negative effect in the first image is not very obvious. Correspondingly, it can be deduced that the manifestation of the negative effect in the second image is not very obvious either. Therefore, no special processing for negative effects needs to be performed on the second image, and the contrast of the second image can be directly adjusted according to the initial contrast parameter.

[0220] Or, if the target intensity parameter H of the first image is greater than or equal to the preset intensity threshold Hs, it can be determined that the manifestation of the negative effect in the first image is relatively obvious. Correspondingly, it can be deduced that the manifestation of the negative effect in the second image is also relatively obvious. Therefore, special processing for negative effects needs to be performed on the second image. Therefore, it is necessary to update the initial contrast parameter, and then perform the subsequent contrast adjustment processing on the second image according to the updated contrast parameter (referred to as the target contrast parameter in this embodiment).

[0221] The implementation method of adjusting the initial contrast parameter will be introduced below. In this embodiment, for example, an initial contrast parameter can be preset, and an adjustment step I can also be preset and adjusted, where I is a value greater than or equal to 0, and the adjustment step is used as the step for updating the initial contrast parameter. Therefore, the initial contrast parameter can be updated according to the adjustment step to obtain the target contrast parameter.

[0222] In one implementation method, for example, the difference between the target intensity parameter and the preset intensity threshold can be determined to measure how much the target intensity parameter specifically exceeds the preset intensity threshold. Then, according to the difference between the target intensity parameter and the preset intensity threshold and the adjustment step, the adjustment value of the contrast parameter is determined. Exemplarily, for example, the product of the difference and the adjustment step introduced here can be determined as the adjustment value of the contrast parameter.

[0223] Then, for example, the sum of the adjustment value of the contrast parameter and the initial contrast parameter can be determined as the target contrast parameter.

[0224] Exemplarily, for example, the adjustment of the contrast parameter can be referred to the following formula three:

[0225] CSVR = CSV + I×(H - Hs) Formula Three

[0226] Where CSVR is the adjusted target contrast parameter, CSV is the initial contrast parameter (which can be a preset value), I is the adjustment step of the contrast parameter, H is the target intensity parameter of the first image, and Hs is the preset intensity threshold. In the actual implementation process, the implementation method of adjusting the contrast parameter is not limited to the above-mentioned formula three. Equivalent deformation can be carried out on the basis of the above formula three, or corresponding parameters can be added on the basis of the above formula three, and the same purpose can also be achieved.

[0227] After determining the adjusted target contrast parameter, the contrast of the second image can be adjusted according to the target contrast parameter, so as to output a second image with good contrast, so as to alleviate or eliminate the negative effects in the second image.

[0228] Exemplarily, the contrast parameter introduced above can be, for example, a parameter of local tone mapping (LTM, Local Tone Mapping) or global tone mapping (GTM, Global Tone Mapping). Then, based on the adjusted target LTM parameter or target GTM parameter, the contrast adjustment of the second image is performed, so as to output the second image after contrast adjustment, that is, the output image of the camera application in response to the user operation introduced above, so as to ensure that the negative effects in the output image can be effectively alleviated or eliminated.

[0229] Since the technical solution of the present application is to determine the target contrast parameter based on the target intensity parameter used to specifically measure the negative effect of the image.

[0230] Among them, when the target intensity parameter indicates that the negative effect of the image is not obvious, the preset initial contrast parameter is directly determined as the target contrast parameter. That is to say, there is no need to perform the remaining additional contrast adjustments, and just adjust according to the preset method to ensure that the contrast performance of the final output image is good. It can be understood that when the negative effect in the image is not obvious, or there is no negative effect introduced in this embodiment in the image, if additional contrast adjustments are still made specifically for the negative effect, then there will be a situation of "overcorrecting", which will instead lead to poor contrast performance in the image.

[0231] Then the accuracy of measuring whether to perform special processing for the negative effect is very important. The multiple parameters currently used introduced above are not directly parameters for measuring the negative effect. Therefore, based on those parameters to measure whether to perform special processing for the negative effect, it is inevitable that there will be the overcorrecting situation introduced above. However, the target intensity parameter in the present application is specifically used to characterize the manifestation degree of the negative effect in the image. Therefore, when the target intensity parameter indicates that the negative effect is not obvious, the initial contrast parameter can be directly determined as the target contrast parameter to ensure that the output image of the camera application always has good contrast performance.

[0232] And when the target intensity parameter indicates that the negative effect of the image is relatively obvious, the initial contrast parameter is updated according to the target intensity parameter, the preset intensity threshold, and the adjustment step for setting the contrast parameter to obtain the target contrast parameter, so as to ensure that the contrast adjustment of the second image according to the target contrast parameter can effectively eliminate the negative effect, and also ensure that the output image of the camera application always has good contrast performance.

[0233] Therefore, the technical solution of the present application is based on the target intensity specifically used to measure the negative effect to determine the target contrast parameter for adjusting the image contrast, which can effectively ensure that for the second images obtained under various shooting environments, when the output images are obtained after performing contrast adjustment, the output images always have a good contrast effect.

[0234] Based on the above introduction, the following will further describe Figure 11 the execution steps of the image adjustment method provided by the present application. Figure 11 It is a schematic flowchart of the image adjustment method provided by the embodiment of the present application.

[0235] As Figure 11 shown, the method includes:

[0236] S1101. Determine the saturation corresponding to each target pixel point according to the pixel value of each target pixel point in the first image.

[0237] S1102. Determine the target intensity parameter of the negative effect corresponding to the first image according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point. The negative effect is caused by the contrast of the first image.

[0238] S1103. Determine the target contrast parameter according to the target intensity parameter and the preset intensity threshold.

[0239] S1104. Adjust the contrast of the second image according to the target contrast parameter.

[0240] In this embodiment, the saturation can be determined for each target pixel point, and then the target intensity parameter corresponding to the first image can be determined according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point. The target intensity parameter is used to indicate the manifestation degree of the negative effect of the first image.

[0241] Referring to the above embodiments, it can be introduced that, in one implementation manner, the single-pixel intensity parameter corresponding to each target pixel point can be first determined according to the saturation and pixel value of each target pixel point, and then the target intensity parameter corresponding to the first image can be uniformly determined according to the single-pixel intensity parameter corresponding to each pixel point.

[0242] Alternatively, the saturation corresponding to the first image can be first determined according to the saturation of each target pixel point, and the pixel value corresponding to the first image can be determined according to the pixel value of each target pixel point. Then, the target intensity parameter corresponding to the first image can be determined according to the saturation and pixel value corresponding to the first image.

[0243] After determining the target intensity parameter, the target contrast parameter can be first determined according to the target intensity parameter and the preset intensity threshold, and then the contrast of the second image can be adjusted according to the target contrast parameter to ensure that the contrast of the output image finally output by the camera application is always well presented, and the negative effect caused by the low contrast introduced above is avoided.

[0244] It should be noted that the module names involved in the embodiments of the present application can all be defined as other names, as long as the functions of each module can be realized, and no specific restrictions are imposed on the module names.

[0245] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data that have been authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.

[0246] The image adjustment method of the embodiments of this application has been described above. Next, the device for executing the above method provided by the embodiments of this application will be described. Those skilled in the art can understand that the method and the device can be combined and cited with each other. The relevant device provided by the embodiments of this application can execute the steps in the above image adjustment method.

[0247] The image adjustment method provided by the embodiments of this application can be applied to an electronic device with image photographing and data processing functions. The electronic device includes a terminal device. The specific device form of the terminal device and the like can refer to the above relevant description and will not be elaborated here.

[0248] The embodiments of this application provide a terminal device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.

[0249] The embodiments of this application provide a chip. The chip includes a processor, and the processor is used to call a computer program in the memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those of the above relevant embodiments and will not be elaborated here.

[0250] The embodiments of this application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above method is implemented. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. The computer-readable medium can include a computer storage medium and a communication medium, and can also include any medium that can transmit a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0251] In one possible implementation, the computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM), or other optical disc storage, magnetic disk storage, or any other medium that is targeted to carry or store the program code required in the form of instructions or data structures and is accessible by a computer. Moreover, any connection is properly termed a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of the medium. As used herein, disk and optical disc include optical disc, laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk, and Blu-ray disc, where disks typically reproduce data magnetically, while optical discs utilize lasers to optically reproduce data. Combinations of the above should also be included within the scope of computer-readable media.

[0252] An embodiment of the present application provides a computer program product. The computer program product includes a computer program that, when run, causes a computer to execute the above method.

[0253] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to generate a machine, such that the instructions executed by the processing unit of the computer or other programmable data processing device generate means for implementing the functions specified in Figure 1 one or more of the flows or Figure 1 one or more of the blocks.

[0254] The above specific implementation manners further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are only specific implementation manners of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included within the protection scope of the present invention.

Claims

1. An image adjustment method, characterized in that, comprising: Determining the saturation corresponding to each target pixel point in the first image according to the pixel values of the respective target pixel points; Determining the target intensity parameter of the negative effect corresponding to the first image according to the saturation corresponding to each target pixel point and the pixel values of the respective target pixel points, where the negative effect is caused by the contrast of the first image; Determining a target contrast parameter according to the target intensity parameter and a preset intensity threshold; Adjusting the contrast of the second image according to the target contrast parameter.

2. The method according to claim 1, characterized in that, The step of determining the target intensity parameter of the negative effect corresponding to the first image according to the saturation corresponding to each target pixel point and the pixel values of the respective target pixel points includes: For any one of the target pixel points, determining the single-pixel intensity parameter corresponding to the target pixel point according to the saturation of the target pixel point and the pixel value of the target pixel point; Determining the target intensity parameter of the negative effect corresponding to the first image according to the single-pixel intensity parameters corresponding to the respective target pixel points.

3. The method according to claim 2, characterized in that, The step of determining the target intensity parameter of the negative effect corresponding to the first image according to the single-pixel intensity parameters corresponding to the respective target pixel points includes: Taking the average value of the single-pixel intensity parameters corresponding to the respective target pixel points as the target intensity parameter of the negative effect corresponding to the first image.

4. The method according to claim 2 or 3, characterized in that, The single-pixel intensity parameter is inversely proportional to the saturation of the target pixel point; and, The single-pixel intensity parameter is directly proportional to the maximum value of the pixel value of the target pixel point.

5. The method according to any one of claims 2-4, characterized in that, The step of determining the single-pixel intensity parameter corresponding to the target pixel point according to the saturation of the target pixel point and the pixel value of the target pixel point includes: Determining a target ratio according to the ratio of the maximum value of the pixel value of the target pixel point to a first value, where the first value is the maximum value of the pixel value; Determining the single-pixel intensity parameter corresponding to the target pixel point according to the difference between the target ratio and the saturation of the target pixel point.

6. The method according to any one of claims 1-5, characterized in that, After determining the target intensity parameter of the negative effect corresponding to the first image according to the saturation corresponding to each target pixel point and the pixel values of the respective target pixel points, the method further includes: Performing a normalization process on the target intensity parameter to adjust the target intensity parameter to a value within a preset range.

7. The method according to any one of claims 1-6, characterized in that, The step of determining a target contrast parameter according to the target intensity parameter and a preset intensity threshold includes: Obtaining an initial contrast parameter and an adjustment step; If the target intensity parameter is greater than or equal to the preset intensity threshold, then determine the initial contrast parameter as the target contrast parameter; or, If the target intensity parameter is less than the preset intensity threshold, then adjust the initial contrast parameter according to the adjustment step to obtain the target contrast parameter.

8. The method according to claim 7, wherein, The adjusting the initial contrast parameter according to the adjustment step to obtain the target contrast parameter includes: Determine the difference between the target intensity parameter and the preset intensity threshold; Determine an adjustment value according to the difference and the adjustment step; Determine the sum of the initial contrast parameter and the adjustment value as the target contrast parameter.

9. The method according to any one of claims 1-8, wherein, The generation time of the second image is later than the generation time of the first image.

10. The method according to any one of claims 1-9, wherein, The first image is one of multiple preview images collected by a camera application; Or, the first image is one of multiple captured images, and the multiple captured images are captured by the camera application in response to a user operation on a photographing control.

11. The method according to claim 10, wherein, The second image is an image obtained by fusing the multiple captured images.

12. The method according to any one of claims 1-11, wherein, The method further includes: Perform face detection on the first image, and determine a face frame area in the first image; Determine the pixel points within the face frame area in the first image as the target pixel points.

13. An electronic device, wherein, including: A processor and a memory; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory, so that the electronic device executes the method according to any one of claims 1-12.

14. A computer-readable storage medium, the computer-readable storage medium stores a computer program, wherein, The computer program, when executed by a processor, implements the method according to any one of claims 1-12.

15. A chip system, wherein, including at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is configured to run a computer program or instruction to execute the method according to any one of claims 1-12.

16. A computer program product, wherein, including a computer program, when the computer program is run, it causes a computer to execute the method according to any one of claims 1-12.

Citation Information

Patent Citations

  • Video stream contrast regulation method

    CN102238315A

  • Video image processing method, device and equipment

    CN102780889A

  • Image processing method and system

    CN104715445A

  • Image processing method and mobile terminal

    CN105323459A

  • Method and apparatus for improving image quality

    CN105513019A