Image adjustment method and electronic device
By calculating the saturation and pixel value of the target pixels in the image, the intensity parameter of the negative effect is determined, and the contrast parameter is adjusted. This solves the problem of low contrast in backlight shooting and improves the contrast and clarity of the image, especially the effect on portraits.
Patent Information
- Application Number
- CN202311739678.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2023-11-23
- Filing Date
- 2023-12-15
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-12-15
AI Technical Summary
In backlit shooting scenarios, the image contrast is low, resulting in poor image quality, especially in portraits where the image appears blurry and washed out.
By determining the saturation and pixel value of each target pixel in the image, the target intensity parameter of the negative effect is calculated, and the contrast parameter is adjusted according to the preset intensity threshold to dynamically adjust the contrast of the image in order to eliminate or alleviate the negative effect.
It effectively improves the contrast performance of images in backlit shooting scenarios, ensuring the clarity and color richness of portraits and the overall image, avoiding unnecessary contrast adjustments, and saving power consumption of terminal devices.
Smart Images

Figure CN120070277B_ABST
Abstract
Description
[0001] The present application claims priority to the Chinese patent application No. 202311582005.5, filed on November 23, 2023, and entitled "Image adjustment method and terminal device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the technical field of terminal devices, and in particular to an image adjustment method and an electronic device. BACKGROUND
[0003] With the continuous development of terminal device technology, the current terminal devices usually have the function of image shooting.
[0004] In daily life, there is a scenario of image shooting, which is backlit shooting. Backlight shooting is a condition in which the main subject is just between the light source and the lens. When backlit shooting, the light in the picture is bright, which may reduce the contrast of the picture, resulting in poor shooting effect. SUMMARY
[0005] The embodiments of the present application provide an image adjustment method and an electronic device, which are applied to the technical field of terminal devices to ensure that the images output by the camera application program have good contrast in various scenarios.
[0006] In a first aspect, the embodiments of the present application provide an image adjustment method. The method comprises:
[0007] According to the pixel values of the target pixel points in the first image, the saturation of each target pixel point is determined;
[0008] According to the saturation of each target pixel point and the pixel value of each target pixel point, a target intensity parameter of a negative effect corresponding to the first image is determined, the negative effect being caused by the contrast of the first image;
[0009] According to the target intensity parameter and a preset intensity threshold, a target contrast parameter is determined;
[0010] According to the target contrast parameter, the contrast of the second image is adjusted.
[0011] In this implementation, the target intensity parameter of the first image is determined according to the saturation and the pixel value of the target pixel point in the first image, where the target intensity parameter can represent the performance effect of the negative effect in the first image, and 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 the contrast adjustment of the second image can be effectively ensured to be accurate and meet 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 scenes.
[0012] In a possible implementation, the target intensity parameter of the negative effect corresponding to the first image is determined according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point, including:
[0013] For any target pixel point, a single-pixel intensity parameter corresponding to the target pixel point is determined according to the saturation of the target pixel point and the pixel value of the target pixel point.
[0014] The target intensity parameter of the negative effect corresponding to the first image is determined according to the single-pixel intensity parameter corresponding to each target pixel point.
[0015] In this implementation, the single-pixel intensity parameter corresponding to each pixel point is first determined, and then the target intensity parameter of the first image is determined based on the single-pixel intensity parameter, so that the effective and accurate determination of the target intensity parameter of the first image can be realized in steps.
[0016] In a possible implementation, the target intensity parameter of the negative effect corresponding to the first image is determined according to the single-pixel intensity parameter corresponding to each target pixel point, including:
[0017] The average value of the single-pixel intensity parameter corresponding to each target pixel point is determined as the target intensity parameter of the negative effect corresponding to the first image.
[0018] In a possible implementation, the single-pixel intensity parameter and the saturation of the target pixel point are in inverse proportion, and
[0019] The single-pixel intensity parameter and the maximum value of the pixel value of the target pixel point are in direct proportion.
[0020] In this implementation, by setting the proportional relationship between the single-pixel intensity parameter and 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, the single-pixel intensity parameter corresponding to the target pixel point is determined according to the saturation of the target pixel point and the pixel value of the target pixel point, including:
[0022] A target ratio is determined according to a ratio of the maximum value of the pixel value of the target pixel point to a first value, and the first value is the maximum value of the pixel value.
[0023] The single-pixel intensity parameter corresponding to the target pixel point is determined according to a difference between the target ratio and the saturation of the target pixel point.
[0024] In this implementation, the single-pixel intensity parameter is determined according to the above steps, so that the single-pixel intensity parameter corresponding to each pixel point can be quickly and accurately obtained on the basis of satisfying the proportional relationship between the single-pixel intensity parameter and the corresponding parameter as described above.
[0025] In a possible implementation, after the target intensity parameter of the negative effect corresponding to the first image is determined according to the saturation corresponding to each target pixel point and the pixel value of each target pixel point, the method further includes:
[0026] The target intensity parameter is normalized to adjust the target intensity parameter to a value in a preset range.
[0027] In this way, the data range in which the target intensity parameter is located can be uniformly processed, and then it is ensured that the same standard can be used to measure the size of the target intensity parameter regardless of which image is used.
[0028] In a possible implementation, the target contrast parameter is determined according to the target intensity parameter and a preset intensity threshold, including:
[0029] An initial contrast parameter and an adjustment step are obtained.
[0030] If the target intensity parameter is greater than or equal to the preset intensity threshold, the initial contrast parameter is determined as the target contrast parameter; or,
[0031] If the target intensity parameter is less than the preset intensity threshold, the initial contrast parameter is adjusted according to the adjustment step to obtain the target contrast parameter.
[0032] In a possible implementation, the initial contrast parameter is adjusted according to the adjustment step to obtain the target contrast parameter, including:
[0033] A difference between the target intensity parameter and the preset intensity threshold is determined.
[0034] An adjustment value is determined according to the difference and the adjustment step.
[0035] The sum of the initial contrast parameter and the adjustment value is determined as a 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, and then the contrast of the second image is adjusted according to the adjusted target contrast parameter, so that the negative effect of the second image caused by the low contrast can be targetedly eliminated or alleviated. Meanwhile, 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, so that the problem of poor contrast performance caused by additional contrast adjustment of the second image when the negative effect does not need to be adjusted is avoided.
[0037] In a possible implementation, the second image is generated later than the first image.
[0038] For example, the first image is one of a plurality of preview images collected by a camera application; or the first image is one of a plurality of collected images, and the plurality of collected images are collected by the camera application in response to a user operation on a photographing control.
[0039] For another example, the second image is an image fused from the plurality of collected images.
[0040] In this implementation, by setting the specific selection of the first image and the second image, it is ensured that the processing of eliminating the negative effect is performed on the output image finally output by the camera application. Moreover, it is ensured that the determined target intensity parameter can be effectively applied in the contrast adjustment stage of the second image, so that the ordered and effective execution of the contrast adjustment is ensured.
[0041] In a possible implementation, the method further includes:
[0042] Performing face detection on the first image to determine a face frame region in the first image;
[0043] Determining, as target pixel points, pixel points in the face frame region in the first image.
[0044] In this implementation, the target intensity parameter can be determined based on the pixel points in the face region, so that the performance degree of the negative effect of the face region is targetedly measured. When the performance degree of the negative effect of the face region is relatively serious, special processing of the negative effect is performed, so that the targetedness and necessity of the contrast adjustment can be improved to a certain extent. In other words, for an image in which the negative effect of the face region is not obvious, special processing of the negative effect can not be performed, so that 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 apparatus. The image adjustment apparatus can be an electronic device, or a chip or chip system in the electronic device. The image adjustment apparatus can include a display unit and a processing unit. When the image adjustment apparatus is an electronic device, the display unit can be a display screen. The display unit is configured to perform the displaying, so that the electronic device implements an image adjustment method described in the first aspect or any possible implementation of the first aspect. When the image adjustment apparatus is an electronic device, the processing unit can be a processor. The image adjustment apparatus can further include a storage unit, which can be a memory. The storage unit is configured to store instructions, and the processing unit is configured to execute the instructions stored in the storage unit, so that the electronic device implements an image adjustment method described in the first aspect or any possible implementation of the first aspect. When the image adjustment apparatus is a chip or chip system in the electronic device, the processing unit can be a processor. The processing unit is configured to execute the instructions stored in the storage unit, so that the electronic device implements an image adjustment method described in the first aspect or any possible implementation of the first aspect. The storage unit can be a storage unit (e.g., a register, a cache, etc.) in the chip, or a storage unit (e.g., a read-only memory, a random access memory, etc.) in the electronic device and located outside the chip.
[0046] In a third aspect, an embodiment of the present application provides an electronic device. The electronic device includes a processor and a memory. The memory is configured to store code instructions, and the processor is configured to execute the code instructions to perform the method described in the first aspect or any possible implementation of the first aspect.
[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program or instructions. When the computer program or instructions are executed on a computer, the computer is caused to perform the method described in the first aspect or any possible implementation 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 executed on a computer, the computer is caused to perform the method described in the first aspect or any possible implementation of the first aspect.
[0049] In a sixth aspect, an embodiment of the present application provides a chip or chip system. The chip or chip system includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected through a line. The at least one processor is configured to execute a computer program or instructions to perform the method described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, a pin, or a circuit, etc.
[0050] In a possible implementation, the chip or the chip system described above in the present application further includes at least one memory in which instructions are stored. The memory can be a storage unit inside the chip, for example, a register, a cache, etc., or a storage unit of the chip (for example, a read-only memory, a random access memory, etc.).
[0051] It should be understood that the second aspect to the sixth aspect of the present application correspond to the technical solution of the first aspect of the present application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manner are similar, which will not be repeated. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 Effect diagram of contrast provided by the embodiment of the present application;
[0053] Figure 2 Scene diagram of image shooting provided by the embodiment of the present application;
[0054] Figure 3 Negative effect diagram provided by the embodiment of the present application Figure 1 ;
[0055] Figure 4 Negative effect diagram provided by the embodiment of the present application Figure 2 ;
[0056] Figure 5 Hardware structure diagram of a terminal device provided by the embodiment of the present application;
[0057] Figure 6 Software structure diagram of a terminal device provided by the embodiment of the present application;
[0058] Figure 7 Image selection diagram provided by the embodiment of the present application;
[0059] Figure 8 Processing process diagram of image fusion provided by the embodiment of the present application;
[0060] Figure 9 Flow diagram of the image adjustment method provided by the embodiment of the present application Figure 1 ;
[0061] Figure 10 Target pixel point diagram of the first image provided by the present application;
[0062] Figure 11 Flow diagram of the image adjustment method provided by the embodiment of the present application. DETAILED DESCRIPTION
[0063] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:
[0064] 1. Contrast
[0065] Image contrast can be understood as the degree of difference in brightness between bright and dark areas in an image. If there is a significant difference between the bright and dark areas of an image, then the image has high contrast. Conversely, if the difference between the bright and dark areas is small, then the contrast is low. In image processing, contrast can affect the sharpness and visual effect of an image.
[0066] If the contrast is high enough, the more gradations from black to white there will be in the image, resulting in richer and clearer details and colors. For example, increasing the contrast of an image can make bright areas brighter and dark areas darker.
[0067] Low contrast means that the difference between bright and dark areas in an image is smaller, resulting in fewer gradations from black to white. Consequently, details and colors in the image become harder to discern. Specifically, when an image has low contrast, the fewer gradations from black to white result in a hazy, grayish appearance, making details difficult to identify.
[0068] For example, you can refer to Figure 1 Understanding the impact of contrast on images Figure 1 This is a schematic diagram illustrating the contrast effect provided in an embodiment of this application.
[0069] like Figure 1 As shown, for the same image, if the image has low contrast, it will appear... Figure 1 The effect shown in (a) is that the image as a whole appears grayish, and details and colors are difficult to discern.
[0070] However, if the image has high contrast, it will appear... Figure 1 The effect shown in (b) is that the details and colors of the image will be more rich and clear.
[0071] Understandable Figure 1 The "high" and "low" contrast ratios described herein are for... Figure 1 The two images provided serve as references to each other.
[0072] 2. Saturation
[0073] Saturation refers to the degree of color vividness, which can also be referred to as purity. The higher the saturation of an image, the more vivid the colors presented by the image.
[0074] 3. HDR fusion
[0075] The HDR (high dynamic range) fusion algorithm is an image processing technology for improving color and detail problems caused by non-uniform brightness of an image. The HDR fusion algorithm fuses a high dynamic range image from multiple images with different brightness, thereby improving the color of the image and enhancing the details of the image. The HDR fusion algorithm is a very effective image enhancement technology.
[0076] The HDR fusion algorithm uses multiple photos with different brightness as original images. Each of the images can be represented by pixel grayscale values, thereby constructing an image with a wider range, so as to have stronger contrast and more grayscale values and details, and also to have more scale transformation space. The image can be made clearer by using image and contrast stretching algorithms. The HDR fusion algorithm can increase the sharpness and dynamic range of the image, thereby achieving brightness enhancement processing of the HDR image.
[0077] 4. Other terms
[0078] In the embodiments of the present application, the same items or similar items with basically the same functions and effects are distinguished by using “first”, “second”, and the like. For example, the first chip and the second chip are merely used to distinguish different chips, and do not limit the sequence. Those skilled in the art can understand that the “first”, “second”, and the like do not limit the quantity and execution sequence, and the “first”, “second”, and the like do not necessarily mean different.
[0079] It should be noted that in the embodiments of the present application, the words “exemplary” or “for example” are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described as “exemplary” or “for example” in the present application should not be interpreted as being more preferred or having more advantages than other embodiments or design schemes. Rather, the words “exemplary” or “for example” are used in the sense of presenting related concepts in a specific manner.
[0080] In the embodiments of this application, “at least one” means one or more, and “multiple” means two or more. “And / or” describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B, which can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character “ / ” generally represents an “or” relationship between the associated objects before and after it. “At least one of the following” or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can represent a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.
[0081] 5. Electronic device
[0082] The electronic device of the embodiments of this application can include handheld devices with image capturing functions, vehicle-mounted devices, etc. For example, some electronic devices are: mobile phones, tablet computers, palm computers, notebook computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication functions, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMNs), etc. The embodiments of this application are not limited thereto.
[0083] As an example but not limitation, in embodiments of the present application, the electronic device can also be a wearable device. The wearable device can also be referred to as a wearable smart device, which is a general term for devices that are designed and developed by applying wearable technology to daily wear, such as glasses, gloves, watches, clothing, and shoes
[0084] The electronic device in embodiments of the present application can also be referred to as a terminal device, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), an access terminal, a subscriber unit, a subscriber station, a mobile station, a mobile terminal, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, a user agent, or a user device, etc.
[0085] In 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 a central processing unit (CPU), a memory management unit (MMU), and a memory (also known as main memory), etc. The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, or windows operating system, etc. The application layer includes 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. For example, a sensor module and a lens can be included in the terminal device to achieve the purpose of image shooting.
[0087] In order to better understand the technical solutions of the present application, the related technologies involved in the present application are further described in detail below.
[0088] When using an electronic device to shoot an image, there is a back light shooting scenario, in which back light is a condition in which the main subject is just between the light source and the lens, for example, please refer to Figure 2 To understand the scenario of back light shooting, Figure 2 The scenario of image shooting in embodiments of the present application is shown in the following figure.
[0089] As Figure 2 When the user shoots an image with a front camera in back light, the main subject 202 can be located between the light source 203 and the lens 201.
[0090] Figure 2 For example, the user uses the front camera to take pictures, and when the user uses the rear camera to take pictures, the above-mentioned situation that the subject is located between the light source and the lens can also occur.
[0091] The above-mentioned back light shooting situation can cause poor contrast performance of the image because the subject is located between the lens and the light source.
[0092] For example, when the sensor module in the terminal device is of poor quality, if image shooting is performed in the above-mentioned back light scene, because the light in the picture is bright, for example, the strong non-imaging light of the sun or other light sources is irradiated to the lens of the lens, which causes the lens to produce glare and halo and the like, and is accompanied by a significant decrease in the contrast of the picture. It needs to be understood that the contrast "decrease" introduced here is compared with the contrast of the image collected by image shooting in a non-back light scene. That is, in general, for the same shooting object, the contrast of the image shot in the back light scene is less than that of the image shot in the non-back light scene.
[0093] Based on the above introduction, it can be understood that when the contrast of the image is low, the image will appear hazy. Then for the image containing a portrait, low contrast will cause the portrait in the picture to appear foggy and white, and the foggy effect can be understood as the appearance of a hazy effect in the portrait part, and the white effect can be understood as the overall color of the portrait part being white.
[0094] However, it needs to be understood that the white here is still the white effect caused by the hazy effect of the image, which can be understood by analogy with the feeling of white environment when observing the surrounding environment in the foggy weather, but in fact it is still the hazy gray effect. Or it can also be referred to Figure 1 It can be understood that, referring to Figure 1 It can be determined that, Figure 1 (a) in the above-mentioned (b) presents a foggy effect (a hazy feeling) and a white feeling (still a gray image caused by the hazy effect). Figure 1
[0095] In one implementation, the negative effect mentioned in this application refers to the effect caused by low image contrast. For example, when the contrast is less than a preset contrast, the image can be considered to have low contrast, and the negative effect appearing in the image at this time is the negative effect described in this application. Alternatively, it can be specifically defined as the image performance effect caused by low image contrast due to the backlighting scene in a backlit shooting scenario.
[0096] In other words, the negative effects described in this application can be understood as effects caused by low image contrast, where "low contrast" can be quantified, for example, as an image contrast being less than a preset contrast. Therefore, any effect appearing in an image due to low image contrast can be considered a negative effect described in this application. Low contrast can be caused by the backlighting scenario described above, or by other reasons; this embodiment does not limit this.
[0097] For example, negative effects may include the image whitening and image blurring described above. This embodiment does not limit the specific negative effects.
[0098] In this application, the negative effects such as blurriness and whiteness in the image can be resolved by adjusting the image contrast.
[0099] In one implementation, the low contrast described above may cause a negative effect on the portrait portion of the image. Therefore, the image contrast can be adjusted to alleviate or eliminate the negative effect on the portrait portion. For example, refer to... Figure 3 Understand how to adjust the negative effects on the human figure portion of an image. Figure 3 Illustration of the negative effects provided in the embodiments of this application Figure 1 .
[0100] Figure 3 (a) in the figure illustrates an image, for reference Figure 3 It is certain that the image may include portraits, and the faces within these portraits may exhibit the aforementioned blurring and whitening negative effects. Figure 3 In (a), this negative effect is represented by shading.
[0101] Therefore, by adjusting the contrast of the image, the negative effects on the face can be eliminated or mitigated to some extent, thus obtaining... Figure 3 The adjusted image shown in (b) shows how negative effects on the face can be eliminated or mitigated.
[0102] The current targeted introduction of contrast reduction caused by the negative effect of the portrait part in the picture, so the above Figure 3 Exemplary for the face part (analogous to the implementation of the portrait part is the same) to eliminate negative effects.
[0103] However, in fact, contrast reduction may cause the overall image to have the negative effects described above, not just the portrait part or the face part. Therefore, in actual implementation, contrast adjustment of the image can also achieve the mitigation or elimination of negative effects for the entire image.
[0104] For example, refer to Figure 4 To understand the implementation of adjusting the negative effects of the entire image, Figure 4 Negative effects of the present application embodiment Figure 2 .
[0105] Figure 4 (a) in the image, refer to Figure 4 It can be determined that the image may include a portrait, but in fact the overall image may have the negative effects of the above-mentioned fogging and whitening, and Figure 4 The negative effects in (a) are represented by shading.
[0106] Then the negative effects in the image can be eliminated or mitigated to a certain extent by adjusting the contrast of the image, so as to obtain the adjusted image shown in (b) of Figure 4 The negative effects of the entire image can be eliminated or mitigated.
[0107] In actual implementation, which part of the image has a negative effect depends on the actual image generation, and the present embodiment does not limit it. In short, the technical solution of the present application can mitigate or eliminate the negative effects caused by too low contrast in the image.
[0108] The following will be further introduced by taking the negative elimination of the portrait part as an example. In order to solve the problem that the portrait part in the image has a negative effect in the above-mentioned backlit shooting scene, thereby causing the image containing the portrait to perform poorly, it is usually necessary to adjust the contrast of the image (the same concept as contrast adjustment) to improve the contrast of the image as much as possible, so as to offset the negative effects described above to a certain extent.
[0109] Currently, in the related art, when the contrast of an image is adjusted, whether the portrait part in the image needs to be adjusted in terms of contrast is usually measured based on the iso (sensitivity), luxindex (brightness index) or adrc_gain (automatic dynamic range compression gain) of the image, and then the image is adjusted in terms of contrast based on these parameters. The adrc in the adrc_gain represents automatic dynamic range compression, and the gain represents gain.
[0110] However, none of the above-mentioned parameters is used to directly measure the degree of the negative effect caused by the low contrast, so that the image is measured based on the above-mentioned parameters to determine whether the image needs to be adjusted in terms of contrast, and then the image is adjusted in terms of contrast based on these parameters, which may result in the situation that the contrast is too low or too high after adjustment in some shooting scenes.
[0111] Therefore, the present application proposes the following technical concept: an intensity parameter for representing the negative effect of the portrait part in the image is proposed, and then the contrast of the portrait part in the image is dynamically adjusted based on the intensity parameter, so that the accuracy of the contrast adjustment can be effectively improved, and a good contrast can be obtained for the portrait in different shooting scenes.
[0112] The technical solution provided by the present application can be applied to a terminal device. First, the terminal device is briefly introduced as follows.
[0113] For example, Figure 5 A hardware structure schematic diagram of a terminal device provided by an embodiment of the present application is shown in FIG. 1.
[0114] The terminal device can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge 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 loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 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] The processor 110 can include one or more processing units. Different processing units can be independent devices or integrated in one or more processors. The processor 110 can also be provided with a memory for storing instructions and data.
[0116] The terminal device can display by the GPU, the display screen 194, and the application processor. 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 can include 1 or N display screens 194, N being a positive integer greater than 1.
[0118] The terminal device can implement camera functions such as shooting and video recording by the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor.
[0119] The camera 193 is used to capture still images or videos. In some embodiments, the terminal device can include 1 or N cameras 193, N being a positive integer greater than 1.
[0120] The ISP is used to process data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing to convert it into an image visible to the naked eye. The ISP can also optimize algorithms for image noise, brightness, and skin color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be provided in the camera 193.
[0121] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the terminal device. In some other embodiments of the present application, the terminal device can also use different interface connection methods or combinations of multiple interface connection methods in the above embodiments.
[0122] The software system of the terminal device described above can use a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiments of the present application take a layered architecture system as an example to illustrate the software structure of the terminal device.
[0123] An example of a software structure of a terminal device provided by an embodiment of the present application is shown in the following table. Figure 6 An example of a software structure of a terminal device provided by an embodiment of the present application is shown in the following table.
[0124] As Figure 6As shown, the layered architecture divides the software into several layers, each with a clear role and function. 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 use the Android system as an example. In other operating systems (such as HarmonyOS, iOS, etc.), as long as the functions implemented by each functional module are similar to those in the embodiments of this application, the solution of this application can also be implemented.
[0126] The application layer can include a series of application packages. For example... Figure 6 As shown, the application package may include applications such as a camera and a gallery. The camera application is used to implement the image capturing function described in this application. Furthermore, after an image is captured, the user can view the captured image in the gallery application.
[0127] The application layer may also include calendar, phone, maps, navigation, email, social networking, wireless local area networks (WLAN), Bluetooth, music, video, SMS, lock screen applications, and settings applications. Of course, the application layer may also include other application packages, such as third-party applications like payment applications, shopping applications, banking applications, and social networking applications; this application does not limit this.
[0128] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. For example, ... Figure 6 As shown, the application framework layer may include a camera access interface. The camera access interface may include camera management and camera devices. Specifically, camera management provides an access interface for managing the camera, and camera devices provide an interface for accessing the camera.
[0129] Furthermore, the application framework layer may also include some predefined functions. For example, it may include an activity manager, window manager, content provider, view system, resource manager, notification manager, and camera server unit, etc., and this application embodiment does not impose any limitations on this. The camera server unit of the application framework layer can be started during the terminal device's boot phase and can be used to transmit and save relevant camera information.
[0130] And, the hardware abstraction layer is used to abstract the hardware, encapsulate the Linux kernel driver, and provide an interface upward, shielding the implementation details of the low-level hardware. For example, the hardware abstraction layer can include Figure 6 The camera hardware abstraction layer, other hardware device abstraction layers, and the camera algorithm library are shown.
[0131] The camera hardware abstraction layer can include a camera device 1, a camera device 2, and the like. The camera hardware abstraction layer can be connected to the camera algorithm library, and the camera hardware abstraction layer can call algorithms in the camera algorithm library.
[0132] The camera algorithm library can include algorithm instructions such as camera algorithms and image algorithms, and perform part of the image processing steps. For example, the first algorithm or the first algorithm set in the camera algorithm library can be included, where the first algorithm or the first algorithm set is used to implement the related processing of the contrast adjustment for the portrait image described in the present application.
[0133] Or it can also be understood that the processing unit is included in the HAL layer, where the processing unit is used to implement the related processing of the contrast adjustment for the portrait image described in the present application.
[0134] And the driver layer is used to provide drivers for different hardware devices. For example, the driver layer can 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 interacting with the hardware module.
[0135] And the hardware layer can 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] In the photographing process, for example, the camera application of the application layer can send an image acquisition instruction to the camera device in the camera access interface in response to a user operation, where the image acquisition includes image acquisition in the preview stage and image acquisition in the shooting stage. Then the camera device issues related instructions to the camera HAL, the camera HAL issues related instructions to the camera device driver, and the camera device driver interacts with the related sensors and processors in the hardware layer to complete the purpose of image shooting.
[0137] After the image acquisition is completed, the collected image is displayed in the camera application program or the gallery application program through the data flow in the opposite direction described above. In the opposite data flow, the collected image can be further processed in part of the hierarchical structure.
[0138] For example, the HAL layer can be configured to further process the captured image. For example, the HAL layer can invoke a first algorithm or a first set of algorithms in a camera algorithm library, and perform the contrast adjustment described in the present disclosure on the captured image in combination with the interaction with the related drivers of the driver layer and the related hardware units of the hardware layer, so that the contrast of the final output image is good.
[0139] Based on the above description, the specific implementation of the contrast adjustment of the image provided in the present disclosure will be described below.
[0140] In the present disclosure, an intensity parameter for characterizing the intensity of the negative effect in the image is provided, so the implementation of the intensity parameter is described first. For example, the intensity parameter in the present disclosure can also be understood as the intensity of the vignetting, which is used to measure the intensity of the vignetting in the portrait area (or the face area) of the image, or can also be used to measure the intensity of the vignetting of the entire image.
[0141] In an implementation manner, the technical solution of the present disclosure is to adjust the contrast of the to-be-displayed image to be output. The to-be-displayed image is the image generated by the camera application in response to the click operation on the shooting button after the user clicks the shooting button. By adjusting the contrast of the to-be-displayed image, the contrast of the output image after the shooting is completed can be guaranteed to be good.
[0142] Then, in order to guarantee that the contrast adjustment of the to-be-displayed image can be implemented, 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 is adjusted according to the intensity parameter, so that the output image after the adjustment can be obtained.
[0143] For example, the to-be-displayed image that needs to be adjusted in contrast can be referred to as a second image in the present disclosure, and the image generated before the second image for determining the intensity parameter can be referred to as a first image. First, the selection manner of the first image and the second image will be described below. Figure 7 The selection manner of the first image and the second image will be described below. Figure 7 The image selection schematic diagram provided in the embodiment of the present disclosure is shown.
[0144] As shown in Figure 7 , it is assumed that the user clicks the shooting button at t1, so that the terminal device is in the shooting preview stage before t1, and is in the to-be-displayed image generation stage after t1.
[0145] In the shooting preview stage, the camera of the terminal device continuously captures images to generate a preview stream, that is, a plurality of images are included in the preview stream. As shown in Figure 7As shown, for example, the preview stream includes images a1, a2, and a3, etc.
[0146] Furthermore, during the image generation stage, the camera application in the terminal device responds to the user's action of pressing the shutter button, and can continuously capture n images (n is an integer greater than or equal to 1), for example in... Figure 7 In the example, the terminal device continuously captures 6 images. Then, the terminal device can perform fusion processing on at least a portion of the n captured images to obtain... Figure 7 The image shown here is the merged image to be displayed. This image is the second image that requires contrast adjustment.
[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. For example, any image in the preview stream can be selected as the first image, or any image in the preview stream whose time interval from time t1 is less than a preset duration can be selected as the first image.
[0148] Alternatively, a first image can be selected from n consecutively captured images in response to a user action on the camera button. For example, the m-th image among the n consecutively captured images can be determined as a reference image, and then used as the first image as described in this application. For example, in... Figure 7 In the example, the third image among the six consecutively acquired images is determined as the reference image, and therefore the reference image b3 can be used as the first image described in this application.
[0149] In actual implementation, m can be a pre-set integer, where m is an integer greater than or equal to 1 and less than or equal to n.
[0150] Alternatively, any one of the n consecutively acquired images can be designated as the first image; this embodiment does not impose any restrictions on this.
[0151] Next, let's combine... Figure 8 The reason why the intensity parameters are determined based on the first image, and then the contrast of the second image is adjusted based on the intensity parameters (meaning the image used to determine the intensity parameters and the image to which the intensity parameters are applied are not the same image), is further explained, instead of directly determining the intensity parameters based on the second image and then adjusting the contrast of the second image based on the intensity parameters (meaning the image used to determine the intensity parameters and the image to which the intensity parameters are applied are the same image). Figure 8 This is a schematic diagram of the image fusion processing procedure provided in an embodiment of this application.
[0152] like Figure 8As shown, after collecting the continuous n images (i.e. image b1~image b6) in response to the user operation on the photographing button, the fusion processing can be firstly performed on the continuous n images, so as to obtain the initial fusion image. Figure 8
[0153] For example, the fusion processing introduced herein can be the HDR fusion introduced above, and thus after the image fusion, the brightness adjustment is usually needed to be performed on the fused image, so as to obtain the image with normal brightness.
[0154] In Figure 8 , the initial fusion image has not been subjected to the brightness adjustment, and thus the initial fusion image actually appears very dark, which does not conform to the human eye judgment, that is, does not conform to the brightness condition of the real scene observed by the human eye. Thus, the brightness information in the initial fusion image has not been processed, and the brightness information is inaccurate.
[0155] Continuing to refer to Figure 8 , after the initial fusion image is obtained by the fusion, the next step is to perform the brightness adjustment on the initial fusion image, wherein the purpose of the brightness adjustment is to brighten the dark area in the image and to darken the bright area, so as to make the brightness effect in the image conform to the human eye judgment. The contrast adjustment introduced in the present application is completed in the brightness adjustment stage, and it can also be understood that the contrast adjustment is an adjustment operation in the brightness adjustment stage.
[0156] After the brightness adjustment is performed on the initial fusion image, the remaining image parameter adjustment processing can also be performed, so as to obtain Figure 8 the final fusion image shown, wherein the final fusion image is the output image finally output after the photographing is completed, as introduced above. If the user views the photographing result in the gallery application, the image viewed is the final fusion image introduced herein.
[0157] Then, based on the current introduction, if the intensity parameter is determined according to the second image, there are the following two choices:
[0158] The first choice is to determine the intensity parameter according to the initial fusion image shown in Figure 8 . However, the brightness information of the initial fusion image is not processed, and thus the brightness information of the initial fusion image is not accurate, and thus the intensity parameter determined according to the initial fusion image is also not accurate.
[0159] Therefore, the intensity parameter cannot be determined according to the initial fusion image.
[0160] The second choice is to determine the intensity parameter according to the final fusion image shown in Figure 8 The intensity parameter is determined according to the final fusion image. However, the contrast adjustment is processed before the final fusion image is obtained, so after the final fusion image is obtained, the contrast parameter determined according to the final fusion image cannot be applied to the contrast adjustment of the final fusion image.
[0161] Therefore, the intensity parameter determined according to the final fusion image is accurate, but cannot be applied to the contrast adjustment.
[0162] Therefore, according to the above analysis, it can be determined that the intensity parameter cannot be determined according to the second image in the embodiment. To realize the contrast adjustment of the second image, the intensity parameter needs to be determined in advance. Therefore, in the embodiment, the intensity parameter is determined according to the first image, and then the contrast of the second image is adjusted according to the intensity parameter.
[0163] The first image is generated before the second image, so that the intensity parameter determined according to the first image can be applied to the contrast adjustment of the second image. In addition, the first image in the embodiment is either the image in the preview stream or the reference image, so the first image can be obtained without fusion processing. Therefore, the first image does not need to be adjusted after fusion processing, so the generation speed of the first image is relatively fast, and the speed of determining the intensity parameter according to the first image is also relatively fast. Therefore, the intensity parameter determined according to the first image can be effectively applied to the brightness adjustment of the second image. In addition, the pre-determined mask image and gain image can also improve the speed of the contrast adjustment of the second image.
[0164] In addition, the contrast adjustment introduced in the embodiment is completed in the brightness adjustment stage introduced above. Figure 8 Therefore, the intensity parameter actually adjusted in the embodiment is the contrast of the initial fusion image shown in the above. Figure 8 Therefore, the second image that needs to be adjusted in the embodiment is the initial fusion image introduced above, and the initial fusion image and the to-be-displayed image introduced above are the same concept.
[0165] After the brightness adjustment of the initial fusion image, the final fusion image shown in the above is obtained. Figure 8 The final fusion image is the output image of the camera application.
[0166] The above introduces the implementation of the first image and the second image, and the specific implementation of determining the intensity parameter is introduced below.
[0167] After the first image is determined, the intensity parameter can be determined according to the first image. In an implementation, the preview images in the preview stream and the n continuous captured images can all be YUV images. YUV is a color encoding mode, in which Y represents luminance, i.e., a gray value, and UV represent chrominance and chroma respectively.
[0168] Therefore, the first image in the embodiment can also be a YUV image. In order to facilitate subsequent processing, the first image in YUV format can be converted to RGB space, so as to obtain a first image in RGB format, and then subsequent processing is performed based on the first image in RGB format. RGB is also a color encoding mode, in which 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 Figure 9 a flowchart of an image adjustment method provided by the embodiment of the application, Figure 10 a schematic diagram of a target pixel point of a first image provided by the application.
[0170] As Figure 9 indicated, the method comprises the following steps.
[0171] 1. For each target pixel point in the first image, it is determined whether the target pixel point is overexposed, and the overexposed target pixel point is filtered out.
[0172] First, the target pixel point will be introduced. The target pixel point in the embodiment is a pixel point used to determine the target intensity parameter of the first image.
[0173] In an implementation, the target intensity parameter in the embodiment is used to represent the intensity of the negative effect of the face part in the image. Therefore, a face detection algorithm can be used to perform face detection on the first image, so as to obtain the position of the face detection frame (or face frame) in the first image. Then, the pixel points in the first image located in the face detection frame can be determined as the target pixel points.
[0174] Alternatively, the target intensity parameter in the embodiment can also be used to represent the intensity of the negative effect of the portrait part in the image. Therefore, a portrait detection algorithm can be used to perform portrait detection on the first image, so as to obtain the position of the portrait region in the first image. Then, the pixel points in the first image located in the portrait region can be determined as the target pixel points.
[0175] The order of execution of the step of converting the first image in YUV format into the first image in RBG format and the step of performing face detection or portrait detection on the first image can be adjusted according to actual needs, and the embodiment does not limit this.
[0176] Alternatively, the target intensity parameter in the embodiment can also be the intensity of the negative effect of the image as a whole, so each pixel point in the first image can also be determined as a target pixel point.
[0177] Therefore, in actual implementation, the pixel points in the region of the first image that needs to measure the intensity of the negative effect are determined as the target pixel points in the embodiment. In the embodiment, the target pixel point can also be defined as a pixel point in a target region in the first image, wherein the target region is a region that needs to measure the negative effect, or the target intensity parameter of the first image is used to represent the intensity of the negative effect of the target region.
[0178] After the concept of the target pixel point is determined, in order to improve processing efficiency and data effectiveness, the target pixel points can also be filtered, for example.
[0179] For example, for any 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, wherein the overexposed target pixel point is overwhite in the picture, and processing this type of target pixel point does not have much meaning, so the overexposed target pixel point can be filtered out to reduce the amount of subsequent data processing.
[0180] 2. Determine the saturation of each target pixel point according to the pixel value of each target pixel point in the first image.
[0181] It should be noted that the step of filtering the target pixel point is optional. Whether the target pixel point is filtered depends on actual needs. Even if the step of filtering the target pixel point is not executed, it does not affect the subsequent execution of the scheme.
[0182] If the target pixel point is filtered, the subsequent data processing is executed on the basis of all target pixel points. If the target pixel point is filtered, the subsequent data processing can be executed on the basis of the filtered target pixel point.
[0183] For example, it can be understood with reference to Figure 9 Subsequent processing, in Figure 9The diagram schematically shows 16 pixels, for example, these 16 pixels are all target pixels in the first image. Figure 9 As shown in this embodiment, the saturation of each target pixel can be determined first based on the pixel value of each target pixel in the first image.
[0184] The first image can be an RGB format image, so for each target pixel, its pixel value includes R, G, and B values. In determining the saturation of the target pixels, the maximum and minimum pixel values of each target pixel can be determined separately.
[0185] For example, for any target pixel, the maximum value among its R, G, and B values can be determined as the maximum pixel value. The maximum pixel value can be represented as maxValue = MAX3(R, G, B), where MAX3(R, G, B) means taking the maximum value among the R, G, and B values of the target pixel.
[0186] Furthermore, for any target pixel, the minimum value among its R, G, and B values can be determined as the minimum pixel value. For example, the minimum pixel value can be expressed as minValue = MIN3(R, G, B), where MIN3(R, G, B) represents taking the minimum value among the R, G, and B values of the target pixel.
[0187] For example, you can refer to Figure 10 To gain a further understanding, such as Figure 10 As shown, suppose 16 target pixels are displayed in the first image, where each box represents a target pixel. Assume the pixel value of the first target pixel 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. Therefore, for this target pixel, we can determine that its maximum pixel value is 144 and its minimum pixel value is 12.
[0188] For any target pixel, after determining the maximum and minimum pixel values, the saturation of the target pixel can be determined based on these maximum and minimum values.
[0189] For example, the difference between the maximum value (maxValue) and the minimum value (minValue) of a pixel can be determined first, and then the ratio of the determined difference to the maximum value of the pixel can be used to determine the saturation.
[0190] For example, it can be expressed as the following formula:
[0191] Saturation = (maxValue-minValue) / maxValue Formula 1
[0192] In actual implementation process, the implementation manner of determining the saturation is not limited to the Formula 1, and equivalent transformation can be performed on the basis of the Formula 1, or a corresponding parameter can be added on the basis of the Formula 1, and the same purpose can also be achieved.
[0193] In addition, the implementation of determining the saturation of the pixel point is not limited to the manner described above, and any manner of determining the saturation can be used to perform the current step, which is not limited by the embodiment.
[0194] 3. For any target pixel point, the single-pixel intensity parameter of the target pixel point is determined according to the saturation of the target pixel point and the pixel value of the target pixel point.
[0195] In an implementation manner, after the saturation of the target pixel point and the pixel value of the target pixel point are determined, the single-pixel intensity parameter of each target pixel point can be determined according to the saturation and the pixel value, wherein the single-pixel intensity parameter is used to indicate the intensity of the negative effect corresponding to the single target pixel point.
[0196] The inventor has found through a large amount of data research 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 more serious the fogging degree and / or the whitening degree of the image. In addition, the smaller the pixel value of a single pixel point 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 more serious the fogging degree and / or the whitening degree of the image.
[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 point in the image is smaller, the degree of the negative effect such as fogging and whitening presented by the image is naturally more obvious.
[0198] The pixel value of the single pixel point introduced herein can be the maximum value of the R value, the G value and the B value of the pixel point, or can also be the average value of the three pixel values of the pixel point, or can also be the minimum value, and the embodiment is not limited thereto. The maximum value is taken as an example for description.
[0199] That is, the following rule can be summarized: the intensity of the negative effect presented by the image and the maximum value of the pixel value of each pixel point in the image are in a positive proportional relationship, and the intensity of the negative effect presented by the image and the saturation of the image are in an inverse proportional relationship.
[0200] Further, for a single pixel, 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.
[0201] For example, the single-pixel intensity parameter of the target pixel point can be determined according to the saturation of the target pixel point and the maximum value of the pixel value of the target pixel point according to the proportional relationship introduced herein.
[0202] For example, the target ratio can be determined according to the ratio of the maximum value of the pixel value of the target pixel point to the first value, where the first value is the maximum value of the pixel value. For example, when the value range of the pixel value is 0-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 in subsequent calculation is that the maximum value of the pixel value is usually a relatively large number compared to the saturation. In order to avoid the influence of the maximum value of the pixel value being too large on the calculation result of the intensity parameter, and to avoid the influence of the saturation on the calculation result of the intensity parameter being completely covered, it is necessary to adjust the maximum value of the pixel value to a suitable range and then perform subsequent calculation.
[0204] For example, the difference between the ratio and the saturation can be determined as the single-pixel intensity parameter of the target pixel point. The above calculation process can be represented by the following Formula Two, for example:
[0205] Hp = maxValue / 255 - Saturation Formula Two
[0206] Wherein, Hp represents the single-pixel intensity parameter of a single target pixel point. In actual implementation, the implementation manner of determining the single-pixel intensity parameter of a single target pixel point is not limited to the above-introduced Formula Two. Equivalent transformation can be performed on the basis of the above Formula Two, or corresponding parameters can be added on the basis of the above Formula Two, which can also achieve the same purpose.
[0207] Or, as long as the single-pixel intensity parameter and the maximum value of the pixel value are directly proportional, and the single-pixel intensity parameter and the saturation are inversely proportional, 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 point.
[0209] In a possible implementation manner, for example, the average value of the single-pixel intensity parameters Hp corresponding to each target pixel point can be determined as the target intensity parameter of the first image, which can be represented by H.
[0210] In actual implementation, in addition to determining the target intensity parameter of the first image based on the above-mentioned average number determination manner, for example, the target intensity parameter of the first image can also be determined by a median number determination manner, a mode determination manner, etc.
[0211] Then, for example, the above-mentioned target intensity parameter of the first image can be multiplied by 100 again to normalize the target intensity parameter of the first image to a preset range of 0-100, facilitating subsequent processing. Alternatively, the target intensity parameter of the first image can also be normalized to any desired preset range according to actual requirements, which is not limited in the embodiment.
[0212] In the embodiment, for each target pixel point in the first image, the saturation of the target pixel point is first determined according to the pixel value of the target pixel point, 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 the single-pixel intensity parameter of each target pixel point is determined from the perspective of saturation and the perspective of pixel value, and the above-mentioned saturation and the influence of the pixel value on the degree of manifestation of the negative effect are referred to, 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 the target pixel points, so that the target intensity parameter capable of intuitively reflecting the degree of manifestation of the negative effect of the first image can be obtained.
[0213] The above-mentioned 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 the target pixel points. In another implementation manner, for example, the average maximum value corresponding to the first image can be determined according to the maximum value of the pixel value of each target pixel point, and the average saturation corresponding to the first image can be determined according to the saturation of each target pixel point. Then, the target intensity parameter of the first image is directly obtained according to the average maximum value and the average saturation, similar to the above-mentioned Formula 2, and the effect is similar.
[0214] After the target intensity parameter is determined based on the first image, the contrast of the second image can be adjusted according to the target intensity parameter. First, it can be understood with reference to the above-mentioned Figure 8 introduction that the contrast adjustment is a processing step that exists by itself before the camera application outputs an image. That is, whether the second image needs to be subjected to the special processing of eliminating the negative effect or not, the second image is subjected to the contrast adjustment.
[0215] The difference is that if no special processing of the negative effect is needed for the second image, then only the contrast adjustment of the second image according to the preset initial contrast parameter is needed, wherein the contrast parameter in the embodiment is a parameter for adjusting the contrast of an image, and the initial contrast parameter is preset, and if the contrast adjustment is performed according to the initial contrast parameter, then the same contrast adjustment is performed for any image.
[0216] However, if special processing of the negative effect is needed for the second image, the contrast adjustment according to the initial contrast parameter cannot achieve the purpose of eliminating or alleviating the negative effect, and therefore the initial contrast parameter needs to be updated first, and then the contrast adjustment of the second image is performed according to the updated contrast parameter.
[0217] Therefore, it is needed to measure whether the special processing of the negative effect is needed for the second image in the stage of the contrast adjustment. In the embodiment, the greater the target intensity parameter of the first image is, the more obvious the negative effect in the first image is, because the first image and the second image are images collected in the same shooting scene and at a very close time, and therefore the target intensity parameter of the first image can be used to measure whether the special processing of the negative effect is needed for the second image.
[0218] For example, 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, then it can be determined that the negative effect in the first image is not very obvious, and accordingly it can be deduced that the negative effect in the second image is also not very obvious, and therefore the special processing of the negative effect is not needed for the second image, and the contrast adjustment of the second image can be directly performed 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, then it can be determined that the negative effect in the first image is relatively obvious, and accordingly it can be deduced that the negative effect in the second image is also relatively obvious, and therefore the special processing of the negative effect is needed for the second image, and therefore the initial contrast parameter needs to be updated, and then the contrast adjustment of the second image is performed according to the updated contrast parameter (which is referred to as a target contrast parameter in the embodiment).
[0221] The implementation of adjusting the initial contrast parameter is introduced as follows. In the embodiment, the initial contrast parameter can be preset, and an adjustment step I can also be preset, where I is a value greater than or equal to 0, and the adjustment step is a step for updating the initial contrast parameter. Therefore, the initial contrast parameter can be updated according to the adjustment step, so as to obtain the target contrast parameter.
[0222] In an implementation, the difference between the target intensity parameter and the preset intensity threshold can be determined, so as to measure how much the target intensity parameter exceeds the preset intensity threshold. Then, the adjustment value of the contrast parameter can be determined according to the difference between the target intensity parameter and the preset intensity threshold and the adjustment step. For example, the product of the difference and the adjustment step can be determined as the adjustment value of the contrast parameter.
[0223] Then, the sum of the adjustment value of the contrast parameter and the initial contrast parameter can be determined as the target contrast parameter.
[0224] For example, the adjustment of the contrast parameter can be performed according to Formula Three as follows:
[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 actual implementation, the implementation of adjusting the contrast parameter is not limited to Formula Three, and equivalent transformation can be performed on the basis of Formula Three, or corresponding parameters can be added on the basis of Formula Three, and the same purpose can also be achieved.
[0227] After the adjusted target contrast parameter is determined, the contrast of the second image can be adjusted according to the target contrast parameter, so as to output the second image with good contrast, so as to achieve the mitigation or elimination of the negative effect in the second image.
[0228] For example, the contrast parameter introduced above can be a parameter of local tone mapping (LTM) or global tone mapping (GTM), and then the contrast adjustment of the second image is performed based on the adjusted target LTM parameter or target GTM parameter, so as to output the second image after the contrast adjustment, that is, the output image of the camera application program in response to the user operation, so as to ensure that the negative effect in the output image can be effectively mitigated or eliminated.
[0229] Because the technical solution of this application is based on the target intensity parameter used to specifically measure the negative effect of an image, the target contrast parameter is determined.
[0230] Specifically, when the target intensity parameter indicates that the negative effect of the image is not obvious, the preset initial contrast parameter is directly set as the target contrast parameter. This means that no additional contrast adjustments are needed; adjustments are made according to the preset method to ensure good contrast in the final output image. It is understandable that if the negative effect in the image is not obvious, or if the negative effect described in this embodiment does not exist, additional contrast adjustments specifically targeting the negative effect would be excessive, potentially leading to poor contrast in the image.
[0231] Therefore, the accuracy of determining whether to apply special processing for negative effects is crucial. The parameters currently used, as described above, are not directly used to measure negative effects. Therefore, relying on those parameters to determine whether to apply special processing for negative effects inevitably leads to overcorrection, as mentioned above. However, the target intensity parameter in this application is specifically used to characterize the degree of 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] Furthermore, 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 set for the contrast parameter to obtain the target contrast parameter. This ensures that the contrast adjustment of the second image based on the target contrast parameter can effectively eliminate the negative effect and also ensures that the output image of the camera application always has good contrast performance.
[0233] Therefore, the technical solution of this application, based on the target intensity specifically used to measure the negative effect, determines the target contrast map parameters for adjusting the image contrast, which can effectively ensure that the output image of the second image obtained under various shooting environments always has a good contrast effect after contrast adjustment.
[0234] Based on the above introduction, the following will further combine... Figure 11 The execution steps of the image adjustment method provided in this application will be further explained. Figure 11 This is a schematic flowchart of the image adjustment method provided in an embodiment of this application.
[0235] like Figure 11 As shown, the method includes:
[0236] S1101, determine, according to the pixel value of each target pixel point in the first image, the saturation degree corresponding to each target pixel point.
[0237] S1102, determine, according to the saturation degree corresponding to each target pixel point and the pixel value of each target pixel point, the target intensity parameter of the negative effect corresponding to the first image, the negative effect being caused by the contrast of the first image.
[0238] S1103, determine, according to the target intensity parameter and the preset intensity threshold, the target contrast parameter.
[0239] S1104, adjust, according to the target contrast parameter, the contrast of the second image.
[0240] In the embodiment, the saturation degree can be determined for each target pixel point, and then the target intensity parameter corresponding to the first image is determined according to the saturation degree corresponding to each target pixel point and the pixel value of each target pixel point, the target intensity parameter being used to indicate the performance degree of the negative effect of the first image.
[0241] It can be introduced according to the above embodiment that in an implementation manner, the single-pixel intensity parameter of each target pixel point can be first determined according to the saturation degree and the pixel value of each target pixel point, and then the target intensity parameter corresponding to the first image is uniformly determined according to the single-pixel intensity parameter corresponding to each pixel point.
[0242] Alternatively, the saturation degree corresponding to the first image can be first determined according to the saturation degree 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, and then the target intensity parameter corresponding to the first image is determined according to the saturation degree and the pixel value corresponding to the first image.
[0243] After the target intensity parameter is determined, 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 is adjusted according to the target contrast parameter, so that the contrast of the output image of the camera application program is always good, and the negative effect caused by the low contrast is avoided.
[0244] It should be noted that the module names involved in the embodiments of the present application can be defined as other names, as long as the functions of the modules can be realized, and the names of the modules are not limited specifically.
[0245] It should be noted that the user information (including but not limited to user equipment 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 the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.
[0246] The image adjustment method of the embodiments of the present application has been described above, and the device for executing the above method provided by the embodiments of the present application will be described below. Those skilled in the art can understand that the method and the device can be combined and referred to each other, and the related device provided by the embodiments of the present application can execute the steps in the above image adjustment method.
[0247] The image adjustment method provided by the embodiments of the present application can be applied in electronic devices with image shooting and data processing functions. The electronic device includes a terminal device, and the specific device form of the terminal device can refer to the above related description, which will not be repeated here.
[0248] The embodiments of the present application provide a terminal device, which includes: a processor and a memory; the memory stores computer execution instructions; and the processor executes the computer execution instructions stored in the memory, so that the terminal device executes the above method.
[0249] The embodiments of the present application provide a chip. The chip includes a processor, which is used to call a computer program in a memory to execute the technical solutions in the above embodiments. The implementation principle and technical effects are similar to those of the above related embodiments, which will not be repeated here.
[0250] The embodiments of the present application also provide a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is executed by the processor to implement the above method. The method described in the above embodiments can be realized by software, hardware, firmware or any combination thereof, in whole or in part. If realized 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 computer storage medium and communication medium, and can also include any medium that can transfer computer programs from one place to another. The storage medium can be any target medium accessible by a computer.
[0251] In a possible implementation, the computer readable medium can include a RAM, a ROM, a compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that is suitable for storing desired program code in the form of instructions or data structures and that can be accessed by a computer. Also, any connection is properly termed a computer readable medium. For example, if the software is transmitted from a website, server, or other remote source using a 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 medium. Disk and disc, as used herein, include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk, and Blu-ray® disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer readable media.
[0252] The embodiment of the present application provides a computer program product, which comprises a computer program, and when the computer program is executed, the computer executes the above method.
[0253] The embodiment of the present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiment of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the 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 a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices generate a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks Figure 1 The functions specified in one flow or multiple flows and / or blocks
[0254] The above detailed description is further detailed for the purpose of the present application, technical solutions, and beneficial effects, and it should be understood that the above is only a specific embodiment of the present application, and is not used to limit the protection scope of the present application, and any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. An image adjustment method characterized by, The method comprises: determining, according to pixel values of each target pixel point in the first image, a saturation degree corresponding to each target pixel point; the first image is one of a plurality of continuously captured acquisition images; for any target pixel point, determining a single-pixel intensity parameter corresponding to the target pixel point according to the saturation degree of the target pixel point and the pixel value of the target pixel point; determining a target intensity parameter of a negative effect corresponding to the first image according to the single-pixel intensity parameter corresponding to each target pixel point; wherein the negative effect is a hazing and / or fogging effect of the first image caused by a reduction in the contrast of the first image, and the target intensity parameter is used to represent the intensity of the negative effect of a specific region in the first image; if the target intensity parameter is greater than or equal to a preset intensity threshold, determining a preset initial contrast parameter as a target contrast parameter; if the target intensity parameter is less than the preset intensity threshold, adjusting the initial contrast parameter according to a preset adjustment step to obtain the target contrast parameter; adjusting the contrast of a second image according to the target contrast parameter; the second image is generated later than the first image, and the second image is an image obtained by fusing at least part of the plurality of acquisition images.
2. The method of claim 1, wherein, The method further comprises: determining the average value of the single-pixel intensity parameter corresponding to each target pixel point as the target intensity parameter of the negative effect corresponding to the first image.
3. The method according to claim 1 or 2, characterized in that, The single-pixel intensity parameter is inversely proportional to the saturation degree 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.
4. The method according to claim 1 or 2, characterized in that, The method further comprises: 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, wherein 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 target ratio and the difference between the saturation degree of the target pixel point.
5. The method according to claim 1 or 2, characterized in that, The method further comprises: normalizing the target intensity parameter to adjust the target intensity parameter to a value within a preset range.
6. The method of claim 1, wherein, The method further comprises: determining the difference between the target intensity parameter and the preset intensity threshold; determining an adjustment value according to the difference and the adjustment step; determining the sum of the initial contrast parameter and the adjustment value as the target contrast parameter.
7. The method of any one of claims 1-2 and 6, wherein: the plurality of acquisition images are captured by a camera application in response to a user operation on a photographing control.
8. The method according to any of claims 1-2, 6, characterized by, The method further comprises: performing face detection on the first image to determine a face frame region in the first image; Determine, as the target pixel, a pixel in a face frame region in the first image.
9. An electronic device, comprising: Comprising: a processor and a memory; the memory stores computer-executed instructions; the processor executes the computer-executed instructions stored in the memory, so that the electronic device executes the method in any one of claims 1-8.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program, when executed by a processor, implements the method in any one of claims 1-8.
11. A chip system, characterized by Comprising 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, so as to execute the method in any one of claims 1-8.
12. A computer program product, characterised in that, Comprising a computer program, when the computer program is executed, so that the computer executes the method in any one of claims 1-8.
Citation Information
Patent Citations
Video image processing method, device and equipment
CN102780889A
Image saturation degree adjustment method, terminal and storage medium
CN107705247A