A camera state switching method and device, electronic equipment and storage medium

CN117676324BActive Publication Date: 2026-10-23XIAN UNIVIEW INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210994595.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-18
Publication Date
2026-10-23
Estimated Expiration
2042-08-18

AI Technical Summary

Technical Problem

[0004]如果在非宽动态场景开启了宽动态模式来拍摄,不仅会白白耗费芯片性能,效果往往也不够理想;如果在宽动态场景没有开启宽动态,会由于过曝和过暗造成画面信息丢失

Benefits of technology

[0019]本发明实施例的技术方案,通过获取摄像机在当前状态下的长曝光帧和短曝光帧;然后对长曝光帧和短曝光帧的信息熵进行计算,得到信息熵差值,并对信息熵差值进行判断,若信息熵差值满足预设阈值条件,则将摄像机状态从当前状态切换至目标状态。本技术方案,能够根据长曝光帧和短曝光帧的信息熵之差实时判断是否需要切换摄像机状态,避免反复切换的现象。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117676324B_ABST
    Figure CN117676324B_ABST
Patent Text Reader

Abstract

The application discloses a camera state switching method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a long exposure frame and a short exposure frame of a camera in a current state; wherein the camera state comprises a wide dynamic mode and a linear mode; calculating the information entropy of the long exposure frame and the short exposure frame to obtain an information entropy difference value; if the information entropy difference value meets a preset threshold condition, switching the camera state from the current state to a target state. According to the technical scheme, whether the camera state needs to be switched can be judged in real time according to the difference between the information entropy of the long exposure frame and the short exposure frame. The video stream picture can be ensured to be smooth without affecting normal exposure, and the phenomenon of repeated switching can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and storage medium for switching camera states. Background Technology

[0002] With the continuous iteration of camera processing chips and CMOS components, wide dynamic range technology is becoming more and more widely used, and the effects of wide dynamic range images and videos are getting better and better.

[0003] However, wide dynamic range (WDR) modes on cameras generally require users to manually switch shooting modes based on the current environmental conditions and image quality.

[0004] Enabling wide dynamic range (WDR) mode in non-WDR scenes not only wastes chip resources but also often produces unsatisfactory results. Conversely, failing to enable WDR in WDR scenes can lead to image information loss due to overexposure or underexposure. Therefore, accurately identifying scene characteristics and automatically switching WDR on and off as needed can save users time and intelligently achieve better results. Summary of the Invention

[0005] This invention provides a camera state switching method, device, electronic device, and storage medium, which can determine in real time whether the camera state needs to be switched based on the difference in information entropy between long exposure frames and short exposure frames, avoiding repeated switching and improving the image quality of the camera.

[0006] According to one aspect of the present invention, a camera state switching method is provided, the method comprising:

[0007] Acquire long exposure frames and short exposure frames of the camera in its current state; wherein, the camera state includes wide dynamic range mode and linear mode;

[0008] The information entropy of the long exposure frame and the short exposure frame is calculated to obtain the information entropy difference;

[0009] If the information entropy difference meets the preset threshold condition, the camera state is switched from the current state to the target state.

[0010] According to another aspect of the present invention, a camera state switching device is provided, the device comprising:

[0011] The exposure frame acquisition module is used to acquire long exposure frames and short exposure frames of the camera in the current state; wherein, the camera state includes wide dynamic range mode and linear mode;

[0012] The information entropy difference module is used to calculate the information entropy of the long exposure frame and the short exposure frame to obtain the information entropy difference.

[0013] The camera state switching module is used to switch the camera state from the current state to the target state if the information entropy difference meets a preset threshold condition.

[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0015] At least one processor; and

[0016] A memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform a camera state switching method according to any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement a camera state switching method according to any embodiment of the present invention.

[0019] The technical solution of this invention acquires long-exposure frames and short-exposure frames of the camera in its current state; then, it calculates the information entropy of the long-exposure frames and short-exposure frames to obtain the information entropy difference, and judges the information entropy difference. If the information entropy difference meets a preset threshold condition, the camera state is switched from the current state to the target state. This technical solution can determine whether to switch the camera state in real time based on the difference in information entropy between the long-exposure frames and short-exposure frames, avoiding repeated switching.

[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of a camera state switching method provided in Embodiment 1 of the present invention;

[0023] Figure 2This is a flowchart of a camera state switching process provided in Embodiment 2 of the present invention;

[0024] Figure 3 This is a schematic diagram of the overexposed area provided in Embodiment 2 of this application;

[0025] Figure 4 This is a flowchart of another camera state switching process provided in Embodiment 3 of the present invention;

[0026] Figure 5 This is a flowchart of another camera state switching method provided in the embodiments of this application;

[0027] Figure 6 This is a schematic diagram of a camera state switching device provided in Embodiment 4 of the present invention;

[0028] Figure 7 This is a schematic diagram of the structure of an electronic device that implements a camera state switching method according to an embodiment of the present invention. Detailed Implementation

[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0031] Example 1

[0032] Figure 1This is a flowchart of a camera state switching method according to Embodiment 1 of the present invention. This embodiment is applicable to situations where the camera state needs to be switched according to the shooting scene. The method can be executed by a camera state switching device, which can be implemented in hardware and / or software. This camera state switching device can be configured on any electronic device with network communication capabilities, including but not limited to: computers, personal digital assistants, etc. Figure 1 As shown, the method includes:

[0033] S110. Obtain the long exposure frame and short exposure frame of the camera in the current state; wherein, the camera state includes wide dynamic range mode and linear mode.

[0034] Wide dynamic range mode refers to the technique of capturing multiple frames of the same scene with different exposure levels and then combining the multiple frames into a single frame.

[0035] In this embodiment, linear mode refers to the technique of outputting a single frame from multiple frames of images captured on the same scene.

[0036] In this solution, the current state of the camera may be wide dynamic range mode or linear mode. The current state of the camera can be determined by checking the camera status record.

[0037] Frames with large exposures are called long exposure frames because the longer exposure time effectively preserves information in dark areas. Frames with small exposures are called short exposure frames because the shorter exposure time effectively preserves information in bright areas.

[0038] In this embodiment, long exposure frames and short exposure frames can be determined based on the camera's own output.

[0039] S120. Calculate the information entropy of the long exposure frame and the short exposure frame to obtain the information entropy difference.

[0040] Information entropy is used to characterize the average amount of information in an image. It can be obtained by statistically analyzing the grayscale histograms of long-exposure and short-exposure frames. The difference between the information entropies of the long-exposure and short-exposure frames is then calculated to obtain the information entropy difference value.

[0041] S130. If the information entropy difference meets the preset threshold condition, then the camera state is switched from the current state to the target state.

[0042] In this embodiment, the preset threshold condition can refer to a threshold used to constrain the magnitude of the information entropy difference. The specific threshold value can be set according to the camera state switching requirements.

[0043] In this solution, the information entropy difference is compared with a preset threshold. If the information entropy difference meets the preset threshold condition, the camera state can be switched from linear mode to wide dynamic range mode, or the camera state can be switched from wide dynamic range mode to linear mode.

[0044] The technical solution of this invention acquires long-exposure frames and short-exposure frames of the camera in its current state; then, it calculates the information entropy of the long-exposure frames and short-exposure frames to obtain the information entropy difference, and judges the information entropy difference. If the information entropy difference meets a preset threshold condition, the camera state is switched from the current state to the target state. By implementing this technical solution, it is possible to determine in real time whether to switch the camera state based on the difference in information entropy between the long-exposure frames and short-exposure frames, avoiding repeated switching. Furthermore, it can improve the image quality of the camera.

[0045] Example 2

[0046] Figure 2 This is a flowchart illustrating a camera state switching process according to Embodiment 2 of the present invention. The relationship between this embodiment and the previous embodiments is that this provides a detailed description of the camera state switching process. For example... Figure 2 As shown, the method includes:

[0047] S210. If the current state of the camera is linear mode, then acquire the first long exposure frame and the first short exposure frame.

[0048] In this solution, the current status of the camera can be determined by viewing the camera status records.

[0049] Specifically, in linear mode, the frame rate of a typical camera is fixed. For example, a frame rate of around 30 frames per second is sufficient for most security cameras. Currently, the output frame rate of CMOS sensors is generally adjustable, with most sensors actually supporting up to 60 frames per second. Taking a 30fps camera as an example, in normal shooting mode, the CMOS sensor outputs 32 frames per second. Of these, 30 frames are normally exposed and used for the final output. The two additional frames (L1 and L2) are set with shorter exposure times (the specific time can be modified according to the desired wide dynamic range exposure ratio). Only the raw data is collected and stored in a separate storage space; no post-processing is performed, and no output is performed, ensuring a consistently stable display. In other words, when the camera is currently in linear mode, encoding is performed only based on the first long exposure frame, and the first short exposure frame is not output, ensuring a stable video stream without affecting normal exposure. L1 and L2 are continuously acquired, and then the nearest normally exposed image (L3) is taken. At this point, L3 has an exposure ratio relationship with L1 and L2, simulating the long and short exposures in wide dynamic range mode.

[0050] The brightness statistics of long and short exposures are converted into brightness histograms. In non-wide dynamic range (WDR) scenes, the distribution trends of the two should be the same, with only the specific brightness values ​​differing. However, in WDR scenes, overexposed areas exist, and the distributions of the two should differ significantly. In this case, the information entropy can be calculated based on their distributions to determine the amount of information carried by each frame. For short exposures, due to the insufficient exposure time, the signal often carries a large amount of noise, interfering with the calculation of information content. Since random noise appears in different positions in different frames, frame difference detection is performed on frames L1 and L2, and the frame output after removing noise is L4. That is, the final first long exposure frame is L3, and the first short exposure frame is L4.

[0051] S220. Calculate the information entropy of the first long exposure frame and the first short exposure frame to obtain the first long exposure information entropy and the first short exposure information entropy.

[0052] Specifically, the information entropy of L3 and L4 is calculated using the following formula:

[0053]

[0054]

[0055] Where, p i The probability of a pixel of gray level i appearing in the image is obtained by statistical analysis of the gray-level histogram.

[0056] S230. Subtract the first long exposure information entropy from the first short exposure information entropy to obtain the first information entropy difference.

[0057] Specifically, the difference in information entropy between two frames is calculated using the following formula to obtain the first information entropy difference:

[0058] H i =H l4 -H l3 .

[0059] S240. If the first information entropy difference is greater than or equal to a preset first threshold, then calculate the connectivity coefficient of the overexposed region of the first long exposure frame to obtain the exposure connectivity coefficient; wherein, the overexposed region is determined based on the number of pixels in the first long exposure frame.

[0060] The preset first threshold can be set according to the camera status switching requirements.

[0061] Specifically, if the difference in the first information entropy is greater than or equal to a preset first threshold, it indicates that a significant amount of information has been lost during the long exposure. In this case, enabling the wide dynamic range mode can acquire more image information, resulting in greater benefits. However, in actual use, the following situations may interfere with the judgment: the presence of one or more point light sources in the image may cause the brightness distribution of both long and short exposures to exhibit the same trend as the wide dynamic range scene. In this case, enabling the wide dynamic range mode will not actually yield significant benefits. Therefore, under the premise of satisfying the first threshold, the connectivity of the overexposed region in the first long exposure frame is further calculated.

[0062] In this technical solution, optionally, the connectivity coefficient of the overexposed region of the first long exposure frame is calculated to obtain the exposure connectivity coefficient, including:

[0063] The pixel brightness values ​​of the first long exposure frame are filtered according to a preset pixel threshold to determine the first pixel;

[0064] Calculate the average pixel brightness in the overexposed area corresponding to the first pixel to obtain the average pixel brightness.

[0065] The second pixel is determined by filtering the pixel brightness values ​​of the average value of the first pixel based on a preset pixel threshold.

[0066] Calculate the average pixel brightness in the overexposed area corresponding to the second pixel to obtain the average second pixel;

[0067] Using the preset pixel threshold, the first pixel, the average value of the first pixel, the second pixel, and the average value of the second pixel, the connectivity coefficient of the overexposed region is calculated to obtain the exposure connectivity coefficient.

[0068] Specifically, i1 is set as the pixel threshold, and all pixels in the long exposure frame L3 with brightness i > i1 are denoted as the first pixel x. i Calculate each x i The first pixel mean j of the adjacent first overexposed area x , will x i Replace the value with j x Then find all brightness levels j. x The second pixel of i1 x j Calculate each x j The second pixel mean k of the adjacent second overexposed area x , will x j Replace the value with k x And according to the preset formula, based on i1, x i j x x j and k xCalculate the connectivity coefficient of the overexposed region to obtain the exposure connectivity coefficient. The first overexposed region can be an a*a region. Assuming the number of pixels in the image's width and height directions are w and h respectively, then set... n is a constant. For example, n can be 10. 7 ,Right now The second overexposed region can be a (a+l)*(a+l) region, where l is a constant, for example, l could be 5. For example, Figure 3 This is a schematic diagram of the overexposed area provided in Embodiment 2 of this application, as shown below. Figure 3 As shown, the first overexposed area is x. i The nearest a*a region. Calculate each x i The first pixel mean j of the adjacent first overexposed area x That is, calculate the first pixel x i The average value of each pixel within the adjacent a*a region.

[0069] By calculating the distribution near the first and second pixels, the connectivity of the overexposed area can be estimated, thus eliminating interference from point light sources and improving the accuracy of camera state switching.

[0070] In this technical solution, optionally, the exposure connectivity coefficient is calculated using the following formula;

[0071]

[0072] Among them, H j Let n be the exposure connectivity coefficient. i n is the number of the first pixels. j j is the number of the second pixel. x k is the mean value of the first pixel. x Let i be the mean of the second pixel. x is the pixel threshold, and M is a constant.

[0073] In this scheme, H j The larger the value, the greater the change in pixels during the two averaging processes, and the worse the connectivity of overexposed pixels.

[0074] By calculating the distribution near the first and second pixels, the connectivity of the overexposed area can be estimated, thus eliminating interference from point light sources and improving the accuracy of camera state switching.

[0075] S250. If the exposure connectivity coefficient is less than a preset second threshold, the camera state is switched from linear mode to wide dynamic range mode.

[0076] The preset second threshold can be set according to the camera status switching requirements.

[0077] In this scheme, if the exposure connectivity coefficient is less than the preset second threshold, it indicates that the overexposed area has strong connectivity. At this time, the camera state is controlled to switch from linear mode to wide dynamic range mode.

[0078] The technical solution of this invention involves acquiring a first long exposure frame and a first short exposure frame; then calculating the information entropy of the first long exposure frame and the first short exposure frame to obtain a first information entropy difference; judging the first information entropy difference; if the first information entropy difference meets a preset threshold condition, calculating the connectivity coefficient of the overexposed region of the first long exposure frame to obtain the exposure connectivity coefficient; and judging the exposure connectivity coefficient, thereby switching the camera state from linear mode to wide dynamic range mode. By implementing this technical solution, it is possible to determine in real time whether to switch the camera state based on the difference in information entropy between the long exposure frame and the short exposure frame, ensuring a stable video stream without affecting normal exposure and avoiding repeated switching.

[0079] Example 3

[0080] Figure 4 This is a flowchart of another camera state switching process provided in Embodiment 3 of the present invention. The relationship between this embodiment and the above embodiments is a detailed description of the camera state switching process. Figure 4 As shown, the method includes:

[0081] S410. If the current state of the camera is wide dynamic range mode, then acquire the second long exposure frame and the second short exposure frame.

[0082] In this solution, the current status of the camera can be determined by viewing the camera status records.

[0083] Specifically, in wide dynamic range mode, the camera itself outputs two frames: a long exposure and a short exposure. Therefore, we take two short exposure frames W1 and W2, and one long exposure frame W3. We then perform noise reduction processing on W1 and W2 to generate the final short frame W4. This yields the second long exposure frame W3 and the second short exposure frame W4.

[0084] S420. Calculate the information entropy of the second long exposure frame and the second short exposure frame to obtain the second long exposure information entropy and the second short exposure information entropy.

[0085] Specifically, the information entropy of W3 and W4 is calculated using the following formula:

[0086]

[0087]

[0088] S430. Subtract the second long exposure information entropy from the second short exposure information entropy to obtain the second information entropy difference.

[0089] Specifically, the second information entropy difference H is calculated according to the following formula. j ;

[0090] H j =H w4 -H w3 .

[0091] S440. If the difference in the second information entropy is less than a preset third threshold, then the camera state is switched from wide dynamic range mode to linear mode; wherein the third threshold is less than the first threshold.

[0092] In this scheme, if the difference in the second information entropy is less than the preset third threshold, it means that the wide dynamic range mode has no obvious benefits, and the camera state can be controlled to switch from wide dynamic range mode to linear mode.

[0093] In this embodiment, setting the third threshold to be lower than the first threshold can prevent the camera state from switching repeatedly. If the third threshold is the same as the first threshold, there is a risk that the camera will switch repeatedly near neighboring points; therefore, a certain gap is set between the two thresholds.

[0094] The technical solution of this invention involves acquiring a second long-exposure frame and a second short-exposure frame; then calculating the information entropy of the second long-exposure frame and the second short-exposure frame to obtain a second information entropy difference; and judging the second information entropy difference. If the second information entropy difference meets a preset threshold condition, the camera state is switched from the current state to the target state. By implementing this technical solution, it is possible to determine in real time whether to switch the camera state based on the difference in information entropy between the long-exposure frame and the short-exposure frame, ensuring a smooth video stream without affecting normal exposure and avoiding repeated switching.

[0095] For example, Figure 5 This is a flowchart of another camera state switching method provided in the embodiments of this application, such as... Figure 5 As shown, determine whether the camera's current state is in wide dynamic range mode; if not, output the first long exposure frame and two short exposure frames; perform noise reduction processing on the two short exposure frames to obtain the first short exposure frame; calculate the first information entropy difference H between the first long exposure frame and the first short exposure frame. i If the first information entropy difference H i Greater than or equal to the preset first threshold H TH1 Calculate the exposure connectivity H of the overexposed region in the first long exposure frame. j If the exposure connectivity coefficient H j Less than the preset second threshold H TH2If so, switch to wide dynamic range mode. If yes, then acquire the second long exposure frame and two short exposure frames; short exposure frames often carry a lot of random noise due to insufficient exposure time. To eliminate the interference of noise on the information entropy calculation, denoising processing is performed on the two short exposure frames to obtain the second short exposure frame; calculate the second information entropy difference H between the second long exposure frame and the second short exposure frame. W If the second information entropy difference H W Less than the preset third threshold H TH3 If so, switch to linear mode.

[0096] Example 4

[0097] Figure 6 This is a schematic diagram of a camera state switching device provided in Embodiment 4 of the present invention. Figure 6 As shown, the device includes:

[0098] The exposure frame acquisition module 610 is used to acquire long exposure frames and short exposure frames of the camera in the current state; wherein, the camera state includes wide dynamic range mode and linear mode;

[0099] The information entropy difference module 620 is used to calculate the information entropy of the long exposure frame and the short exposure frame to obtain the information entropy difference.

[0100] The camera state switching module 630 is used to switch the camera state from the current state to the target state if the information entropy difference meets a preset threshold condition.

[0101] In this technical solution, optionally, the exposure frame acquisition module 610 is specifically used for:

[0102] If the current state of the camera is linear mode, then the first long exposure frame and the first short exposure frame are acquired;

[0103] If the current state of the camera is wide dynamic range mode, then acquire the second long exposure frame and the second short exposure frame.

[0104] In this technical solution, the optional information entropy difference acquisition module 620 includes:

[0105] The first information entropy obtaining unit is used to calculate the information entropy of the first long exposure frame and the first short exposure frame to obtain the first long exposure information entropy and the first short exposure information entropy.

[0106] The first information entropy difference unit is used to subtract the first long exposure information entropy from the first short exposure information entropy to obtain the first information entropy difference.

[0107] In this technical solution, optionally, the camera state switching module 630 includes:

[0108] An exposure connectivity coefficient obtaining unit is used to calculate the connectivity coefficient of the overexposed region of the first long exposure frame if the first information entropy difference is greater than or equal to a preset first threshold, thereby obtaining the exposure connectivity coefficient; wherein the overexposed region is determined based on the number of pixels in the first long exposure frame;

[0109] The camera state first switching unit is used to switch the camera state from linear mode to wide dynamic range mode if the exposure connectivity coefficient is less than a preset second threshold.

[0110] In this technical solution, optionally, the unit for obtaining the exposure connectivity coefficient includes:

[0111] The first pixel determination subunit is used to filter the pixel brightness values ​​of the first long exposure frame according to a preset pixel threshold to determine the first pixel;

[0112] The first pixel mean value is used to obtain a sub-unit, which is used to calculate the pixel brightness mean value in the overexposed area corresponding to the first pixel, and obtain the first pixel mean value.

[0113] The second pixel determination subunit is used to filter the pixel brightness value of the average value of the first pixel according to a preset pixel threshold to determine the second pixel;

[0114] The second pixel mean value is used to obtain a sub-unit, which is used to calculate the pixel brightness mean value in the overexposed area corresponding to the second pixel, and obtain the second pixel mean value.

[0115] The exposure connectivity coefficient sub-unit is used to calculate the connectivity coefficient of the overexposed region using the preset pixel threshold, the first pixel, the average value of the first pixel, the second pixel, and the average value of the second pixel, to obtain the exposure connectivity coefficient.

[0116] In this technical solution, optionally, the exposure connectivity coefficient is used to obtain sub-units, specifically for:

[0117] The exposure connectivity coefficient is calculated using the following formula;

[0118]

[0119] Among them, H j Let n be the exposure connectivity coefficient. i n is the number of the first pixels. j j is the number of the second pixel. x k is the mean value of the first pixel. x Let i be the mean of the second pixel. x is the pixel threshold, and M is a constant.

[0120] In this technical solution, the optional information entropy difference acquisition module 620 also includes:

[0121] The second information entropy obtaining unit is used to calculate the information entropy of the second long exposure frame and the second short exposure frame to obtain the second long exposure information entropy and the second short exposure information entropy.

[0122] The second information entropy difference unit is used to subtract the second long exposure information entropy from the second short exposure information entropy to obtain the second information entropy difference.

[0123] Correspondingly, the camera state switching module 630 also includes:

[0124] The second camera state switching unit is used to switch the camera state from wide dynamic range mode to linear mode if the second information entropy difference is less than a preset third threshold; wherein the third threshold is less than the first threshold.

[0125] The camera state switching device provided in this embodiment of the invention can execute a camera state switching method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0126] Example 5

[0127] Figure 7 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0128] like Figure 7As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0129] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0130] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a camera state switching method.

[0131] In some embodiments, a camera state switching method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the camera state switching method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a camera state switching method by any other suitable means (e.g., by means of firmware).

[0132] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0133] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0134] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0135] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0136] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0137] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0138] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0139] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for switching camera states, characterized in that, include: Acquire long exposure frames and short exposure frames of the camera in its current state; wherein, the camera state includes wide dynamic range mode and linear mode; The information entropy of the long exposure frame and the short exposure frame is calculated to obtain the information entropy difference; If the information entropy difference meets the preset threshold condition, then the camera state is switched from the current state to the target state; If the information entropy difference meets a preset threshold condition, then switching the camera state from the current state to the target state includes: If the first information entropy difference is greater than or equal to a preset first threshold, the connectivity coefficient of the overexposed region of the first long exposure frame is calculated to obtain the exposure connectivity coefficient; wherein, the overexposed region is determined based on the number of pixels in the first long exposure frame, and the first information entropy difference is the difference between the first long exposure information entropy and the first short exposure information entropy obtained after calculating the information entropy of the first long exposure frame and the first short exposure frame, and the first long exposure frame and the first short exposure frame are acquired when the current state of the camera is linear mode; If the exposure connectivity coefficient is less than a preset second threshold, the camera state is switched from linear mode to wide dynamic range mode.

2. The method according to claim 1, characterized in that, Acquire long exposure frames and short exposure frames of the camera in its current state, including: If the current state of the camera is linear mode, then the first long exposure frame and the first short exposure frame are acquired; If the current state of the camera is wide dynamic range mode, then acquire the second long exposure frame and the second short exposure frame.

3. The method according to claim 2, characterized in that, The information entropy of the long exposure frame and the short exposure frame is calculated to obtain the information entropy difference, including: The information entropy of the first long exposure frame and the first short exposure frame is calculated to obtain the first long exposure information entropy and the first short exposure information entropy. Subtract the first long exposure information entropy from the first short exposure information entropy to obtain the first information entropy difference.

4. The method according to claim 1, characterized in that, Calculate the connectivity coefficient of the overexposed region in the first long exposure frame to obtain the exposure connectivity coefficient, including: The pixel brightness values ​​of the first long exposure frame are filtered according to a preset pixel threshold to determine the first pixel; Calculate the average pixel brightness in the overexposed area corresponding to the first pixel to obtain the average pixel brightness. The second pixel is determined by filtering the pixel brightness values ​​of the average value of the first pixel based on a preset pixel threshold. Calculate the average pixel brightness in the overexposed area corresponding to the second pixel to obtain the average second pixel; Using the preset pixel threshold, the first pixel, the average value of the first pixel, the second pixel, and the average value of the second pixel, the connectivity coefficient of the overexposed region is calculated to obtain the exposure connectivity coefficient.

5. The method according to claim 4, characterized in that, include: The exposure connectivity coefficient is calculated using the following formula; ; in, For the exposure connectivity coefficient, The number of the first pixel. The number of the second pixel. The average value of the first pixel. The average value of the second pixel. For pixel threshold, It is a constant.

6. The method according to claim 2, characterized in that, The calculation of the information entropy of the long exposure frame and the short exposure frame to obtain the information entropy difference also includes: The information entropy of the second long exposure frame and the second short exposure frame is calculated to obtain the second long exposure information entropy and the second short exposure information entropy; Subtract the second long exposure information entropy from the second short exposure information entropy to obtain the second information entropy difference; Accordingly, if the information entropy difference meets a preset threshold condition, the camera state is switched from the current state to the target state, including: If the difference in the second information entropy is less than a preset third threshold, the camera state is switched from wide dynamic range mode to linear mode; wherein the third threshold is less than the first threshold.

7. A camera state switching device, characterized in that, include: The exposure frame acquisition module is used to acquire long exposure frames and short exposure frames of the camera in the current state; wherein, the camera state includes wide dynamic range mode and linear mode; The information entropy difference module is used to calculate the information entropy of the long exposure frame and the short exposure frame to obtain the information entropy difference. A camera state switching module is used to switch the camera state from the current state to the target state if the information entropy difference meets a preset threshold condition. The camera state switching module includes: An exposure connectivity coefficient obtaining unit is used to calculate the connectivity coefficient of the overexposed region of the first long exposure frame if the first information entropy difference is greater than or equal to a preset first threshold, thereby obtaining the exposure connectivity coefficient; wherein, the overexposed region is determined based on the number of pixels in the first long exposure frame, and the first information entropy difference is the difference between the first long exposure information entropy and the first short exposure information entropy obtained after calculating the information entropy of the first long exposure frame and the first short exposure frame, and the first long exposure frame and the first short exposure frame are acquired when the current state of the camera is linear mode; The camera state first switching unit is used to switch the camera state from linear mode to wide dynamic range mode if the exposure connectivity coefficient is less than a preset second threshold.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a camera state switching method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a camera state switching method according to any one of claims 1-6.

Citation Information

Patent Citations

  • HDR scene detection method and device, terminal and readable storage medium

    CN113747062A

  • Exposure control system and associated exposure control method

    US9554059B1