A method for switching day and night modes of a camera

By analyzing the brightness and chromaticity information of the camera image, and combining the image block ratio and counter judgment, the camera's precise day and night mode switching was realized. This solved the problems of high hardware cost and poor adaptability in the existing technology, reduced economic costs, and improved the stability of switching.

CN115604577BActive Publication Date: 2026-07-03HANGZHOU NATCHIP SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211303967.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-24
Publication Date
2026-07-03
Estimated Expiration
2042-10-24

AI Technical Summary

Technical Problem

Existing methods for switching day and night modes in cameras suffer from high hardware costs and poor adaptability. In particular, when infrared lights are turned on at night, image brightness judgment is prone to errors, causing the mode to fluctuate repeatedly.

Method used

By acquiring the image brightness and exposure information from the camera and combining it with chromaticity information for secondary analysis, the light source type is determined using the ratio of red, green and blue channels and the average brightness of the image block. A counter is set to ensure that the light is stable before switching modes, thus avoiding the need for additional hardware.

Benefits of technology

It achieves precise day/night mode switching, reduces hardware costs, improves the adaptability of mode switching, and avoids repeated mode oscillations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115604577B_ABST
    Figure CN115604577B_ABST
Patent Text Reader

Abstract

This invention discloses a method for switching day and night modes in a camera. The method first acquires the camera's image brightness and exposure information, analyzes the brightness information to determine if brightness conditions are met, then performs a secondary analysis of the chromaticity information to determine if chromaticity conditions are met, and finally analyzes whether the current switching conditions are stable, thereby switching the camera's day and night modes. This invention fully considers the difference in ambient light between day and night modes, which can lead to difficulties in determining the current light source, ensuring that the camera can accurately identify whether the current scene is illuminated by visible light or infrared light when the light changes. By combining this with further calculation and analysis of effective white balance information, it can achieve better adaptation to different scenes. This invention avoids increased hardware costs and solves the problem of poor adaptability and repeated switching between day and night modes caused by threshold judgment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, specifically relating to a method for switching day and night modes in a camera. Background Technology

[0002] The security industry requires cameras to provide 24-hour monitoring. During the day, when lighting conditions are good, cameras only capture visible light, allowing for image formation and ensuring color accuracy. At night, however, light is very weak, with very little visible light available. Therefore, infrared lights are needed for supplemental illumination. By switching to an IRCut (dual filter switcher), the camera can capture infrared light, improving image brightness and achieving effective nighttime monitoring.

[0003] Currently, there are two methods for switching between day and night modes in the industry:

[0004] Hardware switching solution: A photosensor is used to collect external light, and the ambient light value collected by the photosensor is converted into a digital value by an A / D converter, which is then transmitted to the camera to control the switching of IRCut. This method adds external hardware circuitry, resulting in higher costs and susceptibility to structural influences. The installation angle has a significant impact on the photosensor, greatly increasing costs and subsequent maintenance.

[0005] Software switching scheme: Two thresholds are set for switching from day mode to night mode and from night mode to day mode, respectively. Switching is determined by comparing the image gain with the two thresholds. However, this method has poor adaptability in practical use. When the infrared lights are on at night, the camera captures infrared light, making the image very bright, and the thresholds are easily misjudged, causing repeated switching between day and night modes. Summary of the Invention

[0006] The purpose of this invention is to address the shortcomings of existing technologies by providing a method for switching between day and night modes for cameras, thereby solving the problem of insufficient accuracy of cameras when switching between day and night modes, while eliminating the need for additional hardware peripherals and greatly reducing economic costs.

[0007] This invention first acquires the image brightness and exposure information from the camera, analyzes the brightness information to determine if the brightness conditions are met, then performs a secondary analysis of the chromaticity information to determine if the chromaticity conditions are met, and finally analyzes whether the current switching conditions are in a stable state to switch the camera's day / night mode. The technical solution is as follows:

[0008] Step (1) Obtain camera exposure information, including exposure time Exp and system gain Gain;

[0009] Step (2) Divide a frame of image captured by the camera into M×N image blocks, and calculate the red-green channel ratio R / G[m,n], blue-green channel ratio B / G[m,n], and average image brightness Y[m,n] for each image block, where m=0,1,…,M and n=0,1,…,N.

[0010] Calculate the effective brightness block flag for each image block. Among them, T bright T is the set brightness threshold for the highlighted area. bright ∈[1,…,255], T is set bright The smaller the value, the more highlight areas of the image are removed; T dark T is the set brightness threshold for dark areas. dark ∈[0,1,...,254], T is set dark The larger the value, the more image patches in the dark areas are removed; T bright >T dark .

[0011] Calculate the average brightness of the effective brightness blocks for each image patch.

[0012] Step (3) Calculate the ambient illuminance value in night mode. If EV≤T n2d If the current night mode remains unchanged, the condition is met that the counter's count value C = 0; if EV > T n2d If so, then perform a colorimetric determination and execute step (4); where T n2d T is the threshold for switching from night mode to day mode. n2d =0.001~1, T n2d The smaller the value, the higher the brightness sensitivity when switching from night mode to day mode.

[0013] Calculate ambient illuminance values ​​in day mode. If EV < T d2n If the condition is met, then perform a conditional count and execute step (5); if EV≥T d2n If the current daily pattern remains unchanged, the condition is met that the counter's count value C = 0; where T d2n T is the threshold for switching from day mode to night mode. d2n =0.001~1, T d2n The larger the value, the higher the brightness sensitivity when switching between day and night modes.

[0014] Step (4) Chromaticity determination: First, obtain the visible light weight coordinates W. dnp[m,n]; If F[m,n]=0, then the image patch does not participate in the chromaticity determination; If F[m,n]=1, substitute R / G[m,n] and B / G[m,n] into W. dnp [m,n], to obtain the average weight of visible light.

[0015] Obtain visible light weight coordinates W dnp The [m,n] method uses mature existing technologies, such as the white balance algorithm used in invention patent CN202010284945.6 to calculate weight information.

[0016] If V≥T color If V < T, then the night mode remains unchanged; color If the condition is met, then perform a condition-matching count and execute step (5); where T color T is the chroma threshold set for switching from night mode to day mode. color =0~1, T color The larger the value, the lower the color sensitivity, and the more stringent the color conditions for judgment.

[0017] Step (5) condition fulfillment count:

[0018] The counter increments by 1 when the condition is met;

[0019] If C > T count If the ambient light is stable, the camera will switch to night mode if the camera is in day mode, and simultaneously switch the dual filter switcher IRCut and execute C=0; if the camera is in night mode, the camera will switch to day mode, and simultaneously switch the dual filter switcher IRCut and execute C=0.

[0020] If C≤T count If the ambient light suddenly changes, the requirements for mode switching are not met, and no mode switching is performed; C=0 is executed. Where T... count T is the set mode switching count threshold. count =60~600,T count The larger the value, the longer it takes for the mode switch to stabilize.

[0021] This invention fully considers the differences in ambient light between day and night modes, which can lead to an inability to determine the current light source. It ensures that the camera can accurately identify whether the current scene is illuminated by visible or infrared light when the light changes. By combining this with effective white balance information for further calculation and analysis, it can achieve better adaptability to different scenes. This invention avoids increasing hardware costs and solves the problem of poor adaptability and repeated switching between day and night modes caused by threshold judgment. Attached Figure Description

[0022] Figure 1 This is a flowchart illustrating the method of the present invention;

[0023] Figure 2 This is a block partitioning diagram according to an embodiment of the present invention;

[0024] Figure 3 This is a schematic diagram of visible light weighted coordinates according to an embodiment of the present invention. Detailed Implementation

[0025] Embodiments of the present invention are described in detail below, wherein the same or similar reference numerals denote the same or similar elements or elements with similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as limiting the present invention.

[0026] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0027] like Figure 1 As shown, a method for switching between day and night modes for a camera is as follows:

[0028] Step (1) Obtain camera exposure information, including exposure time Exp and system gain Gain.

[0029] Step (2) divides a frame of image captured by the camera into M×N image blocks, such as Figure 2 As shown, M=17, N=15.

[0030] Calculate the red-green channel ratio R / G[m,n], blue-green channel ratio B / G[m,n], and average image brightness Y[m,n] for each image block, where m = 0, 1, ..., M and n = 0, 1, ..., N.

[0031] Calculate the effective brightness block flag for each image block. Among them, T bright T is the set brightness threshold for the highlighted area. bright ∈[1,...,255], T is set bright The smaller the value, the more highlight areas of the image are removed; T dark T is the set brightness threshold for dark areas. dark ∈[0,1,...,254], T is set dark The larger the value, the more image patches in the dark areas are removed; T bright >T dark In this embodiment, T is used. bright =235, T dark =16.

[0032] Calculate the average brightness of the effective brightness blocks for each image patch.

[0033] Step (3) Calculate the ambient illuminance value in night mode. If EV≤T n2d If the current night mode remains unchanged, the condition is met that the counter's count value C = 0; if EV > T n2d If so, then perform a colorimetric determination and execute step (4); where T n2d T is the threshold for switching from night mode to day mode. n2d =0.001~1, T n2d The smaller the value, the higher the brightness sensitivity when switching from night mode to day mode. This embodiment uses T... n2d =0.05.

[0034] Calculate ambient illuminance values ​​in day mode. If EV < T d2n If the condition is met, then perform a conditional count and execute step (5); if EV≥T d2n If the current daily pattern remains unchanged, the condition is met that the counter's count value C = 0; where T d2n T is the threshold for switching from day mode to night mode. d2n =0.001~1, T d2n The larger the value, the higher the brightness sensitivity when switching from day mode to night mode. This embodiment uses T... d2n =0.1.

[0035] Step (4) Chromaticity determination: First, obtain the visible light weight coordinates W. dnp [m,n]; If F[m,n]=0, then the image patch does not participate in the chromaticity determination; If F[m,n]=1, substitute R / G[m,n] and B / G[m,n] into W. dnp [m,n], such as Figure 3 As shown, the average weight of visible light is obtained.

[0036] If V≥T color If V < T, then the night mode remains unchanged; color If the condition is met, then perform a condition-matching count and execute step (5); where T color T is the chroma threshold set for switching from night mode to day mode. color =0~1, T color The larger the value, the lower the color sensitivity, and the more stringent the color sensitivity criteria. This embodiment uses T. color =0.65.

[0037] Step (5) condition fulfillment count:

[0038] The counter increments by 1 when the condition is met;

[0039] If C > T count If the ambient light is stable, the camera will switch to night mode if the camera is in day mode, and simultaneously switch the dual filter switcher IRCut and execute C=0; if the camera is in night mode, the camera will switch to day mode, and simultaneously switch the dual filter switcher IRCut and execute C=0.

[0040] If C≤T count If the ambient light suddenly changes, the requirements for mode switching are not met, and no mode switching is performed; C=0 is executed. Where T... count T is the set mode switching count threshold. count =60~600,T count The larger the value, the longer the stabilization time required for mode switching. This embodiment uses T. count =125.

[0041] The above description is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make several improvements and modifications without departing from the concept of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for switching day and night modes in a camera, characterized in that: Step (1) Obtain camera exposure information, including exposure time. System gain ; Step (2) divides a frame of image captured by the camera into... For each image patch, calculate the red-green channel ratio. Blue-green channel ratio Image brightness average , , ; Calculate the effective brightness block flag for each image block. ;in, The set brightness threshold for the highlighted area. The set brightness threshold for dark areas. ; For valid brightness block markers For an effective brightness block of 1, calculate the average image brightness of the effective brightness block. average ; Step (3) Calculate the ambient illuminance value in night mode. ;if If the current night mode remains unchanged, the condition is met and the counter value is reached. ;if If so, then perform a colorimetric determination and execute step (4); where, The threshold for switching from night mode to day mode; Calculate ambient illuminance values ​​in day mode. ;if If the condition is met, then perform a condition-matching count and proceed to step (5); if If the current daily pattern remains unchanged, the counter's count value will be met. ;in, The threshold for switching from day mode to night mode; Step (4) Chromaticity determination: First, obtain the visible light weight coordinates. ;if If so, the image block will not participate in the colorimetric determination; if ,Will and Substitute The average weight of visible light is obtained. ; if If the night mode remains unchanged, then the night mode will remain unchanged; if If the condition is met, then perform a condition-matching count and execute step (5); where, Set the chroma threshold for switching from night mode to day mode; Step (5) condition fulfillment count: The counter increments by 1 when the condition is met; if If the ambient light is stable, and the camera is currently in day mode, it will switch to night mode, simultaneously switching the dual filter switcher IRCut and executing... If the camera is currently in night mode, switch the camera to day mode, simultaneously switch the dual filter switcher IRCut, and execute... ; if If the ambient light suddenly changes, it is considered that the requirements for mode switching are not met, and mode switching will not be performed; among them, The set threshold for mode switching count.

2. The method for switching day and night modes of a camera as described in claim 1, characterized in that: The brightness threshold of the high-brightness area , set The smaller the value, the more image blocks of highlighted areas are removed.

3. The method for switching day and night modes of a camera as described in claim 1, characterized in that: The set brightness threshold for dark areas , set The larger the value, the more image blocks of dark areas are removed.

4. The method for switching day and night modes of a camera as described in claim 1, characterized in that: The threshold for switching from night mode to day mode , The smaller the value, the higher the brightness sensitivity when switching from night mode to day mode.

5. The method for switching day and night modes of a camera as described in claim 1, characterized in that: The threshold for switching from day mode to night mode , The larger the value, the higher the brightness sensitivity when switching between day and night modes.

6. The method for switching day and night modes of a camera as described in claim 1, characterized in that: The chromaticity threshold for switching from night mode to day mode .

7. The method for switching day and night modes of a camera as described in claim 1, characterized in that: The mode switching count threshold , The larger the value, the longer it takes for the mode switch to stabilize.

Citation Information

Patent Citations

  • White balance correction method based on metamerism

    CN111314684A

  • Method and equipment for determining working mode of camera equipment

    CN103716527A

  • Switching method and device for day and night ICR

    CN106231179A