Scene detection method, device and equipment and computer readable storage medium

By performing block processing and weight matrix calculation on the image, the brightness characteristics of the image are dynamically evaluated, solving the accuracy and flexibility problems of HDR scene detection in the existing technology, and achieving more efficient image processing.

CN118608495APending Publication Date: 2024-09-06XIAN WINGTECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410769074.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing HDR scene detection technology relies on pre-set thresholds and fixed parameters, resulting in inaccurate judgment and inability to flexibly adapt to different image collection scenarios, which increases the complexity and cost of image processing.

Method used

By dividing the image to be detected into blocks, calculating the comprehensive weight matrix and weighted brightness matrix, dynamically evaluating the brightness characteristics of the image, and determining whether it is a high dynamic range image, there is no need to rely on pre-set thresholds, thus improving the accuracy and flexibility of detection.

Benefits of technology

It reduces misjudgments caused by inappropriate fixed parameter settings, improves the accuracy and flexibility of HDR scene detection, and reduces the complexity and cost of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608495A
    Figure CN118608495A
Patent Text Reader

Abstract

The invention relates to the field of image detection, and provides a scene detection method, device and equipment and a computer readable storage medium. By adopting the method, the comprehensive weight matrix can be dynamically calculated for the to-be-detected image, and whether the to-be-detected image is a high-dynamic-range image or not is determined by evaluating the difference between the weighted brightness matrix obtained after weighting calculation of the comprehensive weight matrix and the average brightness of the to-be-detected image. According to the method, the image acquisition scene is determined to be the HDR scene when the continuous multi-frame images are all the high dynamic range images, and fixed parameters such as a preset threshold value do not need to be considered, so that misjudgment caused by improper setting of the fixed parameters is reduced, and the flexibility and accuracy of HDR scene detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image detection technology, and in particular to a scene detection method, device, equipment and computer-readable storage medium. Background Art

[0002] High Dynamic Range (HDR) image processing is an image technology used to enhance the brightness, contrast and color expression of an image. Traditional images can usually only present a limited brightness and color range, while HDR technology captures multiple images with different exposure levels in the same photo and merges them together to show more details and a wider brightness range. This technology can be used in fields such as photography, filmmaking and television display to provide more realistic and true image quality.

[0003] However, not all images in all scenes need to be processed with HDR. In some cases, the dynamic range of the scene may not be high, and using HDR to process the image may not bring obvious advantages, but increase the cost and complexity of image processing. Therefore, it is necessary to perform HDR detection on the image acquisition scene to determine whether HDR processing is required.

[0004] In existing HDR scene detection technology, it usually relies on pre-set thresholds and algorithms, and these parameters may need to be adjusted accordingly in the face of different image acquisition scenarios. However, if the pre-set thresholds and other fixed parameters are not appropriate, it may lead to wrong judgments, resulting in poor accuracy of HDR image detection. Summary of the invention

[0005] In order to solve the above technical problems, the present disclosure provides a scene detection method, device, equipment and computer-readable storage medium to improve the accuracy of image detection.

[0006] In a first aspect, an embodiment of the present disclosure provides a scene detection method, including:

[0007] Calculating the average brightness of the image to be detected according to original brightness information of a single frame of the image to be detected, wherein the image to be detected is divided into a plurality of image blocks;

[0008] Processing the original brightness information in blocks to obtain a brightness information matrix, wherein the image blocks correspond one to one to the elements in the brightness information matrix;

[0009] Calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix;

[0010] Obtaining a weighted brightness matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix;

[0011] If the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determining that the image to be detected is a high dynamic range image;

[0012] If all N consecutive frames of images to be detected are high dynamic range images, it is determined that the image acquisition scene corresponding to the N consecutive frames of images to be detected is a high dynamic range scene, and N is greater than a preset frame number threshold.

[0013] In some embodiments, the calculating of the comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix includes:

[0014] Determine a position weight matrix of the image to be detected based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected;

[0015] Determine the brightness level corresponding to each of the image blocks according to the brightness information matrix;

[0016] Determining a level weight matrix of the image to be detected based on the brightness level of each of the image blocks and the total number of image blocks in the image to be detected;

[0017] Determining a brightness weight matrix of the image to be detected based on the average brightness corresponding to each of the image blocks and the average brightness of the image to be detected;

[0018] The position weight matrix, the level weight matrix, and the brightness weight matrix are fused to obtain the comprehensive weight matrix.

[0019] In some embodiments, the position weight matrix is ​​composed of position weights corresponding to each image block, the multiple image blocks include at least a first image block and a second image block, and the position weight matrix of the image to be detected is determined based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected, including:

[0020] If the first distance is smaller than the second distance, the position weight of the first image block is greater than the position weight of the second image block, the first distance is the distance between the first image block and the center position of the image to be detected, and the second distance is the distance between the second image block and the center position of the image to be detected.

[0021] In some embodiments, the level weight matrix is ​​composed of level weights corresponding to each image block, the multiple image blocks include at least a third image block and a fourth image block, and the level weight matrix of the image to be detected is determined based on the brightness level of each image block and the total number of image blocks in the image to be detected, including:

[0022] If the first proportion is smaller than the second proportion, the level weight of the third image block is smaller than the level weight of the fourth image block, the first proportion is the ratio of the number of image blocks with the same brightness level as the third image block to the total number of image blocks, and the second proportion is the ratio of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks.

[0023] In some embodiments, the brightness weight matrix is ​​composed of brightness weights corresponding to each image block, the multiple image blocks include at least a fifth image block and a sixth image block, and the brightness weight matrix of the image to be detected is determined based on the average brightness corresponding to each of the image blocks and the average brightness of the image to be detected, including:

[0024] If the first brightness difference value is smaller than the second brightness difference value, the brightness weight of the fifth image block is smaller than the brightness weight of the sixth image block, the first brightness difference value is the difference between the average brightness of the fifth image block and the average brightness of the image to be detected, and the second brightness difference value is the difference between the average brightness of the sixth image block and the average brightness of the image to be detected.

[0025] In some embodiments, if the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determining that the image to be detected is a high dynamic range image includes:

[0026] Calculating the mean square error between the brightness values ​​corresponding to the multiple elements in the weighted brightness matrix and the average brightness;

[0027] If the mean square error is greater than the preset difference threshold, it is determined that the image to be detected is a high dynamic range image.

[0028] In some embodiments, the processing of the original brightness information into blocks to obtain a brightness information matrix includes:

[0029] Calculating the average brightness of each image block according to the original brightness information;

[0030] The average brightness of each image block is used as multiple elements in the brightness information matrix.

[0031] In a second aspect, an embodiment of the present disclosure provides a scene detection device, including:

[0032] A first calculation module, used for calculating the average brightness of the image to be detected according to the original brightness information of a single frame of the image to be detected, wherein the image to be detected is divided into a plurality of image blocks;

[0033] A block processing module, used for performing block processing on the original brightness information to obtain a brightness information matrix, wherein the image blocks correspond one to one to the elements in the brightness information matrix;

[0034] A second calculation module, used for calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix;

[0035] A weighting module, used for obtaining a weighted brightness matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix;

[0036] A first determination module, configured to determine that the image to be detected is a high dynamic range image if the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold;

[0037] The second determination module is used to determine that the image acquisition scene corresponding to the consecutive N frames of images to be detected is a high dynamic range scene if all of the consecutive N frames of images to be detected are high dynamic range images, and N is greater than a preset frame number threshold.

[0038] In a third aspect, an embodiment of the present disclosure provides a computer device, including:

[0039] Memory;

[0040] Processor; and

[0041] Computer programs;

[0042] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.

[0043] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method described in the first aspect.

[0044] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the scene detection method as described above is implemented.

[0045] The scene detection method, apparatus, device and computer-readable storage medium provided by the embodiments of the present disclosure determine whether the image to be detected is a high dynamic range image by dynamically calculating a comprehensive weight matrix for the image to be detected, and evaluating the difference between a weighted brightness matrix obtained after weighted calculation of the comprehensive weight matrix and the average brightness of the image to be detected. When multiple consecutive frames of images are all high dynamic range images, the image acquisition scene is determined to be an HDR scene, without considering fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR scene detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

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

[0048] Figure 1 A schematic diagram of an application environment of a scene detection method provided by an embodiment of the present disclosure;

[0049] Figure 2 A flow chart of a scene detection method provided by an embodiment of the present disclosure;

[0050] Figure 3 A flow chart of a scene detection method provided by another embodiment of the present disclosure;

[0051] Figure 4 A schematic diagram of the structure of a scene detection device provided in an embodiment of the present disclosure;

[0052] Figure 5 An internal structure diagram of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0053] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0054] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0055] The present disclosure provides a scene detection method, which is described below in conjunction with a specific embodiment.

[0056] The scene detection method provided in this application can be applied to Figure 1 In the application environment shown. The scene detection method is applied to an image detection system. The image detection system includes a terminal 102 and a server 104. The terminal 102 and the server 104 communicate through a network. By dynamically calculating the comprehensive weight for the image to be detected, the weighted brightness information after the weighted calculation of the comprehensive weight is evaluated to determine whether the image to be detected is a high dynamic range image, without considering fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR image detection. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0057] In one embodiment, Figure 2 As shown, a scene detection method is provided. This embodiment mainly applies the method to Figure 1 The terminal 110 (or server 120) is used as an example.

[0058] S202: Calculate the average brightness of the image to be detected according to original brightness information of a single frame of the image to be detected, where the image to be detected is divided into a plurality of image blocks.

[0059] Exemplarily, the single frame image to be detected may be the current frame image.

[0060] The terminal obtains the original brightness information of a single frame of the image to be detected, specifically including the brightness value of each pixel, which ranges from 0 to 255; the single frame of the image to be detected is divided into multiple image blocks according to certain rules, and the original brightness information is also the brightness information of the multiple image blocks.

[0061] Furthermore, the terminal calculates the average brightness of the image to be detected based on the acquired original brightness information, that is, the average value of the brightness value of each pixel in the image to be detected.

[0062] Optionally, the single-frame image to be detected may be an image in any format, including but not limited to: an image in YUV or RGB format.

[0063] Among them, YUV is a color encoding system used to represent and process color information in images or videos. Unlike the common RGB (red, green, and blue) color space, the YUV color space represents brightness (Y) and chrominance (U and V) separately. Brightness (Y) represents the black and white information in the image, while chrominance (U and V) represents color information. Since the human eye is more sensitive to brightness and relatively less sensitive to chrominance, YUV encoding can reduce the amount of data while maintaining image quality. This makes YUV encoding widely used in image and video compression, transmission, and processing. In the YUV color space, the value range of brightness (Y) is 0 to 255 (or 0 to 1), and the value range of chrominance (U and V) is -128 to 127 (or -0.5 to 0.5). Common YUV formats include YUV420, YUV422, and YUV444, which represent and store color information in images or videos in different sampling methods and chrominance resolutions.

[0064] S204, performing block processing on the original brightness information to obtain a brightness information matrix, wherein the image blocks correspond one to one to the elements in the brightness information matrix.

[0065] In some embodiments, after the terminal obtains a single frame of image to be detected, it performs brightness block processing on it, that is, divides the single frame of image to be detected into multiple image blocks, and correspondingly processes the original brightness information in blocks, saves it as a brightness information matrix, and takes the average brightness of the pixels in each image block as the brightness level of the image block.

[0066] It is understandable that if the number of image blocks is too small, the image area covered by each image block will become larger, which will result in the larger image blocks being unable to effectively retain the details of the original single-frame image to be detected. The detail information will be blurred by the average value or other statistics within the image block, causing the image processing result to lose detail information, thereby affecting the accuracy and effect of the image. Therefore, the number of image blocks can be automatically set according to the size of the single-frame image to be detected.

[0067] S206: Calculate a comprehensive weight matrix corresponding to each image block based on the position of each image block in the image to be detected and the brightness information matrix.

[0068] The comprehensive weight matrix is ​​obtained by weighted mixing of multiple weight matrices, wherein each weight matrix is ​​respectively related to the position of each image block in the image to be detected and / or the original brightness information.

[0069] For example, the comprehensive weight matrix includes at least a position weight matrix, a level weight matrix, and a brightness weight matrix, wherein the position weight of each image block is related to the position of the image block in the image to be detected; the level weight and the brightness weight are related to the brightness information matrix.

[0070] A simple example formula is given below. The comprehensive weight matrix is ​​calculated as follows:

[0071] W=α 1 *w 1 +α 2 *w 2 +…+α n *w n

[0072] Among them, α 1 , α 2 …α n is the mixing coefficient, which represents the corresponding weight matrix w 1 、w 2 ,…,w n The weight, α 1 +α 2 +…+α n =1,α 1 , α 2 , …, α n ≥0.

[0073] S208. Obtain a weighted brightness information matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix.

[0074] The comprehensive weight matrix includes the importance of the brightness of each image block in determining whether the image to be detected is a high dynamic range image. The terminal uses the comprehensive weight matrix to perform weighted calculation on the brightness information matrix to obtain a weighted brightness matrix of the image to be detected. The weighted brightness matrix actually makes the brightness features in the image to be detected more prominent.

[0075] S210: If the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determine that the image to be detected is a high dynamic range image.

[0076] S212: If all the consecutive N frames of images to be detected are high dynamic range images, determine that the image acquisition scene corresponding to the consecutive N frames of images to be detected is a high dynamic range scene, and N is greater than a preset frame number threshold.

[0077] If there are more than N consecutive frames of high dynamic range images, the image acquisition scene corresponding to these high dynamic range images is determined to be a high dynamic range scene. The terminal can turn on the HDR function to process the high dynamic range images to obtain better image display effects.

[0078] The disclosed embodiment calculates the average brightness of the image to be detected based on the original brightness information of a single frame of the image to be detected, and the image to be detected is divided into multiple image blocks; the original brightness information is processed in blocks to obtain a brightness information matrix, and the image blocks correspond one-to-one to the elements in the brightness information matrix; based on the position of each image block in the image to be detected and the brightness information matrix, a comprehensive weight matrix of the image to be detected is calculated; based on the comprehensive weight matrix and the brightness information matrix, a weighted brightness matrix of the image to be detected is obtained; if the degree of difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, it is determined that the image to be detected is a high dynamic range Image; if N consecutive frames of images to be detected are all high dynamic range images, then the image acquisition scene corresponding to the N consecutive frames of images to be detected is determined to be a high dynamic range scene, N is greater than a preset frame number threshold, and a comprehensive weight matrix is ​​dynamically calculated for the image to be detected, and the difference between the weighted brightness matrix obtained after weighted calculation of the comprehensive weight matrix and the average brightness of the image to be detected is evaluated to determine whether the image to be detected is a high dynamic range image, and when multiple consecutive frames of images are all high dynamic range images, the image acquisition scene is determined to be an HDR scene, and there is no need to consider fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR scene detection.

[0079] Based on the above embodiment, the original brightness information is processed into blocks to obtain a brightness information matrix, including: calculating the average brightness of each image block according to the original brightness information; and using the average brightness of each image block as multiple elements in the brightness information matrix.

[0080] Each element in the brightness information matrix corresponds to an image block, and each element is the average brightness of the image block. By dividing the image to be processed into multiple image blocks, the original brightness information is processed into a brightness information matrix for storage, and the subsequent detection process is based on the image block and the brightness information matrix, which reduces the complexity of image processing. Compared with processing the entire large-size image, block processing can reduce the amount of calculation and memory requirements, making the calculation process in image detection more efficient and feasible.

[0081] On the basis of the above embodiment, the comprehensive weight includes at least position weight, level weight, and brightness weight. The comprehensive weight matrix of the image to be detected is calculated based on the position of each image block in the image to be detected and the brightness information matrix, including: determining the position weight matrix of the image to be detected based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected; determining the brightness level corresponding to each image block according to the brightness information matrix; determining the level weight matrix of the image to be detected based on the brightness level of each image block and the total number of image blocks in the image to be detected; determining the brightness weight matrix of the image to be detected based on the average brightness corresponding to each image block and the average brightness of the image to be detected; and fusing the position weight matrix, the level weight matrix, and the brightness weight matrix to obtain the comprehensive weight matrix.

[0082] In some embodiments, the position weight matrix is ​​composed of position weights corresponding to each image block, and the multiple image blocks include at least a first image block and a second image block. The position weight matrix of the image to be detected is determined based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected, including: if the first distance is less than the second distance, the position weight of the first image block is greater than the position weight of the second image block, the first distance is the distance between the first image block and the center position of the image to be detected, and the second distance is the distance between the second image block and the center position of the image to be detected.

[0083] According to the human eye's habit of viewing images, when taking a picture, the focus is mostly on the center. Therefore, for multiple image blocks corresponding to the image to be detected, the closer the position of the image block in the image to be detected is to the center of the image to be detected, the higher the position weight should be given to the image block.

[0084] The position weight matrix is ​​composed of the position weights corresponding to each image block. Each element in the position weight matrix corresponds to an image block one-to-one, and is the position weight of each image block. The position weight of each image block is determined based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected. Specifically, taking the first image block and the second image block among multiple image blocks as an example, the first image block and the second image block can be any two of the multiple image blocks. If the distance between the first image block and the center position of the image to be detected is smaller than the distance between the second image block and the center position of the image to be detected, the first image block should be assigned a higher position weight than the second image block.

[0085] Optionally, the position weights can be set in the form of a Gaussian weighting function. The standard form of the Gaussian function is:

[0086] f(x)=A*exp(-(x-)^2 / (2σ^2))

[0087] Where x is the independent variable, A is the amplitude factor, which controls the maximum or minimum value of the function, μ is the mean, which indicates the center position of the function, and σ is the standard deviation, which controls the shape and width of the function.

[0088] If we set A = 1, μ = 0, σ = 1, then the position weight formula is:

[0089] w=exp(-(d^2) / (2*σ^2))

[0090] For example, suppose there is a 3x3 image to be detected, which is divided into nine image blocks. The center point of the image to be detected is selected as (1,1). Then the distances of the nine image blocks can be expressed as:

[0091]

[0092] The position weight matrix obtained by calculating the position weight formula is:

[0093]

[0094] It can be seen that the closer the image block is to the center of the image to be detected, the higher its position weight is.

[0095] In some embodiments, the level weight matrix is ​​composed of level weights corresponding to each image block, and the multiple image blocks include at least a third image block and a fourth image block. The level weight matrix of the image to be detected is determined based on the brightness level of each image block and the total number of image blocks in the image to be detected, including: if the first proportion is less than the second proportion, the level weight of the third image block is less than the level weight of the fourth image block, the first proportion is the ratio of the number of image blocks with the same brightness level as the third image block to the total number of image blocks, and the second proportion is the ratio of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks.

[0096] The brightness levels are divided according to a preset step size. For example, if the preset step size is 30, the value ranges of the brightness levels are 0-29, 30-59, 60-89, etc. until the brightness range of 0-255 is covered.

[0097] The brightness level corresponding to each of the image blocks is determined according to the brightness information matrix of the image to be detected. For example, if the average brightness of two image blocks is within the range of 30 to 59, the two image blocks are of the same brightness level; if the brightness of the two image blocks is within the range of 30 to 59 and 60 to 89, respectively, the two image blocks are of different brightness levels.

[0098] According to the brightness level corresponding to each image block, the proportion of the number of image blocks of each brightness level in the image to be detected to the total number of image blocks is counted. The level weight of the image block is further determined according to the proportion corresponding to the brightness level of each image block. The brightness level of the image block is graded to eliminate the negative impact of small-area highlights and low-brightness areas. Small-area highlights and low-brightness areas will not affect the overall image effect in some scenes, but may have a negative impact if HDR processing is performed.

[0099] The level weight matrix is ​​composed of level weights corresponding to each image block, each element in the level weight corresponds to an image block one-to-one, and is the level weight of the image block. The level weight of each image block is determined based on the brightness level of each image block and the total number of image blocks in the image to be detected. For example, taking the third image block and the fourth image block among multiple image blocks as an example, if the proportion of the number of image blocks with the same brightness level as the third image block to the total number of image blocks is less than the proportion of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks, it is considered that the area covered by the image block with the same brightness level as the third image block is smaller than the area covered by the image block with the same brightness level as the fourth image block. Therefore, the image block with the same brightness level as the third image block has a smaller impact on the overall image effect than the image block with the same brightness level as the fourth image block, and the level weight of the third image block should be smaller than the level weight of the fourth image block.

[0100] In some embodiments, the brightness weight matrix is ​​composed of brightness weights corresponding to each image block, and the multiple image blocks include at least a fifth image block and a sixth image block. The brightness weight of each image block is determined based on the average brightness corresponding to each image block and the average brightness of the image to be detected, including: if the first brightness difference value is less than the second brightness difference value, then the brightness weight of the fifth image block is less than the brightness weight of the sixth image block, the first brightness difference value is the difference between the average brightness of the fifth image block and the average brightness of the image to be detected, and the second brightness difference value is the difference between the average brightness of the sixth image block and the average brightness of the image to be detected.

[0101] The brightness weight matrix is ​​composed of the brightness weights corresponding to each image block. The elements in the brightness weight matrix correspond to the image blocks one by one and are the brightness weights of the image blocks.

[0102] Generally speaking, the smaller the dynamic range of the brighter and darker parts of the image, the smaller the dynamic range of the entire image to be detected. In other words, if the brightness levels of the image blocks in the image to be detected are closer, the smaller the dynamic range of the image to be detected. Therefore, image blocks with a large difference in average brightness level from the image to be detected may have a greater impact on the dynamic range of the image to be detected, and should be given a larger brightness weight.

[0103] Specifically, the brightness weight of each image block is determined based on the average brightness corresponding to each image block and the average brightness of the image to be detected. Taking the fifth image block and the sixth image block among the multiple image blocks as an example, if the difference between the average brightness of the fifth image block and the average brightness of the image to be detected is smaller than the difference between the average brightness of the sixth image block and the average brightness of the image to be detected, it means that the fifth image block is closer to the average brightness level of the image to be detected, which may have a smaller impact on the dynamic range of the image to be detected, while the average brightness level of the sixth image block is more different from that of the image to be detected, which may have a greater impact on the dynamic range of the image to be detected, so the brightness weight of the fifth image block should be smaller than the brightness weight of the sixth image block.

[0104] In some embodiments, other weight matrices may also be introduced, for example, different scene weights may be set for each image block according to different scene areas (face scene, green plant scene, blue sky scene, etc.) in the image to be detected, but this is not limited to the embodiments of the present disclosure.

[0105] The disclosed embodiment introduces a variety of weight matrices for the image to be detected, and each weight matrix is ​​dynamically calculated based on the image to be detected, rather than using preset fixed weights, which is more in line with the subjective recognition of the human eye and improves the accuracy and flexibility of image HDR detection.

[0106] Figure 3 A flow chart of a scene detection method provided by another embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the method includes the following steps:

[0107] S301 : calculating the average brightness of a single frame of the image to be detected according to original brightness information of the image to be detected, wherein the image to be detected is divided into a plurality of image blocks.

[0108] S302: Process the original brightness information in blocks to obtain a brightness information matrix, wherein the image blocks correspond to elements in the brightness information matrix one by one.

[0109] S303 . Determine a position weight matrix of the image to be detected based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected.

[0110] S304: Determine the brightness level corresponding to each of the image blocks according to the brightness information matrix.

[0111] S305 . Determine a level weight matrix of the image to be detected based on the brightness level of each image block and the total number of image blocks in the image to be detected.

[0112] S306 , determining a brightness weight matrix of the image to be detected based on the average brightness corresponding to each of the image blocks and the average brightness of the image to be detected.

[0113] S307 , fusing the position weight matrix, the level weight matrix, and the brightness weight matrix to obtain the comprehensive weight matrix.

[0114] S308. Obtain a weighted brightness matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix.

[0115] S309: If the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determine that the image to be detected is a high dynamic range image.

[0116] The difference between the weighted brightness information and the average brightness can be evaluated in the form of mean square error. For example, the weighted brightness information is as follows:

[0117]

[0118] The calculated mean square error is 0.045.

[0119] A smaller mean square error indicates that the difference between the weighted brightness information of the bright and dark areas of the entire image and the average brightness is smaller; a larger mean square error indicates that the difference between the weighted brightness information and the average brightness is greater, and HDR processing is required at this time. The difference threshold can be adjusted according to the specific situation, and the difference threshold is set to decide whether to perform the HDR processing process.

[0120] S310: If all N consecutive frames of images to be detected are high dynamic range images, determine that the image acquisition scene corresponding to the N consecutive frames of images to be detected is a high dynamic range scene, and N is greater than a preset frame number threshold.

[0121] If more than N consecutive frames of to-be-detected images are all high dynamic range images, it is determined that the image acquisition scene corresponding to the multiple frames of to-be-detected images is a high dynamic range scene.

[0122] The disclosed embodiment dynamically calculates a comprehensive weight matrix for the image to be detected, and evaluates the weighted brightness information after the comprehensive weighted calculation to determine whether the image to be detected is a high dynamic range image. There is no need to consider fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR image detection.

[0123] At the same time, by dividing the image to be processed into multiple image blocks, the original brightness information is processed in blocks to obtain the brightness information matrix, which reduces the complexity of image processing. Compared with processing the entire large-size image and the entire brightness information, block processing and matrix calculation can reduce the amount of calculation and memory requirements, making image processing more efficient and feasible, and reducing processing time and resource overhead without introducing other statistical algorithms; by introducing multiple weight matrices for the image to be detected, and each weight matrix is ​​dynamically calculated based on the image to be detected, rather than using preset fixed weights, it is more in line with the subjective recognition of the human eye.

[0124] It should be understood that although Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0125] Figure 4 The schematic diagram of the structure of the scene detection device provided in the embodiment of the present disclosure. The scene detection device may be the terminal as described in the above embodiment, or the scene detection device may be a component or assembly in the terminal. The scene detection device provided in the embodiment of the present disclosure may execute the processing flow provided in the scene detection method embodiment, such as Figure 4As shown, the scene detection device 40 includes: a first calculation module 41, a block processing module 42, a second calculation module 43, a weighting module 44, a first determination module 45, and a second determination module 46; the first calculation module 41 is used to calculate the average brightness of the image to be detected according to the original brightness information of a single frame of the image to be detected, and the image to be detected is divided into a plurality of image blocks; the block processing module 42 is used to perform block processing on the original brightness information to obtain a brightness information matrix, and the image blocks correspond to the elements in the brightness information matrix one by one; the second calculation module 43 is used to calculate the average brightness of the image to be detected based on the original brightness information of each image block in the image to be detected. The position of the image to be detected and the brightness information matrix are used to calculate the comprehensive weight matrix of the image to be detected; the weighting module 44 is used to obtain the weighted brightness matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix; the first determination module 45 is used to determine that the image to be detected is a high dynamic range image if the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold; the second determination module 46 is used to determine that the image acquisition scene corresponding to the consecutive N frames of images to be detected is a high dynamic range scene if all of them are high dynamic range images, and N is greater than a preset frame number threshold.

[0126] Optionally, the second calculation module 43 includes a first determination unit 431, a second determination module 432, a third determination unit 433, and a fusion unit 434; the first determination unit 431 is used to determine the position weight matrix of the image to be detected based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected; the second determination module 432 is used to determine the brightness level corresponding to each image block according to the brightness information matrix; based on the brightness level of each image block and the total number of image blocks in the image to be detected, determine the level weight matrix of the image to be detected; the third determination unit 433 is used to determine the brightness weight matrix of the image to be detected based on the average brightness corresponding to each image block and the average brightness of the image to be detected; the fusion unit 434 is used to fuse the position weight matrix, the level weight matrix, and the brightness weight matrix to obtain the comprehensive weight matrix.

[0127] Optionally, the position weight matrix is ​​composed of position weights corresponding to each image block, the multiple image blocks include at least a first image block and a second image block, and the first determination unit 431 is used to determine that if the first distance is less than the second distance, the position weight of the first image block is greater than the position weight of the second image block, the first distance is the distance between the first image block and the center position of the image to be detected, and the second distance is the distance between the second image block and the center position of the image to be detected.

[0128] Optionally, the level weight matrix is ​​composed of level weights corresponding to each image block, and the multiple image blocks include at least a third image block and a fourth image block. The second determination module 432 is used to determine that if the first proportion is smaller than the second proportion, the level weight of the third image block is smaller than the level weight of the fourth image block. The first proportion is the ratio of the number of image blocks with the same brightness level as the third image block to the total number of image blocks, and the second proportion is the ratio of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks.

[0129] Optionally, the brightness weight matrix is ​​composed of brightness weights corresponding to each image block, and the multiple image blocks include at least a fifth image block and a sixth image block. The third determination unit 433 is used to determine that if the first brightness difference value is smaller than the second brightness difference value, the brightness weight of the fifth image block is smaller than the brightness weight of the sixth image block, the first brightness difference value is the difference between the average brightness of the fifth image block and the average brightness of the image to be detected, and the second brightness difference value is the difference between the average brightness of the sixth image block and the average brightness of the image to be detected.

[0130] Optionally, the first determination module 45 includes a first calculation unit 451 and a fourth determination unit 452; the first calculation unit 451 is used to calculate the mean square error between the brightness values ​​corresponding to multiple elements in the weighted brightness matrix and the average brightness; the fourth determination unit 452 is used to determine that the image to be detected is a high dynamic range image if the mean square error is greater than the preset difference threshold.

[0131] Optionally, the block processing module 42 includes a second calculation unit 421 and a fifth determination unit 422; the second calculation unit 421 is used to calculate the average brightness of each image block based on the original brightness information; the fifth determination unit 422 is used to use the average brightness of each image block as multiple elements in the brightness information matrix.

[0132] The present invention determines whether the image to be detected is a high dynamic range image by dynamically calculating a comprehensive weight matrix for the image to be detected, and evaluating the difference between a weighted brightness matrix obtained after weighted calculation of the comprehensive weight matrix and the average brightness of the image to be detected. When multiple consecutive frames of images are all high dynamic range images, the image acquisition scene is determined to be an HDR scene, without considering fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR scene detection.

[0133] For the specific definition of the scene detection device, please refer to the definition of the scene detection method above, which will not be repeated here. Each module in the above-mentioned scene detection device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0134] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a scene detection method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the computer device housing, or an external keyboard, touch pad or mouse, etc.

[0135] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0136] In one embodiment, the scene detection device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 5 The computer device is run on the computer device shown. The memory of the computer device can store various program modules constituting the scene detection device, such as: Figure 4 The first calculation module 41, the block processing module 42, the second calculation module 43, the weighting module 44, the first determination module 45, and the second determination module 46 are shown. The computer program composed of various program modules enables the processor to execute the steps of the scene detection method of each embodiment of the present application described in this specification.

[0137] For example, Figure 5 The computer device shown can be Figure 4 The acquisition module in the scene detection device shown is used to acquire the original brightness information of a single frame of an image to be detected, and the image to be detected includes multiple image blocks. The computer device can use the calculation module to calculate the comprehensive weight corresponding to each image block based on the position of each image block in the image to be detected and the original brightness information; the computer device can use the weighting module to obtain the weighted brightness information of the image to be detected based on the comprehensive weight and the original brightness information; the computer device can use the first determination module to determine that the image to be detected is a high dynamic range image if the difference between the weighted brightness information and the average brightness of the image to be detected is greater than a preset difference threshold.

[0138] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: calculating the average brightness of the image to be detected based on the original brightness information of a single frame of the image to be detected, wherein the image to be detected is divided into multiple image blocks; processing the original brightness information in blocks to obtain a brightness information matrix, wherein the image blocks correspond one-to-one to the elements in the brightness information matrix; calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix; obtaining a weighted brightness matrix of the image to be detected based on the comprehensive weight matrix and the brightness information matrix; if the degree of difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determining that the image to be detected is a high dynamic range image; if N consecutive frames of images to be detected are all high dynamic range images, determining that the image acquisition scene corresponding to the N consecutive frames of images to be detected is a high dynamic range scene, and N is greater than a preset frame number threshold.

[0139] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected, the position weight matrix of the image to be detected is determined; based on the brightness information matrix, the brightness level corresponding to each image block is determined; based on the brightness level of each image block and the total number of image blocks in the image to be detected, the level weight matrix of the image to be detected is determined; based on the average brightness corresponding to each image block and the average brightness of the image to be detected, the brightness weight matrix of the image to be detected is determined; the position weight matrix, the level weight matrix, and the brightness weight matrix are merged to obtain the comprehensive weight matrix.

[0140] In one embodiment, when the processor executes the computer program, the following steps are also implemented: if the first distance is smaller than the second distance, the position weight of the first image block is greater than the position weight of the second image block, the first distance is the distance between the first image block and the center position of the image to be detected, and the second distance is the distance between the second image block and the center position of the image to be detected.

[0141] In one embodiment, the processor further implements the following steps when executing the computer program: if the first proportion is smaller than the second proportion, the level weight of the third image block is smaller than the level weight of the fourth image block, the first proportion is the ratio of the number of image blocks with the same brightness level as the third image block to the total number of image blocks, and the second proportion is the ratio of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks.

[0142] In one embodiment, when the processor executes the computer program, the following steps are also implemented: if the first brightness difference value is smaller than the second brightness difference value, the brightness weight of the fifth image block is smaller than the brightness weight of the sixth image block, the first brightness difference value is the difference between the average brightness of the fifth image block and the average brightness of the image to be detected, and the second brightness difference value is the difference between the average brightness of the sixth image block and the average brightness of the image to be detected.

[0143] In one embodiment, when the processor executes the computer program, the following steps are also implemented: calculating the mean square error between the brightness values ​​corresponding to multiple elements in the weighted brightness matrix and the average brightness; if the mean square error is greater than the preset difference threshold, determining that the image to be detected is a high dynamic range image.

[0144] In one embodiment, when the processor executes the computer program, the following steps are further implemented: calculating the average brightness of each image block according to the original brightness information; and using the average brightness of each image block as multiple elements in the brightness information matrix.

[0145] The present invention determines whether the image to be detected is a high dynamic range image by dynamically calculating a comprehensive weight matrix for the image to be detected, and evaluating the difference between a weighted brightness matrix obtained after weighted calculation of the comprehensive weight matrix and the average brightness of the image to be detected. When multiple consecutive frames of images are all high dynamic range images, the image acquisition scene is determined to be an HDR scene, without considering fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR scene detection.

[0146] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: calculating the average brightness of the image to be detected based on the original brightness information of a single frame of the image to be detected, wherein the image to be detected is divided into multiple image blocks; processing the original brightness information in blocks to obtain a brightness information matrix, wherein the image blocks correspond one-to-one to the elements in the brightness information matrix; calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix; obtaining a weighted brightness matrix of the image to be detected based on the comprehensive weight matrix and the brightness information matrix; if the degree of difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determining that the image to be detected is a high dynamic range image; if N consecutive frames of images to be detected are all high dynamic range images, determining that the image acquisition scene corresponding to the N consecutive frames of images to be detected is a high dynamic range scene, and N is greater than a preset frame number threshold.

[0147] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected, determine the position weight matrix of the image to be detected; determine the brightness level corresponding to each image block according to the brightness information matrix; based on the brightness level of each image block and the total number of image blocks in the image to be detected, determine the level weight matrix of the image to be detected; based on the average brightness corresponding to each image block and the average brightness of the image to be detected, determine the brightness weight matrix of the image to be detected; and fuse the position weight matrix, the level weight matrix, and the brightness weight matrix to obtain the comprehensive weight matrix.

[0148] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: if the first distance is smaller than the second distance, the position weight of the first image block is greater than the position weight of the second image block, the first distance is the distance between the first image block and the center position of the image to be detected, and the second distance is the distance between the second image block and the center position of the image to be detected.

[0149] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: if the first proportion is smaller than the second proportion, the level weight of the third image block is smaller than the level weight of the fourth image block, the first proportion is the ratio of the number of image blocks with the same brightness level as the third image block to the total number of image blocks, and the second proportion is the ratio of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks.

[0150] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: if the first brightness difference value is smaller than the second brightness difference value, the brightness weight of the fifth image block is smaller than the brightness weight of the sixth image block, the first brightness difference value is the difference between the average brightness of the fifth image block and the average brightness of the image to be detected, and the second brightness difference value is the difference between the average brightness of the sixth image block and the average brightness of the image to be detected.

[0151] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the mean square error between the brightness values ​​corresponding to multiple elements in the weighted brightness matrix and the average brightness; if the mean square error is greater than the preset difference threshold, determining that the image to be detected is a high dynamic range image.

[0152] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the average brightness of each image block according to the original brightness information; and using the average brightness of each image block as multiple elements in the brightness information matrix.

[0153] The present invention determines whether the image to be detected is a high dynamic range image by dynamically calculating a comprehensive weight matrix for the image to be detected, and evaluating the difference between a weighted brightness matrix obtained after weighted calculation of the comprehensive weight matrix and the average brightness of the image to be detected. When multiple consecutive frames of images are all high dynamic range images, the image acquisition scene is determined to be an HDR scene, without considering fixed parameters such as pre-set thresholds, thereby reducing misjudgments caused by inappropriate fixed parameter settings and improving the flexibility and accuracy of HDR scene detection.

[0154] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).

[0155] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0156] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A scene detection method, characterized in that: The method comprises: Calculating the average brightness of the image to be detected according to original brightness information of a single frame of the image to be detected, wherein the image to be detected is divided into a plurality of image blocks; Processing the original brightness information in blocks to obtain a brightness information matrix, wherein the image blocks correspond one to one to the elements in the brightness information matrix; Calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix; Obtaining a weighted brightness matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix; If the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determining that the image to be detected is a high dynamic range image; If all N consecutive frames of images to be detected are high dynamic range images, it is determined that the image acquisition scene corresponding to the N consecutive frames of images to be detected is a high dynamic range scene, and N is greater than a preset frame number threshold.

2. The method according to claim 1, characterized in that The step of calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix comprises: Determine a position weight matrix of the image to be detected based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected; Determine the brightness level corresponding to each of the image blocks according to the brightness information matrix; Determining a level weight matrix of the image to be detected based on the brightness level of each of the image blocks and the total number of image blocks in the image to be detected; Determining a brightness weight matrix of the image to be detected based on the average brightness corresponding to each of the image blocks and the average brightness of the image to be detected; The position weight matrix, the level weight matrix, and the brightness weight matrix are fused to obtain the comprehensive weight matrix.

3. The method according to claim 2, characterized in that The position weight matrix is ​​composed of position weights corresponding to each image block, the multiple image blocks include at least a first image block and a second image block, and the position weight matrix of the image to be detected is determined based on the distance between the position of each image block in the image to be detected and the center position of the image to be detected, including: If the first distance is smaller than the second distance, the position weight of the first image block is greater than the position weight of the second image block, the first distance is the distance between the first image block and the center position of the image to be detected, and the second distance is the distance between the second image block and the center position of the image to be detected.

4. The method according to claim 2, characterized in that: The level weight matrix is ​​composed of level weights corresponding to each image block, the multiple image blocks include at least a third image block and a fourth image block, and the level weight matrix of the image to be detected is determined based on the brightness level of each image block and the total number of image blocks in the image to be detected, including: If the first proportion is smaller than the second proportion, the level weight of the third image block is smaller than the level weight of the fourth image block, the first proportion is the ratio of the number of image blocks with the same brightness level as the third image block to the total number of image blocks, and the second proportion is the ratio of the number of image blocks with the same brightness level as the fourth image block to the total number of image blocks.

5. The method according to claim 2, characterized in that: The brightness weight matrix is ​​composed of brightness weights corresponding to each image block, the multiple image blocks include at least a fifth image block and a sixth image block, and the brightness weight matrix of the image to be detected is determined based on the average brightness corresponding to each of the image blocks and the average brightness of the image to be detected, including: If the first brightness difference value is smaller than the second brightness difference value, the brightness weight of the fifth image block is smaller than the brightness weight of the sixth image block, the first brightness difference value is the difference between the average brightness of the fifth image block and the average brightness of the image to be detected, and the second brightness difference value is the difference between the average brightness of the sixth image block and the average brightness of the image to be detected.

6. The method according to claim 1, characterized in that If the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold, determining that the image to be detected is a high dynamic range image includes: Calculating the mean square error between the brightness values ​​corresponding to the multiple elements in the weighted brightness matrix and the average brightness; If the mean square error is greater than the preset difference threshold, it is determined that the image to be detected is a high dynamic range image.

7. The method according to claim 1, characterized in that The block processing of the original brightness information to obtain a brightness information matrix includes: Calculating the average brightness of each image block according to the original brightness information; The average brightness of each image block is used as multiple elements in the brightness information matrix.

8. A scene detection device, characterized in that: include: A first calculation module, used for calculating the average brightness of the image to be detected according to the original brightness information of a single frame of the image to be detected, wherein the image to be detected is divided into a plurality of image blocks; A block processing module, used for performing block processing on the original brightness information to obtain a brightness information matrix, wherein the image blocks correspond one to one to the elements in the brightness information matrix; A second calculation module, used for calculating a comprehensive weight matrix of the image to be detected based on the position of each image block in the image to be detected and the brightness information matrix; A weighting module, used for obtaining a weighted brightness matrix of the image to be detected according to the comprehensive weight matrix and the brightness information matrix; A first determination module, configured to determine that the image to be detected is a high dynamic range image if the difference between the weighted brightness matrix and the average brightness is greater than a preset difference threshold; The second determination module is used to determine that the image acquisition scene corresponding to the consecutive N frames of images to be detected is a high dynamic range scene if all of the consecutive N frames of images to be detected are high dynamic range images, and N is greater than a preset frame number threshold.

9. A computer device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.

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 method according to any one of claims 1 to 7 is implemented.