Camera scene mode switching method, device and equipment
By acquiring and analyzing the brightness and gain values of the video image in the on-board camera device, and combining preset thresholds to judge and switch scene modes, the problem of instability in identifying errors and switching in different scenarios is solved, improving image quality and reducing costs.
Patent Information
- Application Number
- CN202411876957.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-12-19
AI Technical Summary
When on-board cameras process video images in different scenarios, a single image processing strategy is difficult to adapt, resulting in scene recognition errors or instability, increasing hardware and circuit design costs.
By obtaining the scene mode, image gain value, global average brightness and attention block average brightness of the video image, combining the preset gain and brightness threshold, the scene range and mode judgment are performed, and the scene mode switching is performed after the continuous N-frame video images meet the conditions.
It effectively solves the problem of scene identification errors or back-and-forth switching in operation of vehicle-mounted camera equipment, improves the quality of the camera image, reduces hardware and circuit design costs, and avoids the flickering of image effects through buffering scene transitions.
Smart Images

Figure CN119342340B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a camera scene mode switching method, device and equipment. Background Art
[0002] When the image processing module of the vehicle-mounted camera equipment processes the video images collected by the front end, a single image processing strategy is often difficult to adapt to various complex scenes. Therefore, for video images of different scenes, different image processing strategies need to be adopted to achieve the best effect of image information such as brightness, clarity, and color.
[0003] The judgment and switching timing of scenes also affect the display of the optimal effect of the camera equipment. Therefore, how to accurately distinguish and judge scenes and switch them is an urgent problem to be solved.
[0004] Existing solutions:
[0005] 1) Judgment scheme based on image brightness or gain: compare the brightness switching thresholds of scene 1 (day mode) and scene 2 (night mode); 2) Judgment scheme based on photoresistor: sense the ambient brightness through photoresistor and make judgment based on image brightness;
[0006] However, the existing solutions have the following problems:
[0007] The problem with solution 1) is that on city roads at night, the surrounding environment and street lights are relatively bright, which can easily lead to scene misjudgment. The problem with solution 2) is that it increases the cost of hardware and circuit design and can also lead to scene misjudgment when driving on city roads at night.
[0008] In summary, the existing technology still has the problem of incorrect scene recognition or switching back and forth during operation of the vehicle-mounted camera equipment.
[0009] The background description provided herein is for the purpose of generally presenting the context of the present application. Unless otherwise indicated herein, the materials described in this section are not prior art to the claims of this application and are not admitted to be prior art by inclusion in this section. Summary of the invention
[0010] In view of the above technical problems in the related art, the present invention proposes a camera scene mode switching method, device and equipment.
[0011] In order to achieve the above-mentioned invention object, the present invention adopts the following technical scheme:
[0012] In a first aspect, the present invention provides a method for switching a camera scene mode, comprising the following steps:
[0013] S1, obtaining the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image; the scene mode includes day mode, night mode, and midnight mode;
[0014] S2. Preliminarily determine the current scene range by comparing the image gain value with a preset gain threshold; the preset gain threshold includes a first gain threshold, a second gain threshold, a third gain threshold and a fourth gain threshold; the scene range includes a daytime scene, a nighttime scene, a midnight scene, a first buffer scene and a second buffer scene;
[0015] S3, judging whether the scene mode switching condition is met by using the average brightness of the image focus block or the global average brightness of the image and a preset brightness threshold according to the scene range, if so, proceeding to step S4, if not, maintaining the current scene mode;
[0016] S4: If N consecutive video images after the current video image meet the scene mode switching condition, the scene mode is switched; otherwise, the current scene mode is maintained.
[0017] Specifically, step S2 specifically includes:
[0018] When the image gain value is less than or equal to the first gain threshold, it is preliminarily determined that the current scene range is a daytime scene;
[0019] When the image gain value is greater than the second gain threshold and less than or equal to the third gain threshold, it is preliminarily determined that the current scene range is a night scene;
[0020] When the image gain value is greater than the fourth gain threshold, it is preliminarily determined that the current scene range is a midnight scene;
[0021] Among them, the first gain threshold<the second gain threshold<the third gain threshold<the fourth gain threshold.
[0022] Specifically, the scene mode switching condition in step S3 specifically includes:
[0023] First scene mode switching condition: if the scene range is a daytime scene, determine whether the average brightness of the image focus block is greater than the first block brightness threshold, if so, the condition is met and proceed to step S4, if not, maintain the current scene mode;
[0024] Second scene mode switching condition: if the scene range is a night scene, determine whether the average brightness of the image focus block is less than the second block brightness threshold, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0025] The third scene mode switching condition: if the scene range is a midnight scene, determine whether the average brightness of the global screen is less than the average brightness threshold, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0026] The preset brightness threshold includes a first block brightness threshold, a second block brightness threshold and an average brightness threshold, and the first block brightness threshold>the second block brightness threshold>the average brightness threshold.
[0027] Specifically, step S4 specifically includes:
[0028] If the current scene range is a daytime scene, and N consecutive video frames after the current video image all meet the first scene mode switching condition, the scene mode is switched to the daytime mode; otherwise, the current scene mode is maintained;
[0029] If the current scene range is a night scene, and N consecutive video images after the current video image all meet the second scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained;
[0030] If the current scene range is a midnight scene, and N consecutive video images after the current video image all meet the third scene mode switching condition, the scene mode is switched to the midnight mode; otherwise, the current scene mode is maintained.
[0031] Specifically, step S2 also includes:
[0032] When the image gain value is greater than the first gain threshold and less than or equal to the second gain threshold, it is preliminarily determined that the current scene range is the first buffer scene;
[0033] When the image gain value is greater than the third gain threshold and less than or equal to the fourth gain threshold, it is preliminarily determined that the current scene range is the second buffer scene.
[0034] Specifically, the scene mode switching condition in step S3 further includes:
[0035] Fourth scene mode switching condition: if the scene range is the first cache scene, determine whether the current scene mode is the midnight mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0036] Fifth scene mode switching condition: if the scene range is the second cache scene, determine whether the current scene mode is the day mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode.
[0037] Specifically, the step S4 further includes:
[0038] If the current scene range is the first buffer scene, and N consecutive video frames after the current video image all meet the fourth scene mode switching condition, switch the scene mode to the night mode; otherwise, maintain the current scene mode;
[0039] If the current scene range is the second buffer scene, and N consecutive video images after the current video image all meet the fifth scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained.
[0040] Specifically, the selection of the image focus block in step S1 is as follows: the entire screen of the current video image is divided into m*m blocks of brightness statistical blocks, and each brightness statistical block is numbered, and the brightness statistical block that can represent the brightness characteristics of the key area and exclude interference is selected as the image focus block.
[0041] In a second aspect, the present invention provides a camera scene mode switching device, based on the camera scene mode switching method described in any one of the first aspects, comprising:
[0042] A data acquisition unit, used to obtain the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image;
[0043] A scene range judgment unit, used to preliminarily judge the current scene range according to the comparison between the image gain value and the preset gain threshold; the preset gain threshold includes a first gain threshold, a second gain threshold, a third gain threshold and a fourth gain threshold; the scene range includes a daytime scene, a nighttime scene, a midnight scene, a first buffer scene and a second buffer scene;
[0044] A scene mode switching judgment unit, used to judge whether a scene mode switching condition is met according to the scene range by using the average brightness of the image focus block or the global average brightness of the image and a preset brightness threshold, if so, proceeding to step S4, if not, maintaining the current scene mode;
[0045] The continuous stability judgment unit is used to switch the scene mode after N consecutive video images after the current video image meet the scene mode switching conditions, otherwise maintain the current scene mode.
[0046] In a third aspect, the present invention provides an electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements any of the methods described in the first aspect when executing the computer program.
[0047] A camera scene mode switching method provided by the present invention comprises the following steps: S1, obtaining the current scene mode, image gain value, global average brightness of the image and average brightness of the image focus block of the current video image; S2, preliminarily judging the current scene range according to the comparison between the image gain value and the preset gain threshold; S3, judging whether the scene mode switching condition is met according to the scene range by using the average brightness of the image focus block or the global average brightness of the image and the preset brightness threshold, and if so, entering step S4; S4, if N consecutive video images after the current video image meet the scene mode switching condition, the scene mode is switched; through the secondary judgment of the image gain combined with the brightness statistical window, the problem of scene recognition error or back and forth switching of the vehicle-mounted camera device during operation is effectively solved, the quality of the camera image is improved, and no additional hardware and circuit design are added, so the cost is effectively controlled;
[0048] In addition, the present invention aims at video images in different scenes, and in order to achieve the best effect for image information such as brightness, clarity, and color, different image processing strategies need to be adopted. However, if the actual scene changes back and forth quickly, resulting in the scene mode switching back and forth or jumping across levels, the image processing strategy adjusted with the scene mode changes too much, which will cause abnormal phenomena such as flickering in the image effect. This embodiment introduces the first buffer scene and the second buffer scene as the switching transition of the scene mode, which effectively avoids the above problems.
[0049] In addition, the present invention introduces the first buffer scene and the second buffer scene and the continuous stability judgment, which helps to maintain the stability of image quality and reduce unnecessary fluctuations in the system. By requiring N consecutive frames to meet the switching conditions, those short-term, non-continuous brightness changes can be effectively filtered out, ensuring the accuracy and stability of scene switching, avoiding erroneous switching due to accidental noise or instantaneous brightness changes, and thus bringing a smoother visual experience to users. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 is a schematic diagram of a camera scene mode switching method provided by an embodiment of the present invention;
[0052] Figure 2 is a schematic diagram of brightness statistics block window division according to an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of selecting an image focus block in a vehicle-mounted scene according to an embodiment of the present invention;
[0054] Figure 4 is a schematic diagram of scene range division provided according to an embodiment of the present invention;
[0055] Figure 5 is a schematic diagram of a camera scene mode switching device provided by an embodiment of the present invention;
[0056] Figure 6 2 is a schematic diagram of a camera scene mode switching device provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0058] In the description of the present invention, if there is a description of first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0059] In the description of the present invention, it should be understood that descriptions involving orientation, such as orientation or positional relationship indicated as up, down, etc., are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0060] In the description of the present invention, it should be noted that, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific content of the technical solution.
[0061] Example 1
[0062] refer to Figure 1 This embodiment provides a method for switching a camera scene mode, comprising the following steps:
[0063] S1, obtaining the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image;
[0064] In this embodiment, the scene modes are divided into three types, namely, day mode Day_mode, night mode Night_mode and midnight mode Midnight_mode;
[0065] Before enabling this method, the initial current scene mode may be set to any one of the scene modes or set to the day mode by default, which is not limited here.
[0066] The current video image is a video image collected in real time by a camera device;
[0067] The camera device may be a vehicle-mounted camera device or a similar shooting device, which is not limited here. Preferably, the camera device in this embodiment is a vehicle-mounted front camera device;
[0068] The image gain of the current image can be obtained mainly in two ways: one is to directly read the value in the corresponding register inside the image sensor; the other is to obtain it with the help of the information value in the register provided by the automatic exposure algorithm module built into the ISP (image signal processor). This is the existing technology and will not be repeated here.
[0069] In order to better count the global average brightness of the image and the average brightness of the image focus block, this embodiment divides the entire screen of the current image into m*m brightness statistical blocks, and numbers each brightness statistical block as a brightness statistical window.
[0070] In this embodiment, the value of m can be adjusted according to actual requirements, and the specific means of dividing and numbering the brightness statistical blocks are not limited. This is the existing technology. As long as the technical means can ensure that the brightness statistical blocks and the numbers can be one-to-one corresponding, they are protected and no specific limitation is made here.
[0071] Preferably, the value of m in this embodiment is 8.
[0072] refer to Figure 2 In this embodiment, the image is divided into 8*8=64 rectangular blocks, and these rectangular blocks are defined as brightness statistical blocks. The brightness statistical blocks are numbered from 1 in the order from left to right and from top to bottom, namely, brightness statistical block 1, brightness statistical block 2, ..., brightness statistical block 64.
[0073] Different brightness statistical blocks are selected as image focus blocks for different camera application scenarios. In particular, brightness statistical blocks that can represent the brightness characteristics of key areas and exclude interference are selected as image focus blocks, which can be used to reasonably implement the setting of scene thresholds.
[0074] For example, in the vehicle application scenario, refer to Figure 3, select brightness statistics block 3, brightness statistics block 4, brightness statistics block 5, and brightness statistics block 6 as image focus blocks. This is because in the vehicle-mounted application scenario, the brightness statistics blocks 3 to 6 captured by the vehicle-mounted camera front-end device basically correspond to the sky, rather than buildings or street lights. Setting the scene judgment brightness threshold based on the brightness of the sky can effectively reduce the impact of the surrounding environment brightness on scene judgment.
[0075] Obtain the brightness value of each brightness statistical block, then multiply the brightness values of all brightness statistical blocks by their corresponding weights and divide the sum by the sum of the weights of all brightness statistical blocks, that is, use the weighted average method to obtain the global average brightness of the image;
[0076] Similarly, the brightness value of each image focus block is obtained, and then the sum of the brightness values of all image focus blocks multiplied by their corresponding weights is divided by the sum of the weights of all image focus blocks, that is, the average brightness of the image focus blocks is obtained using the weighted average method;
[0077] Obtaining the brightness value of the brightness statistics block / image focus block is an existing technology, which can be obtained by using the information value in the register provided by the automatic exposure algorithm module built into the ISP (image signal processor), and will not be repeated here;
[0078] S2. Preliminarily determine the current scene range according to the comparison between the image gain value and the preset gain threshold; the preset gain threshold includes a first gain threshold, a second gain threshold, a third gain threshold and a fourth gain threshold; the scene range includes a daytime scene, a nighttime scene and a midnight scene; the scene range also includes a first buffer scene and a second buffer scene;
[0079] Specifically include:
[0080] When the image gain value is less than or equal to the first gain threshold, it is preliminarily determined that the current scene range is a daytime scene;
[0081] When the image gain value is greater than the second gain threshold and less than or equal to the third gain threshold, it is preliminarily determined that the current scene range is a night scene;
[0082] When the image gain value is greater than the fourth gain threshold, it is preliminarily determined that the current scene range is a midnight scene;
[0083] When the image gain value is greater than the first gain threshold and less than or equal to the second gain threshold, it is preliminarily determined that the current scene range is the first buffer scene;
[0084] When the image gain value is greater than the third gain threshold and less than or equal to the fourth gain threshold, it is preliminarily determined that the current scene range is the second buffer scene;
[0085] Wherein the first gain threshold < the second gain threshold < the third gain threshold < the fourth gain threshold;
[0086] refer to Figure 4 In this embodiment, the scene range is preset as a day scene (Day scene), a first buffer scene (buffer 1), a night scene (Night scene), a second buffer scene (buffer 2), and a midnight scene (Midnight scene) according to the preset gain thresholds: a first gain threshold gain_switch_0, a second gain threshold gain_switch_1, a third gain threshold gain_switch_2, and a fourth gain threshold gain_switch_3;
[0087] The setting condition of the Day scene S101 is that the image gain value nCurGain is less than or equal to the first gain threshold gain_switch_0;
[0088] The setting condition of buffer area 1 S102 is that the current image gain value nCurGain is greater than the first gain threshold gain_switch_0 and less than or equal to the second gain threshold gain_switch_1;
[0089] The setting condition of the Night scene S103 is that the current image gain value nCurGain is greater than the second gain threshold gain_switch_1 and less than or equal to the third gain threshold gain_switch_2;
[0090] The setting condition of the buffer 2 area S104 is that the current image gain value nCurGain is greater than the third gain threshold gain_switch_2 and less than or equal to the fourth gain threshold gain_switch_3;
[0091] The setting condition of the Midnight scene S105 is that the current image gain value nCurGain is greater than the fourth gain threshold gain_switch_3.
[0092] Among them, gain_switch_0 <gain_switch_1<gain_switch_2<gain_switch_3;
[0093] S3, judging whether the scene mode switching condition is met by using the average brightness of the image focus block or the global average brightness of the image and a preset brightness threshold according to the scene range, if so, proceeding to step S4, if not, maintaining the current scene mode;
[0094] The scene mode switching conditions specifically include:
[0095] First scene mode switching condition: if the scene range is a daytime scene, determine whether the average brightness of the image focus block nCurAreaAvg is greater than the first block brightness threshold area_avg_switch_h, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0096] Second scene mode switching condition: if the scene range is a night scene, determine whether the average brightness of the image focus block nCurAreaAvg is less than the second block brightness threshold area_avg_switch_1, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0097] The third scene mode switching condition: if the scene range is a midnight scene, determine whether the global screen brightness average nCurAvg is less than the average brightness threshold avg_switch, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0098] Fourth scene mode switching condition: if the scene range is the first cache scene, determine whether the current scene mode is the midnight mode Midnight_mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0099] Fifth scene mode switching condition: if the scene range is the second cache scene, determine whether the current scene mode is the day mode Day_mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0100] The preset brightness threshold includes a first block brightness threshold, a second block brightness threshold and an average brightness threshold, and the first block brightness threshold>the first block brightness threshold>the average brightness threshold;
[0101] S4. If N consecutive video images after the current video image all meet the scene mode switching condition, the scene mode is switched; otherwise, the current scene mode is maintained.
[0102] This step is a step for continuous stability judgment, which specifically includes:
[0103] If the current scene range is a daytime scene, and N consecutive video frames after the current video image all meet the first scene mode switching condition, the scene mode is switched to the daytime mode; otherwise, the current scene mode is maintained;
[0104] If the current scene range is a night scene, and N consecutive video images after the current video image all meet the second scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained;
[0105] If the current scene range is a midnight scene, and N consecutive video images after the current video image all meet the third scene mode switching condition, the scene mode is switched to the midnight mode; otherwise, the current scene mode is maintained;
[0106] Also includes:
[0107] If the current scene range is the first buffer scene, and N consecutive video frames after the current video image all meet the fourth scene mode switching condition, switch the scene mode to the night mode; otherwise, maintain the current scene mode;
[0108] If the current scene range is the second buffer scene, and N consecutive video frames after the current video image all meet the fifth scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained;
[0109] The continuous stability judgment in the first buffer scene ensures that when the brightness increases, it smoothly transitions from the darkest midnight mode to the darker night mode instead of jumping directly to the brightest day mode;
[0110] The continuous stability judgment in the second buffer scene ensures that when the brightness decreases, it smoothly transitions from the brightest day mode to the darker night mode, rather than jumping directly to the darkest midnight mode;
[0111] Such a design helps to maintain stable image quality and reduce unnecessary fluctuations in the system. By requiring N consecutive frames to meet the switching conditions, it can effectively filter out those short-term, non-continuous brightness changes, ensure the accuracy and stability of scene switching, and avoid false switching due to accidental noise or instantaneous brightness changes, thereby bringing users a smoother visual experience.
[0112] In this embodiment, the gain thresholds gain_switch_0, gain_switch_1, gain_switch_2, gain_switch_3, the brightness thresholds area_avg_switch_h, area_avg_switch_1, avg_switch and the values of N are all determined by testing based on actual scene applications and switching timing. N is a positive integer greater than 0.
[0113] Preferably, in this embodiment, N is 10; gain_switch_0 is 3 times AE gain; gain_switch_1 is 6 times AE gain; gain_switch_2 is 20 times AE gain; gain_switch_3 is 40 times AE gain; area_avg_switch_h is 90 grayscales; area_avg_switch_l is 50 grayscales, and avg_switch is 32 grayscales.
[0114] A camera scene mode switching method provided in the present embodiment includes the following steps: S1, obtaining the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image; S2, preliminarily judging the current scene range according to the comparison between the image gain value and the preset gain threshold; S3, judging whether the scene mode switching condition is met according to the scene range using the average brightness of the image focus block or the global average brightness of the image and the preset brightness threshold, and if so, entering step S4; S4, if N consecutive video images after the current video image meet the scene mode switching condition, the scene mode is switched; through the secondary judgment of the image gain combined with the brightness statistical window, the problem of scene recognition error or switching back and forth during operation of the vehicle-mounted camera device is effectively solved, the quality of the camera image is improved, and no additional hardware and circuit design is added, so the cost is effectively controlled;
[0115] In addition, in order to achieve the best effect for image information such as brightness, clarity, and color of video images in different scenes, this embodiment needs to adopt different image processing strategies. However, if the actual scene changes back and forth quickly, resulting in the scene mode switching back and forth or jumping across levels, the image processing strategy adjusted with the scene mode changes too much, which will cause abnormal phenomena such as flickering in the image effect. This embodiment introduces the first buffer scene and the second buffer scene as the switching transition of the scene mode, which effectively avoids the above problems.
[0116] Embodiment 2
[0117] refer to Figure 5 This embodiment provides a camera scene mode recognition and switching device, based on the camera scene mode switching method described in Embodiment 1, including:
[0118] A data acquisition unit, used to obtain the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image;
[0119] A scene range judgment unit, used to preliminarily judge the current scene range according to the comparison between the image gain value and the preset gain threshold; the preset gain threshold includes a first gain threshold, a second gain threshold, a third gain threshold and a fourth gain threshold; the scene range includes a daytime scene, a nighttime scene and a midnight scene; the scene range also includes a first buffer scene and a second buffer scene;
[0120] Specifically include:
[0121] When the image gain value is less than or equal to the first gain threshold, it is preliminarily determined that the current scene range is a daytime scene;
[0122] When the image gain value is greater than the second gain threshold and less than or equal to the third gain threshold, it is preliminarily determined that the current scene range is a night scene;
[0123] When the image gain value is greater than the fourth gain threshold, it is preliminarily determined that the current scene range is a midnight scene;
[0124] When the image gain value is greater than the first gain threshold and less than or equal to the second gain threshold, it is preliminarily determined that the current scene range is the first buffer scene;
[0125] When the image gain value is greater than the third gain threshold and less than or equal to the fourth gain threshold, it is preliminarily determined that the current scene range is the second buffer scene;
[0126] Wherein the first gain threshold < the second gain threshold < the third gain threshold < the fourth gain threshold;
[0127] A scene mode switching judgment unit, used to judge whether a scene mode switching condition is met according to the scene range by using the average brightness of the image focus block or the global average brightness of the image and a preset brightness threshold, if so, proceeding to step S4, if not, maintaining the current scene mode;
[0128] The scene mode switching conditions specifically include:
[0129] The first scene mode switching condition: if the scene range is a daytime scene, determine whether the average brightness of the image focus block nCurAreaAvg is greater than the first block brightness threshold area_avg_switch_h. If so, the condition is met and the continuous stability judgment unit is entered for judgment. If not, the current scene mode is maintained.
[0130] Second scene mode switching condition: if the scene range is a night scene, determine whether the average brightness of the image focus block nCurAreaAvg is less than the second block brightness threshold area_avg_switch_1, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0131] The third scene mode switching condition: if the scene range is a midnight scene, determine whether the global screen brightness average nCurAvg is less than the average brightness threshold avg_switch, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0132] Fourth scene mode switching condition: if the scene range is the first cache scene, determine whether the current scene mode is the midnight mode Midnight_mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0133] Fifth scene mode switching condition: if the scene range is the second cache scene, determine whether the current scene mode is the day mode Day_mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode;
[0134] The preset brightness threshold includes a first block brightness threshold, a second block brightness threshold and an average brightness threshold, and the first block brightness threshold>the first block brightness threshold>the average brightness threshold;
[0135] The continuous stability judgment unit is used to switch the scene mode after N consecutive video images after the current video image meet the scene mode switching conditions, otherwise maintain the current scene mode.
[0136] Specifically include:
[0137] If the current scene range is a daytime scene, and N consecutive video frames after the current video image all meet the first scene mode switching condition, the scene mode is switched to the daytime mode; otherwise, the current scene mode is maintained;
[0138] If the current scene range is a night scene, and N consecutive video images after the current video image all meet the second scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained;
[0139] If the current scene range is a midnight scene, and N consecutive video images after the current video image all meet the third scene mode switching condition, the scene mode is switched to the midnight mode; otherwise, the current scene mode is maintained;
[0140] Also includes:
[0141] If the current scene range is the first buffer scene, and N consecutive video frames after the current video image all meet the fourth scene mode switching condition, switch the scene mode to the night mode; otherwise, maintain the current scene mode;
[0142] If the current scene range is the second buffer scene, and N consecutive video images after the current video image all meet the fifth scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained.
[0143] Embodiment 3
[0144] Please see attached Figure 6 , Figure 61 is a schematic diagram of the structure of a camera scene mode recognition switching device according to an embodiment of the present invention. The device 20 includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above device embodiments are implemented.
[0145] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the camera scene mode recognition switching device 20. For example, the computer program may be divided into the modules in the second embodiment. For the specific functions of each module, please refer to the working process of the device described in the above embodiment, which will not be repeated here.
[0146] The camera scene mode recognition switching device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will appreciate that the schematic diagram is merely an example of a camera scene mode recognition switching device 20 and does not constitute a limitation on the camera scene mode recognition switching device 20. The camera scene mode recognition switching device 20 may include more or fewer components than shown in the figure, or may combine certain components, or different components. For example, the camera scene mode recognition switching device 20 may also include input and output devices, network access devices, buses, etc.
[0147] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the camera scene mode recognition switching device 20, and uses various interfaces and lines to connect various parts of the entire camera scene mode recognition switching device 20.
[0148] The memory 22 can be used to store the computer program and / or module. The processor 21 realizes various functions of the camera scene mode recognition switching device 20 by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0149] Wherein, if the module / unit integrated in the camera scene mode recognition switching device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor 21, the steps of the above-mentioned method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.
[0150] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present invention. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between the modules, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement the invention without creative work.
[0151] So far, the technical solution of the present invention has been described in conjunction with examples, but it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for switching camera scene modes, characterized in that: The following steps are involved: S1, obtaining the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image; the scene mode includes day mode, night mode, and midnight mode; S2. Preliminarily determine the current scene range by comparing the image gain value with a preset gain threshold; the preset gain threshold includes a first gain threshold, a second gain threshold, a third gain threshold and a fourth gain threshold; the scene range includes a daytime scene, a nighttime scene, a midnight scene, a first buffer scene and a second buffer scene; Step S2 specifically includes: When the image gain value is less than or equal to the first gain threshold, it is preliminarily determined that the current scene range is a daytime scene; When the image gain value is greater than the second gain threshold and less than or equal to the third gain threshold, it is preliminarily determined that the current scene range is a night scene; When the image gain value is greater than the fourth gain threshold, it is preliminarily determined that the current scene range is a midnight scene; When the image gain value is greater than the first gain threshold and less than or equal to the second gain threshold, it is preliminarily determined that the current scene range is the first buffer scene; When the image gain value is greater than the third gain threshold and less than or equal to the fourth gain threshold, it is preliminarily determined that the current scene range is the second buffer scene; Wherein, the first gain threshold < the second gain threshold < the third gain threshold < the fourth gain threshold; S3, judging whether the scene mode switching condition is met by using the average brightness of the image focus block or the global average brightness of the image and a preset brightness threshold according to the scene range, if so, proceeding to step S4, if not, maintaining the current scene mode; The scene mode switching conditions include: Fourth scene mode switching condition: if the scene range is the first cache scene, determine whether the current scene mode is the midnight mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode; Fifth scene mode switching condition: if the scene range is the second cache scene, determine whether the current scene mode is the day mode, if so, the condition is met and go to step S4, if not, maintain the current scene mode; S4. If N consecutive video images after the current video image meet the scene mode switching condition, the scene mode is switched, otherwise the current scene mode is maintained; The step S4 comprises: If the current scene range is the first buffer scene, and N consecutive video frames after the current video image all meet the fourth scene mode switching condition, switch the scene mode to the night mode; otherwise, maintain the current scene mode; If the current scene range is the second buffer scene, and N consecutive video images after the current video image all meet the fifth scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained.
2. The camera scene mode switching method according to claim 1, characterized in that: The scene mode switching conditions in step S3 specifically include: First scene mode switching condition: if the scene range is a daytime scene, determine whether the average brightness of the image focus block is greater than the first block brightness threshold, if so, the condition is met and proceed to step S4, if not, maintain the current scene mode; Second scene mode switching condition: if the scene range is a night scene, determine whether the average brightness of the image focus block is less than the second block brightness threshold, if so, the condition is met and go to step S4, if not, maintain the current scene mode; The third scene mode switching condition: if the scene range is a midnight scene, determine whether the average brightness of the global screen is less than the average brightness threshold, if so, the condition is met and go to step S4, if not, maintain the current scene mode; The preset brightness threshold includes a first block brightness threshold, a second block brightness threshold and an average brightness threshold, and the first block brightness threshold>the second block brightness threshold>the average brightness threshold.
3. The camera scene mode switching method according to claim 1, characterized in that: Step S4 specifically includes: If the current scene range is a daytime scene, and N consecutive video frames after the current video image all meet the first scene mode switching condition, the scene mode is switched to the daytime mode; otherwise, the current scene mode is maintained; If the current scene range is a night scene, and N consecutive video images after the current video image all meet the second scene mode switching condition, the scene mode is switched to the night mode; otherwise, the current scene mode is maintained; If the current scene range is a midnight scene, and N consecutive video images after the current video image all meet the third scene mode switching condition, the scene mode is switched to the midnight mode; otherwise, the current scene mode is maintained.
4. The camera scene mode switching method according to claim 1, characterized in that: The selection of the image focus block in step S1 is specifically as follows: the entire screen of the current video image is divided into m*m blocks of brightness statistical blocks, and each brightness statistical block is numbered, and the brightness statistical block that can represent the brightness characteristics of the key area and exclude interference is selected as the image focus block.
5. A camera scene mode switching device, based on the camera scene mode switching method according to any one of claims 1 to 4, characterized in that: include: A data acquisition unit, used to obtain the current scene mode, image gain value, global average brightness of the image, and average brightness of the image focus block of the current video image; A scene range judgment unit, used to preliminarily judge the current scene range according to the comparison between the image gain value and the preset gain threshold; the preset gain threshold includes a first gain threshold, a second gain threshold, a third gain threshold and a fourth gain threshold; the scene range includes a daytime scene, a nighttime scene, a midnight scene, a first buffer scene and a second buffer scene; A scene mode switching judgment unit, used to judge whether a scene mode switching condition is met according to the scene range by using the average brightness of the image focus block or the global average brightness of the image and a preset brightness threshold, if so, proceeding to step S4, if not, maintaining the current scene mode; The continuous stability judgment unit is used to switch the scene mode after N consecutive video images after the current video image meet the scene mode switching conditions, otherwise maintain the current scene mode.
6. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Day-night switching method and device based on forward collision warning
CN105187731A
Day and night mode switching method and device, camera device and storage medium
CN110225257A
Scene switching method and device for shooting equipment, shooting equipment and storage medium
CN115604576A