Light source image processing method, electronic device and storage medium

By determining the light source transition area in the light source image processing and adjusting the white balance parameters according to the area, the light source image is subjected to white balance processing, which solves the problem of excessive transition area of ​​the light source image and improves the image quality.

CN119211747BActive Publication Date: 2025-04-11HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411550823.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-04-11
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

When shooting light source images, due to unstable environment and unstable shooting parameters, the transition area around the light source image is larger than the transition area around the actual light source, resulting in lower image quality of the light source image.

Method used

By determining the light source transition area of ​​the light source image, the white balance parameters are determined based on the area, including the target channel optimization direction and the number of optimizations, and the light source image is white balanced to reduce the color channel difference in the light source transition area.

Benefits of technology

The transitional unnatural areas of the light source image are significantly reduced and the image quality of the light source image is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211747B_ABST
    Figure CN119211747B_ABST
Patent Text Reader

Abstract

The present application discloses a light source image processing method, an electronic device and a storage medium. The light source image processing method includes: determining a first light source transition area of ​​a first light source image; determining white balance parameters according to the first light source transition area, the white balance parameters including a target channel optimization direction and a target channel optimization number; performing white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, wherein the first area of ​​the first light source transition area is greater than the second area of ​​the second light source transition area of ​​the second light source image. The method performs white balance processing on the light source image according to the target channel optimization direction and the target channel optimization number corresponding to the light source transition area of ​​the light source image, thereby greatly reducing the difference between the color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a light source image processing method, electronic equipment and storage medium. Background Art

[0002] At present, when capturing a light source image, the transition area around the light source image may be larger than the transition area around the actual light source due to various reasons. For example, due to unstable shooting environment, unstable shooting parameters, etc., the transition area around the light source image may be larger than the transition area around the actual light source. The light source transition area of ​​the light source image is larger, resulting in lower image quality of the light source image. Summary of the invention

[0003] In view of this, embodiments of the present application provide a light source image processing method, an electronic device, and a storage medium to overcome the above problems of the prior art.

[0004] In a first aspect, an embodiment of the present application provides a light source image processing method, including: determining a first light source transition region of a first light source image; determining white balance parameters based on the first light source transition region, the white balance parameters including a target channel optimization direction and a target channel optimization number; performing white balance processing on the first light source image based on the white balance parameters to obtain a second light source image, wherein a first area of ​​the first light source transition region is larger than a second area of ​​the second light source transition region of the second light source image.

[0005] The solution provided in the present application performs white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition area of ​​the light source image, thereby greatly reducing the difference between the color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0006] Among them, in some optional embodiments, determining the optimization direction of the target channel according to the first light source transition area includes: forward compensating the target channel of the first light source transition area by a preset constant to obtain a first compensation area; reverse compensating the target channel of the first light source transition area by a preset constant to obtain a second compensation area; determining the optimization direction of the target channel according to the third area of ​​the first compensation area and the fourth area of ​​the second compensation area.

[0007] The solution provided in this embodiment determines the target channel optimization direction based on the forward compensation of the target channel in the light source transition area and the area of ​​the light source transition area after reverse compensation, which is beneficial to improving the optimization accuracy when optimizing the target channel of the light source image.

[0008] Among them, in some optional embodiments, the target channel optimization direction is determined according to the third area of ​​the first compensation area and the fourth area of ​​the second compensation area, including: when the third area is smaller than the first area, determining the target channel optimization direction as the forward compensation direction; when the fourth area is smaller than the first area, determining the target channel optimization direction as the reverse compensation direction.

[0009] The solution provided in this embodiment determines the optimization direction of the target channel based on the area change of the transition area after forward compensation and reverse compensation of the target channel, which is conducive to improving the optimization accuracy when optimizing the target channel of the light source image.

[0010] In some optional embodiments, the first light source image is an RGB color space image, the target channel includes a red channel and a blue channel, and the target channel optimization direction includes a red channel optimization direction and a blue channel optimization direction.

[0011] In the solution provided by this embodiment, during the imaging process of the light source image, the losses of the red channel and the blue channel in the transition area of ​​the light source are relatively large. The white balance processing of the light source image is performed according to the red channel optimization direction and the blue channel optimization direction. Compared with the process of performing white balance processing on the light source image according to the red channel optimization direction, the blue channel optimization direction and the green channel optimization direction, it is beneficial to greatly reduce the difference between color channels and reduce the amount of calculation in the image processing process.

[0012] Among them, in some optional embodiments, the target channel optimization times are determined according to the first light source transition area, including: iteratively optimizing the first light source transition area a target number of times according to the target channel optimization direction to obtain a target optimization area, the area ratio of the fifth area of ​​the target optimization area to the first area is less than or equal to a preset ratio threshold; and determining the target number of times as the target channel optimization times.

[0013] The solution provided in this embodiment determines the number of channel optimization times for the light source transition area according to the area of ​​the light source transition area after channel optimization. In the process of performing white balance processing on the light source image according to the number of channel optimization, it can prevent the electronic device from over-optimizing the light source image and occupying a large amount of computing resources, resulting in a decrease in the system performance of the electronic device, which is beneficial to improving the system performance of the electronic device.

[0014] In some optional embodiments, the second area is zero.

[0015] In the solution provided by this embodiment, the second area is zero, indicating that the light source transition area of ​​the light source image disappears after the white balance processing, which greatly improves the image quality of the light source image.

[0016] Among them, in some optional embodiments, determining the first light source transition area of ​​the first light source image includes: performing LCH color space conversion on the first light source image to obtain an LCH image; binarizing the LCH image to obtain a binary mask image; and determining the first light source transition area based on the binary mask image.

[0017] The solution provided in this embodiment determines the light source transition area of ​​the light source image based on the binary mask image obtained by binarizing the LCH image in the LCH color space. Since the LCH color space is closer to the daily description habits of color, the binary mask image is easier to analyze, which is beneficial to improving the detection accuracy of the light source transition area based on the binary mask image.

[0018] Among them, in some optional embodiments, before determining the first light source transition area according to the binarized mask image, the light source image processing method also includes: determining the light source mask image according to the first light source image; determining whether the light source mask image and the binarized mask image are connected; determining the first light source transition area according to the binarized mask image, including: when it is determined that the light source mask image and the binarized mask image are connected, determining the first light source transition area according to the binarized mask image.

[0019] In the solution provided in this embodiment, both the light source mask image and the binary mask image correspond to the light source image. When the light source mask image is connected to the binary mask image, the light source transition area is detected based on the binary mask image, which is beneficial to improving the detection accuracy of the light source transition area.

[0020] Among them, in some optional embodiments, determining the light source mask image according to the first light source image includes: determining the light source position in the first light source image; determining the minimum enclosing circle of the light source position according to a minimum enclosing circle algorithm; and generating the light source mask image according to the minimum enclosing circle.

[0021] The solution provided in this embodiment generates a light source mask image based on the minimum enclosing circle determined by the minimum enclosing circle algorithm. Since the minimum enclosing circle algorithm has high calculation efficiency and calculation accuracy, it is beneficial to improve the generation efficiency and generation accuracy of the light source mask image.

[0022] Among them, in some optional embodiments, the LCH image is binarized to obtain a binary mask image, including: determining the LCH value of each pixel point of the LCH image; binarizing the LCH image according to the LCH value of each pixel point to obtain a binary mask image.

[0023] The solution provided in this embodiment performs binarization processing on the LCH image pixel by pixel according to the LCH value of each pixel of the LCH image to obtain a binary mask image, thereby improving the accuracy of the binary mask image.

[0024] Among them, in some optional embodiments, the LCH value includes a brightness value, a saturation value and a hue value, and the LCH image is binarized according to the LCH value of each pixel to obtain a binary mask image, including: determining a brightness channel mask value, a saturation channel mask value and a hue channel mask value according to the brightness value, saturation value and hue value of each pixel; determining a pixel mask value according to a brightness channel mask value, a saturation channel mask value and a hue channel mask value corresponding to each pixel; generating a binary mask image according to a pixel mask value corresponding to each pixel.

[0025] The solution provided in this embodiment generates a binary mask image based on the pixel mask value determined by the lightness channel mask value, saturation channel mask value and hue channel mask value of each pixel point of the LCH image, thereby improving the generation accuracy of the binary mask image.

[0026] Among them, in some optional embodiments, a lightness channel mask value, a saturation channel mask value and a hue channel mask value are determined according to the lightness value, saturation value and hue value of each pixel point, including: determining a lightness channel mask value according to the lightness value of each pixel point and the lightness threshold range; determining a saturation channel mask value according to the saturation value of each pixel point and the saturation threshold range; determining a hue channel mask value according to the hue value of each pixel point and the hue threshold range.

[0027] The solution provided in this embodiment determines the corresponding lightness channel mask value, saturation channel mask value and hue channel mask value based on the lightness value, saturation value and hue value of each pixel point, thereby improving the accuracy of each channel mask value.

[0028] Among them, in some optional embodiments, a pixel mask value is determined according to a lightness channel mask value, a saturation channel mask value and a hue channel mask value corresponding to each pixel point, including: when the target lightness channel mask value corresponding to the target pixel point is 1, the target saturation channel mask value is 1 and the target hue channel mask value is 1, the target pixel mask value of the target pixel point is determined to be 1; otherwise, the target pixel mask value is determined to be 0.

[0029] The solution provided in this embodiment calculates the corresponding pixel mask value according to the product of the lightness channel mask value, the saturation channel mask value and the hue channel mask value of each pixel point, thereby improving the contrast of the image and facilitating improving the accuracy of generating the binary mask image.

[0030] Among them, in some optional embodiments, determining the first light source transition area according to the binary mask image includes: determining the light source transition mask area in the binary mask image; and determining the area in the first light source image corresponding to the light source transition mask area as the first light source transition area.

[0031] In the solution provided by this embodiment, the light source transition mask area and the non-light source transition mask area in the binary mask image have a high contrast ratio, and the light source transition area of ​​the light source image is determined based on the light source transition mask area, which is conducive to improving the accuracy of the light source transition area.

[0032] Among them, in some optional embodiments, before determining the area in the first light source image corresponding to the light source transition mask area as the first light source transition area, the light source image processing method also includes: expanding the light source transition mask area to obtain an expanded transition mask area; determining the area in the first light source image corresponding to the light source transition mask area as the first light source transition area, including: determining the area in the first light source image corresponding to the expanded transition mask area as the first light source transition area.

[0033] The solution provided in this embodiment performs expansion processing on the light source transition mask area, thereby expanding the boundary of the light source transition mask area and improving the clarity of the expanded transition mask area, which is beneficial to improving the detection accuracy of the light source transition area based on the expanded transition mask area.

[0034] Among them, in some optional embodiments, the light source image processing method also includes: determining an initial color restoration matrix of the first light source image; and performing color restoration on the second light source transition area according to the initial color restoration matrix to obtain a third light source image.

[0035] The solution provided in this embodiment performs color correction on the light source transition area of ​​the white balance processing based on the initial color restoration matrix, so that the image color of the third light source image after color correction is closer to the natural color or the perception of the human eye, further improving the image quality of the light source image.

[0036] Among them, in some optional embodiments, before performing color restoration on the second light source transition area according to the initial color restoration matrix to obtain the third light source image, the light source image processing method also includes: determining whether the process of performing color restoration on the second light source transition area by the initial color restoration matrix truncates the color channel; performing color restoration on the second light source transition area according to the initial color restoration matrix to obtain the third light source image, including: when it is determined that the process of performing color restoration on the second light source transition area by the initial color restoration matrix truncates the color channel, optimizing the initial color restoration matrix to obtain a target color restoration matrix; performing color restoration on the second light source transition area according to the target color restoration matrix to obtain the third light source image, the process of performing color restoration on the second light source transition area by the target color restoration matrix not truncating the color channel.

[0037] In the solution provided by the present embodiment, during the color restoration process, the contrast of the image after color restoration is reduced due to truncation of the color channel. When the color channel is truncation when the initial color restoration matrix performs color restoration on the light source transition area, the initial color restoration matrix is ​​optimized to a target color restoration matrix that performs color restoration on the light source transition area without truncation of the color channel, thereby suppressing the reduction in contrast caused by color restoration of the transition area by the target color restoration matrix, which is beneficial to improving the image quality of the color restored image.

[0038] Among them, in some optional embodiments, the light source image processing method further includes: performing pixel dithering processing on the third light source image to obtain a fourth light source image.

[0039] In the solution provided in this embodiment, pixel dithering can create texture and increase the expressiveness of pixel painting. After the light source image is processed by pixel dithering, the light source transition area of ​​the light source image is smoother, further improving the image quality of the light source image.

[0040] Among them, in some optional embodiments, before performing pixel dithering processing on the third light source image to obtain the fourth light source image, the light source image processing method also includes: performing format compression on the third light source image to obtain a fifth light source image; performing pixel dithering processing on the third light source image to obtain the fourth light source image, including: performing pixel dithering processing on the fifth light source image to obtain the fourth light source image.

[0041] The solution provided in this embodiment performs format compression on the light source image to reduce the image size of the light source image and improve the image compatibility. The format compression and pixel dithering of the third light source image are performed successively, which is beneficial to reducing the storage space occupied by the fourth light source image while improving the compatibility of the fourth light source image and improving the image quality of the fourth light source image.

[0042] In a second aspect, an embodiment of the present application provides a light source image processing device, including a first determination module, a second determination module, and a white balance processing module. The first determination module is used to determine a first light source transition region of a first light source image; the second determination module is used to determine white balance parameters according to the first light source transition region, and the white balance parameters include a target channel optimization direction and a target channel optimization number; the white balance processing module is used to perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, wherein the first area of ​​the first light source transition region is larger than the second area of ​​the second light source transition region of the second light source image.

[0043] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processors, and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the light source image processing method provided in the first aspect above.

[0044] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the light source image processing method provided in the first aspect above.

[0045] In some optional embodiments, the chip system also includes a memory, and the memory is connected to one or more processors through circuits or wires.

[0046] In some optional embodiments, the chip system also includes a communication interface.

[0047] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device executes the light source image processing method provided in the first aspect above.

[0048] In a sixth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the light source image processing method provided in the first aspect above.

[0049] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0051] Figure 1 A structural diagram of a software system of an electronic device provided in an embodiment of the present application is shown.

[0052] Figure 2 A schematic flow chart of a light source image processing method provided in an embodiment of the present application is shown.

[0053] Figure 3 A schematic diagram of a scene of a light source transition area in the light source image processing method provided in an embodiment of the present application is shown.

[0054] Figure 4 A schematic diagram of a scene of an LCH image in the light source image processing method provided in an embodiment of the present application is shown.

[0055] Figure 5 A schematic diagram of a scene of a binary mask image in the light source image processing method provided in an embodiment of the present application is shown.

[0056] Figure 6 A schematic diagram of a scene of a light source transition mask area in the light source image processing method provided in an embodiment of the present application is shown.

[0057] Figure 7 A schematic diagram of a scene of a light source transition area before white balance processing in the light source image processing method provided in an embodiment of the present application is shown.

[0058] Figure 8 A schematic diagram of a scene of a light source transition area after white balance processing in the light source image processing method provided in an embodiment of the present application is shown.

[0059] Fig. 9 Another schematic flow chart of a light source image processing method provided in an embodiment of the present application is shown.

[0060] Fig.10 Another flow chart of the light source image processing method provided in the embodiment of the present application is shown.

[0061] Fig.11 A schematic diagram of a scene of an expansion transition mask area in the light source image processing method provided in an embodiment of the present application is shown.

[0062] Fig.12Another flow chart of the light source image processing method provided in the embodiment of the present application is shown.

[0063] Fig.13 A schematic diagram of a scene of a smooth transition mask area in the light source image processing method provided in an embodiment of the present application is shown.

[0064] Fig.14 Another flow chart of the light source image processing method provided in the embodiment of the present application is shown.

[0065] Fig.15 Another flow chart of the light source image processing method provided in the embodiment of the present application is shown.

[0066] Fig.16 Another flow chart of the light source image processing method provided in the embodiment of the present application is shown.

[0067] Fig.17 Another flow chart of the light source image processing method provided in the embodiment of the present application is shown.

[0068] Fig.18 A structural block diagram of a light source image processing device provided in an embodiment of the present application is shown.

[0069] Fig.19 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0070] Fig. 20 A functional block diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0071] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0072] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or reference letters in different examples, and this repetition is for the purpose of simplification and clarity, which itself does not indicate the relationship between the various embodiments and / or settings discussed.

[0073] At present, when capturing a light source image, the transition area around the light source image may be larger than the transition area around the actual light source due to various reasons. For example, due to unstable shooting environment, unstable shooting parameters, etc., the transition area around the light source image may be larger than the transition area around the actual light source. The light source transition area of ​​the light source image is larger, resulting in lower image quality of the light source image.

[0074] In response to the above problems, the light source image processing method, electronic device and storage medium provided in the embodiments of the present application determine a first light source transition region of a first light source image, and determine white balance parameters based on the first light source transition region, where the white balance parameters include a target channel optimization direction and a target channel optimization number, and perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, wherein a first area of ​​the first light source transition region is larger than a second area of ​​the second light source transition region of the second light source image, thereby performing white balance processing on the light source image according to the target channel optimization direction and the target channel optimization number corresponding to the light source transition region of the light source image, thereby greatly reducing the difference between color channels in the light source transition region, reducing the unnatural transition region of the light source image, and improving the image quality of the light source image.

[0075] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0076] The light source image processing method provided in the embodiment of the present application can be applied to electronic devices. The electronic devices can include various terminal devices, which can also be called terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc.

[0077] The terminal device may be a mobile phone, a sweeping robot, a drone, a smart TV, a wearable device, a PDA, a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc. The type of terminal device is not limited here, and it can be set according to actual needs.

[0078] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device.

[0079] See also Figure 1 , which shows a schematic diagram of the structure of the software system of an electronic device provided by an embodiment of the present application. The software system includes several layers, each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, namely, the application layer, the application framework layer, the system library, and the kernel layer from top to bottom.

[0080] The application layer may include a series of applications. For example, the application layer may include a camera application, a gallery application, a call application, a wireless local area network (Wireless Local Area Networks, WLAN) application, a video application, a media provider (MediaProvider) application, a user space file system (Filesystem in Userspace, FUSE) application, etc.

[0081] The media provider is used to create multimedia files in FUSE or access multimedia files in FUSE. Each application in the application layer can create multimedia files in FUSE through the media provider MediaProvider or access multimedia files in FUSE through the media provider MediaProvider.

[0082] FUSE is used to store the multimedia files that the media provider creates. Of course, in other embodiments, FUSE also can be used to store other data.

[0083] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions. For example, the application framework layer may include a window manager, a content provider, a resource manager, and a view system.

[0084] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0085] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0086] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0087] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0088] System libraries may include Surface Manager, Media Libraries, Android Rruntime, etc.

[0089] The Android runtime consists of a core library and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0090] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0091] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0092] The kernel layer may include modules such as camera driver, display driver, Wi-Fi driver, Bluetooth driver, and audio driver.

[0093] Understandably, Figure 1 The layers in the software structure shown and the components contained in each layer do not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer layers than shown in the figure, and each layer may include more or fewer components, which is not limited in the present application.

[0094] See also Figure 2 , which shows a flow chart of a light source image processing method provided by an embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Figure 2 The process shown is described in detail, and the light source image processing method may include the following steps 110 to 130.

[0095] Step 110: Determine a first light source transition region of a first light source image.

[0096] In an embodiment of the present application, when the user needs to optimize the first light source image, an optimization instruction can be sent to the electronic device, and the electronic device receives and responds to the optimization instruction to determine the first light source transition area of ​​the first light source image.

[0097] The light source may be any one of the sun, LED lamps, OLED lamps, fluorescent lamps, incandescent lamps or lightning, etc., and is not limited here.

[0098] The first light source image may be an initial image of the light source acquired by the electronic device, and the first light source image may be any one of an RGB color space image, a Lab color space image, a CMYK color space image, an HSV color space image, or an HSL color space image, etc. The first light source transition area may be an area in the first light source image where there is a color channel difference around the light source.

[0099] As an example, the light source may be the sun, and the first light source image may be an image of the sun, such as Figure 3 As shown, the first light source transition area can be Figure 3 The area shown in area A.

[0100] In some embodiments, when the user needs to optimize the first light source image, an optimization instruction can be sent to the electronic device, which receives and responds to the optimization instruction, performs LCH color space conversion on the first light source image to obtain an LCH image, and binarizes the LCH image to obtain a binary mask image, and determines the first light source transition area according to the binary mask image, and determines the light source transition area of ​​the light source image based on the binary mask image obtained by binarizing the LCH image in the LCH color space. Since the LCH color space is closer to the daily description of color habits, the binary mask image is easier to analyze, which is beneficial to improving the detection accuracy of the light source transition area based on the binary mask image.

[0101] Specifically, when the user needs to optimize the first light source image, an optimization instruction can be sent to the electronic device, and the electronic device receives and responds to the optimization instruction, performs LCH color space conversion on the first light source image, and obtains an LCH image, such as Figure 4 As shown, the LCH value of each pixel of the LCH image is determined, and the LCH image is binarized according to the LCH value of each pixel to obtain a binary mask image, such as Figure 5 As shown, the first light source transition area is determined according to the binary mask image, and the LCH image is binarized pixel by pixel according to the LCH value of each pixel of the LCH image to obtain the binary mask image, thereby improving the accuracy of the binary mask image.

[0102] The LCH value may include a lightness value (L), a saturation value (C), and a hue value (H).

[0103] Regarding the process of the electronic device determining the LCH value of each pixel point of the LCH image, as an implementation mode, the electronic device may decouple and separate the LCH image to obtain the LCH value of each pixel point.

[0104] Regarding the process in which the above-mentioned electronic device binarizes the LCH image according to the LCH value of each pixel point to obtain a binary mask image, as an implementation mode, the electronic device can determine a brightness channel mask value, a saturation channel mask value and a hue channel mask value according to the brightness value, saturation value and hue value of each pixel point, and determine a pixel mask value according to a brightness channel mask value, a saturation channel mask value and a hue channel mask value corresponding to each pixel point, and generate a binary mask image according to a pixel mask value corresponding to each pixel point, and generate a binary mask image based on the pixel mask value determined based on the brightness channel mask value, the saturation channel mask value and the hue channel mask value of each pixel point of the LCH image, thereby improving the generation accuracy of the binary mask image.

[0105] Among them, the electronic device can determine a brightness channel mask value according to the brightness value of each pixel and the brightness threshold range, determine a saturation channel mask value according to the saturation value of each pixel and the saturation threshold range, and determine a hue channel mask value according to the hue value of each pixel and the hue threshold range, and determine the corresponding brightness channel mask value, saturation channel mask value and hue channel mask value based on the brightness value, saturation value and hue value of each pixel, thereby improving the accuracy of each channel mask value.

[0106] When the target brightness value of the target pixel is within the brightness threshold range, the electronic device determines that the target brightness channel mask value of the target pixel is 1; when the target brightness value of the target pixel is not within the brightness threshold range, the electronic device determines that the target brightness channel mask value is 0, and determines the brightness channel mask value of each pixel based on the brightness value of each pixel and the brightness threshold range, which is beneficial to improving the calculation accuracy of the pixel mask value calculated based on the brightness channel mask value.

[0107] As an example, the brightness value of the i-th pixel in the LCH image is L(x i ,y i ), the brightness threshold range is (th_L_lower, th_L_upper).

[0108] When th_L_lower<L(x i ,y i )<th_L_upper, mark the brightness channel mask value mask_L(x i ,y i ) is 1;

[0109] When L(x i ,y i )≤th_L_lower or L(x i ,y i )≥th_L_upper, mark the brightness channel mask value mask_L(x i ,y i ) is 0.

[0110] When the target saturation value of the target pixel is within the saturation threshold range, the electronic device determines that the target saturation channel mask value of the target pixel is 1; when the target saturation value of the target pixel is not within the saturation threshold range, the electronic device determines that the target saturation channel mask value is 0. Based on the saturation value of each pixel and the saturation threshold range, the saturation channel mask value of each pixel is determined, which is conducive to improving the calculation accuracy of the pixel mask value calculated based on the saturation channel mask value.

[0111] As an example, the saturation value of the i-th pixel in the LCH image is C(x i ,y i ), the saturation threshold range is (th_C_lower, th_C_upper).

[0112] When th_C_lower<C(x i ,y i )<th_C_upper, mark the saturation channel mask value mask_C(x i ,y i ) is 1;

[0113] When C(x i ,y i )≤th_C_lower or C(x i ,y i )≥th_C_upper, mark the saturation channel mask value mask_C(x i ,y i ) is 0.

[0114] When the target hue value of the target pixel is within the hue threshold range, the electronic device determines that the target hue channel mask value of the target pixel is 1; when the target hue value of the target pixel is not within the hue threshold range, the electronic device determines that the target hue channel mask value is 0, and determines the hue channel mask value of each pixel based on the hue value of each pixel and the hue threshold range, which is conducive to improving the calculation accuracy of the pixel mask value calculated based on the hue channel mask value.

[0115] As an example, the hue value of the i-th pixel in the LCH image is H(x i ,y i ), the hue threshold range is (th_H_lower, th_H_upper).

[0116] When th_H_lower<H(x i ,y i )<th_H_upper, mark the hue channel mask value mask_H(x i ,y i ) is 1;

[0117] When H(x i ,y i )≤th_H_lower or H(x i ,y i )≥th_H_upper, mark the hue channel mask value mask_H(x i ,yi ) is 0.

[0118] When the target brightness channel mask value corresponding to the target pixel point is 1, the target saturation channel mask value is 1, and the target hue channel mask value is 1, the electronic device determines that the target pixel mask value of the target pixel point is 1; otherwise, the electronic device determines that the target pixel mask value is 0, and calculates the corresponding pixel mask value according to the product of the brightness channel mask value, the saturation channel mask value, and the hue channel mask value of each pixel point, thereby improving the contrast of the image and facilitating improving the accuracy of generating the binary mask image.

[0119] As an example, the lightness channel mask value of the i-th pixel in the LCH image is mask_L(x i ,y i ), the saturation channel mask value is mask_C(x i ,y i ) and the hue channel mask value is mask_H(x i ,y i ), the pixel mask value mask(x i ,y i ).

[0120] Formula 1 is: mask(x i ,y i )=mask_L(x i ,y i )·mask_C(x i ,y i )·mask_H(x i ,y i ).

[0121] When mask_L(x i ,y i )=1,mask_C(x i ,y i )=1 and mask_H(x i ,y i )=1, mask(x i ,y i )=1; otherwise mask(x i ,y i )=0.

[0122] Regarding the process in which the electronic device determines the first light source transition region according to the binary mask image, as an implementation mode, the electronic device may determine the light source transition mask region in the binary mask image, such as Figure 6As shown, the area in the first light source image corresponding to the light source transition mask area is determined as the first light source transition area. The light source transition mask area in the binary mask image has a high contrast with the non-light source transition mask area. The light source transition area of ​​the light source image is determined according to the light source transition mask area, which is beneficial to improving the accuracy of the light source transition area.

[0123] The light source transition mask area is an area whose binary value is 1 in the binary mask image, and the area is surrounded by an area whose binary value is 0.

[0124] The electronic device can determine the light source transition mask area from the binary mask image according to the binary value of each pixel point in the binary mask image.

[0125] In some embodiments, the electronic device may be provided with an input panel. When a user needs to optimize the first light source image, the user may input an optimization instruction on the input panel of the electronic device, for example, by handwriting the optimization instruction on the input panel of the electronic device, or by pressing a button on the input panel of the electronic device to input the optimization instruction. The electronic device receives the optimization instruction via the input panel.

[0126] In some embodiments, the electronic device may be provided with a voice recognition module. When a user needs to optimize the first light source image, a voice message may be sent within the voice collection range of the voice recognition module. The voice recognition module collects the voice message sent by the user, and performs voice recognition on the collected voice message to obtain a voice recognition result. When it is determined that the voice recognition result contains a keyword for instructing the electronic device to optimize the first light source image, for example, the keyword is "optimize the first light source image", or for another example, the keywords are "first light source image" and "optimize", etc., it is determined that the optimization instruction has been received.

[0127] As an example, the voice message sent by the user is: optimize the first light source image, and the voice recognition result of the voice recognition contains the keywords "first light source image" and "optimization", then it is determined that the optimization instruction is received.

[0128] In some embodiments, when the user needs to optimize the first light source image, an optimization instruction may be sent to the client. The client receives and responds to the optimization instruction, forwards the optimization instruction to the electronic device via the network, and the electronic device receives the optimization instruction forwarded by the client.

[0129] The client can be connected to the electronic device through the network and exchange data with the electronic device through the network. The client can be any of a mobile client (for example, a mobile client, a PDA client, a Tablet PC client, a laptop client, a smart watch client, a smart bracelet client, or a wearable client, etc.) or a fixed client (for example, a desktop client, a smart panel client, etc.), etc. The type of client is not limited here and can be set according to actual needs.

[0130] The network can be any of ZigBee network, Bluetooth (BT) network, Wireless Fidelity (Wi-Fi) network, Thread network, Long Range Radio (LoRa) network, Low-Power Wide-Area Network (LPWAN), Infrared network, Narrow Band Internet of Things (NB-IoT), Controller Area Network (CAN), Digital Living Network Alliance (DLNA) network, Wide Area Network (WAN), Local Area Network (LAN), Metropolitan Area Network (MAN) or Wireless Personal Area Network (WPAN), etc. The type of network is not limited here and can be set according to actual needs.

[0131] Step 120: Determine white balance parameters according to the first light source transition region.

[0132] In an embodiment of the present application, the electronic device may determine white balance parameters according to the first light source transition region, and the white balance parameters may include a target channel optimization direction and a target channel optimization number, etc.

[0133] In some embodiments, the electronic device can forward compensate the target channel of the first light source transition area by a preset constant to obtain a first compensation area, and reverse compensate the target channel of the first light source transition area by a preset constant to obtain a second compensation area, and determine the target channel optimization direction based on the third area of ​​the first compensation area and the fourth area of ​​the second compensation area. The target channel optimization direction is determined based on the area of ​​the light source transition area after forward compensation and reverse compensation of the target channel of the light source transition area, which is beneficial to improving the optimization accuracy when optimizing the target channel of the light source image.

[0134] Among them, the preset constant can be a channel constant corresponding to the target channel, the preset constant can be a channel constant pre-set by the user, or a channel constant automatically generated by the electronic device according to an optimization process of optimizing the light source image multiple times, etc., which is not limited here.

[0135] The process of forward compensating the preset constant for the target channel of the first light source transition area can be the number of target channels for each pixel point in the first light source transition area plus a preset constant, or can be the number of target channels for each pixel point in the first light source transition area multiplied by a preset constant, etc., which is not limited here.

[0136] The process of reversely compensating the preset constant for the target channel of the first light source transition area can be obtained by subtracting a preset constant from the target channel number for each pixel point in the first light source transition area, or by dividing the target channel number for each pixel point in the first light source transition area by a preset constant, etc., which is not limited here.

[0137] When the third area is smaller than the first area, the optimization direction of the target channel is determined to be the forward compensation direction; when the fourth area is smaller than the first area, the optimization direction of the target channel is determined to be the reverse compensation direction. The optimization direction of the target channel is determined based on the area change of the transition area after forward compensation and reverse compensation of the target channel, which is beneficial to improving the optimization accuracy when optimizing the target channel of the light source image.

[0138] In some embodiments, the first light source image may be an RGB color space image, the target channel may include at least any one of a red channel, a blue channel, and a green channel, and the target channel optimization direction may include at least any one of a red channel optimization direction, a blue channel optimization direction, and a green channel optimization direction corresponding to the target channel.

[0139] As an implementation manner, the first light source image may be an RGB color space image, the target channels may include a red channel and a blue channel, the target channel optimization directions may include a red channel optimization direction and a blue channel optimization direction, and during the imaging process of the light source image, the losses of the red channel and the blue channel in the light source transition area are large. White balance processing is performed on the light source image according to the red channel optimization direction and the blue channel optimization direction. Compared with the process of performing white balance processing on the light source image according to the red channel optimization direction, the blue channel optimization direction and the green channel optimization direction, it is beneficial to greatly reduce the difference between color channels while reducing the amount of calculation in the image processing process.

[0140] The first compensation region may include a first sub-region and a second sub-region, the second compensation region may include a third sub-region and a fourth sub-region, the third area may include the first sub-area and the second sub-area, and the fourth area may include the third sub-area and the fourth sub-area.

[0141] The electronic device can forward compensate the red channel of the first light source transition area by a preset constant to obtain a first sub-area, and reverse compensate the red channel of the first light source transition area by a preset constant to obtain a third sub-area, and determine the optimization direction of the red channel based on the first sub-area of ​​the first sub-area and the third sub-area of ​​the third sub-area. The optimization direction of the red channel is determined based on the area of ​​the light source transition area after forward compensation and reverse compensation of the red channel of the light source transition area, which is beneficial to improving the optimization accuracy of the red channel optimization of the light source image.

[0142] When the first sub-area is smaller than the first area, the optimization direction of the red channel is determined to be the forward compensation direction; when the third sub-area is smaller than the first area, the optimization direction of the red channel is determined to be the reverse compensation direction. The optimization direction of the red channel is determined based on the area change of the transition area after forward compensation and reverse compensation of the red channel, which is beneficial to improving the optimization accuracy when optimizing the red channel of the light source image.

[0143] As an example, the area mask (RGain, GGain, BGain) of the first light source transition region is a1 (ie, the first area), and the preset constant is delta.

[0144] The red channel of the first light source transition region is positively compensated by delta to obtain a first sub-region, and a first sub-area mask (RGain+delta, GGain, BGain) of the first sub-region is a2.

[0145] The red channel of the first light source transition region is reversely compensated for delta to obtain a third sub-region, and a third sub-area mask (RGain-delta, GGain, BGain) of the third sub-region is a3.

[0146] When a2<a1, the optimization direction of the red channel is determined to be the forward compensation direction; when a3<a1, the optimization direction of the red channel is determined to be the reverse compensation direction.

[0147] When one of a2 and a3 is greater than a1, the other must be less than a1; when one of a2 and a3 is less than a1, the other must be greater than a1.

[0148] The electronic device can forward compensate the blue channel of the first light source transition area by a preset constant to obtain a second sub-area, and reverse compensate the blue channel of the first light source transition area by a preset constant to obtain a fourth sub-area, and determine the optimization direction of the blue channel based on the second sub-area of ​​the second sub-area and the fourth sub-area of ​​the fourth sub-area. The optimization direction of the blue channel is determined based on the area of ​​the light source transition area after forward compensation and reverse compensation of the blue channel of the light source transition area, which is beneficial to improving the optimization accuracy of the blue channel optimization of the light source image.

[0149] When the second sub-area is smaller than the first area, the optimization direction of the blue channel is determined to be the forward compensation direction; when the fourth sub-area is smaller than the first area, the optimization direction of the blue channel is determined to be the reverse compensation direction. The optimization direction of the blue channel is determined based on the area change of the transition area after forward compensation and reverse compensation of the blue channel, which is beneficial to improving the optimization accuracy when optimizing the blue channel of the light source image.

[0150] As an example, the area mask (RGain, GGain, BGain) of the first light source transition region is a1 (ie, the first area), and the preset constant is delta.

[0151] The blue channel of the first light source transition region is positively compensated by delta to obtain a second sub-region, and a second sub-area mask (RGain, GGain, BGain+delta) of the second sub-region is a4.

[0152] The blue channel of the first light source transition region is reversely compensated by delta to obtain a fourth sub-region, and a fourth sub-area mask (RGain, GGain, BGain-delta) of the fourth sub-region is a5.

[0153] When a4<a1, the optimization direction of the blue channel is determined to be the forward compensation direction; when a5<a1, the optimization direction of the blue channel is determined to be the reverse compensation direction.

[0154] Among them, when one of a4 and a5 is greater than a1, the other must be less than a1; when one of a4 and a5 is less than a1, the other must be greater than a1.

[0155] In some embodiments, the electronic device may iteratively optimize the first light source transition region a target number of times according to the target channel optimization direction to obtain a target optimized region. When the area ratio of the fifth area of ​​the target optimized region to the first area is less than or equal to a preset ratio threshold, the target number of times is determined as the target channel optimization number. The channel optimization number of the light source transition region is determined according to the area of ​​the light source transition region after channel optimization. In the process of performing white balance processing on the light source image according to the channel optimization number, it can be prevented that the electronic device over-optimizes the light source image and occupies a large amount of computing resources, resulting in a decrease in the system performance of the electronic device, which is beneficial to improving the system performance of the electronic device.

[0156] Among them, the preset ratio threshold can be used to characterize the minimum area ratio of the light source transition area after optimization and before optimization when the color channel difference in the light source transition area is small. The preset ratio threshold can be an area ratio pre-set by the user, or it can be an area ratio automatically generated by the electronic device according to an optimization process of optimizing the light source image multiple times, etc., which is not limited here.

[0157] In some embodiments, the first light source image may be an RGB color space image, the target channel may include a red channel and a blue channel, and the target channel optimization direction may include a red channel optimization direction and a blue channel optimization direction.

[0158] The electronic device can iteratively optimize the first light source transition area a target number of times according to the red channel optimization direction and the blue channel optimization direction to obtain the target optimization area. When the area ratio of the fifth area of ​​the target optimization area to the first area is less than or equal to a preset ratio threshold, the target number of times is determined as the channel optimization number.

[0159] As an example, the preset constant delta=0.1, and the preset ratio threshold may be 1 / 3.

[0160] The electronic device can iteratively optimize the first light source transition area N times according to the red channel optimization direction and the blue channel optimization direction according to the preset constant delta=0.1 to obtain the target optimization area. When the area ratio of the fifth area of ​​the target optimization area to the first area is less than or equal to 1 / 3, N times is determined as the number of channel optimization times.

[0161] Step 130: performing white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0162] In an embodiment of the present application, the electronic device can perform white balance processing on the first light source image according to the target channel optimization direction and the target channel optimization number to obtain the second light source image, and the first area of ​​the first light source transition region is larger than the second area of ​​the second light source transition region of the second light source image, thereby realizing white balance processing on the light source image according to the target channel optimization direction and the target channel optimization number corresponding to the light source transition region of the light source image, greatly reducing the difference between the color channels in the light source transition region, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0163] In some embodiments, the second area may be zero, indicating that the light source transition region of the light source image disappears after white balance processing, thereby greatly improving the image quality of the light source image.

[0164] In an application scenario, the light source may be the sun, and the first light source image may be an RGB color space image, such as Figure 7 As shown, the first light source transition region can be as Figure 7 As shown in area B in , the target channel optimization direction and the target channel optimization times can be determined according to the first light source transition area, and the target channel optimization direction can include a red channel optimization direction and a blue channel optimization direction.

[0165] According to the optimization direction of the red channel and the optimization direction of the blue channel, the first light source image is iteratively optimized for the number of target channel optimizations to obtain the second light source image, such as Figure 8 As shown, the second light source transition area is as follows Figure 8 As shown in area C.

[0166] Among them, the area of ​​region B is larger than the area of ​​region C.

[0167] The solution provided by the present application determines a first light source transition region of a first light source image, determines white balance parameters based on the first light source transition region, wherein the white balance parameters include a target channel optimization direction and a target channel optimization number, and performs white balance processing on the first light source image based on the white balance parameters to obtain a second light source image, wherein a first area of ​​the first light source transition region is larger than a second area of ​​the second light source transition region of the second light source image, thereby performing white balance processing on the light source image based on the target channel optimization direction and the target channel optimization number corresponding to the light source transition region of the light source image, thereby greatly reducing the difference between color channels in the light source transition region, reducing an unnatural transition region of the light source image, and improving the image quality of the light source image.

[0168] See also Fig. 9 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig. 9 The process shown in FIG. 2 is described in detail, and the light source image processing method may include the following steps 210 to 270 .

[0169] Step 210: Perform LCH color space conversion on the first light source image to obtain an LCH image.

[0170] Step 220: binarize the LCH image to obtain a binary mask image.

[0171] In this embodiment, step 210 and step 220 may refer to the contents of the corresponding steps in the aforementioned embodiment, which will not be described in detail here.

[0172] Step 230: Determine a light source mask image according to the first light source image.

[0173] In this embodiment, the electronic device can determine the position of the light source in the first light source image, determine the minimum enclosing circle of the light source position according to the minimum enclosing circle algorithm, and generate a light source mask image according to the minimum enclosing circle. The light source mask image is generated based on the minimum enclosing circle determined by the minimum enclosing circle algorithm. Since the minimum enclosing circle algorithm has high computational efficiency and computational accuracy, it is beneficial to improve the generation efficiency and generation accuracy of the light source mask image.

[0174] Among them, the electronic device can obtain a pixel brightness of each pixel point in the first light source image to obtain multiple pixel brightnesses, and select multiple target pixel brightnesses whose pixel brightness is greater than or equal to a brightness threshold from the multiple pixel brightnesses, and determine the pixel area positions corresponding to the multiple target pixel brightnesses as the light source positions. Since the pixel brightness corresponding to the light source position is relatively large, determining the light source position based on the pixel brightness of each pixel point of the first light source image is conducive to improving the accuracy of the light source position.

[0175] The brightness threshold can be used to characterize the minimum pixel brightness of the pixel position when the pixel position is the light source position. The brightness threshold can be a pixel brightness value pre-set by the user, or it can be a pixel brightness value automatically generated by the electronic device according to an optimization process of optimizing the light source image multiple times, etc., which is not limited here.

[0176] After the electronic device determines the minimum enclosing circle of the light source position in the first light source image, it can perform binarization processing on the first light source image to obtain a light source mask image.

[0177] Specifically, the electronic device assigns a value of 1 to an image area corresponding to a minimum enclosing circle in the first light source image, and assigns a value of 0 to an image area outside the minimum enclosing circle, thereby obtaining a light source mask image.

[0178] As an example, the minimum enclosing circle algorithm process is explained. The point set P of the light source position can be randomly arranged, and the minimum enclosing circle C of the point set P can be recursively solved. The first point p is selected from the point set P, and the minimum enclosing circle C' of the remaining point set is recursively solved. When the minimum enclosing circle C' contains the point p, the minimum enclosing circle C' is determined as the minimum enclosing circle of the light source position. When the minimum enclosing circle C' does not contain the point p, the next point is selected from the point set P, and the recursive solution of the minimum enclosing circle C'' of the remaining point set is repeated until the minimum enclosing circle C'' contains the point p, and the minimum enclosing circle C'' is determined as the minimum enclosing circle of the light source position.

[0179] Step 240: Determine whether the light source mask image is connected to the binary mask image.

[0180] In this embodiment, the electronic device can determine whether the light source mask image is connected to the binary mask image. Both the light source mask image and the binary mask image correspond to the first light source image. The connectivity between the light source mask image and the binary mask image is judged to facilitate the judgment of the detection accuracy of the light source transition area based on the binary mask image.

[0181] Among them, the pixel positions of the light source mask image correspond one-to-one to the pixel positions of the binary mask image. The electronic device can calculate the product of the corresponding binary value of the light source mask image and the binary value of the binary mask image according to each pixel point, obtain the pixel binarization product, and calculate the sum of all pixel binarization products, and determine whether the light source mask image and the binary mask image are connected according to the sum of all pixel binarization products.

[0182] When the sum of the binarization products of all pixels is greater than or equal to 1, it is determined that the source mask image is connected to the binary mask image; when the sum of the binarization products of all pixels is less than 1, it is determined that the source mask image is not connected to the binary mask image.

[0183] Step 250: When it is determined that the light source mask image is connected to the binary mask image, determine the first light source transition region according to the binary mask image.

[0184] In this embodiment, when the electronic device determines that the light source mask image is connected to the binary mask image, the first light source transition area can be determined based on the binary mask image. Both the light source mask image and the binary mask image correspond to the light source image. When the light source mask image is connected to the binary mask image, the light source transition area is detected based on the binary mask image, which is beneficial to improving the detection accuracy of the light source transition area.

[0185] Step 260: Determine white balance parameters according to the first light source transition region.

[0186] Step 270: Perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0187] In this embodiment, step 260 and step 270 may refer to the contents of the corresponding steps in the aforementioned embodiment, which will not be described in detail here.

[0188] The solution provided by this embodiment performs LCH color space conversion on the first light source image to obtain an LCH image, and performs binarization processing on the LCH image to obtain a binary mask image, and determines the light source mask image according to the first light source image, and determines whether the light source mask image and the binary mask image are connected, and when it is determined that the light source mask image and the binary mask image are connected, determines the first light source transition area according to the binary mask image, and determines the white balance parameters according to the first light source transition area, and performs white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, thereby realizing white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition area of ​​the light source image, greatly reducing the difference between the color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0189] Furthermore, the light source mask image and the binary mask image both correspond to the light source image. When the light source mask image and the binary mask image are connected, the light source transition area is detected based on the binary mask image, which is beneficial to improving the detection accuracy of the light source transition area.

[0190] See also Fig.10 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig.10 The process shown is described in detail, and the light source image processing method may include the following steps 310 to 370.

[0191] Step 310: Perform LCH color space conversion on the first light source image to obtain an LCH image.

[0192] Step 320: binarize the LCH image to obtain a binary mask image.

[0193] Step 330: Determine the light source transition mask area in the binary mask image.

[0194] In this embodiment, step 310, step 320 and step 330 may refer to the contents of the corresponding steps in the aforementioned embodiment, which will not be described in detail here.

[0195] Step 340: dilate the light source transition mask region to obtain an expanded transition mask region.

[0196] In this embodiment, the electronic device can perform expansion processing on the light source transition mask area according to a preset expansion coefficient to obtain an expanded transition mask area, such as Fig.11 As shown, the light source transition mask area is expanded, the boundary of the light source transition mask area is expanded, and the clarity of the expanded transition mask area is improved.

[0197] The preset expansion coefficient may be an expansion ratio preset by a user, or may be an expansion ratio automatically generated by the electronic device according to an optimization process of optimizing the light source image multiple times, and is not limited here.

[0198] Step 350: Determine the area in the first light source image that corresponds to the dilated transition mask area as the first light source transition area.

[0199] In this embodiment, the electronic device can determine the area in the first light source image corresponding to the expanded transition mask area as the first light source transition area. The boundary of the expanded transition mask area after the expansion processing is larger and has higher clarity, which is conducive to improving the detection accuracy of the light source transition area based on the expanded transition mask area.

[0200] Step 360: Determine white balance parameters according to the first light source transition region.

[0201] Step 370: Perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0202] In this embodiment, step 360 and step 370 may refer to the contents of the corresponding steps in the aforementioned embodiment, which will not be described in detail here.

[0203] The solution provided in this embodiment performs LCH color space conversion on the first light source image to obtain an LCH image, performs binarization processing on the LCH image to obtain a binary mask image, determines a light source transition mask area in the binary mask image, performs dilation processing on the light source transition mask area to obtain an expanded transition mask area, determines an area in the first light source image corresponding to the expanded transition mask area as a first light source transition area, determines white balance parameters according to the first light source transition area, and performs white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, thereby achieving white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition area of ​​the light source image, greatly reducing the difference between color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0204] Furthermore, the light source transition mask area is expanded to expand the boundary of the light source transition mask area, and the clarity of the expanded transition mask area is improved, which is beneficial to improving the detection accuracy of the light source transition area according to the expanded transition mask area.

[0205] See also Fig.12 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig.12 The process shown is described in detail, and the light source image processing method may include the following steps 410 to 480.

[0206] Step 410: Perform LCH color space conversion on the first light source image to obtain an LCH image.

[0207] Step 420: binarize the LCH image to obtain a binary mask image.

[0208] Step 430: Determine the light source transition mask area in the binary mask image.

[0209] Step 440: dilate the light source transition mask region to obtain an expanded transition mask region.

[0210] In this embodiment, step 410, step 420, step 430 and step 440 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be described in detail here.

[0211] Step 450: Smoothing the dilated transition mask region to obtain a smoothed transition mask region.

[0212] In this embodiment, the electronic device can perform smoothing on the expansion transition mask region to obtain a smooth transition mask region, such as Fig.13 As shown, the random noise in the dilated transition mask region can be reduced by smoothing the dilated transition mask region.

[0213] Step 460: Determine the area in the first light source image that corresponds to the smooth transition mask area as the first light source transition area.

[0214] In this embodiment, the electronic device can determine the area in the first light source image corresponding to the smooth transition mask area as the first light source transition area. The smooth transition mask area after smoothing has less random noise, which is conducive to further improving the detection accuracy of the light source transition area.

[0215] Step 470: Determine white balance parameters according to the first light source transition region.

[0216] Step 480: Perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0217] In this embodiment, step 470 and step 480 may refer to the contents of the corresponding steps in the aforementioned embodiment, which will not be described in detail here.

[0218] The solution provided by this embodiment performs LCH color space conversion on the first light source image to obtain an LCH image, and performs binarization processing on the LCH image to obtain a binary mask image, and determines the light source transition mask area in the binary mask image, and performs dilation processing on the light source transition mask area to obtain an dilated transition mask area, and performs smoothing processing on the dilated transition mask area to obtain a smooth transition mask area, and determines the area corresponding to the smooth transition mask area in the first light source image as the first light source transition area, and determines the white balance parameters according to the first light source transition area, and performs white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, so as to realize white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition area of ​​the light source image, thereby greatly reducing the difference between the color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0219] Furthermore, smoothing the expansion transition mask region can reduce random noise in the expansion transition mask region, which is beneficial to further improve the detection accuracy of the light source transition region.

[0220] See also Fig.14 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig.14 The process shown is described in detail, and the light source image processing method may include the following steps 510 to 550.

[0221] Step 510: Determine a first light source transition region of a first light source image.

[0222] Step 520: Determine white balance parameters according to the first light source transition region.

[0223] Step 530: performing white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0224] In this embodiment, step 510, step 520 and step 530 may refer to the contents of the corresponding steps in the aforementioned embodiment, which will not be described again here.

[0225] Step 540: Determine an initial color restoration matrix of the first light source image.

[0226] In this embodiment, the electronic device may obtain the ambient color temperature of the first light source image, and calculate an initial color correction matrix (Color Correction Matrix, CCM) of the first light source image according to the ambient color temperature.

[0227] Among them, the initial CCM can be used to correct the color of the image so that the corrected image color is closer to the natural color or the perception of the human eye, and the electronic device can analyze the first light source image to obtain the ambient color temperature of the first light source image.

[0228] Step 550: Perform color restoration on the second light source transition area according to the initial color restoration matrix to obtain a third light source image.

[0229] In this embodiment, the electronic device can perform color restoration on the second light source transition area according to the initial CCM to obtain a third light source image, and perform color correction on the light source transition area processed by white balance based on the initial CCM, so that the image color of the third light source image after color correction is closer to the natural color or the perception of the human eye, thereby further improving the image quality of the light source image.

[0230] The solution provided by this embodiment determines the first light source transition area of ​​the first light source image, determines the white balance parameters according to the first light source transition area, performs white balance processing on the first light source image according to the white balance parameters to obtain the second light source image, determines the initial color restoration matrix of the first light source image, and performs color restoration on the second light source transition area according to the initial color restoration matrix to obtain the third light source image, thereby realizing white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition area of ​​the light source image, greatly reducing the difference between the color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0231] Furthermore, the light source transition area of ​​the white balance processing is color corrected based on the initial color restoration matrix, so that the image color of the third light source image after color correction is closer to the natural color or the perception of the human eye, further improving the image quality of the light source image.

[0232] See also Fig.15 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig.15 The process shown in FIG. 1 is described in detail, and the light source image processing method may include the following steps 610 to 670 .

[0233] Step 610: Determine a first light source transition region of a first light source image.

[0234] Step 620: Determine white balance parameters according to the first light source transition region.

[0235] Step 630: Perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0236] Step 640: Determine an initial color restoration matrix of the first light source image.

[0237] In this embodiment, step 610, step 620, step 630 and step 640 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be repeated here.

[0238] Step 650: Determine whether the color channel is truncated during the color restoration process of the second light source transition region by the initial color restoration matrix.

[0239] In this embodiment, the electronic device may determine whether the color channel is cut off during the color restoration performed by the initial CCM on the second light source transition region.

[0240] Among them, the electronic device can calculate the product of the initial CCM and the initial color channel value of the second light source transition area to obtain the target color channel value, and determine whether the color channel is truncated during the color restoration process of the second light source transition area by the initial CCM according to the target color channel value.

[0241] When the target color channel value exceeds the preset color channel value range, it is determined that the color channel is truncated in the process of color restoration of the second light source transition area by the initial CCM; when the target color channel value does not exceed the preset color channel value range, it is determined that the color channel is not truncated in the process of color restoration of the second light source transition area by the initial CCM.

[0242] The preset color channel value range is associated with the color channel of the second light source transition area, for example, the RGB color channel value range is 0-255.

[0243] As an example, the first light source image is an RGB color space image, the initial color channel values ​​may include R, G and B, the initial CCM is a 3×3 matrix, and the target color channel values ​​R', G' and B' may be calculated according to Formula 2.

[0244] Formula 2 is:

[0245] R'=R·CCM[1,1]+G·CCM[1,2]+B·CCM[1,3];

[0246] G'=R·CCM[2,1]+G·CCM[2,2]+B·CCM[2,3];

[0247] B'=R·CCM[3,1]+G·CCM[3,2]+B·CCM[3,3];

[0248] Among them, CCM[1,1] represents the first row and first column of the initial matrix CCM, CCM[1,2] represents the first row and second column of the initial matrix CCM, CCM[1,3] represents the first row and third column of the initial matrix CCM, CCM[2,1] represents the second row and first column of the initial matrix CCM, CCM[2,2] represents the second row and second column of the initial matrix CCM, CCM[2,3] represents the second row and third column of the initial matrix CCM, CCM[3,1] represents the third row and first column of the initial matrix CCM, CCM[3,2] represents the third row and second column of the initial matrix CCM, and CCM[3,3] represents the third row and third column of the initial matrix CCM.

[0249] Step 660: When it is determined that the initial color restoration matrix cuts off the color channel during the color restoration of the second light source transition region, the initial color restoration matrix is ​​optimized to obtain a target color restoration matrix.

[0250] In this embodiment, when the electronic device determines that the initial CCM cuts off the color channel during the color restoration of the second light source transition region, the initial CCM may be optimized to obtain the target CCM.

[0251] The CCM may be optimized according to a preset ratio, the preset ratio is related to the maximum color channel cutoff value, and the preset ratio is a value between 0 and 1.

[0252] As an example, the first light source image is an RGB color space image, the initial color channel values ​​may include R, G and B, the initial CCM is a 3×3 matrix (denoted as CCM), and the target color channel values ​​R', G' and B' can be calculated according to Formula 2, and the preset ratio is Ratio.

[0253] CCM can be optimized according to a preset ratio Ratio to obtain a target CCM (denoted as CCM'), and Ratio, CCM and CCM' satisfy Formula 3.

[0254] Formula three is:

[0255] CCM'[1,1]=1+(CCM[1,1]-1)·Ratio;

[0256] CCM'[2, 2]=1+(CCM[2, 2]-1)·Ratio;

[0257] CCM'[3,3]=1+(CCM[3,3]-1)·Ratio;

[0258] CCM'[1, 2]=0+(CCM[1, 2]-0)·Ratio;

[0259] CCM'[1,3]=0+(CCM[1,3]-0)·Ratio;

[0260] CCM'[2,1]=0+(CCM[2,1]-0)·Ratio;

[0261] CCM'[2,3]=0+(CCM[2,3]-0)·Ratio;

[0262] CCM'[3,1]=0+(CCM[3,1]-0)·Ratio;

[0263] CCM'[3, 2]=0+(CCM[3, 2]-0)·Ratio;

[0264] CCM'[1, 1] represents the first row and first column of the target matrix CCM, CCM'[2, 2] represents the second row and second column of the target matrix CCM, CCM'[3, 3] represents the third row and third column of the target matrix CCM, CCM'[1, 2] represents the first row and second column of the target matrix CCM, CCM'[1, 3] represents the first row and third column of the target matrix CCM, CCM'[2, 1] represents the second row and first column of the target matrix CCM, CCM'[2, 3] represents the second row and third column of the target matrix CCM, CCM'[3, 1] represents the third row and first column of the target matrix CCM, and CCM'[3, 2] represents the third row and second column of the target matrix CCM.

[0265] The maximum channel cutoff value RGB_clip may be calculated according to formula 4 based on the initial color channel values ​​R, G, B and the target color channel values ​​R', G', B'.

[0266] Formula 4 is: RGB_clip=max(R-(abs(R')-R) / 2, G-(abs(G')-G) / 2, B-(abs(B')-B) / 2);

[0267] abs(R') represents the absolute value of the target color channel R', abs(G') represents the absolute value of the target color channel G', and abs(B') represents the absolute value of the target color channel B'.

[0268] The value of the preset ratio Ratio can be determined according to the maximum channel cutoff value RGB_clip.

[0269] When RGB_clip=0, the preset ratio Ratio=1 is determined;

[0270] When RGB_clip=value between 0 and 20, the preset ratio Ratio=1-(RGB_clip / 20) is determined;

[0271] When RGB_clip=20, the preset ratio Ratio=0 is determined;

[0272] When RGB_clip>20, it is determined that the preset ratio Ratio=0.

[0273] Step 670: Perform color restoration on the second light source transition area according to the target color restoration matrix to obtain a third light source image.

[0274] In this embodiment, the electronic device can perform color restoration on the second light source transition area according to the target CCM to obtain a third light source image. During the color restoration process, the contrast of the color restored image is reduced due to the truncation of the color channel. When the color channel is truncation when the initial color restoration matrix performs color restoration on the light source transition area, the initial color restoration matrix is ​​optimized to a target color restoration matrix that does not cause truncation of the color channel when performing color restoration on the light source transition area, thereby suppressing the contrast reduction caused by the transition area being restored by the target color restoration matrix, which is beneficial to improving the image quality of the color restored image.

[0275] The target CCM does not cut off the color channel during the color restoration of the second light source transition region.

[0276] The solution provided by this embodiment determines a first light source transition region of a first light source image, determines a white balance parameter according to the first light source transition region, performs white balance processing on the first light source image according to the white balance parameter to obtain a second light source image, determines an initial color restoration matrix of the first light source image, determines whether the process of color restoration of the second light source transition region by the initial color restoration matrix truncates the color channel, and when it is determined that the process of color restoration of the second light source transition region by the initial color restoration matrix truncates the color channel, optimizes the initial color restoration matrix to obtain a target color restoration matrix, and performs color restoration on the second light source transition region according to the target color restoration matrix to obtain a third light source image, thereby achieving white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition region of the light source image, greatly reducing the difference between the color channels in the light source transition region, reducing the unnatural transition region of the light source image, and improving the image quality of the light source image.

[0277] Furthermore, in the process of color restoration, the contrast of the image after color restoration decreases due to truncation of color channels. When the color channels are truncation when the initial color restoration matrix performs color restoration on the light source transition area, the initial color restoration matrix is ​​optimized to a target color restoration matrix in which the color channels are not truncation when the light source transition area is restored. This suppresses the contrast decrease caused by the transition area being restored by the target color restoration matrix, which is beneficial to improving the image quality of the color restored image.

[0278] See also Fig.16 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig.16 The process shown is described in detail, and the light source image processing method may include the following steps 710 to 780.

[0279] Step 710: Determine a first light source transition region of a first light source image.

[0280] Step 720: Determine white balance parameters according to the first light source transition region.

[0281] Step 730: Perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0282] Step 740: Determine an initial color restoration matrix of the first light source image.

[0283] Step 750: Determine whether the color channel is truncated during the color restoration process of the second light source transition region by the initial color restoration matrix.

[0284] Step 760: When it is determined that the initial color restoration matrix cuts off the color channel during the color restoration of the second light source transition region, the initial color restoration matrix is ​​optimized to obtain a target color restoration matrix.

[0285] Step 770: Perform color restoration on the second light source transition area according to the target color restoration matrix to obtain a third light source image.

[0286] In this embodiment, step 710, step 720, step 730, step 740, step 750, step 760 and step 770 can refer to the contents of the corresponding steps in the above-mentioned embodiments, which will not be repeated here.

[0287] Step 780: Perform pixel dithering processing on the third light source image to obtain a fourth light source image.

[0288] In this embodiment, the electronic device can perform pixel dithering processing on the third light source image to obtain a fourth light source image. Pixel dithering can create texture and increase the expressiveness of pixel painting. After the light source image is processed by pixel dithering, the light source transition area of ​​the light source image is smoother, further improving the image quality of the light source image.

[0289] In some embodiments, the electronic device may determine a first light source transition region of a first light source image, determine a white balance parameter based on the first light source transition region, perform white balance processing on the first light source image based on the white balance parameter to obtain a second light source image, and perform pixel dithering processing on the second light source image to obtain a fourth light source image.

[0290] The solution provided by this embodiment determines a first light source transition region of a first light source image, determines a white balance parameter according to the first light source transition region, performs white balance processing on the first light source image according to the white balance parameter to obtain a second light source image, determines an initial color restoration matrix of the first light source image, determines whether the process of color restoration of the second light source transition region by the initial color restoration matrix truncates the color channel, and when it is determined that the process of color restoration of the second light source transition region by the initial color restoration matrix truncates the color channel, optimizes the initial color restoration matrix to obtain a target color restoration matrix, performs color restoration on the second light source transition region according to the target color restoration matrix to obtain a third light source image, and performs pixel dithering processing on the third light source image to obtain a fourth light source image, thereby achieving white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition region of the light source image, greatly reducing the difference between the color channels in the light source transition region, reducing the unnatural transition region of the light source image, and improving the image quality of the light source image.

[0291] Furthermore, pixel dithering can create textures and increase the expressiveness of pixel paintings. After the light source image is processed by pixel dithering, the light source transition area of ​​the light source image is smoother, further improving the image quality of the light source image.

[0292] See also Fig.17 , which shows a flow chart of a light source image processing method provided by another embodiment of the present application. In a specific embodiment, the light source image processing method can be applied to electronic devices. Fig.17 The process shown is described in detail, and the light source image processing method may include the following steps 810 to 890.

[0293] Step 810: Determine a first light source transition region of a first light source image.

[0294] Step 820: Determine white balance parameters according to the first light source transition region.

[0295] Step 830: Perform white balance processing on the first light source image according to the white balance parameters to obtain a second light source image.

[0296] Step 840: Determine an initial color restoration matrix of the first light source image.

[0297] Step 850: Determine whether the color channel is truncated during the color restoration process of the second light source transition region by the initial color restoration matrix.

[0298] Step 860: When it is determined that the initial color restoration matrix cuts off the color channel during the color restoration of the second light source transition region, the initial color restoration matrix is ​​optimized to obtain a target color restoration matrix.

[0299] Step 870: Perform color restoration on the second light source transition area according to the target color restoration matrix to obtain a third light source image.

[0300] In this embodiment, step 810, step 820, step 830, step 840, step 850, step 860 and step 870 can refer to the contents of the corresponding steps in the above-mentioned embodiments, which will not be repeated here.

[0301] Step 880: compress the third light source image to obtain a fifth light source image.

[0302] In this embodiment, the electronic device may perform format compression on the third light source image to obtain a fifth light source image. Format compression on the light source image may reduce the image size of the light source image and improve the image compatibility.

[0303] Step 890: Perform pixel dithering processing on the fifth light source image to obtain a fourth light source image.

[0304] In this embodiment, the electronic device can perform pixel dithering processing on the fifth light source image to obtain a fourth light source image, and perform format compression and pixel dithering on the third light source image in sequence, which is beneficial to reducing the storage space occupied by the fourth light source image while improving the compatibility of the fourth light source image and improving the image quality of the fourth light source image.

[0305] In some embodiments, the electronic device may determine a first light source transition area of ​​a first light source image, determine a white balance parameter based on the first light source transition area, perform white balance processing on the first light source image based on the white balance parameter to obtain a second light source image, perform format compression on the second light source to obtain a fifth light source image, and perform pixel dithering processing on the fifth light source image to obtain a fourth light source image.

[0306] The solution provided by this embodiment determines the first light source transition area of ​​the first light source image, determines the white balance parameter according to the first light source transition area, performs white balance processing on the first light source image according to the white balance parameter to obtain the second light source image, determines the initial color restoration matrix of the first light source image, determines whether the process of color restoration of the second light source transition area by the initial color restoration matrix truncates the color channel, and when it is determined that the process of color restoration of the second light source transition area by the initial color restoration matrix truncates the color channel, optimizes the initial color restoration matrix to obtain the target color restoration matrix, performs color restoration on the second light source transition area according to the target color restoration matrix to obtain the third light source image, performs format compression on the third light source image to obtain the fifth light source image, and performs pixel dithering processing on the fifth light source image to obtain the fourth light source image, thereby achieving white balance processing on the light source image according to the target channel optimization direction and the target channel optimization times corresponding to the light source transition area of ​​the light source image, greatly reducing the difference between the color channels in the light source transition area, reducing the unnatural transition area of ​​the light source image, and improving the image quality of the light source image.

[0307] Furthermore, format compression of the light source image can reduce the image size of the light source image and improve the compatibility of the image. Format compression and pixel dithering of the third light source image in succession can help reduce the storage space occupied by the fourth light source image while improving the compatibility of the fourth light source image and improving the image quality of the fourth light source image.

[0308] See also Fig.18 , which shows a light source image processing device 900 provided by an embodiment of the present application. The light source image processing device 900 can be applied to electronic devices. The following takes electronic devices as an example. Fig.18 The light source image processing device 900 shown in FIG. 1 is described in detail. The light source image processing device 900 may include a first determination module 910 , a second determination module 920 and a white balance processing module 930 .

[0309] The first determination module 910 can be used to determine the first light source transition area of ​​the first light source image; the second determination module 920 can be used to determine the white balance parameters based on the first light source transition area, and the white balance parameters may include the target channel optimization direction and the target channel optimization times; the white balance processing module 930 can be used to perform white balance processing on the first light source image according to the white balance parameters to obtain the second light source image, and the first area of ​​the first light source transition area can be larger than the second area of ​​the second light source transition area of ​​the second light source image.

[0310] In some implementations, the second determination module 920 may include a first compensation submodule, a second compensation submodule, and a first determination submodule.

[0311] The first compensation submodule can be used to forward compensate the target channel of the first light source transition area by a preset constant to obtain a first compensation area; the second compensation submodule can be used to reverse compensate the target channel of the first light source transition area by a preset constant to obtain a second compensation area; the first determination submodule can be used to determine the optimization direction of the target channel based on the third area of ​​the first compensation area and the fourth area of ​​the second compensation area.

[0312] In some implementations, the first determining submodule may include a first determining unit and a second determining unit.

[0313] The first determination unit can be used to determine that the target channel optimization direction is the forward compensation direction when the third area is smaller than the first area; the second determination unit can be used to determine that the target channel optimization direction is the reverse compensation direction when the fourth area is smaller than the first area.

[0314] In some embodiments, the first light source image may be an RGB color space image, the target channel may include a red channel and a blue channel, and the target channel optimization direction may include a red channel optimization direction and a blue channel optimization direction.

[0315] In some implementations, the second determination module 920 may further include a first optimization submodule and a second determination submodule.

[0316] The first optimization submodule can be used to iteratively optimize the first light source transition area a target number of times according to the target channel optimization direction to obtain the target optimization area, and the area ratio of the fifth area of ​​the target optimization area to the first area can be less than or equal to a preset ratio threshold; the second determination submodule can be used to determine the target number of times as the target channel optimization number of times.

[0317] In some embodiments, the second area may be zero.

[0318] In some implementations, the first determination module 910 may include a conversion submodule, a processing submodule, and a third determination submodule.

[0319] The conversion submodule can be used to perform LCH color space conversion on the first light source image to obtain an LCH image; the processing submodule can be used to perform binarization processing on the LCH image to obtain a binary mask image; the third determination submodule can be used to determine the first light source transition area based on the binary mask image.

[0320] In some implementations, the light source image processing device 900 may further include a third determining module and a fourth determining module.

[0321] The third determination module can be used to determine the light source mask image according to the first light source image before the third determination submodule determines the first light source transition area according to the binary mask image; the fourth determination module can be used to determine whether the light source mask image is connected to the binary mask image.

[0322] In some embodiments, the third determining submodule may be configured to determine the first light source transition region according to the binarized mask image when it is determined that the light source mask image is connected to the binarized mask image.

[0323] In some implementations, the third determining module may include a fourth determining submodule, a fifth determining submodule, and a generating submodule.

[0324] The fourth determination submodule can be used to determine the light source position in the first light source image; the fifth determination submodule can be used to determine the minimum enclosing circle of the light source position according to the minimum enclosing circle algorithm; the generation submodule can be used to generate a light source mask image according to the minimum enclosing circle.

[0325] In some implementations, the processing submodule may include a third determining unit and a processing unit.

[0326] The third determination unit may be used to determine the LCH value of each pixel point of the LCH image; the processing unit may be used to perform binarization processing on the LCH image according to the LCH value of each pixel point to obtain a binary mask image.

[0327] In some embodiments, the LCH value may include a brightness value, a saturation value, and a hue value, and the processing unit may include a first determining subunit, a second determining subunit, and a generating subunit.

[0328] The first determination subunit can be used to determine a lightness channel mask value, a saturation channel mask value and a hue channel mask value according to the lightness value, saturation value and hue value of each pixel point; the second determination subunit can be used to determine a pixel mask value according to a lightness channel mask value, a saturation channel mask value and a hue channel mask value corresponding to each pixel point; the generation subunit can be used to generate a binary mask image according to a pixel mask value corresponding to each pixel point.

[0329] In some embodiments, the first determination subunit may include a first determination sub-subunit, a second determination sub-subunit, and a third determination sub-subunit.

[0330] The first determination sub-subunit can be used to determine a luminance channel mask value based on the luminance value of each pixel and the luminance threshold range; the second determination sub-subunit can be used to determine a saturation channel mask value based on the saturation value of each pixel and the saturation threshold range; the third determination sub-subunit can be used to determine a hue channel mask value based on the hue value of each pixel and the hue threshold range.

[0331] In some embodiments, the second determining sub-unit may include a fourth determining sub-sub-unit and a fifth determining sub-sub-unit.

[0332] The fourth determination sub-subunit can be used to determine that the target pixel mask value of the target pixel point is 1 when the target brightness channel mask value corresponding to the target pixel point is 1, the target saturation channel mask value is 1, and the target hue channel mask value is 1; the fifth determination sub-subunit can be used to determine that the target pixel mask value is 0 otherwise.

[0333] In some implementations, the third determining submodule may include a fourth determining unit and a fifth determining unit.

[0334] The fourth determination unit may be used to determine the light source transition mask region in the binary mask image; and the fifth determination unit may be used to determine the region in the first light source image corresponding to the light source transition mask region as the first light source transition region.

[0335] In some implementations, the light source image processing device 900 may further include a dilation processing module.

[0336] The expansion processing module can be used to expand the light source transition mask area to obtain an expanded transition mask area before the fifth determination unit determines the area corresponding to the light source transition mask area in the first light source image as the first light source transition area.

[0337] In some embodiments, the fifth determining unit may include a third determining subunit.

[0338] The third determining subunit may be configured to determine a region in the first light source image corresponding to the dilated transition mask region as the first light source transition region.

[0339] In some implementations, the light source image processing device 900 may further include a fifth determining module and a restoring module.

[0340] The fifth determination module may be used to determine an initial color restoration matrix of the first light source image; the restoration module may be used to perform color restoration on the second light source transition region according to the initial color restoration matrix to obtain a third light source image.

[0341] In some implementations, the light source image processing device 900 may further include a sixth determining module.

[0342] The sixth determination module can be used for the restoration module to perform color restoration on the second light source transition area according to the initial color restoration matrix, and before obtaining the third light source image, determine whether the process of color restoration on the second light source transition area by the initial color restoration matrix truncates the color channel.

[0343] In some implementations, the restoration module may include a second optimization submodule and a restoration submodule.

[0344] The second optimization submodule can be used to optimize the initial color restoration matrix to obtain a target color restoration matrix when it is determined that the initial color restoration matrix truncates the color channel in the process of color restoration of the second light source transition area; the restoration submodule can be used to perform color restoration on the second light source transition area according to the target color restoration matrix to obtain a third light source image, and the target color restoration matrix does not truncate the color channel in the process of color restoration of the second light source transition area.

[0345] In some implementations, the light source image processing device 900 may further include a dithering processing module.

[0346] The dithering processing module may be used to perform pixel dithering processing on the third light source image to obtain a fourth light source image.

[0347] In some implementations, the light source image processing device 900 may further include a compression processing module.

[0348] The compression processing module can be used for the dithering processing module to perform pixel dithering processing on the third light source image, and before obtaining the fourth light source image, perform format compression on the third light source image to obtain the fifth light source image.

[0349] In some implementations, the dither processing module may include a dither processing sub-module.

[0350] The dithering processing submodule may be used to perform pixel dithering processing on the fifth light source image to obtain a fourth light source image.

[0351] The solution provided by this embodiment determines a first light source transition region of a first light source image, determines white balance parameters according to the first light source transition region, wherein the white balance parameters include a target channel optimization direction and a target channel optimization number, and performs white balance processing on the first light source image according to the white balance parameters to obtain a second light source image, wherein a first area of ​​the first light source transition region is larger than a second area of ​​the second light source transition region of the second light source image, thereby performing white balance processing on the light source image according to the target channel optimization direction and the target channel optimization number corresponding to the light source transition region of the light source image, thereby greatly reducing the difference between color channels in the light source transition region, reducing an unnatural transition region of the light source image, and improving the image quality of the light source image.

[0352] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Any processing method described in the method embodiment can be implemented by the corresponding processing module in the device embodiment, and will not be repeated one by one in the device embodiment.

[0353] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0354] See also Fig.19 , which shows a hardware structure diagram of an electronic device 1000 provided by an embodiment of the present application. Fig.19 As shown, the electronic device 1000 may include a processor 1010, an external memory interface 1020, an internal memory 1021, a Universal Serial Bus (USB) interface 1030, a charging management module 1040, a power management module 1041, a battery 1042, an antenna 1, an antenna 2, a mobile communication module 1050, a wireless communication module 1060, an audio module 1070, a speaker 1070A, a receiver 1070B, a microphone 1070C, an earphone interface 1070D, a sensor module 1080, a button 1090, a motor 1091, an indicator 1092, a camera 1093, a display screen 1094, and a Subscriber Identification Module (SIM) card interface 1095, etc. Among them, the sensor module 1080 may include a pressure sensor 1080A, a gyroscope sensor 1080B, an air pressure sensor 1080C, a magnetic sensor 1080D, an acceleration sensor 1080E, a distance sensor 1080F, a proximity light sensor 1080G, a fingerprint sensor 1080H, a temperature sensor 1080J, a touch sensor 1080K, an ambient light sensor 1080L, a bone conduction sensor 1080M, etc.

[0355] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 1000. In other embodiments of the present application, the electronic device 1000 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0356] For example, Fig.19 The processor 1010 shown may include one or more processing units, for example, the processor 1010 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0357] The controller may be the nerve center and command center of the electronic device 1000. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0358] The processor 1010 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 1010 is a cache memory. The memory may store instructions or data that the processor 1010 has just used or cyclically used. If the processor 1010 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 1010, and thus improves the efficiency of the system.

[0359] In some embodiments, the processor 1010 may include one or more interfaces. The interface may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General Purpose Input / Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and / or a Universal Serial Bbus (USB) interface, etc.

[0360] The external memory interface 1020 may be used to connect an external memory card, such as a Secure Digital (SD) card, to expand the storage capacity of the electronic device 1000. The external memory card communicates with the processor 1010 via the external memory interface 1020 to implement a data storage function.

[0361] The internal memory 1021 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 1010 executes various functional applications and data processing of the electronic device 1000 by running the instructions stored in the internal memory 1021. The internal memory 1021 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as an image capture function, a video recording function, etc.), etc. The data storage area may store data (such as image data, video data, etc.) created during the use of the electronic device 1000, etc. In addition, the internal memory 1021 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (Universal Flash Storage, UFS), etc.

[0362] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 1000. In other embodiments of the present application, the electronic device 1000 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0363] See also Fig. 20 , which shows a functional block diagram of an electronic device 1100 according to an embodiment of the present application. Fig. 20 As shown, the electronic device 1100 includes: one or more processors 1110 ( Fig. 20 Only one processor is shown in the figure) and a memory 1120, the memory 1120 is coupled to one or more processors 1110, the memory 1120 is used to store computer program code 1130, the computer program code 1130 includes computer instructions, and one or more processors 1110 call the computer instructions to enable the electronic device 1100 to implement the steps in any one of the above methods.

[0364] Those skilled in the art will understand that Fig. 20 This is only an example of the electronic device 1100 and does not constitute a limitation on the electronic device 1100. In practice, the electronic device 1100 may include more or fewer components than shown in the figure, or combine certain components, or different components, for example, it may also include input and output devices, network access devices, etc. The electronic device 1100 may also be the same device as the electronic device 1000 described in the above embodiment.

[0365] The processor 1110 may be a central processing unit (CPU), other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0366] In some embodiments, the memory 1120 may be an internal storage unit of the electronic device 1100, such as a hard disk or memory of the electronic device 1100. In other embodiments, the memory 1120 may also be an external storage device of the electronic device 1100, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1100. Optionally, the memory 1120 may also include both an internal storage unit of the electronic device 1100 and an external storage device. The memory 1120 is used to store an operating system, an application program, a boot loader, data, and other programs, such as program codes of a computer program, etc. The memory 1120 may also be used to temporarily store data that has been output or is to be output.

[0367] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0368] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0369] An embodiment of the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device implements the steps in any one of the above methods.

[0370] In some embodiments, the chip system also includes a memory, and the memory is connected to one or more processors through circuits or wires.

[0371] In some embodiments, the chip system also includes a communication interface.

[0372] An embodiment of the present application further provides a computer-readable medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device implements the methods described in the above-mentioned various method embodiments.

[0373] The embodiments of the present application also provide a computer program product. When the computer program product is run on an electronic device, the electronic device executes the above-mentioned related steps to implement the methods described in the above-mentioned various method embodiments.

[0374] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0375] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0376] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0377] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0378] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0379] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0380] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0381] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0382] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some implementations", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0383] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A light source image processing method, characterized in that: include: determining a first light source transition region of the first light source image; determining a white balance parameter according to the first light source transition region, the white balance parameter including a target channel optimization direction and a target channel optimization number, the target channel optimization direction including a forward compensation direction and a reverse compensation direction, and after compensating the target channel of the first light source transition region by a preset constant based on the forward compensation direction or the reverse compensation direction, a first area of ​​the first light source transition region becomes smaller; The first light source image is subjected to white balance processing according to the white balance parameter to obtain a second light source image, wherein the first area is larger than a second area of ​​a second light source transition region of the second light source image.

2. The light source image processing method according to claim 1, characterized in that: The step of determining the target channel optimization direction according to the first light source transition area includes: Forward compensating the preset constant for the target channel to obtain a first compensation area; Reversely compensating the preset constant for the target channel to obtain a second compensation area; The target channel optimization direction is determined according to the third area of ​​the first compensation area and the fourth area of ​​the second compensation area.

3. The light source image processing method according to claim 2, characterized in that: The step of determining the target channel optimization direction according to the third area of ​​the first compensation area and the fourth area of ​​the second compensation area includes: When the third area is smaller than the first area, determining the target channel optimization direction to be the forward compensation direction; When the fourth area is smaller than the first area, the target channel optimization direction is determined to be the reverse compensation direction.

4. The light source image processing method according to claim 1, characterized in that: The first light source image is an RGB color space image, the target channel includes a red channel and a blue channel, and the target channel optimization direction includes a red channel optimization direction and a blue channel optimization direction.

5. The light source image processing method according to claim 1, characterized in that: The step of determining the number of target channel optimization times according to the first light source transition region includes: Iteratively optimize the first light source transition area a target number of times according to the target channel optimization direction to obtain a target optimization area, wherein a ratio of a fifth area of ​​the target optimization area to the first area is less than or equal to a preset ratio threshold; The target number of times is determined as the target channel optimization number of times.

6. The light source image processing method according to claim 1, characterized in that: The second area is zero.

7. The light source image processing method according to any one of claims 1 to 6, characterized in that: The determining the first light source transition area of ​​the first light source image includes: Performing LCH color space conversion on the first light source image to obtain an LCH image; Binarizing the LCH image to obtain a binary mask image; The first light source transition region is determined according to the binary mask image.

8. The light source image processing method according to claim 7, characterized in that: Before determining the first light source transition area according to the binary mask image, the light source image processing method further includes: determining a light source mask image according to the first light source image; Determining whether the light source mask image is connected to the binary mask image; The determining the first light source transition area according to the binary mask image comprises: When it is determined that the light source mask image is connected to the binary mask image, the first light source transition area is determined according to the binary mask image.

9. The light source image processing method according to claim 8, characterized in that: The step of determining the light source mask image according to the first light source image comprises: determining a light source position in the first light source image; Determine the minimum enclosing circle of the light source position according to a minimum enclosing circle algorithm; The light source mask image is generated according to the minimum enclosing circle.

10. The light source image processing method according to claim 7, characterized in that: The binarization process of the LCH image to obtain a binarized mask image includes: Determine the LCH value of each pixel of the LCH image; The LCH image is binarized according to the LCH value of each pixel point to obtain the binarized mask image.

11. The light source image processing method according to claim 10, characterized in that: The LCH value includes a brightness value, a saturation value and a hue value, and the binarization process is performed on the LCH image according to the LCH value of each pixel point to obtain the binarized mask image, including: Determine a lightness channel mask value, a saturation channel mask value, and a hue channel mask value according to the lightness value, the saturation value, and the hue value of each pixel point; Determine a pixel mask value according to the one brightness channel mask value, the one saturation channel mask value and the one hue channel mask value corresponding to each pixel point; The binary mask image is generated according to the one pixel mask value corresponding to each pixel point.

12. The light source image processing method according to claim 11, characterized in that: The determining a lightness channel mask value, a saturation channel mask value, and a hue channel mask value according to the lightness value, the saturation value, and the hue value of each pixel point includes: Determine the one brightness channel mask value according to the brightness value of each pixel and the brightness threshold range; Determine the one saturation channel mask value according to the saturation value of each pixel and the saturation threshold range; The hue channel mask value is determined according to the hue value of each pixel and the hue threshold range.

13. The light source image processing method according to claim 11, characterized in that: The determining a pixel mask value according to the one brightness channel mask value, the one saturation channel mask value and the one hue channel mask value corresponding to each pixel point includes: When the target brightness channel mask value corresponding to the target pixel point is 1, the target saturation channel mask value is 1, and the target hue channel mask value is 1, determining that the target pixel mask value of the target pixel point is 1; Otherwise, the target pixel mask value is determined to be 0.

14. The light source image processing method according to claim 7, characterized in that: The determining the first light source transition area according to the binary mask image comprises: Determining a light source transition mask area in the binary mask image; An area in the first light source image corresponding to the light source transition mask area is determined as the first light source transition area.

15. The light source image processing method according to claim 14, characterized in that: Before determining the area in the first light source image corresponding to the light source transition mask area as the first light source transition area, the light source image processing method further includes: Performing expansion processing on the light source transition mask region to obtain an expanded transition mask region; The step of determining the area in the first light source image corresponding to the light source transition mask area as the first light source transition area includes: An area in the first light source image corresponding to the expansion transition mask area is determined as the first light source transition area.

16. The light source image processing method according to any one of claims 1 to 6, characterized in that: Also includes: Determining an initial color restoration matrix of the first light source image; The second light source transition region is color restored according to the initial color restoration matrix to obtain a third light source image.

17. The light source image processing method according to claim 16, characterized in that: Before performing color restoration on the second light source transition region according to the initial color restoration matrix to obtain a third light source image, the light source image processing method further includes: Determining whether a color channel is truncated in a process in which the initial color restoration matrix performs color restoration on the second light source transition region; The performing color restoration on the second light source transition region according to the initial color restoration matrix to obtain a third light source image includes: When it is determined that the color channel is truncated in the process of the initial color restoration matrix performing color restoration on the second light source transition area, the initial color restoration matrix is ​​optimized to obtain a target color restoration matrix; The second light source transition area is color restored according to the target color restoration matrix to obtain the third light source image, and the color channel is not truncated during the process of color restoration of the second light source transition area by the target color restoration matrix.

18. The light source image processing method according to claim 17, characterized in that: Also includes: Perform pixel dithering processing on the third light source image to obtain a fourth light source image.

19. The light source image processing method according to claim 18, characterized in that: Before performing pixel dithering processing on the third light source image to obtain the fourth light source image, the light source image processing method further includes: Compressing the third light source image to obtain a fifth light source image; The performing pixel dithering processing on the third light source image to obtain a fourth light source image includes: Perform pixel dithering processing on the fifth light source image to obtain the fourth light source image.

20. An electronic device, characterized in that: The electronic device includes: one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the light source image processing method as described in any one of claims 1 to 19.

21. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes instructions, and when the instructions are executed on an electronic device, the electronic device executes the light source image processing method according to any one of claims 1 to 19.

Citation Information

Patent Citations

  • Control method and control device

    CN106851121A

  • Image white balance processing method and device, electronic equipment and storage medium

    CN112866667A