Scene recognition method, device and storage medium
By acquiring the image's color temperature curve and target white points and performing scene recognition, the problem that the white balance algorithm in the prior art cannot accurately identify image scenes, and better white balance processing effect and image quality are achieved.
Patent Information
- Application Number
- CN202010830867.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-18
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2040-08-18
AI Technical Summary
The existing white balance algorithm cannot accurately identify the scenes of images, resulting in poor white balance processing.
By obtaining the color temperature curve of the image to be processed, the target white dot number is determined, and scene recognition is performed based on this number to obtain the scene recognition result.
Accurate recognition of image scenes is achieved, which helps improve the white balance processing effect and thus improves image quality.
Smart Images

Figure CN112040202B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a scene recognition method, device and storage medium. Background Art
[0002] With the rapid development of electronic technology, taking pictures has become a standard technology for electronic devices (such as mobile phones, tablets, etc.). Taking pictures inevitably involves white balance technology. At present, general white balance algorithms are only effective for scenes containing white points (gray points, neutral gray), but cannot accurately recognize the scene of the image. Therefore, the problem of how to recognize the scene of the image needs to be solved urgently. Summary of the invention
[0003] The embodiments of the present application provide a scene recognition method, device and storage medium, which can accurately recognize image scenes and help improve the white balance processing effect.
[0004] In a first aspect, an embodiment of the present application provides a scene recognition method, the method comprising:
[0005] Get the image to be processed;
[0006] Acquire a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve;
[0007] Scene recognition is performed based on the target white point quantity to obtain a scene recognition result.
[0008] In a second aspect, an embodiment of the present application provides a scene recognition device, the device comprising: an acquisition unit, a determination unit and a recognition unit, wherein:
[0009] The acquisition unit is used to acquire the image to be processed;
[0010] The determining unit is used to obtain a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve;
[0011] The recognition unit is used to perform scene recognition based on the number of target white points to obtain a scene recognition result.
[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.
[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0014] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0015] The embodiments of the present application have the following beneficial effects:
[0016] It can be seen that the scene recognition method, device and storage medium described in the embodiments of the present application are applied to electronic devices to obtain an image to be processed, obtain a color temperature curve of the image to be processed, and determine the target number of white points of the image to be processed based on the color temperature curve, perform scene recognition based on the target number of white points, and obtain a scene recognition result. In this way, the scene of the image can be identified by the number of white points, which helps to subsequently select a suitable algorithm to process the image. For example, it helps to improve the white balance processing effect, and then helps to improve the image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] 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.
[0018] Figure 1A is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0019] Figure 1B is a flow chart of a scene recognition method provided in an embodiment of the present application;
[0020] Figure 1C is a flowchart of another scene recognition method provided in an embodiment of the present application;
[0021] Figure 1D is a flowchart of another scene recognition method provided in an embodiment of the present application;
[0022] Figure 2 is a flowchart of another scene recognition method provided in an embodiment of the present application;
[0023] Figure 3 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0024] Figure 4 It is a block diagram of the functional units of a scene recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0027] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0028] The electronic device involved in the embodiment of the present application may be an electronic device with communication capability or an electronic device without communication capability. The electronic device may include various handheld devices with wireless communication function, vehicle-mounted devices, wearable devices (smart glasses, smart bracelets, smart watches, etc.), computing devices or other processing devices connected to wireless modems, and various forms of user equipment (UE), mobile stations (MS), terminal devices, etc. In the embodiment of the present application, a monochrome scene can be understood as a scene where a color appears in a large area, or it can be described as an area ratio of a color in an image exceeding a preset area threshold. The preset area threshold can be set by the user or by the system default, for example, the preset area threshold can be 80%, 90%, etc. A monochrome scene can be a single color scene, for example, pure green, pure blue, etc. Of course, a monochrome scene can also be defined as a scene where the number of white spots in the image is less than a preset number threshold, which can be set by the user or by the system default, for example, the preset number threshold can be 0, 1, 2, etc. A white spot scene can be defined as a scene where the number of white spots in the image is greater than or equal to the preset number threshold. In a specific implementation, monochrome scenes and white spot scenes can be recognized according to the white spot detection related algorithm mentioned in the embodiment of the present application. The embodiment of the present application is described in detail below.
[0029] See also Figure 1A , Figure 1A 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device includes a processor, a memory, a signal processor, a transceiver, a display screen, a speaker, a microphone, a random access memory (RAM), a camera, a sensor, and a communication module, etc. Among them, the memory, the signal processor, the display screen, the speaker, the microphone, the RAM, the camera, the sensor, and the communication module are connected to the processor, and the transceiver is connected to the signal processor.
[0030] The display screen may be a liquid crystal display (LCD), an organic or inorganic light-emitting diode (OLED), an active matrix organic light-emitting diode panel (AMOLED), etc.
[0031] The camera may be a common camera or an infrared camera, which is not limited here. The camera may be a front camera or a rear camera, which is not limited here.
[0032] Among them, the sensor includes at least one of the following: a light sensor, a gyroscope, an infrared proximity sensor, a fingerprint sensor, a pressure sensor, and the like. Among them, the light sensor, also known as an ambient light sensor, is used to detect the brightness of ambient light. The light sensor may include a photosensitive element and an analog-to-digital converter. Among them, the photosensitive element is used to convert the collected light signal into an electrical signal, and the analog-to-digital converter is used to convert the above electrical signal into a digital signal. Optionally, the light sensor may also include a signal amplifier, which may amplify the electrical signal converted by the photosensitive element and output it to the analog-to-digital converter. The above-mentioned photosensitive element may include at least one of a photodiode, a phototransistor, a photoresistor, and a silicon photocell.
[0033] Among them, the processor is the control center of the electronic device, which uses various interfaces and lines to connect the various parts of the entire electronic device, and performs various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory, and calling data stored in the memory, thereby monitoring the electronic device as a whole.
[0034] The processor may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor, wherein the processor may be at least one of the following: ISP, CPU, GPU, NPU, etc., which are not limited here.
[0035] The memory is used to store software programs and / or modules, and the processor executes various functional applications and data processing of the electronic device by running the software programs and / or modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a software program required for at least one function, etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 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, or other volatile solid-state storage devices.
[0036] Among them, the communication module can be used to realize the communication function, and the communication module can be at least one of the following: infrared module, Bluetooth module, mobile communication module, NFC module, Wi-Fi module, etc., which is not limited here.
[0037] See also Figure 1B , Figure 1B The present application provides a flow chart of a scene recognition method, which is applied to Figure 1A The electronic device shown in the figure, as shown in the figure, the scene recognition method includes the following operations.
[0038] 101. Obtain an image to be processed.
[0039] The image to be processed may be an RGB image or a Bayer image. The image to be processed may be a partial image or the entire image of an original image.
[0040] 102. Obtain a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve.
[0041] The electronic device may obtain a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve.
[0042] In a possible example, the above step 102, obtaining the color temperature curve of the image to be processed, and determining the number of target white points of the image to be processed based on the color temperature curve, may include the following steps:
[0043] A21, obtain target environment parameters;
[0044] A22. Determine the color temperature curve corresponding to the target environment parameter;
[0045] A23, converting the image to be processed into a YCbCr space to obtain a Cb component and a Cr component;
[0046] A24. Determine the target white point quantity of the image to be processed according to the Cb component and the Cr component of the color temperature curve.
[0047] In the embodiment of the present application, the environmental parameter may be at least one of the following: ambient brightness, geographical location, weather, temperature, humidity, magnetic field interference coefficient, etc., which are not limited here. The electronic device may obtain the environmental parameter through an environmental detection sensor, which may be at least one of the following: an ambient light sensor, a positioning sensor, a meteorological sensor, a temperature sensor, a humidity sensor, a magnetic field detection sensor, etc., which are not limited here.
[0048] In a specific implementation, the electronic device can pre-store the mapping relationship between the environmental parameters and the color temperature curve. For example, by adopting the "white point detection method based on the color temperature curve", the test card image is first collected in the color temperature light box according to the sensor characteristics to fit the color temperature curve function. Specifically, the electronic device can obtain the target environmental parameters, and determine the color temperature curve corresponding to the target environmental parameters according to the mapping relationship, and can convert the image to be processed into the YCbCr space to obtain the Cb component and the Cr component. Then, the target number of white points of the image to be processed can be determined according to the color temperature curve, the Cb component and the Cr component. The pixel points near the color temperature curve are white points, and the white points and their RGB values are counted. Then, the white point detection is performed on the counted pixel points, and the number of white points Cnt1 is counted.
[0049] In a possible example, the above step 102, obtaining the color temperature curve of the image to be processed, may include the following steps:
[0050] B21, obtaining the target user's target human eye visual difference;
[0051] B22. Determine the color temperature curve corresponding to the target human eye visual difference according to a preset mapping relationship between the human eye visual difference and the color temperature curve.
[0052] In a specific implementation, the electronic device can pre-store a mapping relationship between preset human eye visual differences and color temperature curves. Then, the electronic device can obtain the target human eye visual differences of the target user, and determine the color temperature curve corresponding to the target human eye visual differences according to the mapping relationship between the preset human eye visual differences and the color temperature curve. In this way, the appropriate color temperature curve can be selected according to different people, and finally a scene recognition result suitable for human eye vision can be obtained.
[0053] 103. Perform scene recognition based on the target white point quantity to obtain a scene recognition result.
[0054] Among them, the scene recognition result can be a white dot scene or a monochrome scene. The electronic device can perform scene recognition based on the number of target white dots to obtain the scene recognition result. Different scene recognition results can use different image processing algorithms to process the image to better improve the image quality.
[0055] In a possible example, the above step 103, performing scene recognition based on the number of target white points to obtain a scene recognition result, may include the following steps:
[0056] 31. When the number of target white points is less than or equal to a first preset threshold, confirming that the scene recognition result is a monochrome scene;
[0057] 32. When the number of the target white points is greater than the first preset threshold, obtaining the proportion of white points of the image to be processed in the three-dimensional histogram domain;
[0058] 33. Perform scene recognition based on the white point proportion to obtain the scene recognition result.
[0059] The first preset threshold value can be set by the user or by the system default. When the number of target white dots is less than or equal to the first preset threshold value, the electronic device can confirm that the scene recognition result is a monochrome scene. When the number of target white dots is greater than the first preset threshold value, the white dot ratio of the image to be processed in the three-dimensional histogram domain is obtained, and the scene recognition is performed based on the white dot ratio to obtain the scene recognition result. In this way, the scene can be preliminarily recognized based on the number of target white dots, and the white dot scene or monochrome scene can be further recognized through the white dot ratio in the three-dimensional histogram.
[0060] In a possible example, the above step 33, performing scene recognition according to the white point proportion to obtain the scene recognition result, may include the following steps:
[0061] 331. When the white spot ratio is greater than a second preset threshold, confirming that the scene recognition result is a white spot scene;
[0062] 332. When the white point ratio is less than or equal to a second preset threshold, determine the number of bins of the image to be processed in a three-dimensional histogram domain;
[0063] 333. Perform scene recognition according to the number of bins to obtain the scene recognition result.
[0064] Among them, the second preset threshold can be set by the user or by the system default. When the white point proportion is greater than the second preset threshold, the electronic device can confirm that the scene recognition result is a white point scene. When the white point proportion is less than or equal to the second preset threshold, the electronic device can determine the number of bins of the image to be processed in the three-dimensional histogram domain, and perform scene recognition based on the number of bins to obtain a scene recognition result. In this way, the scene can be further accurately identified.
[0065] In a possible example, the above step 333, performing scene recognition according to the bin number to obtain the scene recognition result, may include the following steps:
[0066] 3331. When the number of bins is less than or equal to a third preset threshold, confirm that the scene recognition result is a monochrome scene;
[0067] 3332. When the number of bins is greater than the third preset threshold, confirm that the scene recognition result is a white spot scene.
[0068] The third preset threshold value can be set by the user or by the system default. In a specific implementation, the electronic device can confirm that the scene recognition result is a monochrome scene when the number of bins is less than or equal to the third preset threshold value, and vice versa, when the number of bins is greater than the third preset threshold value, confirm that the scene recognition result is a white spot scene. In this way, the scene recognition result can be accurately obtained, which is conducive to selecting an image processing algorithm suitable for the scene to process the image to be processed, and helps to improve the image quality.
[0069] For example, in a specific implementation, an electronic device can use three characteristic parameters to determine whether there are white spots in a scene. The parameters are: the number of white spots Cnt1 obtained by "based on the color temperature curve algorithm and the white spot detection algorithm", the white spot ratio Cnt2 of the image obtained by "based on 3D_hist" statistics, and the number of bins Cnt3 of the image. The process of scene type recognition is as follows: Figure 1C shown.
[0070] exist Figure 1C In the example, T1 is the first preset threshold, T2 is the second preset threshold, and T3 is the third preset threshold. The scene type determination method is as follows:
[0071] First, count the number of white dots Cnt1. When the number of white dots Cnt1 ≤ T1, it is a monochrome scene. When Cnt1> Thr1, it may be a scene with white dots or a monochrome scene.
[0072] Secondly, the white spot ratio Cnt2 is counted. When Cnt2>T2, it is a scene with white spots. When Cnt2≤T2, it may be a scene with white spots, but a small number of images (such as low-light images at the camera mount) may be monochrome scenes. Further judgment needs to be made in combination with the bin number Cnt3.
[0073] Finally, the number of bins of the image is counted Cnt3. When Cnt3>T3, it is a scene with white spots, and when Cnt3≤Thr3, it is a monochrome scene.
[0074] In a specific implementation, the electronic device may pre-process the image to be processed, convert the RGB image into the 3D_hist space domain, and calculate the proportion Cnt2 of the white points in the image and the number Cnt3 of the image bins, such as Figure 1C shown.
[0075] Further, in Figure 1D In the process, it mainly includes preset white point Bin coordinate range, color space conversion (RGB2YCbCr), 3D_hist generation, 3D_hist preprocessing, statistical white point Bin value Sum_bin_w, statistical image Bin value Sum_bin, calculation of white point proportion, and detection of image Bin number. Each part is described as follows:
[0076] Color space conversion (RGB2YCbCr), specifically converting the RGB image to the YCbCr space to obtain the Cb and Cr components;
[0077] Generate 3D_hist, where an xy coordinate plane is established with Cr as the x-axis and Cb as the y-axis, and its range is preset, and the cumulative distribution value of the image pixel points in the CbCr color domain is counted, that is, 3D_hist is generated;
[0078] 3D_hist preprocessing can be used to process the generated 3D_hist to remove the interference of noise and unsaturated pixels.
[0079] The preset white point Bin coordinates bin_w(i,j) can be obtained through neural network algorithm training. Specifically, the 3D_hist data of the image to be processed can be input into the trained neural network model, that is, it can be obtained that the test card image is collected at different color temperatures, 3D_hist is generated, and the Bin(i,j) coordinates of the gray point are recorded. The set of these Bin(i,j) coordinates is called the white point Bin coordinates bin_w(i,j).
[0080] Count the white point Bin value Sum_bin_w. When a pixel in the image falls into bin_w(i,j), count the cumulative distribution value Sum_bin_w of each bin. Count the image Bin value Sum_bin. Count the cumulative distribution value Sum_bin of all pixels in the image that fall into bin(i,j).
[0081] Furthermore, the white point ratio is calculated, wherein the white point ratio is the percentage Cnt2 of the white point Bin value to the image Bin value, and is calculated as follows:
[0082]
[0083] Count the number of image bins Cnt3. The number of bins can reflect the richness of the scene colors. Count the number of bins in 3D_hist as follows:
[0084] Cnt3=Sum(find(Bin(i,j)>Thr3_0))
[0085] Among them, “find(Bin(i,j)>Thr)” means counting the number of Bins in the image whose Bin values are greater than the threshold Thr, and removing a small amount of false colors or interfering colors.
[0086] Furthermore, in a possible example, after the above step 103, the following steps may also be included:
[0087] C1. Determine the target image processing algorithm corresponding to the scene recognition result according to the preset mapping relationship between the scene and the image processing algorithm;
[0088] C2. Performing image processing on the image to be processed according to the target image processing algorithm to obtain a target image.
[0089] Among them, the electronic device can pre-store the mapping relationship between the preset scene and the image processing algorithm, and then determine the target image processing algorithm corresponding to the scene recognition result according to the mapping relationship between the preset scene and the image processing algorithm, and perform image processing on the image to be processed according to the target image processing algorithm to obtain the target image, so that the image processing algorithm matching the scene can be selected to process the image to be processed, which helps to improve the image quality. The image processing algorithm can be at least one of the following: image enhancement algorithm, white balance algorithm, smoothing algorithm, wavelet algorithm, neural network algorithm, etc., which are not limited here.
[0090] Furthermore, when the scene recognition result is a white spot scene, the above step C2 may include the following steps:
[0091] C21, dividing the image to be processed into multiple regions;
[0092] C22, determining the white point distribution density of each of the multiple regions to obtain multiple target white point distribution densities;
[0093] C23, obtaining algorithm control parameters of the target image processing algorithm;
[0094] C24, according to a preset mapping relationship between white point distribution density and adjustment factor, determining the adjustment factor corresponding to each target white point distribution density among the multiple target white point distribution densities, to obtain multiple adjustment factors;
[0095] C25. Determine a target algorithm control parameter for each region according to the multiple adjustment factors and the algorithm control parameter to obtain multiple target algorithm control parameters;
[0096] C26. Process the image to be processed according to the multiple target algorithm control parameters and the target image processing algorithm to obtain a result image.
[0097] In a specific implementation, the electronic device can divide the image to be processed into multiple areas, and the area size of each area can be the same or different. In addition, the white point distribution density of each area in the multiple areas can be determined to obtain multiple target white point distribution densities, where the target white point distribution density = the total number of white points in each area / area size. The algorithm control parameters of the target image processing algorithm can also be obtained. The algorithm control parameters are used to control the processing degree of the algorithm. For example, for a deblurring algorithm, the algorithm control parameters can control the degree of deblurring.
[0098] Further, the electronic device may pre-store a mapping relationship between a preset white point distribution density and an adjustment factor. Then, the adjustment factor corresponding to each target white point distribution density in a plurality of target white point distribution densities may be determined according to the mapping relationship between the preset white point distribution density and the adjustment factor, and a plurality of adjustment factors may be obtained. The value range of the adjustment factor may be between -1 and 1. For example, the value of the adjustment factor may be between -0.0134 and 0.0134. The algorithm control parameter may be adjusted by the adjustment factor. Then, the target algorithm control parameter of each region may be determined according to the plurality of adjustment factors and the algorithm control parameter, and a plurality of target algorithm control parameters may be obtained. The specific formula may be as follows:
[0099] Target algorithm control parameter = (1 + adjustment factor) * algorithm control parameter
[0100] Finally, the electronic device can process the image to be processed according to multiple target algorithm control parameters and the target image processing algorithm to obtain a result image. In this way, the image to be processed can be processed according to the differences in different regions, which helps to improve the image quality in a targeted manner.
[0101] It can be seen that the scene recognition method described in the embodiment of the present application is applied to an electronic device to obtain an image to be processed, obtain a color temperature curve of the image to be processed, and determine the target number of white points of the image to be processed based on the color temperature curve, and perform scene recognition based on the target number of white points to obtain a scene recognition result. In this way, the scene of the image can be identified by the number of white points, which helps to subsequently select a suitable algorithm to process the image. For example, it helps to improve the white balance processing effect, and then helps to improve the image quality.
[0102] With the above Figure 1B For details on the embodiments shown in the drawings, please refer to Figure 2 , Figure 2 It is a flow chart of a scene recognition method provided in an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the scene recognition method includes the following steps.
[0103] 201. Obtain an image to be processed.
[0104] 202. Obtain a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve.
[0105] 203. When the number of target white points is less than or equal to a first preset threshold, confirm that the scene recognition result is a monochrome scene.
[0106] 204. When the target white point quantity is greater than the first preset threshold, obtain a white point proportion of the image to be processed in a three-dimensional histogram domain.
[0107] 205. When the white spot proportion is greater than a second preset threshold, confirm that the scene recognition result is a white spot scene.
[0108] 206. When the white point proportion is less than or equal to a second preset threshold, determine the number of bins of the image to be processed in a three-dimensional histogram domain.
[0109] 207. When the number of bins is less than or equal to a third preset threshold, confirm that the scene recognition result is a monochrome scene.
[0110] 208. When the number of bins is greater than the third preset threshold, confirm that the scene recognition result is a white spot scene.
[0111] The detailed description of the above steps 201 to 208 can be found in the above Figure 1B The corresponding steps of the described scene recognition method will not be repeated here.
[0112] It can be seen that the scene recognition method described in the embodiment of the present application is applied to an electronic device to obtain an image to be processed, obtain a color temperature curve of the image to be processed, and determine the target number of white points of the image to be processed based on the color temperature curve. When the target number of white points is less than or equal to the first preset threshold, the scene recognition result is confirmed to be a monochrome scene. When the target number of white points is greater than the first preset threshold, the white point proportion of the image to be processed in the three-dimensional histogram domain is obtained. When the white point proportion is greater than the second preset threshold, the scene recognition result is confirmed to be a white point scene. When the white point proportion is less than or equal to the second preset threshold, the number of bins of the image to be processed in the three-dimensional histogram domain is determined. When the number of bins is less than or equal to the third preset threshold, the scene recognition result is confirmed to be a monochrome scene. When the number of bins is greater than the third preset threshold, the scene recognition result is confirmed to be a white point scene. In this way, the scene of the image can be identified by the number of white points, which is helpful for the subsequent selection of an appropriate algorithm to process the image. For example, it helps to improve the white balance processing effect, and thus helps to improve the image quality.
[0113] With the above Figure 1B , Figure 2 For details on the embodiments shown in the drawings, please refer to Figure 3 , Figure 3 It is a structural diagram of an electronic device 300 provided in an embodiment of the present application. As shown in the figure, the electronic device 300 includes a processor 310, a memory 320, a communication interface 330 and one or more programs 321, wherein the one or more programs 321 are stored in the above-mentioned memory 320 and are configured to be executed by the above-mentioned processor 310, and the one or more programs 321 include instructions for executing any step in the above-mentioned method embodiment.
[0114] Get the image to be processed;
[0115] Acquire a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve;
[0116] Scene recognition is performed based on the target white point quantity to obtain a scene recognition result.
[0117] It can be seen that the electronic device described in the embodiment of the present application obtains an image to be processed, obtains a color temperature curve of the image to be processed, determines the target number of white points of the image to be processed based on the color temperature curve, performs scene recognition based on the target number of white points, and obtains a scene recognition result. In this way, the scene of the image can be identified by the number of white points, which helps to subsequently select a suitable algorithm to process the image. For example, it helps to improve the white balance processing effect, and then helps to improve the image quality.
[0118] In a possible example, in terms of performing scene recognition based on the number of target white points to obtain a scene recognition result, the instructions in the program are further specifically used to perform the following operations:
[0119] When the number of target white points is less than or equal to a first preset threshold, confirming that the scene recognition result is a monochrome scene;
[0120] When the target white point quantity is greater than the first preset threshold, obtaining the white point proportion of the image to be processed in the three-dimensional histogram domain;
[0121] Scene recognition is performed according to the white point proportion to obtain the scene recognition result.
[0122] In a possible example, in performing scene recognition according to the white point proportion to obtain the scene recognition result, the instructions in the program are further specifically used to perform the following operations:
[0123] When the white spot ratio is greater than a second preset threshold, confirming that the scene recognition result is a white spot scene;
[0124] When the white point ratio is less than or equal to a second preset threshold, determining the number of bins of the image to be processed in a three-dimensional histogram domain;
[0125] The scene recognition is performed according to the number of bins to obtain the scene recognition result.
[0126] In a possible example, in terms of performing scene recognition according to the number of bins to obtain the scene recognition result, the instructions in the program are further specifically used to perform the following operations:
[0127] When the number of bins is less than or equal to a third preset threshold, confirming that the scene recognition result is a monochrome scene;
[0128] When the bin number is greater than the third preset threshold, the scene recognition result is confirmed to be a white spot scene.
[0129] In a possible example, in the aspect of acquiring the color temperature curve of the image to be processed and determining the number of target white points of the image to be processed based on the color temperature curve, the instructions in the program are further specifically used to perform the following operations:
[0130] Get target environment parameters;
[0131] Determining the color temperature curve corresponding to the target environmental parameters;
[0132] Convert the image to be processed into a YCbCr space to obtain a Cb component and a Cr component;
[0133] The target white point quantity of the image to be processed is determined according to the color temperature curve, the Cb component and the Cr component.
[0134] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware 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 the present application.
[0135] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0136] Figure 4 4 is a functional unit block diagram of a scene recognition device 400 involved in an embodiment of the present application. The scene recognition device 400 is applied to an electronic device, and the scene recognition device 400 includes an acquisition unit 401, a determination unit 402 and a recognition unit 403. The following is a detailed description.
[0137] The acquisition unit 401 is used to acquire the image to be processed;
[0138] The determining unit 402 is used to obtain a color temperature curve of the image to be processed, and determine the number of target white points of the image to be processed based on the color temperature curve;
[0139] The recognition unit 403 is used to perform scene recognition based on the number of target white points to obtain a scene recognition result.
[0140] It can be seen that the scene recognition device described in the embodiment of the present application is applied to an electronic device to obtain an image to be processed, obtain a color temperature curve of the image to be processed, and determine the target number of white points of the image to be processed based on the color temperature curve, and perform scene recognition based on the target number of white points to obtain a scene recognition result. In this way, the scene of the image can be identified by the number of white points, which helps to subsequently select a suitable algorithm to process the image. For example, it helps to improve the white balance processing effect, and then helps to improve the image quality.
[0141] In a possible example, in performing scene recognition based on the number of target white points to obtain a scene recognition result, the recognition unit 403 is specifically configured to:
[0142] When the number of target white points is less than or equal to a first preset threshold, confirming that the scene recognition result is a monochrome scene;
[0143] When the target white point quantity is greater than the first preset threshold, obtaining the white point proportion of the image to be processed in the three-dimensional histogram domain;
[0144] Scene recognition is performed according to the white point proportion to obtain the scene recognition result.
[0145] In a possible example, in performing scene recognition according to the white point proportion to obtain the scene recognition result, the recognition unit 403 is specifically configured to:
[0146] When the white spot ratio is greater than a second preset threshold, confirming that the scene recognition result is a white spot scene;
[0147] When the white point ratio is less than or equal to a second preset threshold, determining the number of bins of the image to be processed in a three-dimensional histogram domain;
[0148] The scene recognition is performed according to the number of bins to obtain the scene recognition result.
[0149] In a possible example, in performing scene recognition according to the number of bins to obtain the scene recognition result, the recognition unit 403 is specifically configured to:
[0150] When the number of bins is less than or equal to a third preset threshold, confirming that the scene recognition result is a monochrome scene;
[0151] When the bin number is greater than the third preset threshold, the scene recognition result is confirmed to be a white spot scene.
[0152] In a possible example, in acquiring the color temperature curve of the image to be processed and determining the number of target white points of the image to be processed based on the color temperature curve, the determining unit 402 is specifically configured to:
[0153] Get target environment parameters;
[0154] Determining the color temperature curve corresponding to the target environmental parameters;
[0155] Convert the image to be processed into a YCbCr space to obtain a Cb component and a Cr component;
[0156] The target white point quantity of the image to be processed is determined according to the color temperature curve, the Cb component and the Cr component.
[0157] The scene recognition device 400 may further include a storage unit 404 for storing program codes and data of the electronic device. The acquisition unit 401, the determination unit 402 and the recognition unit 403 may be processors, and the storage unit 404 may be a memory.
[0158] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0159] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0160] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0161] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0162] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. 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, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0163] 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.
[0164] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0165] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.
[0166] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0167] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A scene recognition method, characterized in that: The method comprises: Get the image to be processed; Acquiring the color temperature curve of the image to be processed, specifically: acquiring the target human eye visual difference of the target user, and determining the color temperature curve corresponding to the target human eye visual difference according to a preset mapping relationship between the human eye visual difference and the color temperature curve; Determining the target white point number of the image to be processed based on the color temperature curve; Performing scene recognition based on the number of target white spots to obtain a scene recognition result; According to the preset mapping relationship between the scene and the image processing algorithm, determine the target image processing algorithm corresponding to the scene recognition result; Performing image processing on the image to be processed according to the target image processing algorithm to obtain a target image; Wherein, when the scene recognition result is a white spot scene, performing image processing on the image to be processed according to the target image processing algorithm to obtain a target image includes: Dividing the image to be processed into a plurality of regions; Determine the white point distribution density of each of the multiple areas to obtain multiple target white point distribution densities; Acquiring algorithm control parameters of the target image processing algorithm; According to a preset mapping relationship between white point distribution density and adjustment factor, determining the adjustment factor corresponding to each target white point distribution density among the multiple target white point distribution densities to obtain multiple adjustment factors; Determining a target algorithm control parameter for each region according to the multiple adjustment factors and the algorithm control parameter to obtain multiple target algorithm control parameters; The image to be processed is processed according to the multiple target algorithm control parameters and the target image processing algorithm to obtain a result image.
2. The method according to claim 1, characterized in that The performing scene recognition based on the number of target white points to obtain a scene recognition result includes: When the number of target white points is less than or equal to a first preset threshold, confirming that the scene recognition result is a monochrome scene; When the target white point quantity is greater than the first preset threshold, obtaining the white point proportion of the image to be processed in the three-dimensional histogram domain; Scene recognition is performed according to the white point proportion to obtain the scene recognition result.
3. The method according to claim 2, characterized in that The performing scene recognition according to the white point proportion to obtain the scene recognition result includes: When the white spot ratio is greater than a second preset threshold, confirming that the scene recognition result is a white spot scene; When the white point ratio is less than or equal to a second preset threshold, determining the number of bins of the image to be processed in a three-dimensional histogram domain; The scene recognition is performed according to the number of bins to obtain the scene recognition result.
4. The method according to claim 3, characterized in that The performing scene recognition according to the number of bins to obtain the scene recognition result includes: When the number of bins is less than or equal to a third preset threshold, confirming that the scene recognition result is a monochrome scene; When the bin number is greater than the third preset threshold, the scene recognition result is confirmed to be a white spot scene.
5. The method according to any one of claims 1 to 4, characterized in that: The step of determining the target white point quantity of the image to be processed based on the color temperature curve comprises: Convert the image to be processed into a YCbCr space to obtain a Cb component and a Cr component; The target white point quantity of the image to be processed is determined according to the color temperature curve, the Cb component and the Cr component.
6. A scene recognition device, characterized in that: The device comprises: an acquisition unit, a determination unit and an identification unit, wherein: The acquisition unit is used to acquire the image to be processed; The determination unit is used to obtain the color temperature curve of the image to be processed, specifically: obtain the target human eye visual difference of the target user, and determine the color temperature curve corresponding to the target human eye visual difference according to the preset mapping relationship between the human eye visual difference and the color temperature curve; determine the target white point number of the image to be processed based on the color temperature curve; The recognition unit is used to perform scene recognition based on the number of target white spots to obtain a scene recognition result; The device is also specifically used for: According to the preset mapping relationship between the scene and the image processing algorithm, determine the target image processing algorithm corresponding to the scene recognition result; Performing image processing on the image to be processed according to the target image processing algorithm to obtain a target image; Wherein, when the scene recognition result is a white spot scene, performing image processing on the image to be processed according to the target image processing algorithm to obtain a target image includes: Dividing the image to be processed into a plurality of regions; Determine the white point distribution density of each of the multiple areas to obtain multiple target white point distribution densities; Acquiring algorithm control parameters of the target image processing algorithm; According to a preset mapping relationship between white point distribution density and adjustment factor, determining the adjustment factor corresponding to each target white point distribution density among the multiple target white point distribution densities to obtain multiple adjustment factors; Determining a target algorithm control parameter for each region according to the multiple adjustment factors and the algorithm control parameter to obtain multiple target algorithm control parameters; The image to be processed is processed according to the multiple target algorithm control parameters and the target image processing algorithm to obtain a result image.
7. The device according to claim 6, characterized in that In the aspect of performing scene recognition based on the number of target white points to obtain a scene recognition result, the recognition unit is specifically used for: When the number of target white points is less than or equal to a first preset threshold, confirming that the scene recognition result is a monochrome scene; When the target white point quantity is greater than the first preset threshold, obtaining the white point proportion of the image to be processed in the three-dimensional histogram domain; Scene recognition is performed according to the white point proportion to obtain the scene recognition result.
8. The device according to claim 7, characterized in that In the aspect of performing scene recognition according to the white point proportion to obtain the scene recognition result, the recognition unit is specifically used for: When the white spot ratio is greater than a second preset threshold, confirming that the scene recognition result is a white spot scene; When the white point ratio is less than or equal to a second preset threshold, determining the number of bins of the image to be processed in a three-dimensional histogram domain; The scene recognition is performed according to the number of bins to obtain the scene recognition result.
9. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
White balance adjustment method, system and camera
CN101227623A
Adaptive white balance correction method and device
CN109361910A