Camera mode switching method and related device and storage medium
By evaluating the dynamic range and recoverable parameters of the camera equipment, the camera mode switching method is determined, which solves the problem of invalid switching in the prior art and achieves more accurate mode switching and better imaging effect.
Patent Information
- Application Number
- CN202611141630.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-11-03
AI Technical Summary
The current camera mode switching method is too simple and is prone to invalid switching, especially when the detail recovery in the bright area is low, which leads to inaccurate wide dynamic range mode switching.
By acquiring the dynamic range and recoverable parameters of the current image from the camera device, it is determined whether to switch to wide dynamic range mode. The recoverable parameters are used to evaluate the degree of detail recovery in the bright areas, avoiding blind switching and improving the accuracy of switching.
It effectively reduces invalid switching of wide dynamic range mode, improves the accuracy of camera mode switching, and ensures that it only switches to wide dynamic range mode when the details in the bright areas are highly recoverable, thereby improving image quality.
Smart Images

Figure CN123035374A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a camera mode switching method, related equipment, and storage medium. Background Technology
[0002] Cameras typically support linear mode and wide dynamic range mode, and can switch between these modes to optimize image quality.
[0003] In related technologies, the dynamic range parameters of the current image captured by the camera are typically obtained, and then the camera mode is switched based on this single dimension of the dynamic range parameters. This method of switching camera modes has a simple logic but is prone to ineffective switching.
[0004] Therefore, improving the accuracy of camera mode switching has become a pressing technical problem to be solved in this field. Summary of the Invention
[0005] The main technical problem addressed by this application is to provide a camera mode switching method, related equipment, and computer-readable storage medium that can reduce invalid switching of wide dynamic range mode and improve the accuracy of camera mode switching.
[0006] To solve the above-mentioned technical problems, one technical solution adopted in this application is: providing a camera mode switching method, the method comprising: acquiring the camera mode of the camera device; in response to the camera mode being a linear mode and the dynamic range parameter of the current image of the camera device satisfying a first dynamic range condition, determining whether to switch the camera mode to a wide dynamic range mode using the recoverable parameter of the current image; wherein, the dynamic range parameter is used to characterize the brightness contrast of the image, the recoverable parameter is used to characterize the recoverability of details in the bright areas of the image, and the bright areas are areas whose brightness meets the requirements.
[0007] In one embodiment, determining whether to switch the camera mode to wide dynamic range mode using recoverable parameters of the current image includes: switching the camera mode to wide dynamic range mode in response to the recoverable parameters of the current image satisfying the recoverable condition; and maintaining the camera mode as linear mode in response to the recoverable parameters of the current image not satisfying the recoverable condition; wherein the recoverable condition includes: the recoverable parameter being greater than the recoverable threshold.
[0008] In one embodiment, the current imaging frame includes a plurality of image blocks, and the step of determining the recoverable parameters of the current imaging frame includes: determining the recoverable parameters of the current imaging frame using at least one of a first index value, a second index value, and a third index value.
[0009] The first index value is obtained based on the number of first target image blocks in the first image block set. The first image block set includes first image blocks whose brightness is greater than or equal to a first brightness threshold among several image blocks, and the first target image block is a first image block whose brightness difference with the neighboring image blocks meets the difference requirement.
[0010] The second index value is obtained based on the brightness difference information of the neighboring image blocks of the second target image block. The second target image block is a representative image block of the second image block set, and the second image block set includes a second image block whose brightness is greater than or equal to the second brightness threshold among several image blocks.
[0011] The third index value is obtained based on the number of third target image blocks in the third image block set. The third image block set includes a number of third image blocks whose brightness is greater than or equal to the third brightness threshold. The third target image block is a third image block whose brightness is greater than or equal to the first saturation brightness threshold under the first exposure time and whose brightness is less than the second saturation brightness threshold under the second exposure time. The first exposure time is greater than the second exposure time.
[0012] In one embodiment, the step of determining the first target image block includes: for each first image block in the first image block set, determining the brightness difference between the first image block and each image block in the neighborhood of the first image block, combining the brightness differences of the first image blocks to obtain a first comprehensive brightness difference of the first image block, and determining the first image block as the first target image block in response to the first comprehensive brightness difference of the first image block being less than a brightness difference threshold.
[0013] In one embodiment, the step of determining the first index value includes: selecting the larger quantity between a first preset quantity and the number of image blocks in a first image block set as the first quantity; determining a first ratio between the number of first target image blocks and the first quantity; and using the first ratio to determine the first index value.
[0014] In one embodiment, the step of determining the second index value includes: obtaining a brightness dispersion characterization value in the neighborhood of the second target image block using the brightness of each image block in the neighborhood of the second target image block, and determining the second index value using the brightness dispersion characterization value; or, determining the brightness difference between the second target image block and each image block in the neighborhood of the second target image block respectively, combining the brightness differences of the second target image block to obtain a second comprehensive brightness difference value of the second target image block, and determining the second index value using the second comprehensive brightness difference value.
[0015] In one embodiment, the step of determining the third index value includes: selecting the larger of a second preset quantity and a fourth image block in the third image block set as the second quantity; wherein the fourth image block is a third image block in the third image block set whose brightness is greater than or equal to a first saturation brightness threshold under a first exposure time; determining a second ratio between the number of third target image blocks and the second quantity; and using the second ratio to determine the third index value.
[0016] In one embodiment, the step of determining the dynamic range parameter of the current image frame includes: dividing a plurality of image blocks of the current image frame into a bright image block set and a dark image block set; wherein the brightness of the image blocks in the bright image block set is greater than or equal to a fourth brightness threshold, and the brightness of the image blocks in the dark image block set is less than a fifth brightness threshold; determining a first representative image block of the bright image block set and a second representative image block of the dark image block set; combining the brightness of each image block in the neighborhood of the first representative image block to obtain a first representative brightness, and combining the brightness of each image block in the neighborhood of the second representative image block to obtain a second representative brightness; and using the brightness ratio of the first representative brightness to the second representative brightness to obtain the dynamic range parameter of the current image frame.
[0017] In one embodiment, the first representative image block is the image block with the highest brightness among the bright image blocks, and the second representative image block is the image block with the lowest brightness among the dark image blocks.
[0018] And / or, using the ratio of the first representative brightness to the second representative brightness, the dynamic range parameter of the current image is obtained, including: when the camera mode is linear mode, the brightness ratio is used as the dynamic range parameter of the current image; when the camera mode is wide dynamic range mode, the product of the brightness ratio and a preset coefficient is obtained as the dynamic range parameter of the current image.
[0019] In one embodiment, before switching the camera mode to wide dynamic range mode, the method further includes: determining whether an additional condition is met; wherein the additional condition includes at least one of the following conditions: the dynamic range parameter of at least one associated image of the current image satisfies a first dynamic range condition, and the recoverable parameters of each associated image satisfy a recoverable condition; the difference between the maximum dynamic range parameter and the minimum dynamic range parameter in the current image and at least one associated image is less than a dynamic range difference threshold; the absolute value of the difference between the exposure of the current image and the target exposure is less than an exposure difference threshold; the associated image is an image captured before the current image or an image captured after the current image; switching the camera mode to wide dynamic range mode includes: switching the camera mode to wide dynamic range mode in response to meeting the additional condition.
[0020] In one embodiment, if the recoverable parameters of the current image do not meet the recoverable conditions, the method further includes: performing image adjustment processing on the current image; wherein the image adjustment processing includes at least one of the following processes: reducing the gain of the camera device, reducing the exposure time, and enabling strong light suppression.
[0021] And / or, the method further includes: in response to the camera mode being a wide dynamic range mode and the dynamic range parameter of the current image satisfying a second dynamic range condition, switching the camera mode to a linear mode.
[0022] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a camera device, including a memory and a processor coupled to each other, wherein the memory stores program instructions; and the processor is used to execute the program instructions stored in the memory to implement the above-mentioned camera mode switching method.
[0023] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium for storing program instructions that can be executed by a processor to implement the above-mentioned camera mode switching method.
[0024] The above solution, when the camera's recording mode is linear and the dynamic range parameters of the current image meet the first dynamic range condition, does not directly switch the recording mode to wide dynamic range mode. Instead, it uses the recoverable parameters of the current image to understand the recoverable detail in the bright areas of the current image to determine whether the recording mode can be switched to wide dynamic range mode. This method effectively avoids blindly switching the recording mode to wide dynamic range mode when the recoverable detail in the bright areas of the current image is low, reducing ineffective switching of wide dynamic range mode and improving the accuracy of recording mode switching. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating an embodiment of the camera mode switching method provided in this application; Figure 2 This is a flowchart illustrating another embodiment of the camera mode switching method provided in this application; Figure 3 This is a flowchart illustrating yet another embodiment of the camera mode switching method provided in this application; Figure 4 This is a flowchart illustrating one implementation method of the method for determining the dynamic range parameter provided in this application. Figure 5 This is a flowchart illustrating one embodiment of the method for determining the first target image block provided in this application; Figure 6This is a flowchart illustrating one implementation method of the method for determining the first index value provided in this application; Figure 7 This is a flowchart illustrating one implementation method of the method for determining the second index value provided in this application; Figure 8 This is a flowchart illustrating another implementation of the method for determining the second index value provided in this application; Figure 9 This is a flowchart illustrating one implementation method of the method for determining the third indicator value provided in this application; Figure 10 This is a schematic diagram of the frame of an embodiment of the camera mode switching device provided in this application; Figure 11 This is a schematic diagram of the frame of an embodiment of the camera device provided in this application; Figure 12 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0027] It should be noted that the term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The terms "first" and "second" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. The term "multiple" in this application means at least two, such as two, three, etc. The term "several" in this application means at least two. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0028] In this application, the camera device uses either a linear mode or a wide dynamic range (WDR) mode. Specifically, in linear mode, the camera device operates in a linear exposure state; in WDR mode, it operates in a WDR exposure state. In linear mode, the camera device captures one frame using a single exposure duration. In WDR mode, the camera device captures at least two frames with different exposure durations over time and fuses these frames to obtain a single frame that captures details in both bright and dark areas of the image.
[0029] Currently, camera modes are typically switched based on a single dimension: the dynamic range parameter of the current image captured by the camera. This dynamic range parameter can also be referred to as the dynamic range (DR) of the current scene. For example, if the dynamic range parameter of the current image is large and meets the dynamic range criteria, the camera mode is switched to wide dynamic range mode; if the dynamic range parameter is small and does not meet the dynamic range criteria, the camera mode is switched to linear mode.
[0030] However, this camera mode switching method has a relatively simple switching logic, which can easily lead to invalid switching of camera modes. For example, if the dynamic range parameter of the current image meets the dynamic range condition, but the current image includes bright areas such as streetlights or strong reflections, switching to wide dynamic range mode may not be able to improve the details in the bright areas.
[0031] Therefore, this application improves the camera mode switching method to reduce invalid switching of wide dynamic range mode and improve the accuracy of camera mode switching.
[0032] It should be noted that the camera mode switching method in this application can be executed by a camera device. The camera device can be any device with camera functionality, and this application does not specifically limit the type of camera device. For example, the camera device can be an Internet Protocol Camera (IPC), a dashcam, an in-vehicle camera (such as a front-view camera, rear-view camera, or panoramic surround-view camera), a law enforcement recorder, a smart wearable camera, or a camera deployed in a security scenario.
[0033] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the camera mode switching method provided in this application. It should be noted that if substantially the same result is achieved, the method of this application is not necessarily identical. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, the method includes the following steps: S11: Obtain the camera mode of the camera device.
[0034] In one possible implementation, the camera device can read a flag bit related to the camera mode to determine the current camera mode. For example, when the flag bit is configured as a first identifier, the camera mode is determined to be linear mode; when the flag bit is configured as a second identifier, the camera mode is determined to be wide dynamic range mode. Exemplarily, the first identifier is 0 and the second identifier is 1.
[0035] S12: In response to the camera mode being linear mode and the dynamic range parameter of the current image of the camera device satisfying the first dynamic range condition, determine whether to switch the camera mode to wide dynamic range mode using the recoverable parameters of the current image.
[0036] The current image refers to the current frame of the image captured by the camera device.
[0037] Dynamic range is a parameter used to characterize the contrast between light and dark areas in an image. It can be understood that a larger dynamic range parameter indicates a higher contrast and a wider range of light and dark areas in the current image; conversely, a smaller dynamic range parameter indicates a lower contrast and a smaller range of light and dark areas in the current image.
[0038] The recoverability parameter characterizes the degree to which details in highlighted areas of an image can be recovered. Highlighted areas are those areas in the image whose brightness meets the requirements, i.e., areas with higher brightness.
[0039] In some possible implementations, the recoverable parameter can take the form of a recoverable score, a recoverable probability, a recoverable level, etc. The recoverable level can be one of several preset recoverable levels. For example, the preset recoverable levels include a first recoverable level, a second recoverable level, a third recoverable level, and a fourth recoverable level, where the first recoverable level is lower than the second recoverable level, the second recoverable level is lower than the third recoverable level, and the third recoverable level is lower than the fourth recoverable level.
[0040] The higher the recoverability score or recoverability probability of the current image, or the higher the recoverability level of the current image, the more likely the details in the bright areas of the current image are to be recovered. Switching to wide dynamic range mode can effectively improve the details in the bright areas of the current image, making it more worthwhile to switch to wide dynamic range mode.
[0041] The lower the recoverability score or recoverability probability of the current image, or the lower the recoverability level of the current image, the less recoverable the details of the bright areas in the current image. Switching to wide dynamic range mode will not improve the details of the bright areas in the current image, and it is less worthwhile to switch to wide dynamic range mode.
[0042] In step S12, when the dynamic range parameter of the current image meets the first dynamic range condition, it means that the dynamic range parameter of the current image is large. At this time, the recoverable parameters of the current image are further combined to determine whether to switch the camera mode to wide dynamic range mode.
[0043] In one embodiment, the first dynamic range condition includes: the dynamic range parameter is greater than a first dynamic range threshold. The first dynamic range threshold can be set according to actual needs.
[0044] In one embodiment, when the recoverable parameters of the current image meet the recoverable conditions, the camera mode is switched to wide dynamic range mode; when the recoverable parameters of the current image do not meet the recoverable conditions, the camera mode is maintained as linear mode.
[0045] In one embodiment, the recoverable condition includes: the recoverable parameter is greater than the recoverable threshold. The recoverable threshold can be set according to actual needs. For example, when the recoverable parameter is a recoverable score, the recoverable threshold is a pre-set recoverable score threshold. As another example, when the recoverable parameter is a recoverable probability, the recoverable threshold is a pre-set recoverable probability threshold.
[0046] Optionally, in other embodiments, the recoverable parameter can be a recoverable level. In this case, the recoverable condition can be that the recoverable level is greater than a preset level. The preset level can be set according to actual needs; for example, the preset level can be set to the aforementioned second recoverable level.
[0047] In this embodiment, when the camera mode is linear and the dynamic range parameter of the current image meets the first dynamic range condition, the camera mode is not directly switched to wide dynamic range mode. Instead, the recoverable parameters of the current image are used to understand the recoverable detail of the bright areas in the current image to determine whether the camera mode can be switched to wide dynamic range mode. This method effectively avoids blindly switching the camera mode to wide dynamic range mode when the recoverable detail of the bright areas in the current image is low, reducing ineffective switching of wide dynamic range mode and improving the accuracy of camera mode switching.
[0048] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the camera mode switching method provided in this application. It should be noted that if substantially the same result is achieved, the method of this application does not necessarily require further elaboration. Figure 2 The illustrated process sequence is limited. For example... Figure 2 As shown, the method includes the following steps: S21: Obtain the camera mode of the camera device.
[0049] For details on obtaining the camera mode information, please refer to step S11 above, which will not be repeated here.
[0050] S22: In response to the camera mode being linear mode and the dynamic range parameter of the current image of the camera device satisfying the first dynamic range condition, determine whether to switch the camera mode to wide dynamic range mode using the recoverable parameter of the current image.
[0051] Specifically, when the recoverable parameters of the current image meet the recoverable conditions, the camera mode is switched to wide dynamic range mode; when the recoverable parameters of the current image do not meet the recoverable conditions, the camera mode is maintained as linear mode.
[0052] The relevant content of the first dynamic range condition and the recoverable condition can be referred to in the aforementioned step S12, and will not be repeated here.
[0053] S23: In response to the camera mode being wide dynamic range mode, determine whether to switch the camera mode to linear mode using the dynamic range parameter of the current image.
[0054] Specifically, when the dynamic range parameter of the current image meets the second dynamic range condition, the camera mode is switched to linear mode. When the dynamic range parameter of the current image does not meet the second dynamic range condition, the camera mode is maintained as wide dynamic range mode.
[0055] In one embodiment, the second dynamic range condition includes: the dynamic range parameter is less than a second dynamic range threshold. The second dynamic range threshold is less than a first dynamic range threshold. The second dynamic range threshold can be specifically set according to actual needs.
[0056] In a specific application, the process of switching camera modes can be briefly summarized as follows: When the camera mode is in linear mode, when At the same time, maintain the camera mode as linear mode; When the camera mode is in linear mode, when and When this happens, the camera mode will be switched to wide dynamic range mode, meaning the output will suggest switching to wide dynamic range mode. When the camera mode is in linear mode, when and When the camera mode is maintained in linear mode, it refuses to enter wide dynamic range mode. When the camera mode is set to wide dynamic range, when When necessary, switch the camera mode to linear mode; When the camera mode is set to wide dynamic range, when At this time, the camera mode is kept in linear mode.
[0057] in, This parameter represents the dynamic range of the current image. Indicates recoverable parameters of the current image; This represents the first dynamic range threshold corresponding to the first dynamic range condition; This represents the second dynamic range threshold corresponding to the second dynamic range condition. This represents the recoverable threshold corresponding to the recoverable condition.
[0058] In this embodiment, when the camera mode is linear and the dynamic range parameter of the current image meets the first dynamic range condition, the recoverable parameters of the current image are further used to determine whether the camera mode can be switched to wide dynamic range mode. This reduces invalid switching of wide dynamic range mode and improves the accuracy of camera mode switching. Furthermore, when the camera mode is wide dynamic range mode, the dynamic range parameter of the current image can be used to determine whether the camera mode can be switched to linear mode, avoiding invalid continuation of wide dynamic range mode. Simultaneously, this enables the camera device to have adaptive switching capability between linear mode and wide dynamic range mode. Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the camera mode switching method provided in this application. It should be noted that if substantially the same result is achieved, the method of this application is not necessarily identical. Figure 3 The illustrated process sequence is limited. For example... Figure 3 As shown, the method includes the following steps: S301: Obtain the camera mode of the camera device.
[0059] For details on obtaining the camera mode information, please refer to step S11 above, which will not be repeated here.
[0060] Optionally, before executing steps S302 to S311, it can be determined whether the camera device meets the preconditions. If the camera device meets the preconditions, then steps S302 to S311 are executed. If the camera device does not meet the preconditions, then steps S302 to S311 are not executed, and the current camera mode is maintained. The preconditions include at least one of the following: stable zoom parameters and stable focus parameters. This avoids obtaining less accurate dynamic range and recoverable parameters, and outputting less accurate camera mode switching suggestions, when the camera device's zoom and focus are not stable, thereby further improving the accuracy of camera mode switching.
[0061] S302: Determine the dynamic range parameters of the current image captured by the camera device.
[0062] Before determining the dynamic range parameters of the current image, the current image is first divided into several image blocks.
[0063] In some examples, the current image is directly divided into several image blocks of equal size. Alternatively, the current image can be cropped, scaled, or otherwise processed to obtain the effective image, and then the effective image can be divided into several image blocks of equal size.
[0064] In one example, the current image or the effective image of the current image can be divided into M rows and N columns to obtain M×N image blocks.
[0065] Figure 4 This is a flowchart illustrating one implementation method of the dynamic range parameter determination method provided in this application. Figure 4 As shown, the method includes the following steps: S401: Divide several image blocks in the current image frame into a set of bright image blocks and a set of dark image blocks.
[0066] Specifically, based on the brightness of each image block in the current image, several image blocks in the current image are divided into a set of bright image blocks and a set of dark image blocks.
[0067] In one example, for each image block in the current imaging frame, the average brightness of the pixels within the image block can be obtained as the brightness of the image block.
[0068] The brightness of image patches in the bright image patch set is greater than or equal to the fourth brightness threshold, while the brightness of image patches in the dark image patch set is less than the fifth brightness threshold. The fourth brightness threshold is greater than or equal to the fifth brightness threshold.
[0069] In one example, the fourth brightness threshold and the fifth brightness threshold are thresholds set separately according to actual needs. In this example, dividing the bright image block set and the dark image block set includes: selecting image blocks with brightness greater than or equal to the fourth brightness threshold from several image blocks in the current image frame and adding them to the bright image block set; and selecting image blocks with brightness less than the fifth brightness threshold from several image blocks in the current image frame and adding them to the dark image block set.
[0070] In another example, the fourth brightness threshold and the fifth brightness threshold are equal, and the fourth brightness threshold and the fifth brightness threshold are the average brightness of several image blocks in the current image frame. In this example, dividing the bright image block set and the dark image block set includes: selecting image blocks whose brightness is greater than or equal to the average brightness of several image blocks from the several image blocks in the current image frame and adding them to the bright image block set; and selecting image blocks whose brightness is less than the average brightness of several image blocks from the several image blocks in the current image frame and adding them to the dark image block set.
[0071] In this example, the average brightness of several image blocks in the current image frame can be represented by the following formula:
[0072] in, This represents the average brightness of several image patches in the current image frame, where M represents the number of rows dividing the image patch, and N represents the number of columns dividing the image patch. This represents the brightness of the image block in the i-th row and j-th column.
[0073] Optionally, before dividing the bright image block set and the dark image block set, image blocks with abnormal brightness in some image blocks of the current image can be removed first.
[0074] In one example, the image blocks with abnormal brightness include the brightest and the least bright image blocks in the current image frame.
[0075] In another example, the image blocks with abnormal brightness include image blocks with brightness greater than a first abnormal brightness and image blocks with brightness less than a second abnormal brightness. The first abnormal brightness is defined as higher brightness, and the second abnormal brightness as lower brightness. The specific values of the first and second abnormal brightness can be set according to actual needs.
[0076] S402: Determine the first representative image block of the bright image block set and the second representative image block of the dark image block set.
[0077] In one example, the first representative image block is the brightest image block in the bright image block group, and the second representative image block is the darkest image block in the dark image block group.
[0078] In this example, the first image patch can be represented by the following expression:
[0079] In this example, the second representative image patch can be represented by the following expression:
[0080] S403: Combine the brightness of each image block in the neighborhood of the first representative image block to obtain the first representative brightness, and combine the brightness of each image block in the neighborhood of the second representative image block to obtain the second representative brightness.
[0081] In one example, the neighborhood of a representative image patch (either a first or second representative image patch) is a square region centered on the representative image patch. The neighborhood of a representative image patch contains K×K image patches, where K is an odd number and can be configured according to actual needs.
[0082] In one example, the brightness of each image block in the neighborhood of the first representative image block is weighted and averaged to obtain the first representative brightness.
[0083] In this example, the first value represents the brightness, which is obtained using the following formula:
[0084] in, This indicates the neighborhood of the first image patch; This represents the brightness of the image block (u,v) within the neighborhood of the first image block; The weight coefficients represent the image patch (u,v). The distance between the corresponding image block (u,v) and the first representative image block is negatively correlated.
[0085] In some examples, the brightness of each image block in the neighborhood of the second representative image block is weighted and averaged to obtain the second representative brightness.
[0086] In this example, the second representative brightness is obtained using the following formula:
[0087] in, This represents the neighborhood of the second image patch; This represents the brightness of the image block (u,v) within the neighborhood of the second representative image block; The weight coefficients represent the image patch (u,v). The distance between the corresponding image patch (u,v) and the second representative image patch is negatively correlated.
[0088] In one example, to avoid the occurrence of... =0, or If the value is too small, it may cause division by zero or abnormal amplification of the dynamic range parameter during subsequent calculations. Therefore, the maximum value between the second representative brightness and the preset brightness value can be obtained as the final second representative brightness. The final second representative brightness can be expressed by the following formula:
[0089] in, This represents the preset brightness value, which is a very small positive number set according to actual needs.
[0090] In other embodiments, in step S403, the brightness of the first representative image block can be directly used as the first representative brightness, and the brightness of the second representative image block can be directly used as the second representative brightness.
[0091] S404: The dynamic range parameters of the current image are obtained by using the ratio of the first representative brightness to the second representative brightness.
[0092] In one scenario, the camera mode is linear, directly using the brightness ratio as the dynamic range parameter of the current image.
[0093] In another scenario, the camera mode is wide dynamic range mode, and the product of the brightness ratio and a preset coefficient is used as the dynamic range parameter of the current image. For example, the preset coefficient is a number greater than or equal to 1.
[0094] Since the dynamic range thresholds in the aforementioned first and second dynamic range conditions are calibrated in linear mode, and considering that the luminance ratio obtained in wide dynamic mode according to steps S401 to S404 is usually smaller than the luminance ratio obtained in linear mode according to steps S401 to S404, the luminance ratio obtained in wide dynamic mode is amplified by a preset coefficient to obtain the dynamic range parameter in wide dynamic mode, which is convenient for fair comparison with the calibrated dynamic range threshold.
[0095] In steps S401 to S404, since the brightness of a single representative image block (the first representative image block of the bright image block set or the second representative image block of the dark image block set) is easily affected by noise, local reflections or image block boundaries, the brightness of a single representative image block may not be accurate enough. By combining the brightness of each image block in the neighborhood of the first representative image block to obtain the first representative brightness, and combining the brightness of each image block in the neighborhood of the second representative image block to obtain the second representative brightness, the dynamic range parameters of the current imaging image determined by the first representative brightness and the second representative brightness can be more accurate.
[0096] S303: Determine the recoverable parameters of the current image captured by the camera device.
[0097] The step of determining the recoverable parameters of the current image of the camera device further includes: determining the recoverable parameters of the current image using at least one of a first index value, a second index value, and a third index value.
[0098] The first, second, and third indicator values are described in detail below.
[0099] In this embodiment, the first index value is obtained based on the number of first target image blocks in the first image block set.
[0100] The first image block set is a set of brighter image blocks selected from several image blocks in the current image frame. Specifically, the first image block set includes first image blocks whose brightness is greater than or equal to a first brightness threshold from among several image blocks in the current image frame. That is, all image blocks in the first image block set are first image blocks, and the brightness of the first image blocks is greater than or equal to the first brightness threshold. The first brightness threshold can be a pre-set, relatively high brightness threshold. For example, the first brightness threshold is a threshold close to saturation brightness, where saturation brightness can be understood as the maximum achievable brightness.
[0101] For example, the first set of image patches can be represented by the following formula:
[0102] in, Represents the first image patch set; Indicates the first brightness threshold; This indicates a proportionality coefficient, such as 90%, 95%, etc., which can be set according to the actual situation. Indicates saturated brightness or maximum brightness.
[0103] Furthermore, after selecting the first image patch set, a first target image patch is determined from the first image patch set. Specifically, the first target image patch is the first image patch whose brightness difference with the neighboring image patches meets the difference requirement.
[0104] In one possible implementation, when the brightness difference between the first image block and its neighboring image blocks is small, i.e., the image blocks around the first image block are almost as bright as the first image block, the brightness difference between the first image block and its neighboring image blocks is considered to meet the difference requirement, and the first image block is designated as the first target image block. In this case, the first target image block can also be referred to as a saturation plateau block.
[0105] In this embodiment, the more first target image blocks there are in the first image block set, the more blurred the bright areas of the current image are, and the more difficult it is to improve the details of the bright areas in the current image when switching to wide dynamic range mode.
[0106] In another possible implementation, when the brightness difference between the first image block and the image blocks in its neighborhood is large, the brightness difference between the first image block and the image blocks in its neighborhood is considered to meet the difference requirement, and the first image block is designated as the first target image block. In this case, the first target image block can also be referred to as an unsaturated plateau block.
[0107] In this embodiment, the more target image blocks there are in the first image block set, the more effectively the wide dynamic range mode can improve the details of the bright areas in the current image.
[0108] Figure 5This is a flowchart illustrating an embodiment of the method for determining a first target image block provided in this application. This method is used to determine whether each first image block in a first image block set is a first target image block. Figure 5 As shown, the method includes the following steps: S501: Determine the brightness difference between the first image block and each image block in its neighborhood.
[0109] The division of the neighborhood of the first image block can be referred to the division of the neighborhood of the representative image blocks (the first representative image block and the second representative image block) mentioned above, and will not be repeated here.
[0110] In step S501, there is a corresponding brightness difference between the first image block and each image block in its neighborhood. For each image block in the neighborhood of the first image block, the brightness of the first image block is subtracted from the brightness of the current image block to obtain the brightness difference between the first image block and the current image block. In this way, multiple brightness differences corresponding to the first image block can be obtained.
[0111] S502: Combine the brightness differences of each element in the first image block to obtain the first combined brightness difference value of the first image block.
[0112] The first overall brightness difference of the first image block can characterize the brightness flatness of the image blocks in the neighborhood of the first image block. The smaller the first overall brightness difference of the first image block, the closer the brightness of the image blocks around the first image block is to the brightness of the first image block, and the more it resembles a saturation plateau block.
[0113] In one example, the absolute value of each brightness difference of the first image block is determined, and the absolute values of each brightness difference of the first image block are summed to obtain the first comprehensive brightness difference of the first image block.
[0114] In this example, the first overall brightness difference of the first image block can be represented by the following formula:
[0115] in, S1 represents the first overall brightness difference of the first image block, and S1 represents the first image block set. This represents the coordinates of one of the first image blocks in S1.
[0116] In other examples, the maximum absolute value of each brightness difference in the first image block can be selected as the first overall brightness difference of the first image block. Alternatively, the average absolute value of each brightness difference in the first image block can be obtained as the first overall brightness difference of the first image block.
[0117] S503: In response to the first comprehensive brightness difference of the first image block being less than the brightness difference threshold, the first image block is determined to be the first target image block.
[0118] In step S503, when the first comprehensive brightness difference of the first image block is less than the brightness difference threshold, the first image block is designated as the first target image block. At this time, the first target image block is the aforementioned saturation plateau block.
[0119] Optionally, step S503 can also be replaced by: determining the first image block as the first target image block when the first comprehensive brightness difference of the first image block is greater than or equal to the brightness difference threshold. In this case, the first target image block is the aforementioned unsaturated plateau block.
[0120] Furthermore, after identifying all the first target image blocks in the first image set, the number of first target image blocks is counted, and a first index value is obtained based on the number of first target image blocks.
[0121] Figure 6 This is a flowchart illustrating one implementation method of the method for determining the first index value provided in this application. Figure 6 As shown, the method includes the following steps: S601: Select the larger of the first preset quantity and the number of image blocks in the first image block set as the first quantity.
[0122] For example, the first preset quantity is 1.
[0123] S602: Determine the first ratio of the number of the first target image blocks to the first quantity.
[0124] For example, the first ratio can be expressed by the following formula: S603: Determine the first index value using the first ratio.
[0125] In one scenario, the first target image block is a saturated plateau block, in which case the first ratio and the first index value are negatively correlated.
[0126] In this scenario, the difference between the first preset value and the first ratio can be obtained as the first index value. For example, the first preset value is 1.
[0127] For example, the first indicator value can be expressed by the following formula:
[0128] in, This represents the first indicator value. This indicates the first ratio. It can be expressed by the following formula:
[0129] in, This indicates the number of the first target image patches counted. Indicates the brightness difference threshold; when hour, The value is 1; when hour, The value is 0.
[0130] For example, when the current image includes bright spots from streetlights, the corresponding first ratio is larger, and the first index value is smaller. When the current image includes backlit windows (with a transition between light and dark), the corresponding first ratio is smaller, and the first index value is larger.
[0131] In another scenario, the first target image block is a non-saturated plateau block, in which case the first ratio and the first index value are positively correlated. In this case, the first ratio can be directly used as the first index value.
[0132] It should be noted that, considering the possibility that the first image patch set may be empty, i.e., there is neither a first image patch nor a first target image patch, the first indicator value can be directly set to a preset indicator value. For example, the preset indicator value is 1.
[0133] In this embodiment, the second index value is obtained based on the brightness difference information of the image blocks in the neighborhood of the second target image block, and the second target image block is the representative image block of the second image block set.
[0134] The second image block set comprises a set of brighter image blocks selected from several image blocks in the current image frame. Specifically, the second image block set includes second image blocks whose brightness is greater than or equal to a second brightness threshold from among the several image blocks in the current image frame. That is, all image blocks in the second image block set are second image blocks, and the brightness of each second image block is greater than or equal to the second brightness threshold. The second brightness threshold can be preset according to actual needs.
[0135] In some examples, the second image patch set can be Figure 4 In the illustrated embodiment, the bright image patch set is such that the second brightness threshold is equal to the aforementioned fourth brightness threshold. The second image patch set can also be a separately selected image patch set.
[0136] Furthermore, after selecting the second image patch set, the second target image patch is determined from the second image patch set.
[0137] For example, the representative image block of the second image block set can be the image block with the highest brightness in the second image block set, that is, the second target image block is the image block with the highest brightness in the second image block set.
[0138] Furthermore, after determining the second target image block in the second image block set, the brightness difference information of the image blocks in the neighborhood of the second target image block is determined, and the second index value is determined based on the brightness difference information of the image blocks in the neighborhood of the second target image block.
[0139] The division of the neighborhood of the second target image block can be referred to the division of the neighborhood of the aforementioned representative blocks (first representative image block and second representative image block), and will not be repeated here.
[0140] The brightness difference information of the image patches within the neighborhood of the second target image patch can reflect the brightness level within that neighborhood. The greater the brightness difference information of the image patches within the neighborhood of the second target image patch, the greater the brightness level within that neighborhood, and the more effectively the wide dynamic range mode can improve the details of the bright areas in the current image. Conversely, the smaller the brightness difference information of the image patches within the neighborhood of the second target image patch, the smaller the brightness level within that neighborhood, and the more difficult it is to improve the details of the bright areas in the current image when switching to wide dynamic range mode.
[0141] In some possible implementations, the brightness difference information of the image blocks in the neighborhood of the second target image block is measured using a brightness dispersion characterization value in the neighborhood of the second target image block and a second comprehensive brightness difference value of the second target image block. The second comprehensive brightness difference value of the second target image block is obtained by combining the brightness differences between the second target image block and each image block in its neighborhood.
[0142] Figure 7 This is a flowchart illustrating one implementation method of the method for determining the second index value provided in this application. Figure 7 As shown, the method includes the following steps: S701: Using the brightness of each image block in the neighborhood of the second target image block, obtain the brightness dispersion characterization value in the neighborhood of the second target image block.
[0143] In one example, the brightness dispersion characterization value in the neighborhood of the second target image patch can be the brightness standard deviation corresponding to the brightness of each image patch in the neighborhood of the second target image patch.
[0144] In this example, the standard deviation of brightness can be expressed by the following formula:
[0145]
[0146] in, This represents the standard deviation of brightness corresponding to the brightness of each image patch in the neighborhood of the second target image patch. This represents the average brightness value corresponding to the brightness of each image block in the neighborhood of the second target image block.
[0147] In other examples, the brightness dispersion characteristics of the neighborhood of the second target image patch can also be in other forms, such as variance, range (i.e., the brightness difference between the brightest and the smallest image patch in the neighborhood of the second target image patch), coefficient of variation (the ratio of the standard deviation of brightness to the mean of brightness), etc.
[0148] S702: Determine the second index value by using the brightness dispersion characterization value in the neighborhood of the second target image block.
[0149] The second index value is positively correlated with the brightness dispersion characterization value in the neighborhood of the second target image patch. That is, the larger the brightness dispersion characterization value in the neighborhood of the second target image patch, the larger the corresponding second index value, and the more effective the switching of wide dynamic range mode.
[0150] In one example, the ratio of the brightness dispersion characterization value to the brightness dispersion reference value within the neighborhood of the second target image patch is determined as the second index value. The brightness dispersion reference value refers to a value considered sufficient for sufficient brightness levels within the neighborhood and can be configured according to actual conditions.
[0151] In this example, taking the brightness dispersion as the characterization value and the brightness dispersion reference value as the brightness standard deviation reference value, the second index value can be expressed by the following formula:
[0152] in, This indicates the second indicator value; Indicates the standard deviation of brightness; This indicates the reference value for the standard deviation of luminance.
[0153] Figure 8 This is a flowchart illustrating another embodiment of the method for determining the second index value provided in this application. For example... Figure 8 As shown, the method includes the following steps: S801: Determine the brightness difference between the second target image block and each image block in its neighborhood.
[0154] In step S801, there is a brightness difference between the second target image block and each image block in its neighborhood. For each image block in the neighborhood of the second target image block, the brightness of the second target image block is subtracted from the brightness of the image block to obtain the brightness difference between the second target image block and the image block. In this way, multiple brightness differences corresponding to the second target image block can be obtained.
[0155] S802: Combine the brightness differences of each of the second target image blocks to obtain the second combined brightness difference of the second target image block.
[0156] In one example, the absolute value of each brightness difference of the second target image block is determined, and the absolute values of each brightness difference of the second target image block are summed to obtain the second comprehensive brightness difference of the second target image block.
[0157] In other examples, the maximum absolute value of each brightness difference in the second target image block can be selected as the second overall brightness difference of the second target image block. Alternatively, the average absolute value of each brightness difference in the second target image block can be obtained as the second overall brightness difference of the second target image block.
[0158] S803: Determine the second index value using the second comprehensive brightness difference of the second target image block.
[0159] The second index value is positively correlated with the second comprehensive brightness difference of the second target image block. That is, the larger the second comprehensive brightness difference of the second target image block, the larger the corresponding second index value, and the more effective the switching of wide dynamic range mode.
[0160] In one example, the ratio of the second comprehensive brightness difference value of the second target image block to the brightness difference reference value is determined as the second index value. The brightness difference reference value refers to a reference value considered sufficient in the neighborhood brightness levels, and can be configured according to actual conditions.
[0161] For example, the second indicator value is expressed by the following formula:
[0162] in, This indicates the second indicator value; This represents the second overall brightness difference of the second target image block; This indicates a reference value for the brightness difference.
[0163] In this embodiment, the third index value is obtained based on the number of third target image blocks in the third image block set.
[0164] The third image patch set is a collection of brighter image patches selected from several image patches in the current image frame. Specifically, the third image patch set includes third image patches whose brightness is greater than or equal to a third brightness threshold from among the image patches in the current image frame. That is, all image patches in the third image patch set are third image patches, and the brightness of each third image patch is greater than or equal to the third brightness threshold. The third brightness threshold can be a pre-set, relatively high brightness threshold. For example, the third brightness threshold could be a threshold close to saturation brightness, where saturation brightness can be understood as the maximum achievable brightness.
[0165] In some examples, the third image patch set may be the first image patch set mentioned above, or it may be a separately selected image patch set. This embodiment does not specifically limit this.
[0166] Furthermore, after selecting the third image patch set, the third target image patch is determined from the third image patch set.
[0167] Understandably, even when the camera is in linear mode, it can still acquire two exposure data streams (including data for long and short exposure times), and can use only one stream, such as the data for the long exposure time. Specifically, in the current image captured by the camera, each image block can include brightness at the first exposure time and brightness at the second exposure time. The first exposure time is longer than the second exposure time. The first exposure time corresponds to the long exposure time, and the second exposure time corresponds to the short exposure time.
[0168] The third target image block is an image block whose brightness is greater than or equal to the first saturation brightness threshold under the first exposure time, and whose brightness is less than the second saturation brightness threshold under the second exposure time. The first saturation brightness threshold is greater than the third brightness threshold used when filtering the third image block set. The specific values of the first and second saturation brightness thresholds can be set according to actual needs.
[0169] Specifically, firstly, image blocks with brightness greater than or equal to the first saturation brightness threshold under the first exposure time are selected from the third image block set. Then, from the image blocks with brightness greater than or equal to the first saturation brightness threshold under the first exposure time, image blocks with brightness less than the second saturation brightness threshold under the second exposure time are further selected.
[0170] When the brightness of the third image block during the first exposure time is greater than or equal to the first saturation brightness threshold, it means that the brightness of the third image block during the first exposure time has reached or is close to saturation brightness. When the brightness of the third image block during the second exposure time is less than the second saturation brightness threshold, it means that the brightness of the third image block during the second exposure time has not yet reached saturation brightness.
[0171] Furthermore, after determining the third target image block in the third image block set, the number of the third target image blocks is counted, and the third index value is obtained based on the number of the third target image blocks.
[0172] Understandably, the typical scenario for wide dynamic range (WDR) mode (or multi-exposure fusion) is as follows: long exposures result in good shadows, but highlights are prone to overexposure; short exposures result in a generally darker image, but highlights are often not yet saturated, thus retaining detail. If a third image patch satisfies the following conditions: its brightness at the first exposure duration (i.e., long exposure duration) is greater than or equal to the first saturation brightness threshold (i.e., brightness is saturated or close to saturation), and its brightness at the second exposure duration is less than the second saturation brightness threshold (i.e., brightness has not yet reached saturation), then when fusing the two exposures, the short exposure can compensate for the tones and details lost during the long exposure. In this case, switching to WDR mode can effectively improve detail. If a third image patch satisfies the following conditions: its brightness at the first exposure duration (i.e., long exposure duration) is greater than or equal to the first saturation brightness threshold (i.e., brightness is saturated or close to saturation), and its brightness at the second exposure duration is greater than the second saturation brightness threshold (i.e., brightness is saturated or close to saturation), then when fusing the two exposures, the short exposure cannot compensate for the tones and details lost during the long exposure. In this case, switching to WDR mode is unlikely to effectively improve detail.
[0173] Therefore, in this embodiment, the number of third target image blocks in the third image block set can be used to determine whether the details in the highlight areas of the current image can still be recovered by fusing two exposures. Furthermore, the more third target image blocks in the third image block set, the more suitable it is for switching to wide dynamic range mode.
[0174] Figure 9 This is a flowchart illustrating one implementation method of the method for determining the third indicator value provided in this application. Figure 9 As shown, the method includes the following steps: S901: Select the larger of the second preset quantity and the quantity of the fourth image block in the third image block set as the second quantity.
[0175] The fourth image block is the third image block whose brightness is greater than or equal to the first saturation brightness threshold under the first exposure time.
[0176] For example, the second preset quantity is 1.
[0177] S902: Determine the second ratio of the number of third target image blocks to the second number.
[0178] S903: Use the second ratio to determine the third index value.
[0179] The third indicator value is positively correlated with the second ratio. That is, the larger the second ratio is, the larger the corresponding third indicator value is, and the more suitable it is to switch to wide dynamic mode.
[0180] In one example, the second ratio can be directly used as the third index value.
[0181] In one example, all the identified fourth image patches constitute a set E, and set E can be represented by the following formula:
[0182] in, Represents the third image patch set; This indicates the brightness of the third image block in the third image block set during the first exposure time; This represents the first saturation brightness threshold.
[0183] Furthermore, the third indicator value can be expressed by the following formula:
[0184] in, This indicates the third indicator; This represents the brightness of the image patch in set E during the second exposure time; This indicates the second saturation brightness threshold; This indicates the number of third target image patches in the statistics; when hour, The value is 1; when hour, The value is 0.
[0185] Furthermore, in this embodiment, after obtaining at least one of the first, second, and third index values, the recoverable parameters of the current imaging image are determined using at least one index value.
[0186] Specifically, the step of determining the recoverable parameters of the current image using at least one index value further includes: combining at least one index value to obtain a comprehensive index value; and using the comprehensive index value to obtain the recoverable parameters of the current image.
[0187] In one embodiment, the weight coefficient of each indicator value is determined, and the indicator values are weighted using the weight coefficients to obtain a comprehensive indicator value.
[0188] The weighting coefficients for each indicator value can be preset according to the actual situation. For example, the sum of the weighting coefficients for each indicator value is 1.
[0189] In some implementations, after obtaining the comprehensive index value, it can be directly used as the recoverable parameter of the current image. Alternatively, the comprehensive index value can be used to further determine the recoverable score, recoverable probability, or recoverable level of the current image, which can then be used as the recoverable parameter of the current image. It is understood that the comprehensive index value is positively correlated with the recoverable score and recoverable probability; the larger the comprehensive index value, the higher the corresponding recoverable level, and the smaller the comprehensive index value, the lower the corresponding recoverable level.
[0190] For example, the acquired index values include a first index value, a second index value, and a third index value. The recoverable parameters of the current image can be expressed by the following formula:
[0191] in, Indicates recoverable parameters of the current image; , and The values represent the first, second, and third indicators, respectively. , and These represent the weighting coefficients of the first, second, and third indicator values, respectively.
[0192] In this example, R is mapped to a value in the range of 0 to 1. Furthermore, a larger R value indicates that switching to wide dynamic range mode is more worthwhile; a smaller R value indicates that switching to wide dynamic range mode is less worthwhile.
[0193] S304: Determines whether the camera mode is linear mode.
[0194] If the camera mode is linear mode, then proceed to step S305.
[0195] If the camera mode is not linear mode, that is, the camera mode is wide dynamic range mode, then proceed to step S309.
[0196] S305: Determine whether the dynamic range parameters of the current image meet the first dynamic range condition.
[0197] If the dynamic range parameter of the current image meets the first dynamic range condition, then proceed to step S306.
[0198] If the dynamic range parameters of the current image do not meet the first dynamic range condition, then step S308 is executed.
[0199] The relevant content of the first range dynamic conditions can be referred to in the aforementioned step S12, and will not be repeated here.
[0200] S306: Determine whether the recoverable parameters of the current image meet the recoverable conditions.
[0201] If the recoverable parameters of the current image meet the recoverable conditions, then proceed to step S307.
[0202] If the recoverable parameters of the current image do not meet the recoverable conditions, then proceed to step S308.
[0203] For details regarding the conditions for recovery, please refer to step S12 above, which will not be repeated here.
[0204] S307: Switch the camera mode to wide dynamic range mode.
[0205] Optionally, before switching the camera mode to wide dynamic range mode, the method further includes: first determining whether additional conditions are met; when the additional conditions are met, switching the camera mode to wide dynamic range mode; when the additional conditions are not met, refusing to switch the camera mode to wide dynamic range mode.
[0206] The additional conditions include at least one of the first, second, and third conditions.
[0207] The first condition includes: the dynamic range parameter of at least one associated imaging frame of the current imaging frame satisfies the first dynamic range condition, and the recoverable parameters of each associated imaging frame satisfy the recoverable condition.
[0208] The second condition includes: the difference between the maximum dynamic range parameter and the minimum dynamic range parameter in the current imaging frame and at least one associated imaging frame is less than a dynamic range difference threshold. The dynamic range difference threshold is a pre-set, relatively small threshold.
[0209] The third condition includes: the absolute value of the difference between the current exposure and the target exposure is less than the exposure difference threshold. The exposure difference threshold is a pre-set, relatively small threshold.
[0210] The associated imaging image is either an imaging image captured before the current imaging image or an imaging image captured after the current imaging image.
[0211] In some possible implementations, at least one associated imaging frame is a continuous at least one frame of imaging captured after the current imaging frame, or at least one associated imaging frame is a continuous at least one frame of imaging captured before the current imaging frame, or at least one associated imaging frame includes both imaging frames captured before the current imaging frame and imaging frames captured after the current imaging frame.
[0212] For example, a series of multiple imaging frames can be obtained through a sliding window, the multiple imaging frames including the current imaging frame and at least one associated imaging frame of the current imaging frame.
[0213] In one embodiment, the additional conditions include the first, second, and third conditions described above simultaneously; that is, the camera mode will only be switched to wide dynamic range mode when all three conditions are met. If at least one of the first, second, and third conditions is not met, the camera mode will not be switched to wide dynamic range mode.
[0214] The camera mode is switched to wide dynamic range mode only when the dynamic range parameters of at least one associated imaging frame meet the first dynamic range condition and the recoverable parameters of each associated imaging frame meet the recoverable condition. This effectively suppresses the erroneous switching of wide dynamic range mode caused by abnormal judgment of a single frame, and further improves the accuracy of camera mode switching.
[0215] When the difference between the maximum dynamic range parameter and the minimum dynamic range parameter in the current image and at least one associated image is less than the dynamic range difference threshold, it indicates that the brightness-to-dark ratio has not fluctuated drastically in the current scene. Only then is switching to wide dynamic range mode allowed. This reduces the false switching of wide dynamic range mode caused by scene changes and further improves the accuracy of camera mode switching.
[0216] When the absolute value of the difference between the current exposure and the target exposure is less than the exposure difference threshold, it means that the current exposure is close to the target exposure, i.e., the automatic exposure (AE) has converged. Only then is it allowed to switch to wide dynamic range mode. This can reduce the false switching of wide dynamic range mode caused by the failure of automatic exposure to converge, and further improve the accuracy of camera mode switching.
[0217] S308: Maintain camera mode as linear mode.
[0218] Optionally, in this embodiment, when switching to wide dynamic range mode is refused because the recoverable parameters of the current image do not meet the recoverable conditions, imaging adjustment processing can also be performed on the current image to optimize the imaging quality of the current image as much as possible. Imaging adjustment processing includes at least one of the following: reducing the gain of the camera device, reducing the exposure time, and enabling strong light suppression. The gain of the camera device includes analog gain and digital gain.
[0219] S309: Determine whether the dynamic range parameters of the current image meet the second dynamic range condition.
[0220] If the dynamic range parameter of the current image meets the second dynamic range condition, then proceed to step S310.
[0221] If the dynamic range parameters of the current image do not meet the second dynamic range condition, then step S311 is executed.
[0222] The relevant content of the second dynamic range condition can be referred to in the aforementioned step S23, and will not be repeated here.
[0223] S310: Switch the camera mode to linear mode.
[0224] S311: Maintain camera mode as wide dynamic range mode.
[0225] Please see Figure 10 , Figure 10 This is a schematic diagram of a frame of an embodiment of the camera mode switching device provided in this application. In this embodiment, the camera mode switching device 100 includes a mode acquisition module 101 and a mode switching module 102.
[0226] The mode acquisition module 101 is used to acquire the camera mode of the camera device. The mode switching module 102 is used to determine whether to switch the camera mode to wide dynamic range mode in response to the camera mode being linear mode and the dynamic range parameter of the current image of the camera device meeting the first dynamic range condition, using the recoverable parameter of the current image. The dynamic range parameter characterizes the brightness contrast of the image, and the recoverable parameter characterizes the recoverability of details in the bright areas of the image; the bright areas are areas whose brightness meets the requirements.
[0227] In one embodiment, the mode switching module 102 is used to switch the camera mode to wide dynamic range mode in response to the recoverable parameters of the current image meeting the recoverable condition; and to maintain the camera mode as linear mode in response to the recoverable parameters of the current image not meeting the recoverable condition; wherein the recoverable condition includes: the recoverable parameter is greater than the recoverable threshold.
[0228] In one embodiment, the camera mode switching device 100 further includes a parameter determination module 103. The parameter determination module 103 is used to determine the recoverable parameters of the current image using at least one of a first index value, a second index value, and a third index value.
[0229] The first index value is obtained based on the number of first target image blocks in the first image block set. The first image block set includes first image blocks whose brightness is greater than or equal to a first brightness threshold among several image blocks, and the first target image block is a first image block whose brightness difference with the neighboring image blocks meets the difference requirement.
[0230] The second index value is obtained based on the brightness difference information of the neighboring image blocks of the second target image block. The second target image block is a representative image block of the second image block set, and the second image block set includes a second image block whose brightness is greater than or equal to the second brightness threshold among several image blocks.
[0231] The third index value is obtained based on the number of third target image blocks in the third image block set. The third image block set includes a number of third image blocks whose brightness is greater than or equal to the third brightness threshold. The third target image block is a third image block whose brightness is greater than or equal to the first saturation brightness threshold under the first exposure time and whose brightness is less than the second saturation brightness threshold under the second exposure time. The first exposure time is greater than the second exposure time.
[0232] In one embodiment, for each first image block in the first image block set, the parameter determination module 103 is used to determine the brightness difference between each image block in the neighborhood of the first image block and the first image block, combine the brightness differences of the first image block to obtain the first comprehensive brightness difference of the first image block, and determine the first image block as the first target image block in response to the first comprehensive brightness difference of the first image block being less than the brightness difference threshold.
[0233] In one embodiment, the parameter determination module 103 is used to select the larger of a first preset quantity and the number of image blocks in a first image block set as a first quantity; determine a first ratio between the number of first target image blocks and the first quantity; and determine a first index value using the first ratio.
[0234] In one embodiment, the parameter determination module 103 is used to obtain a brightness dispersion characterization value in the neighborhood of the second target image block using the brightness of each image block in the neighborhood of the second target image block, and to determine a second index value using the brightness dispersion characterization value; or, to determine the brightness difference between the second target image block and each image block in the neighborhood of the second target image block respectively, to obtain a second comprehensive brightness difference value of the second target image block by combining the brightness differences of the second target image block, and to determine the second index value using the second comprehensive brightness difference value.
[0235] In one embodiment, the parameter determination module 103 is used to select the larger of the second preset quantity and the quantity of the fourth image block in the third image block set as the second quantity; wherein, the fourth image block is the third image block in the third image block set whose brightness is greater than or equal to the first saturation brightness threshold under the first exposure time; determine the second ratio of the quantity of the third target image block to the second quantity; and determine the third index value using the second ratio.
[0236] In one embodiment, the parameter determination module 103 is used to divide a plurality of image blocks in the current imaging frame into a bright image block set and a dark image block set; wherein the brightness of the image blocks in the bright image block set is greater than or equal to a fourth brightness threshold, and the brightness of the image blocks in the dark image block set is less than a fifth brightness threshold; determine a first representative image block of the bright image block set and a second representative image block of the dark image block set; obtain a first representative brightness by combining the brightness of each image block in the neighborhood of the first representative image block, and obtain a second representative brightness by combining the brightness of each image block in the neighborhood of the second representative image block; and obtain the dynamic range parameter of the current imaging frame by using the brightness ratio of the first representative brightness to the second representative brightness.
[0237] In one embodiment, the first representative image block is the image block with the highest brightness among the bright image blocks, and the second representative image block is the image block with the lowest brightness among the dark image blocks.
[0238] And / or, the parameter determination module 103 is used to use the brightness ratio as the dynamic range parameter of the current image when the camera mode is linear mode; and to obtain the product of the brightness ratio and a preset coefficient as the dynamic range parameter of the current image when the camera mode is wide dynamic range mode.
[0239] In one embodiment, before switching the camera mode to wide dynamic range mode, the mode switching module 102 is further configured to determine whether additional conditions are met; wherein, the additional conditions include at least one of the following conditions: the dynamic range parameter of at least one associated image of the current image satisfies a first dynamic range condition, and the recoverable parameters of each associated image satisfy a recoverable condition; the difference between the maximum dynamic range parameter and the minimum dynamic range parameter in the current image and at least one associated image is less than a dynamic range difference threshold; the absolute value of the difference between the exposure of the current image and the target exposure is less than an exposure difference threshold; the associated image is an image captured before the current image or an image captured after the current image. The mode switching module 102 is configured to switch the camera mode to wide dynamic range mode in response to the satisfaction of the additional conditions.
[0240] In one embodiment, the camera mode switching device 100 further includes an imaging adjustment module 104. When the recoverable parameters of the current image do not meet the recoverable conditions, the imaging adjustment module 104 is used to perform imaging adjustment processing on the current image; wherein, the imaging adjustment processing includes at least one of the following processes: reducing the gain of the camera device, reducing the exposure time, and enabling strong light suppression.
[0241] And / or, the mode switching module 102 is also configured to switch the camera mode to linear mode in response to the camera mode being wide dynamic range mode and the dynamic range parameter of the current image satisfying the second dynamic range condition.
[0242] It should be noted that the apparatus of this embodiment can perform the steps in the above method. For detailed descriptions of the relevant content, please refer to the method section above, which will not be repeated here.
[0243] Please see Figure 11 , Figure 11 This is a schematic diagram of a frame of an embodiment of the camera device provided in this application. In this embodiment, the camera device 110 includes a memory 111 and a processor 112.
[0244] Processor 112 can also be referred to as CPU (Central Processing Unit). Processor 112 may be an integrated circuit chip with signal processing capabilities. Processor 112 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. A general-purpose processor can be a microprocessor, or processor 112 can be any conventional processor 112, etc.
[0245] The memory 111 in the camera device 110 is used to store the program instructions required for the processor 112 to run.
[0246] The processor 112 is used to execute program instructions to implement the camera mode switching method in this application.
[0247] Please see Figure 12 , Figure 12 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. The computer-readable storage medium 120 of this application embodiment stores program instructions 121, which, when executed, implement the camera mode switching method provided in this application. The program instructions 121 can be formed into a program file and stored in the aforementioned computer-readable storage medium 120 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) can execute all or part of the steps of the methods of various embodiments of this application. The aforementioned computer-readable storage medium 120 includes various media capable of storing program code, such as a USB flash drive, mobile hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or terminal devices such as computers, servers, mobile phones, and tablets.
[0248] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0249] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0250] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatuses, and systems can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or units may be electrical, mechanical, or other forms.
[0251] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0252] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0253] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0254] It should be noted that if the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, the personal information processing rules are clearly informed through signs / information, and authorization is obtained through pop-up information or by asking the individual to upload their personal information. The personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.
[0255] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for switching camera modes, characterized in that, The method includes: Obtain the camera mode of the camera device; In response to the camera mode being linear mode and the dynamic range parameter of the current image of the camera device satisfying the first dynamic range condition, the recoverable parameter of the current image is used to determine whether to switch the camera mode to wide dynamic range mode. The dynamic range parameter is used to characterize the contrast between light and dark areas of the image, and the recoverable parameter is used to characterize the recoverability of details in the bright areas of the image, wherein the bright areas are areas whose brightness meets the requirements.
2. The method according to claim 1, characterized in that, The step of determining whether to switch the camera mode to wide dynamic range mode using the recoverable parameters of the current image includes: In response to the fact that the recoverable parameters of the current image meet the recoverable conditions, the camera mode is switched to the wide dynamic range mode; In response to the fact that the recoverable parameters of the current image frame do not meet the recoverable condition, the camera mode is maintained as the linear mode; The recoverable condition includes: the recoverable parameter is greater than the recoverable threshold.
3. The method according to claim 1, characterized in that, The current imaging frame includes several image blocks, and the step of determining the recoverable parameters of the current imaging frame includes: The recoverable parameters of the current image are determined using at least one of the first index value, the second index value, and the third index value. The first index value is obtained based on the number of first target image blocks in the first image block set. The first image block set includes first image blocks whose brightness is greater than or equal to a first brightness threshold among the plurality of image blocks, and the first target image block is the first image block whose brightness difference with the neighboring image blocks meets the difference requirement. The second index value is obtained based on the brightness difference information of the neighboring image blocks of the second target image block. The second target image block is a representative image block of the second image block set, and the second image block set includes the second image block whose brightness is greater than or equal to the second brightness threshold among the plurality of image blocks. The third index value is obtained based on the number of third target image blocks in the third image block set. The third image block set includes third image blocks whose brightness is greater than or equal to a third brightness threshold among the plurality of image blocks. The third target image block is the third image block whose brightness is greater than or equal to a first saturation brightness threshold under a first exposure time and whose brightness is less than a second saturation brightness threshold under a second exposure time. The first exposure time is greater than the second exposure time.
4. The method according to claim 3, characterized in that, The steps for determining the first target image patch include: For each of the first image blocks in the first image block set, the brightness difference between the first image block and each image block in its neighborhood is determined. The brightness difference of each of the first image blocks is combined to obtain the first comprehensive brightness difference of the first image block. In response to the first comprehensive brightness difference of the first image block being less than the brightness difference threshold, the first image block is determined to be the first target image block.
5. The method according to claim 3, characterized in that, The steps for determining the first indicator value include: The larger of the first preset number and the number of image blocks in the first image block set is selected as the first number; Determine a first ratio between the number of the first target image blocks and the first number; The first index value is determined using the first ratio.
6. The method according to claim 3, characterized in that, The steps for determining the second indicator value include: Using the brightness of each image block in the neighborhood of the second target image block, a brightness dispersion characterization value in the neighborhood of the second target image block is obtained, and the second index value is determined using the brightness dispersion characterization value. Alternatively, the brightness difference between the second target image block and each image block in its neighborhood can be determined separately, and the second comprehensive brightness difference of the second target image block can be obtained by combining the brightness differences of each of the second target image blocks. The second index value can then be determined using the second comprehensive brightness difference.
7. The method according to claim 3, characterized in that, The steps for determining the third indicator value include: The larger of the second preset number and the number of the fourth image blocks in the third image block set is selected as the second number; wherein, the fourth image block is the third image block in the third image block set whose brightness is greater than or equal to the first saturation brightness threshold under the first exposure time. Determine a second ratio between the number of the third target image blocks and the second number; The third index value is determined using the second ratio.
8. The method according to claim 1, characterized in that, The step of determining the dynamic range parameter of the current image includes: The current image frame is divided into a set of bright image blocks and a set of dark image blocks; wherein the brightness of the image blocks in the set of bright image blocks is greater than or equal to a fourth brightness threshold, and the brightness of the image blocks in the set of dark image blocks is less than a fifth brightness threshold. Determine a first representative image block of the bright image block set and a second representative image block of the dark image block set; A first representative brightness is obtained by combining the brightness of each image block in the neighborhood of the first representative image block, and a second representative brightness is obtained by combining the brightness of each image block in the neighborhood of the second representative image block; The dynamic range parameter of the current image is obtained by using the ratio of the first representative brightness to the second representative brightness.
9. The method according to claim 8, characterized in that, The first representative image block is the image block with the highest brightness among the bright image blocks, and the second representative image block is the image block with the lowest brightness among the dark image blocks; And / or, obtaining the dynamic range parameter of the current image using the ratio of the first representative brightness to the second representative brightness includes: When the camera mode is the linear mode, the brightness ratio is used as the dynamic range parameter of the current image. When the camera mode is the wide dynamic range mode, the product of the brightness ratio and the preset coefficient is obtained as the dynamic range parameter of the current image.
10. The method according to claim 2, characterized in that, Before switching the camera mode to wide dynamic range mode, the method further includes: Determine whether additional conditions are met; wherein, the additional conditions include at least one of the following conditions: the dynamic range parameter of at least one associated imaging frame of the current imaging frame satisfies the first dynamic range condition, and the recoverable parameter of each associated imaging frame satisfies the recoverable condition; the difference between the maximum dynamic range parameter and the minimum dynamic range parameter in the current imaging frame and the at least one associated imaging frame is less than a dynamic range difference threshold; the absolute value of the difference between the exposure of the current imaging frame and the target exposure is less than an exposure difference threshold; the associated imaging frame is an imaging frame acquired before the current imaging frame or an imaging frame acquired after the current imaging frame; Switching the camera mode to the wide dynamic range mode includes: In response to the fulfillment of the additional condition, the camera mode is switched to the wide dynamic range mode.
11. The method according to claim 2, characterized in that, If the recoverable parameters of the current imaging frame do not meet the recoverable condition, the method further includes: The current image is subjected to image adjustment processing; wherein the image adjustment processing includes at least one of the following: reducing the gain of the camera device, reducing the exposure time, and enabling strong light suppression; And / or, the method further includes: In response to the camera mode being the wide dynamic range mode and the dynamic range parameter of the current image satisfying the second dynamic range condition, the camera mode is switched to the linear mode.
12. A camera device, characterized in that, Including interconnected memory and processor, The memory stores program instructions; The processor is used to execute program instructions stored in the memory to implement the method according to any one of claims 1-11.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program instructions that can be executed by a processor to implement the method of any one of claims 1-11.
