HDR scene detection method and system, electronic equipment and storage medium
By calculating the steepness and local peak distribution state of the grayscale histogram, the problem of low detection accuracy of existing HDR scenes is solved, and more efficient detection and better balance of photography effects is achieved.
Patent Information
- Application Number
- CN202411296097.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-07
AI Technical Summary
The existing HDR scene detection technology has low accuracy and cannot achieve a good balance between photo effects, software and hardware loads and photo time.
By calculating the steepness of the grayscale histogram of the current scene and its local peak distribution state, we determine whether the scene is an HDR scene, and use detection standards that are more in line with the intuitive perception of the human eye to improve detection accuracy and efficiency.
It realizes accurate judgment of HDR scenes, ensures detection accuracy, and improves the efficiency of scene detection, helps to use the corresponding exposure fusion technology according to the scene detection results during the photo shooting process to balance the quality of the picture, software and hardware load and time-consuming photography. .
Smart Images

Figure CN119277048A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of photographing technology, and in particular to a detection method, system, electronic device and storage medium for an HDR scene. Background Art
[0002] With the increasing popularity of digital devices with camera functions (such as digital cameras, digital video cameras, smart phones, tablets, etc.), multi-exposure fusion technology applied to high dynamic range (HDR) scenes has made great progress. Using multi-exposure fusion technology in high dynamic range scenes can restore the information in the overexposed and underexposed areas of the single exposure shooting in the captured image, and obtain better output effects. However, multi-exposure fusion technology will inevitably increase the software and hardware load and increase the calculation time. In addition, if multi-exposure fusion technology is used for non-high dynamic range scenes (non-HDR scenes), the resulting image will have unnatural content.
[0003] Therefore, the judgment of high dynamic scenes (HDR scenes) plays a vital role in the photography of digital devices. Multi-exposure fusion technology is only applied to detected high dynamic scenes (HDR scenes) for photographing, while non-multi-exposure fusion technology is applied to detected non-high dynamic scenes (non-HDR scenes) for photographing. In this way, a good balance can be achieved between photographing effect, software and hardware load, and photographing time.
[0004] However, the current HDR scene detection technology does not accurately grasp the characteristics of HDR scenes. It is difficult to accurately detect HDR scenes to use multi-exposure fusion technology to process the captured images, and it is impossible to achieve a good balance between photographic effects, software and hardware load, and photographing time. Summary of the invention
[0005] The technical problem to be solved by the present disclosure is to overcome the defects of low accuracy of HDR scene detection in the prior art and the inability to achieve a good balance between photographing effect, software and hardware load and photographing time, and to provide a detection method, system, electronic device and storage medium for HDR scene.
[0006] The present invention solves the above technical problems through the following technical solutions:
[0007] According to a first aspect of the present disclosure, a method for detecting an HDR scene is provided, the detection method comprising:
[0008] Get the grayscale histogram of the preview image in the current scene;
[0009] Calculating the steepness of the grayscale histogram, wherein the steepness represents the concentration degree of pixel intensity distribution in the preview image;
[0010] Determining whether the current scene is an HDR scene according to the steepness.
[0011] Preferably, the step of determining whether the current scene is an HDR scene according to the steepness comprises:
[0012] In response to the steepness satisfying a first preset condition, calculating a local peak distribution state of the grayscale histogram;
[0013] Determining whether the current scene is an HDR scene according to the local peak distribution state.
[0014] Preferably, the step of calculating the local peak distribution state of the grayscale histogram comprises:
[0015] Obtaining a local peak value in the grayscale histogram, wherein the local peak value represents a maximum value of the number of pixels within a preset grayscale value range;
[0016] In response to the existence of a local peak in the grayscale histogram, obtaining a first grayscale value corresponding to the local peak;
[0017] The step of determining whether the current scene is an HDR scene according to the local peak distribution state comprises:
[0018] In response to the first grayscale value being less than or equal to a preset dark area grayscale threshold, determining that the current scene is the HDR scene;
[0019] and / or,
[0020] In response to the first grayscale value being greater than the preset dark area grayscale threshold, obtaining a dark area ratio of the grayscale histogram according to the preset dark area grayscale threshold;
[0021] In response to the dark area proportion being greater than a first threshold, determining that the current scene is the HDR scene.
[0022] Preferably, the local peak distribution state includes grayscale difference and / or local area ratio;
[0023] The step of calculating the local peak distribution state of the grayscale histogram comprises:
[0024] Obtaining a local peak value in the grayscale histogram, wherein the local peak value represents a maximum value of the number of pixels within a preset grayscale value range;
[0025] In response to the existence of at least two local peaks in the grayscale histogram, obtaining a second grayscale value corresponding to each local peak to obtain a grayscale value set;
[0026] The grayscale difference and / or the local area ratio are calculated based on the grayscale value set;
[0027] The step of determining whether the current scene is an HDR scene according to the local peak distribution state comprises:
[0028] Determine whether the current scene is the HDR scene according to the grayscale difference and / or the local area ratio.
[0029] Preferably, the step of calculating the local peak distribution state of the grayscale histogram comprises:
[0030] Acquire a first target grayscale value and a second target grayscale value in the grayscale value set, and calculate the grayscale difference between the first target grayscale value and the second target grayscale value;
[0031] and / or,
[0032] The first histogram sub-areas corresponding to a plurality of the second grayscale values in the grayscale value set are obtained, and the first histogram sub-areas are added to obtain a target histogram area, and the local area ratio of the target histogram area is calculated.
[0033] Preferably, the step of determining whether the current scene is an HDR scene according to the local peak distribution state comprises:
[0034] In response to the local peak distribution state including the grayscale difference, determining whether the current scene is the HDR scene according to the grayscale difference;
[0035] The step of determining whether the current scene is the HDR scene according to the grayscale difference comprises:
[0036] In response to the grayscale difference being greater than or equal to a first preset value, determining that the current scene is the HDR scene;
[0037] In response to the local peak distribution state including the local area ratio, determining whether the current scene is the HDR scene according to the local area ratio;
[0038] The step of determining whether the current scene is the HDR scene according to the local area ratio comprises:
[0039] In response to the local area ratio being greater than or equal to a second threshold, determining that the current scene is the HDR scene;
[0040] In response to the local peak distribution state including the grayscale difference and the local area ratio, determining whether the current scene is the HDR scene according to the grayscale difference and the local area ratio;
[0041] The step of determining whether the current scene is the HDR scene according to the grayscale difference and the local area ratio comprises:
[0042] In response to the grayscale difference being greater than or equal to a second preset value and the local area ratio being greater than or equal to a third threshold, determining that the current scene is the HDR scene;
[0043] The first preset value is greater than the second preset value, and the second threshold is greater than the third threshold.
[0044] Preferably, before the step of calculating the steepness of the grayscale histogram, the detection method further comprises:
[0045] Determine a third grayscale value corresponding to a global peak in the grayscale histogram, wherein the global peak represents a maximum value of the number of pixels;
[0046] Obtaining a second histogram sub-area corresponding to the third grayscale value, and calculating a global area ratio of the second histogram sub-area;
[0047] In response to the global area ratio satisfying a fourth preset condition, the steepness of the grayscale histogram is calculated.
[0048] According to a second aspect of the present disclosure, there is provided a detection system for an HDR scene, the detection system comprising an acquisition module, a calculation module and a determination module;
[0049] The acquisition module is used to acquire the grayscale histogram of the preview image in the current scene;
[0050] The calculation module is used to calculate the steepness of the grayscale histogram, where the steepness represents the concentration degree of pixel intensity distribution in the preview image;
[0051] The determination module is used to determine whether the current scene is an HDR scene according to the steepness.
[0052] Preferably, the determination module is further used to calculate a local peak distribution state of the grayscale histogram in response to the steepness satisfying a first preset condition; and determine whether the current scene is an HDR scene according to the local peak distribution state.
[0053] Preferably, the calculation module is further used to obtain a local peak value in the grayscale histogram, wherein the local peak value represents the maximum value of the number of pixels within a preset grayscale value range; in response to the existence of a local peak value in the grayscale histogram, obtain a first grayscale value corresponding to the local peak value;
[0054] The determination module is also used to determine that the current scene is the HDR scene in response to the first grayscale value being less than or equal to a preset dark area grayscale threshold; and / or, in response to the first grayscale value being greater than the preset dark area grayscale threshold, obtain the dark area ratio of the grayscale histogram according to the preset dark area grayscale threshold; in response to the dark area ratio being greater than a first threshold, determine that the current scene is the HDR scene.
[0055] Preferably, the local peak distribution state includes grayscale difference and / or local area ratio;
[0056] The calculation module is further used to obtain a local peak in the grayscale histogram, wherein the local peak represents the maximum value of the number of pixels within a preset grayscale value range; in response to the existence of at least two local peaks in the grayscale histogram, obtain a second grayscale value corresponding to each local peak to obtain a grayscale value set; and calculate the grayscale difference and / or the local area ratio based on the grayscale value set;
[0057] The determination module is further used to determine whether the current scene is the HDR scene according to the grayscale difference and / or the local area ratio.
[0058] Preferably, the calculation module is also used to obtain the first target grayscale value and the second target grayscale value in the grayscale value set, and calculate the grayscale difference between the first target grayscale value and the second target grayscale value; and / or, obtain the first histogram sub-areas corresponding to several of the second grayscale values in the grayscale value set, and add the first histogram sub-areas to obtain the target histogram area, and calculate the local area ratio of the target histogram area.
[0059] Preferably, the determination module is further configured to, in response to the local peak distribution state including the grayscale difference, determine whether the current scene is the HDR scene according to the grayscale difference; the determination module is further configured to, in response to the grayscale difference being greater than or equal to a first preset value, determine that the current scene is the HDR scene;
[0060] The determination module is further configured to, in response to the local peak distribution state including the local area ratio, determine whether the current scene is the HDR scene according to the local area ratio; the determination module is further configured to, in response to the local area ratio being greater than or equal to a second threshold, determine that the current scene is the HDR scene;
[0061] The determination module is further configured to, in response to the local peak distribution state including the grayscale difference and the local area ratio, determine whether the current scene is the HDR scene according to the grayscale difference and the local area ratio; the determination module is further configured to, in response to the grayscale difference being greater than or equal to a second preset value and the local area ratio being greater than or equal to a third threshold, determine that the current scene is the HDR scene;
[0062] The first preset value is greater than the second preset value, and the second threshold is greater than the third threshold.
[0063] Preferably, the calculation module is also used to determine a third grayscale value corresponding to a global peak in the grayscale histogram, wherein the global peak represents the maximum value of the number of pixels; obtain a second histogram sub-area corresponding to the third grayscale value, and calculate the global area ratio of the second histogram sub-area; in response to the global area ratio satisfying a fourth preset condition, calculate the steepness of the grayscale histogram.
[0064] According to a third aspect of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and used to run on the processor, wherein when the processor executes the computer program, the HDR scene detection method described in the first aspect of the present disclosure is implemented.
[0065] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the HDR scene detection method described in the first aspect of the present disclosure is implemented.
[0066] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method for detecting an HDR scene according to the first aspect of the present disclosure is implemented.
[0067] According to a sixth aspect of the present disclosure, a chip is provided, which is applied to an electronic device, and the chip is used to execute the HDR scene detection method described in the first aspect of the present disclosure.
[0068] According to a seventh aspect of the present disclosure, a chip module is provided, which is applied to an electronic device, including a transceiver component and a chip, wherein the chip is used to execute the HDR scene detection method described in the first aspect of the present disclosure.
[0069] On the basis of being in accordance with the common sense in the art, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present disclosure.
[0070] The positive progress effect of the present disclosure is that: in view of the different steepness of the grayscale histogram of HDR scenes and non-HDR scenes, by calculating the steepness of the grayscale histogram corresponding to the preview image in the current scene and its local peak distribution state, the HDR scene is accurately judged with a detection standard that is more in line with the intuitive perception of the human eye, and the detection process is more intuitive, while ensuring the accuracy of detection, the efficiency of scene detection is improved, which helps to use the corresponding exposure fusion technology to process the captured image according to the scene detection result during the shooting process, so as to achieve a better balance among image quality, software and hardware load, and shooting time. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is a schematic diagram of a grayscale histogram;
[0072] Figure 2 is a first flow chart of the HDR scene detection method in Example 1;
[0073] Figure 3 is a second flow chart of the HDR scene detection method in Example 1;
[0074] Figure 4 is a third flow chart of the HDR scene detection method in Example 1;
[0075] Figure 5 is a fourth flow chart of the HDR scene detection method in Example 1;
[0076] Figure 6 is a fifth flow chart of the HDR scene detection method in Example 1;
[0077] Figure 7 is a sixth flow chart of the HDR scene detection method in Example 1;
[0078] Figure 8 This is a module schematic diagram of the HDR scene detection system in Example 2;
[0079] Fig. 9 This is a schematic diagram of the structure of an electronic device in Example 3. DETAILED DESCRIPTION
[0080] The present disclosure is further described below by way of examples, but the present disclosure is not limited to the scope of the examples.
[0081] Prefixes such as "first" and "second" are used in the embodiments of the present disclosure only to distinguish different description objects, and have no limiting effect on the position, order, priority, quantity or content of the described objects. The use of prefixes such as ordinal numbers to distinguish description objects in the embodiments of the present disclosure does not constitute a limitation on the described objects. For the statement of the described objects, please refer to the description in the context of the claims or embodiments, and no unnecessary limitation should be constituted due to the use of such prefixes. In addition, in the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more.
[0082] In the embodiments of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0083] With the widespread use of digital devices with camera functions such as digital cameras, digital video cameras, tablet computers, and smart phones, digital photography has been widely used. When shooting high-dynamic scenes, due to hardware device limitations, images obtained through a single exposure cannot simultaneously obtain information in all exposure areas. Therefore, in order to shoot in high-dynamic scenes, multi-exposure fusion technology is required. In multi-exposure fusion technology, several images with different exposure levels are taken for the same scene, and then appropriate parts are selected from these images with different exposure levels for fusion to obtain a multi-exposure fusion image.
[0084] By using multi-exposure fusion technology, users can take images with complete image content in high-dynamic scenes. However, multi-exposure fusion technology requires multiple shots with different exposures and subsequent image processing, which will increase the software and hardware load and computing time accordingly. In order to balance the digital device shooting and software and hardware load and time consumption, high dynamic scene (HDR) scene detection technology is needed to detect the scene and determine whether the scene is a high-dynamic scene. Only when the scene is determined to be a high-dynamic scene, the multi-exposure fusion technology is used for photo processing.
[0085] The grayscale histogram reflects the statistical information of the grayscale values in the image, such as Figure 1 As shown, the horizontal axis of the grayscale histogram represents the possible grayscale values in an image. If the image is stored in 8 bits, the horizontal axis of the grayscale histogram takes an integer between 0 and 255, and the vertical axis of the grayscale histogram represents the proportion of pixels with the same grayscale value in the image to all pixels in the image.
[0086] Among them, the grayscale histogram can reflect the bright and dark characteristics of the image: if the image is brighter, the histogram will move closer to the right; if the image is darker, the histogram will move closer to the left. Theoretically, high-dynamic scenes should include both high-brightness scenes and low-brightness scenes, which is reflected in the grayscale histogram, that is, the grayscale histogram is distributed in both the bright area (right end) and the dark area (left end). Based on this assumption, the current most common HDR scene judgment algorithm is to calculate the proportion of bright and dark areas in the scene grayscale histogram. If the proportion of bright and dark areas is greater than a certain pre-set threshold at the same time, the scene is judged to be an HDR scene. From a theoretical analysis, this method is correct and feasible, but through a large number of experiments, it is known that the characteristics of HDR scenes reflected in the grayscale histogram do not have certain bright and dark areas at the same time, so this type of method is difficult to accurately judge HDR scenes in practice.
[0087] Another current HDR scene detection method is to first preliminarily determine whether the scene is an HDR scene based on the image brightness information. If it is not possible to determine whether the scene is an HDR scene based on the image brightness information, it is necessary to further determine whether the scene is an HDR scene based on the characteristics of the grayscale histogram. Compared with the previous HDR scene judgment method based on the proportion of bright and dark areas in the grayscale histogram, this type of method is more in line with the characteristics of the HDR scene in the grayscale histogram. However, this type of method still needs to analyze and calculate based on both the image and the grayscale histogram at the same time, the calculation process is complicated, and the grayscale histogram analysis is not in-depth and detailed enough, making it impossible to accurately judge the HDR scene.
[0088] In view of this, the present disclosure provides a detection method, system, electronic device and storage medium for HDR scenes, which start from the different steepness characteristics of grayscale histograms of HDR scenes and non-HDR scenes and combine the local peak distribution state to perform HDR scene detection, so that the detection process is more intuitive and accurate, thereby solving the problem that the existing HDR scene detection process is complicated and has low accuracy.
[0089] The following explanations are given for the relevant terms appearing in the manual:
[0090] HDR scene: a high dynamic range scene. The image corresponding to this scene has a high dynamic range and strong contrast, and there are both very high brightness areas and very low brightness areas.
[0091] Narrow dynamic scene: It is a non-HDR scene. In the image corresponding to this scene, most of the pixel grayscale values are concentrated in a narrow pixel grayscale range. In different brightness environments, the "most pixel grayscale values" required in the narrow dynamic scene may vary.
[0092] HDR scene detection: a technology used to determine whether a scene is an HDR scene. Based on the HDR scene detection result, a suitable algorithm module can be selected to process the captured image to improve the image quality.
[0093] Image grayscale histogram: a one-dimensional array reflecting the grayscale statistical information of an image. The array subscript represents the grayscale value in the image, and the array value represents the number of pixels in the image at that grayscale value.
[0094] Grayscale histogram bright area ratio: The default grayscale histogram has grayscale values increasing from left to right. Set a certain grayscale value as the bright area grayscale threshold. The ratio of the area to the right of the grayscale value in the histogram to the area of the entire histogram is the grayscale histogram bright area ratio.
[0095] Grayscale histogram dark area ratio: The default grayscale histogram has grayscale values increasing from left to right. A certain grayscale value is set as the dark area grayscale threshold. The ratio of the area to the left of the grayscale value in the histogram to the area of the entire histogram is the grayscale histogram dark area ratio.
[0096] Local peak (maximum) of grayscale histogram: In the grayscale histogram, the number of pixels with the largest value in a certain local grayscale value range;
[0097] Global peak (maximum) of the grayscale histogram: The grayscale histogram has the largest number of pixels in all grayscale value ranges.
[0098] Example 1
[0099] In a specific embodiment of the present disclosure, a method for detecting an HDR scene is provided, such as Figure 2 As shown, the detection method includes:
[0100] S1. Obtain the grayscale histogram of the preview image in the current scene;
[0101] S2, calculating the steepness of the grayscale histogram, where the steepness represents the concentration of the pixel intensity distribution in the preview image;
[0102] S3. Determine whether the current scene is an HDR scene according to the steepness.
[0103] Specifically, the current scene refers to the scene corresponding to the preview image before the user takes the image. Step S1 obtains a grayscale image by grayscale processing the preview image, and counts the number of occurrences of all pixels in the grayscale image according to the size of the grayscale value, thereby obtaining a corresponding grayscale histogram, wherein the grayscale histogram can be represented by a one-dimensional array H[N]. The size of N is related to the number of bits used to store the image. For example, if the image is stored in 6 bits, the grayscale level is 64, and N is 63. If the image is stored in 10 bits, the grayscale level is 1024, and N is 1023, and so on. Currently, images are usually stored in 8 bits with a grayscale level of 256, so N is usually 255.
[0104] After obtaining the grayscale histogram H[N], step S2 may calculate the steepness of the grayscale histogram H[N] by using a norm to determine the concentration of the pixel intensity distribution in the preview image; for example, the L-norm is used for calculation, as shown in formula (1):
[0105]
[0106] Among them, H[i] represents the number of pixels corresponding to the gray value i, and N represents the maximum gray value of the gray histogram at the current gray level.
[0107] It can also be calculated based on the L-2 norm, as shown in formula (2):
[0108]
[0109] Among them, H[i] represents the number of pixels corresponding to the gray value i, and N represents the maximum gray value of the gray histogram at the current gray level.
[0110] Of course, other norms may also be used to calculate the steepness of the grayscale histogram, and this implementation does not specifically limit this.
[0111] In step S3, after calculating the steepness steep of the grayscale histogram, if the steepness steep of the grayscale histogram is ≥ s_th1 (s_th1 is a larger value, for example, s_th1 can be 75), it means that the grayscale histogram has strong fluctuations, that is, the image corresponding to the current scene has obvious visual high dynamics, so the current scene can be directly determined to be an HDR scene; if the steepness steep of the grayscale histogram is ≤ s_th2 (s_th2 is a smaller value, for example, s_th2 can be 50), it means that the grayscale histogram is very smooth, the corresponding image visual effect is relatively soft, and does not contain obvious overexposure, underexposure and other high dynamic large change areas, so the current scene can be determined to be a non-HDR scene.
[0112] This specific implementation method performs accurate detection of the HDR scene based on the different steepness characteristics of the grayscale histograms in the HDR scene and the non-HDR scene. The detection process is more intuitive, which helps to process the captured image using the corresponding exposure fusion technology according to the scene detection result during the photographing process, so as to achieve a better balance among the image quality, software and hardware load, and photographing time.
[0113] In one specific implementation method, as Figure 3 shown, step S3 includes:
[0114] S31. In response to the steepness satisfying the first preset condition, calculate the local peak distribution state of the grayscale histogram;
[0115] S32. Determine whether the current scene is an HDR scene according to the local peak distribution state.
[0116] Specifically, when the steepness steep of the grayscale histogram is neither too large nor too small, but between s_th2 and s_th1, that is, s_th2 < steep < s_th1, at this time, it is impossible to directly determine whether the current scene is an HDR scene according to the steepness of the grayscale histogram, and it is necessary to further analyze the local peak distribution state of the grayscale histogram, such as information such as the width and deviation position of the area around the local peak, and then determine whether the current scene is an HDR scene according to the local peak distribution state.
[0117] This specific implementation method is aimed at the different steepness characteristics of the grayscale histograms in the HDR scene and the non-HDR scene. By calculating the steepness of the grayscale histogram corresponding to the preview image in the current scene and its local peak distribution state, an accurate judgment of the HDR scene is made according to a detection standard that is more in line with the intuitive feeling of the human eye. Moreover, the detection process is more intuitive, which improves the efficiency of scene detection while ensuring the detection accuracy, and helps to process the captured image using the corresponding exposure fusion technology according to the scene detection result during the photographing process, so as to achieve a better balance among the image quality, software and hardware load, and photographing time.
[0118] In one specific implementation method, as Figure 4 shown, step S31 includes:
[0119] S311. Obtain the local peak in the grayscale histogram, where the local peak represents the maximum value of the number of pixels within the preset grayscale value range;
[0120] S312. In response to the existence of a local peak in the grayscale histogram, obtain the first grayscale value corresponding to the local peak;
[0121] Step S32 includes:
[0122] S321, in response to the first grayscale value being less than or equal to a preset dark area grayscale threshold, determining that the current scene is an HDR scene;
[0123] S322. In response to the first grayscale value being greater than a preset dark area grayscale threshold, obtaining a dark area ratio of the grayscale histogram according to the preset dark area grayscale threshold; in response to the dark area ratio being greater than the first threshold, determining that the current scene is an HDR scene.
[0124] Specifically, one or more pending peaks and their corresponding grayscale values can be intuitively determined based on the distribution of the grayscale histogram; then the number of pixels of the pending peak is compared with the number of pixels corresponding to its two adjacent grayscale values and the number of pixels of grayscale values within a certain range to determine whether the number of pixels corresponding to the grayscale value is the maximum value within the certain range. If so, the pending peak can be determined as a local peak, otherwise, it is not a local peak. Of course, a loop traversal method can also be used to find the local peak, which is not specifically limited in this embodiment.
[0125] The local peak value can be determined according to formula (3):
[0126]
[0127] Among them, H[index] represents the number of pixels corresponding to the first gray value index, H max represents the maximum number of pixels in the grayscale histogram, T represents the local range threshold, for example, T is 9, which means that the area formed by the 9 grayscale values on the left and the 9 grayscale values on the right corresponding to the grayscale value to be determined is the local area.
[0128] As a preferred method, since the local peak value calculated according to formula (3) cannot guarantee that it is the maximum number of pixels in the local range, that is, there may be multiple local peaks in a local range, therefore, in order to ensure that the local peak value is the maximum number of pixels in the local range to ensure the accuracy of the HDR scene detection result, when the number of calculated local peak values is greater than 2, the obtained local peak values need to be further screened.
[0129] By subtracting the grayscale values corresponding to each local peak pairwise, if the differences are all greater than the local range threshold, it means that the calculated local peak is the maximum number of pixels in the corresponding local range. Otherwise, take the local peak with a larger number of pixels as the basis for subsequent calculations, remove the local peak with a smaller number of pixels, and subtract it from other local peaks again until the differences are all greater than the local range threshold.
[0130] For example, according to formula (3), five local peak points are calculated, and the corresponding grayscale values are b1, b2, b3, b4, and b5 from small to large, and the number of pixels is c1, c2, c3, c4, and c5 respectively. If b4-b3>T, it means that b3 and b4 are not in the same local range; if b4-b3≤T, it means that b3 and b4 are in the same local range, and the local peak needs to be determined based on c3 and c4. If c3>c4, b4 is removed, b3 is retained, and b3 and b5 are compared, and so on, until the difference between the two local peaks is greater than the local range threshold T, and the selected local peak is used as the basis for subsequent calculations.
[0131] When there is no local peak in the grayscale histogram, it means that the grayscale histogram is relatively smooth, and it can be determined that the current scene is a non-HDR scene.
[0132] When the grayscale histogram contains only one local peak, it is necessary to further determine whether the current scene is an HDR scene based on the position of the grayscale value local corresponding to the local peak. When the grayscale value local is in the dark area, that is, the grayscale value local is less than the preset dark area grayscale threshold, it means that there is an obvious underexposed dark area in the corresponding image. Therefore, the current scene can be determined as an HDR scene, so that the multi-exposure fusion technology can be used in the photo to restore the information in the underexposed dark area; and when the grayscale value local is not in the dark area, it is necessary to combine the grayscale histogram dark area ratio to determine whether the current scene is an HDR scene. If the grayscale histogram dark area ratio is large, that is, the dark area ratio is greater than the first threshold, the current scene is determined to be an HDR scene. In other cases, the current scene is determined to be a non-HDR scene. In one feasible method, the first threshold can be 0.16.
[0133] This specific implementation method is for the condition that there is only one local peak in the grayscale histogram. It determines whether the current scene is an HDR scene based on whether the first grayscale value corresponding to the local peak is located in the dark area. At the same time, when the first grayscale value is not located in the dark area, it is further determined based on the proportion of the dark area, thereby avoiding inaccurate detection results of the HDR scene due to differences in threshold settings.
[0134] In a specific embodiment, Figure 5 As shown, the local peak distribution state includes grayscale difference and / or local area ratio;
[0135] Step S31 also includes:
[0136] S313, in response to the existence of at least two local peaks in the grayscale histogram, obtaining a second grayscale value corresponding to each local peak to obtain a grayscale value set;
[0137] S314, calculating the grayscale difference and / or the local area ratio based on the grayscale value set;
[0138] Wherein, step S314 includes obtaining a first target grayscale value and a second target grayscale value in the grayscale value set, and calculating the grayscale difference between the first target grayscale value and the second target grayscale value;
[0139] Step S314 also includes: obtaining first histogram sub-areas corresponding to several second grayscale values in the grayscale value set, adding the first histogram sub-areas to obtain a target histogram area, and calculating the local area ratio of the target histogram area.
[0140] Step S32 includes: determining whether the current scene is the HDR scene according to the grayscale difference and / or the local area ratio.
[0141] Wherein, step S32 specifically includes:
[0142] S321, in response to the local peak distribution state including the grayscale difference, determining whether the current scene is an HDR scene according to the grayscale difference;
[0143] Step S321 specifically includes: in response to the grayscale difference being greater than or equal to a first preset value, determining that the current scene is an HDR scene;
[0144] S322, in response to the local peak distribution state including the local area ratio, determining whether the current scene is an HDR scene according to the local area ratio;
[0145] Step S321 specifically includes: in response to the local area ratio being greater than or equal to a second threshold, determining that the current scene is an HDR scene;
[0146] S323, in response to the local peak distribution state including the grayscale difference and the local area ratio, determining whether the current scene is an HDR scene according to the grayscale difference and the local area ratio;
[0147] Step S323 specifically includes: in response to the grayscale difference being greater than or equal to the second preset value and the local area ratio being greater than or equal to the third threshold, determining that the current scene is an HDR scene;
[0148] Among them, the first preset value is greater than the second preset value, and the second threshold is greater than the third threshold.
[0149] Specifically, when the grayscale histogram contains two or more local peaks, if the maximum distance M_dis between the second grayscale values corresponding to these local peaks is large, that is, M_dis≥e_dist, e_dist is a pre-set first preset value, for example, e_dist=200 is pre-set, when M_dis≥200, it means that the corresponding image has a large area of grayscale with large difference, then the current scene can be determined as an HDR scene; wherein, the maximum distance M_dis refers to the difference between the grayscale values corresponding to any two local peaks, for example, there are three local peaks in the grayscale histogram, and their corresponding grayscale values are 90, 150, and 200, respectively, then the maximum distance M_dis=200-90. Of course, if the difference between two local peaks is greater than e_dist, the current scene can be directly determined as an HDR scene without finding the maximum distance M_dis.
[0150] If the target histogram area obtained by adding the first histogram sub-areas near each local peak is larger, it means that the grayscale of the corresponding image is not evenly distributed on a large number of grayscale levels, and there are still a large number of pixel vacancies. Therefore, the current scene can be determined as an HDR scene, and the multi-exposure fusion technology can be used to restore the lost content when taking pictures; wherein, the size of the target histogram area can be determined by the local area ratio M_ratio, that is, M_ratio≥e_ratio, e_ratio is a preset third threshold, for example, e_ratio=0.75 is preset, when M_ratio≥0.75, the current scene can be determined as an HDR scene.
[0151] The calculation method of the local area ratio is shown in formula (4):
[0152]
[0153] Among them, j represents the number of local peaks, b k represents the second grayscale value corresponding to the kth local peak, N represents the maximum grayscale value of the grayscale histogram at the current grayscale level, r represents a preset parameter, r≥0 and is a positive number, and h[i] represents the number of pixels corresponding to the grayscale value i. Preferably, r∈[6,12], for example, r=9.
[0154] Combined with the above analysis, if the maximum distance M_dis between the second grayscale values corresponding to these local peaks is relatively large and the histogram sub-area ratio M_ratio near these local peaks is also relatively large, the current scene should also be determined as an HDR scene, so that the multi-exposure fusion technology can be used to restore the lost content when taking pictures. That is, M_dis≥dist and M_ratio≥ratio, dist is a pre-set second preset value, and ratio is a pre-set second threshold. For example, it is pre-set that dist=190, ratio=0.45. When M_dis≥190 and M_ratio≥0.45, the current scene can be determined as an HDR scene.
[0155] This specific implementation method is aimed at the condition that there are two or more local peaks in the grayscale histogram, and further determines whether there is a sharp contrast in the preview image according to the grayscale value distance between the local peaks and the local area ratio, so that the HDR scene detection result is more in line with the detection standard of the human eye's intuitive perception.
[0156] In a specific embodiment, before step S2, Figure 6 As shown, the detection method also includes:
[0157] S11, determining a third grayscale value corresponding to a global peak in the grayscale histogram, where the global peak represents a maximum value of the number of pixels;
[0158] S12, obtaining a second histogram sub-area corresponding to the third grayscale value, and calculating a global area ratio of the second histogram sub-area;
[0159] S13. In response to the global area ratio satisfying a fourth preset condition, calculating the steepness of the grayscale histogram.
[0160] Specifically, before calculating the steepness of the grayscale histogram, the third grayscale value m corresponding to the global peak value (the largest number of pixels) in the grayscale histogram can be found (ie, H[m] = H max ), and then calculate the histogram sub-area corresponding to the third grayscale value m. If the histogram sub-area is very large, it means that most of the pixel grayscale values of the current scene are concentrated in a smaller range, and the scene has no high dynamic content. Therefore, the current scene can be directly judged as a narrow dynamic scene (i.e., non-HDR scene), and there is no need to perform subsequent HDR scene judgment. Otherwise, it is necessary to calculate the steepness of the grayscale histogram and the local peak state to judge the HDR scene.
[0161] The size of the second histogram sub-area can be determined by the global area ratio a_ratio. The calculation method of the global area ratio a_ratio is shown in formula (5):
[0162]
[0163] Among them, n represents the third grayscale value corresponding to the global peak, a_ratio represents the global area ratio of the second histogram sub-area corresponding to the third grayscale value n, N represents the maximum grayscale value of the grayscale histogram at the current grayscale level, r represents a preset parameter, r≥0 and is an integer, and h[i] represents the number of pixels corresponding to the grayscale value i.
[0164] When a_ratio is greater than the threshold a_th, it means that most of the pixel grayscale values in the current scene are concentrated in a smaller range (2r), and the scene does not have high dynamic content, so the current scene can be directly determined as a narrow dynamic scene. It should be noted that the judgment threshold "a_th" will take different values according to different brightness levels. For example, the value of a_th is smaller (such as 0.5) under daytime conditions, and the value of a_th is larger (such as 0.85) under night conditions. This embodiment does not make specific limitations on this.
[0165] This specific implementation method first excludes obvious non-HDR scenes according to the global area ratio corresponding to the global peak, reduces the amount of processed data of steepness and local peak distribution state, and thus further improves the detection efficiency of HDR scenes.
[0166] In a specific example, if Figure 7 As shown in the figure, after obtaining the grayscale histogram corresponding to the preview image of the current scene, first calculate the global area ratio a_ratio corresponding to the global peak. If a_ratio>a_th, it means that most of the pixel grayscale values of the current scene are concentrated in a smaller range and there is no high dynamic content. Then the current scene can be directly determined as a non-HDR scene. Otherwise, it is necessary to calculate the steepness of the grayscale histogram.
[0167] If steep≤s_th2, it means that the grayscale histogram is very smooth, the corresponding image visual effect is relatively soft, and there are no obvious overexposure, underexposure and other high dynamic change areas. In this case, it can be determined that the current scene is a non-HDR scene. If steep≥s_th1, it means that the grayscale histogram has strong fluctuations (at this time, the scene where the grayscale histogram is concentrated in a narrow grayscale area has been excluded), which means that the preview image corresponding to the current scene has obvious visual high dynamics. In this case, the current scene can be directly determined as an HDR scene. For the case of s_th2<steep<s_th1, it is necessary to further accurately detect the HDR scene based on the distribution state of the local peak.
[0168] If the grayscale histogram has no local peak (the number of local peaks is equal to 0), it means that the histogram is relatively smooth at this time, so it should be judged as a non-HDR scene; if the grayscale histogram has only one local peak (the number of local peaks is equal to 1), and the local peak is located in the dark area, the current scene can be directly determined to be an HDR scene. Otherwise, only when the proportion of the dark area is greater than the first threshold, the current scene can be determined to be an HDR scene; if there are two or more local peaks in the grayscale histogram, the maximum distance of these local peaks M_dis≥e_dist, indicating that the corresponding preview image has a large area of grayscale with large differences, and the current scene can be determined to be an HDR scene, or, the local area proportion of these local peaks M_ratio≥e_ratio, indicating that the grayscale of the corresponding preview image is not evenly distributed on a large number of grayscale levels, and the current scene can also be determined to be an HDR scene, or, the maximum distance of these local peaks M_dis≥dist and the local area proportion M_ratio≥ratio, indicating that the corresponding preview image also has a relatively bright color contrast, so the current scene can also be determined to be an HDR scene.
[0169] Therefore, by performing a multi-dimensional analysis of a grayscale histogram of the current scene preview image, the accuracy of HDR scene detection can be ensured, and the detection result is more in line with the intuitive perception of the human eye.
[0170] This embodiment aims at the different steepness of grayscale histograms of HDR scenes and non-HDR scenes. By calculating the steepness of the grayscale histogram corresponding to the preview image in the current scene and its local peak distribution state, the HDR scene is accurately judged with a detection standard that is more in line with the intuitive perception of the human eye. The detection process is more intuitive, and the efficiency of scene detection is improved while ensuring the accuracy of detection. It is helpful to use the corresponding exposure fusion technology to process the captured image according to the scene detection result during the shooting process, so as to achieve a better balance among image quality, software and hardware load, and shooting time.
[0171] Example 2
[0172] In a specific embodiment of the present disclosure, a detection system for an HDR scene is provided, such as Figure 8 As shown, a detection system for an HDR scene is provided, the detection system comprising an acquisition module 100, a calculation module 200 and a determination module 300;
[0173] The acquisition module 100 is used to acquire the grayscale histogram of the preview image in the current scene;
[0174] The calculation module 200 is used to calculate the steepness of the grayscale histogram, and the steepness represents the concentration degree of the pixel intensity distribution in the preview image;
[0175] The determination module 300 is used to determine whether the current scene is an HDR scene according to the steepness.
[0176] In a specific implementation, the determination module 300 is further configured to calculate a local peak distribution state of a grayscale histogram in response to the steepness satisfying a first preset condition; and determine whether the current scene is an HDR scene according to the local peak distribution state.
[0177] In a specific embodiment, the calculation module 200 is further used to obtain a local peak value in the grayscale histogram, where the local peak value represents the maximum value of the number of pixels within a preset grayscale value range; in response to the existence of a local peak value in the grayscale histogram, obtain a first grayscale value corresponding to the local peak value;
[0178] The determination module 300 is also used to determine that the current scene is an HDR scene in response to the first grayscale value being less than or equal to a preset dark area grayscale threshold; or, in response to the first grayscale value being greater than the preset dark area grayscale threshold, obtain the dark area ratio of the grayscale histogram according to the preset dark area grayscale threshold; in response to the dark area ratio being greater than the first threshold, determine that the current scene is an HDR scene.
[0179] In a specific embodiment, the local peak distribution state includes grayscale difference and / or local area ratio;
[0180] The calculation module 200 is also used to obtain a local peak value in the grayscale histogram, where the local peak value represents the maximum value of the number of pixels within a preset grayscale value range; in response to the presence of at least two local peak values in the grayscale histogram, obtain a second grayscale value corresponding to each local peak value to obtain a grayscale value set; and calculate the grayscale difference and / or local area ratio based on the grayscale value set;
[0181] The determination module 300 is further used to determine whether the current scene is an HDR scene according to the grayscale difference and / or the local area ratio.
[0182] In a specific embodiment, the calculation module 200 is also used to obtain the first target grayscale value and the second target grayscale value in the grayscale value set, calculate the grayscale difference between the first target grayscale value and the second target grayscale value; obtain the first histogram sub-areas corresponding to several second grayscale values in the grayscale value set, and add the first histogram sub-areas to obtain the target histogram area, and calculate the local area ratio of the target histogram area.
[0183] In a specific embodiment, the determination module 300 is further used to determine whether the current scene is an HDR scene according to the grayscale difference in response to the local peak distribution state including the grayscale difference; the determination module 300 is further used to determine that the current scene is an HDR scene in response to the grayscale difference being greater than or equal to a first preset value;
[0184] The determination module 300 is further configured to determine whether the current scene is an HDR scene according to the local area ratio in response to the local peak distribution state including the local area ratio; the determination module 300 is further configured to determine that the current scene is an HDR scene in response to the local area ratio being greater than or equal to a second threshold;
[0185] The determination module 300 is further configured to determine whether the current scene is an HDR scene in response to the local peak distribution state including the grayscale difference and the local area ratio according to the grayscale difference and the local area ratio; the determination module 300 is further configured to determine that the current scene is an HDR scene in response to the grayscale difference being greater than or equal to a second preset value and the local area ratio being greater than or equal to a third threshold;
[0186] Among them, the first preset value is greater than the second preset value, and the second threshold is greater than the third threshold.
[0187] In a specific embodiment, the calculation module 200 is also used to determine a third grayscale value corresponding to a global peak in the grayscale histogram, where the global peak represents the maximum number of pixels; obtain a second histogram sub-area corresponding to the third grayscale value, and calculate the global area ratio of the second histogram sub-area; in response to the global area ratio satisfying a fourth preset condition, calculate the steepness of the grayscale histogram.
[0188] As for the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The system embodiment described above is only illustrative, wherein the units described as separate components may or may not be physically separated, and the components as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution.
[0189] This embodiment aims at the different steepness of grayscale histograms of HDR scenes and non-HDR scenes. By calculating the steepness of the grayscale histogram corresponding to the preview image in the current scene and its local peak distribution state, the HDR scene is accurately judged with a detection standard that is more in line with the intuitive perception of the human eye. The detection process is more intuitive, and the efficiency of scene detection is improved while ensuring the accuracy of detection. It is helpful to use the corresponding exposure fusion technology to process the captured image according to the scene detection result during the shooting process, so as to achieve a better balance among image quality, software and hardware load, and shooting time.
[0190] Example 3
[0191] Fig. 9This is a structural schematic diagram of an electronic device shown in an example embodiment of the present disclosure, the electronic device includes a memory, a processor, and a computer program stored in the memory and used to run on the processor, and when the processor executes the computer program, the HDR scene detection method described in any of the above embodiments is implemented. Fig. 9 The electronic device 30 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0192] Among them, electronic devices include digital devices, and digital devices refer to devices with photo-taking functions, such as digital cameras, digital video cameras, smart phones, tablet computers, etc. The digital devices use the HDR scene detection system described in any of the above embodiments to detect the current scene. If the current scene is an HDR scene, the multi-exposure fusion technology is used to process the captured image; otherwise, the multi-exposure fusion technology is not used to achieve a better balance among image quality, software and hardware load, and photo-taking time.
[0193] like Fig. 9 As shown, the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).
[0194] The bus 33 includes a data bus, an address bus, and a control bus.
[0195] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .
[0196] The memory 32 may also include a program tool 325 (or utility) having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include an implementation of a network environment.
[0197] The processor 31 executes various functional applications and data processing by running the computer program stored in the memory 32, such as the HDR scene detection method provided in any of the above embodiments.
[0198] The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the electronic device 30 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 36. As shown, the network adapter 36 communicates with other modules of the electronic device 30 via a bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
[0199] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0200] Example 4
[0201] The embodiments of the present disclosure further provide a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the HDR scene detection method provided in any of the above embodiments is implemented.
[0202] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0203] Example 5
[0204] The embodiments of the present disclosure further provide a computer program product, including a computer program, which implements any of the above-mentioned HDR scene detection methods when executed by a processor.
[0205] Among them, the program code for executing the computer program product of the present disclosure can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.
[0206] Example 6
[0207] The embodiments of the present disclosure also provide a chip, which is applied to an electronic device, and the chip is used to execute the HDR scene detection method provided in any of the above embodiments.
[0208] Example 7
[0209] The embodiments of the present disclosure also provide a chip module, which is applied to electronic devices, including a transceiver component and a chip, and the chip is used to execute the HDR scene detection method provided in any of the above embodiments.
[0210] Although the specific embodiments of the present disclosure are described above, those skilled in the art should understand that this is only an example, and the protection scope of the present disclosure is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present disclosure, but these changes and modifications all fall within the protection scope of the present disclosure.
Claims
1. A method for detecting an HDR scene, characterized in that: The detection method comprises: Get the grayscale histogram of the preview image in the current scene; Calculating the steepness of the grayscale histogram, wherein the steepness represents the concentration degree of pixel intensity distribution in the preview image; Determining whether the current scene is an HDR scene according to the steepness.
2. The detection method according to claim 1, characterized in that: The step of determining whether the current scene is an HDR scene according to the steepness comprises: In response to the steepness satisfying a first preset condition, calculating a local peak distribution state of the grayscale histogram; Determining whether the current scene is an HDR scene according to the local peak distribution state.
3. The detection method according to claim 2, characterized in that: The step of calculating the local peak distribution state of the grayscale histogram comprises: Obtaining a local peak value in the grayscale histogram, wherein the local peak value represents a maximum value of the number of pixels within a preset grayscale value range; In response to the existence of a local peak in the grayscale histogram, obtaining a first grayscale value corresponding to the local peak; The step of determining whether the current scene is an HDR scene according to the local peak distribution state comprises: In response to the first grayscale value being less than or equal to a preset dark area grayscale threshold, determining that the current scene is the HDR scene; and / or, In response to the first grayscale value being greater than the preset dark area grayscale threshold, obtaining a dark area ratio of the grayscale histogram according to the preset dark area grayscale threshold; In response to the dark area proportion being greater than a first threshold, determining that the current scene is the HDR scene.
4. The detection method according to claim 2, characterized in that: The local peak distribution state includes grayscale difference and / or local area ratio; The step of calculating the local peak distribution state of the grayscale histogram comprises: Obtaining a local peak value in the grayscale histogram, wherein the local peak value represents a maximum value of the number of pixels within a preset grayscale value range; In response to the existence of at least two local peaks in the grayscale histogram, obtaining a second grayscale value corresponding to each local peak to obtain a grayscale value set; The grayscale difference and / or the local area ratio are calculated based on the grayscale value set; The step of determining whether the current scene is an HDR scene according to the local peak distribution state comprises: Determine whether the current scene is the HDR scene according to the grayscale difference and / or the local area ratio.
5. The detection method according to claim 4, characterized in that: The step of calculating the local peak distribution state of the grayscale histogram comprises: Acquire a first target grayscale value and a second target grayscale value in the grayscale value set, and calculate the grayscale difference between the first target grayscale value and the second target grayscale value; and / or, The first histogram sub-areas corresponding to a plurality of the second grayscale values in the grayscale value set are obtained, and the first histogram sub-areas are added to obtain a target histogram area, and the local area ratio of the target histogram area is calculated.
6. The detection method according to claim 5, characterized in that: The step of determining whether the current scene is an HDR scene according to the local peak distribution state comprises: In response to the local peak distribution state including the grayscale difference, determining whether the current scene is the HDR scene according to the grayscale difference; The step of determining whether the current scene is the HDR scene according to the grayscale difference comprises: In response to the grayscale difference being greater than or equal to a first preset value, determining that the current scene is the HDR scene; In response to the local peak distribution state including the local area ratio, determining whether the current scene is the HDR scene according to the local area ratio; The step of determining whether the current scene is the HDR scene according to the local area ratio comprises: In response to the local area ratio being greater than or equal to a second threshold, determining that the current scene is the HDR scene; In response to the local peak distribution state including the grayscale difference and the local area ratio, determining whether the current scene is the HDR scene according to the grayscale difference and the local area ratio; The step of determining whether the current scene is the HDR scene according to the grayscale difference and the local area ratio comprises: In response to the grayscale difference being greater than or equal to a second preset value and the local area ratio being greater than or equal to a third threshold, determining that the current scene is the HDR scene; The first preset value is greater than the second preset value, and the second threshold is greater than the third threshold.
7. The detection method according to any one of claims 1 to 6, characterized in that: Before the step of calculating the steepness of the grayscale histogram, the detection method further includes: Determine a third grayscale value corresponding to a global peak in the grayscale histogram, wherein the global peak represents a maximum value of the number of pixels; Obtaining a second histogram sub-area corresponding to the third grayscale value, and calculating a global area ratio of the second histogram sub-area; In response to the global area ratio satisfying a fourth preset condition, the steepness of the grayscale histogram is calculated.
8. A HDR scene detection system, characterized in that: The detection system includes an acquisition module, a calculation module and a determination module; The acquisition module is used to acquire the grayscale histogram of the preview image in the current scene; The calculation module is used to calculate the steepness of the grayscale histogram, where the steepness represents the concentration degree of pixel intensity distribution in the preview image; The determination module is used to determine whether the current scene is an HDR scene according to the steepness.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and used to run on the processor, characterized in that: When the processor executes the computer program, the HDR scene detection method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the HDR scene detection method according to any one of claims 1 to 7 is implemented.