CN108289164B - Mode switching method and device of camera with infrared light supplement lamp - Google Patents

Mode switching method and device of camera with infrared light supplement lamp Download PDF

Info

Publication number
CN108289164B
CN108289164B CN201710014669.XA CN201710014669A CN108289164B CN 108289164 B CN108289164 B CN 108289164B CN 201710014669 A CN201710014669 A CN 201710014669A CN 108289164 B CN108289164 B CN 108289164B
Authority
CN
China
Prior art keywords
illumination intensity
night
current
state
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710014669.XA
Other languages
Chinese (zh)
Other versions
CN108289164A (en
Inventor
张青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201710014669.XA priority Critical patent/CN108289164B/en
Publication of CN108289164A publication Critical patent/CN108289164A/en
Application granted granted Critical
Publication of CN108289164B publication Critical patent/CN108289164B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/66Remote control of cameras or camera parts, e.g. by remote control devices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/64Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/74Circuitry for compensating brightness variation in the scene by influencing the scene brightness using illuminating means

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the invention provides a mode switching method and a mode switching device for a camera with an infrared fill-in light, wherein the method comprises the following steps: periodically acquiring the current illumination intensity of the camera and a first scene state determined in the previous period, wherein the first scene state comprises a day state or a night state; if the first scene state is a daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold; according to the scene state of the period, determining to switch to a night mode or keep a day mode; if the first scene state is a night state, calculating to obtain a current red component/green component ratio according to the image when the current illumination intensity is obtained; determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold; according to the scene state of the present period, it is determined to switch to the day mode or maintain the night mode.

Description

Mode switching method and device of camera with infrared light supplement lamp
Technical Field
The invention relates to the field of cameras, in particular to a mode switching method and device of a camera with an infrared fill-in light.
Background
The cameras which need to work under different illumination intensities in the day, at night and the like are generally provided with the infrared light supplement lamps and the infrared optical filters, and the working modes of the cameras are automatically switched by judging the scene state. One mode switching method of the existing camera is as follows: comparing the illumination intensity with a preset threshold, when the illumination intensity is greater than the threshold, determining that the scene state is a daytime state, switching the mode to a daytime mode, turning off an infrared light supplement lamp, and switching an infrared filter to an infrared light cut-off mode to prevent infrared light from entering and causing image color cast; when illumination intensity is less than or equal to the threshold value, confirm that the scene state is the night state, switch the mode into the night mode, open infrared light filling lamp, switch infrared filter into the sense infrared light mode, promote night vision effect.
Therefore, in the mode switching method in the prior art, the scene state is determined only by judging the illumination intensity, and the judgment accuracy is not high, so that the accuracy of mode switching of the camera is not high.
Disclosure of Invention
The embodiment of the invention aims to provide a mode switching method and device of a camera with an infrared fill-in light so as to improve the accuracy of mode switching of the camera. The specific technical scheme is as follows:
the embodiment of the invention provides a mode switching method of a camera with an infrared fill-in light, which comprises the following steps:
periodically acquiring the current illumination intensity of a camera and a first scene state determined in the previous period, wherein the first scene state comprises a day state or a night state;
if the first scene state is a daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value;
according to the scene state of the period, determining to switch to a night mode or keep a day mode;
if the first scene state is a night state, calculating to obtain a current red component/green component ratio according to the image when the current illumination intensity is obtained;
determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold;
and determining to switch to a day mode or keep a night mode according to the scene state of the period.
Optionally, the step of periodically acquiring the current illumination intensity of the camera includes:
taking the duration corresponding to the shooting of one frame of image as a period, and acquiring the current gain and the current exposure time of an image sensor amplifying circuit when the current frame of image is shot;
calculating the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components of the current frame image;
calculating and obtaining the average brightness of the current frame image according to the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components;
obtaining the current illumination intensity according to the average brightness of the current frame image, the current gain and the current exposure time;
the step of calculating to obtain the ratio of the current red component to the current green component comprises the following steps: and calculating to obtain the ratio of the average value of the red pixel components to the average value of the green pixel components.
Optionally, if the first scene state is a daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold, including:
judging whether a first judgment condition is met or not under the condition that the first scene state is the daytime state, and adding a first preset number to the switching points under the condition that the first judgment condition is met; reducing the number of switching points by a second preset number under the condition that the first judgment condition is not met; the first determination condition is: the current illumination intensity is smaller than a preset daytime illumination intensity threshold value;
judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining that the scene state of the period is a night state, and resetting the switching point number; if not, determining that the scene state of the period is the daytime state.
Optionally, the night illumination intensity threshold includes: the method comprises the following steps of (1) setting an upper limit threshold value of night illumination intensity, a middle limit threshold value of night illumination intensity and a preset night illumination intensity expansion threshold value; wherein the night illumination intensity upper limit threshold is larger than the night illumination intensity middle limit threshold;
the step of determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold comprises:
judging whether a second judgment condition is met, and adding a first preset number to the number of switching points under the condition that the second judgment condition is met; reducing the number of switching points by a second preset number under the condition that the second judgment condition is not met; the second determination condition is: the current illumination intensity is greater than or equal to the night illumination intensity upper limit threshold value and greater than or equal to the night illumination intensity expansion threshold value, and the current red component/green component ratio is smaller than the threshold value of the preset red component/green component ratio; or, the current illumination intensity is greater than or equal to the night illumination intensity expansion threshold and less than or equal to the night illumination intensity middle limit threshold, and the current red component/green component ratio is less than the preset red component/green component ratio threshold;
judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining that the scene state of the period is a daytime state, and resetting the switching point number; if not, determining that the scene state in the period is the night state.
Optionally, the method further includes:
when the first scene state is a daytime state, the current illumination intensity of a third preset number of periods is obtained after the period is switched to a night mode, and the average value of the current illumination intensity of the third preset number of periods is calculated;
and re-determining the night illumination intensity upper limit threshold and the night illumination intensity middle limit threshold according to the average value of the current illumination intensities of the third preset number of periods, the preset night illumination intensity upper limit threshold coefficient and the preset night illumination intensity middle limit threshold coefficient, so that the re-determined night illumination intensity upper limit threshold and the night illumination intensity middle limit threshold are used in the second determination condition of the later period.
Optionally, the re-determining the night light intensity upper limit threshold and the night light intensity middle limit threshold by the average value of the current light intensity of the third preset number of periods, the preset night light intensity upper limit threshold coefficient and the preset night light intensity middle limit threshold coefficient includes:
re-determining an upper night illumination intensity threshold and a middle night illumination intensity threshold according to formulas th _ high _ avg _ α and th _ mid _ i _ avg _ β, wherein th _ high is the upper night illumination intensity threshold, i _ avg is an average value of current illumination intensities of the third preset number of cycles, α is the preset upper night illumination intensity threshold coefficient, th _ mid is the middle night illumination intensity threshold, and β is the preset middle night illumination intensity threshold coefficient.
The embodiment of the invention provides a mode switching device of a camera with an infrared light supplement lamp, which comprises:
the system comprises an acquisition module, a display module and a control module, wherein the acquisition module is used for periodically acquiring the current illumination intensity of a camera and a first scene state determined in the previous period, and the first scene state comprises a day state or a night state;
the first scene state determining module is used for determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value if the first scene state is the daytime state;
the first mode switching module is used for determining to switch to a night mode or keep a day mode according to the scene state of the period;
the night state calculation module is used for calculating and obtaining a current red component/green component ratio according to the image when the current illumination intensity is obtained if the first scene state is the night state;
the second scene state determining module is used for determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold;
and the second mode switching module is used for determining to switch to a day mode or keep a night mode according to the scene state of the period.
Optionally, the obtaining module includes:
the gain and exposure time acquisition submodule is used for acquiring the current gain and the current exposure time of the image sensor amplifying circuit when a current frame image is shot by taking the time length corresponding to the shot frame image as a period;
the pixel component calculating submodule is used for calculating the average value of the red pixel component, the average value of the green pixel component and the average value of the blue pixel component of the current frame image;
the average brightness calculation submodule is used for calculating and obtaining the average brightness of the current frame image according to the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components;
the illumination intensity calculation sub-module is used for obtaining the current illumination intensity according to the average brightness of the current frame image, the current gain and the current exposure time;
the night state calculation module is specifically configured to: and calculating to obtain the ratio of the average value of the red pixel components to the average value of the green pixel components.
Optionally, the first scene state determining module includes:
the first judgment submodule is used for judging whether a first judgment condition is met or not under the condition that the first scene state is the daytime state, and adding a first preset number to the number of switching points under the condition that the first judgment condition is met; reducing the number of switching points by a second preset number under the condition that the first judgment condition is not met; the first determination condition is: the current illumination intensity is smaller than a preset daytime illumination intensity threshold value;
the first scene state determining submodule is used for judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining the scene state of the period as a night state, and resetting the switching point number; if not, determining that the scene state of the period is the daytime state.
Optionally, the night illumination intensity threshold includes: the method comprises the following steps of (1) setting an upper limit threshold value of night illumination intensity, a middle limit threshold value of night illumination intensity and a preset night illumination intensity expansion threshold value; wherein the night illumination intensity upper limit threshold is larger than the night illumination intensity middle limit threshold;
the second scene state determination module includes:
the second judgment sub-module is used for judging whether a second judgment condition is met or not, and adding the first preset number to the number of switching points under the condition that the second judgment condition is met; reducing the number of switching points by a second preset number under the condition that the second judgment condition is not met; the second determination condition is: the current illumination intensity is greater than or equal to the night illumination intensity upper limit threshold value and greater than or equal to the night illumination intensity expansion threshold value, and the current red component/green component ratio is smaller than the threshold value of the preset red component/green component ratio; or, the current illumination intensity is greater than or equal to the night illumination intensity expansion threshold and less than or equal to the night illumination intensity middle limit threshold, and the current red component/green component ratio is less than the preset red component/green component ratio threshold;
the second scene state determining submodule is used for judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining the scene state of the period as the daytime state, and resetting the switching point number; if not, determining that the scene state in the period is the night state.
Optionally, the first mode switching module includes:
the first mode keeping submodule is used for determining to keep the daytime mode according to the condition that the scene state of the period is the daytime state;
the first mode switching submodule is used for determining to switch to a night mode according to the condition that the scene state of the period is the night state;
the device further comprises:
the illumination intensity average value calculating module is used for acquiring the current illumination intensity of a third preset number of periods after the first scene state is the daytime state and the first mode switching sub-module switches the period to the night mode, and calculating and acquiring the average value of the current illumination intensity of the third preset number of periods;
and the night illumination intensity threshold value calculation module is used for re-determining the night illumination intensity upper limit threshold value and the night illumination intensity middle limit threshold value according to the average value of the current illumination intensities of the third preset number of periods, the preset night illumination intensity upper limit threshold value coefficient and the preset night illumination intensity middle limit threshold value coefficient, so that the re-determined night illumination intensity upper limit threshold value and the re-determined night illumination intensity middle limit threshold value are used in the second determination condition of the later period.
Optionally, the night illumination intensity threshold calculation module is specifically configured to:
re-determining an upper night illumination intensity threshold and a middle night illumination intensity threshold according to formulas th _ high _ avg _ α and th _ mid _ i _ avg _ β, wherein th _ high is the upper night illumination intensity threshold, i _ avg is an average value of current illumination intensities of the third preset number of cycles, α is the preset upper night illumination intensity threshold coefficient, th _ mid is the middle night illumination intensity threshold, and β is the preset middle night illumination intensity threshold coefficient.
The method and the device for switching the modes of the camera with the infrared light supplement lamp, provided by the embodiment of the invention, firstly periodically acquire the current illumination intensity of the camera and a first scene state determined in the previous period. If the first scene state is the daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value, and determining to switch to a night mode or keep the daytime mode according to the scene state of the period; if the first scene state is the night state, calculating to obtain a current red component/green component ratio according to an image when the current illumination intensity is obtained, determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, a night illumination intensity threshold value and a preset red component/green component ratio threshold value, and determining to switch to the day mode or keep the night mode according to the scene state of the period.
The embodiment of the invention utilizes the principle that the ratio of the red component to the green component caused by infrared reflected light is larger under the condition that the infrared fill light is turned on, adopts different scene state judging conditions at the daytime state and at the night state, not only utilizes the comparison between the current illumination intensity and the night illumination intensity threshold value, but also introduces the comparison between the ratio of the red component to the green component and the preset threshold value of the ratio of the red component to the green component at the night state, and compared with the prior art that only the comparison between the illumination intensity and the illumination intensity threshold value is used for determining the scene state, the judging conditions of the embodiment of the invention are finer, the judging result of the scene state with higher accuracy can be obtained, and the mode switching result with higher accuracy can be obtained. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a mode switching method of a camera with an infrared fill-in light according to an embodiment of the present invention;
fig. 2 is another flowchart of a mode switching method of a camera with an infrared fill-in light according to an embodiment of the present invention;
FIG. 3 is a schematic diagram showing the ratio of red component/green component as a function of time during the mode switching process according to the embodiment of the present invention;
FIG. 4 is a schematic diagram showing the variation of the illumination intensity with time during the mode switching process according to the embodiment of the present invention corresponding to FIG. 3;
fig. 5 is a structural diagram of a mode switching device of a camera with an infrared fill-in light according to an embodiment of the present invention;
fig. 6 is another structural diagram of the mode switching device of the camera with the infrared fill-in light according to the embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a mode switching method and device of a camera with an infrared light supplement lamp, which can improve the accuracy of mode switching of the camera. First, a mode switching method of a camera with an infrared fill-in light provided by an embodiment of the present invention is described below.
The camera working under different illumination intensities such as day and night is generally provided with an infrared light supplement lamp and an infrared filter, the scene state is automatically judged by comparing the illumination intensity with a preset threshold value, and the mode of the camera is switched according to the judgment result of the scene state. However, the mode switching method in the prior art only uses the illumination intensity to perform judgment to determine the scene state, and the judgment accuracy is not high, so that the accuracy of mode switching of the camera is not high.
The embodiment of the invention adopts different judgment conditions for the day state and the night state, compares the current illumination intensity with a plurality of night illumination intensity threshold values when the last period is the night state, simultaneously compares the current red component/green component ratio with a preset red component/green component ratio threshold value, and determines the scene state according to the comparison result. The embodiment of the invention adopts the different judgment conditions from the prior art, the judgment conditions are more precise, and the scene state judgment result with higher accuracy can be obtained, so that the mode switching result with higher accuracy can be obtained.
Referring to fig. 1, fig. 1 is a flowchart of a mode switching method of a camera with an infrared fill-in light according to an embodiment of the present invention. The method comprises the following steps:
step 101, periodically acquiring the current illumination intensity of the camera and the first scene state determined in the previous period.
The illumination intensity is the energy of visible light received per unit area of the camera. In the embodiment of the invention, the intensity of the ambient light of the camera is measured according to the illumination intensity.
The period of the embodiment of the present invention is a time length set according to an industrial demand or a camera characteristic, and the period is measured in seconds or milliseconds. For example, the time duration corresponding to capturing one frame of image may be taken as a period, where the time duration corresponding to capturing one frame of image is related to the characteristics of the image sensor of the camera, and the time duration corresponding to capturing one frame of image by different image sensors is different, such as 40 milliseconds.
The first scene state is the scene state determined in the last period, and the first scene state comprises a day state or a night state.
It should be noted that, if the first scene is the daytime state, it indicates that the camera in the previous cycle is in the daytime mode, that is: the infrared light supplement lamp is in a closed state, and the infrared filter is in an infrared light cut-off mode; if the first scene is in the night state, the camera in the last period is in the night mode, namely: the infrared light supplement lamp is in an on state, and the infrared filter is in an infrared light sensing mode.
And 102, if the first scene state is the daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value.
In the embodiment of the present invention, when the first scene state is the daytime state, the adopted scene state determination condition may be similar to that in the prior art, that is, the current illumination intensity is compared with a preset daytime illumination intensity threshold, and the scene state of the present period is determined to be the daytime state or the nighttime state according to the comparison result.
The preset daytime illumination intensity threshold is a numerical value obtained according to industrial requirements, camera characteristics, a large amount of empirical data and the like.
And 103, determining to switch to a night mode or keep a day mode according to the scene state of the period.
In the embodiment of the invention, according to the condition that the scene state of the period determined in the step 102 is the night state, the mode of the camera is determined to be switched to the night mode; alternatively, the scene status of the present period determined in step 102 is a daytime status, and the mode of the camera is determined to be maintained in the daytime mode.
And 104, if the first scene state is the night state, calculating to obtain the current ratio of the red component to the green component according to the image when the current illumination intensity is obtained.
In the embodiment of the invention, when the first scene state is the night state, the current red component/green component ratio is calculated and obtained according to the image when the current illumination intensity is obtained, so that the current red component/green component ratio is used for judging the scene state when the first scene state is the night state.
The calculation of the current ratio of the red component to the green component according to the image obtained at the current illumination intensity belongs to the prior art, and is not described herein.
And 105, determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold.
In the embodiment of the present invention, when the first scene state is the night state, the adopted scene state determination condition is different from that of the prior art, that is: the current illumination intensity is compared with a preset night illumination intensity threshold value, the current red component/green component ratio is compared with a preset red component/green component ratio threshold value, and the scene state of the period is comprehensively determined to be a day state or a night state according to two comparison results.
The embodiment of the invention aims at the judgment condition that the first scene state is the night state, and is more precise than the judgment condition in the prior art, and the judgment result of the obtained scene state is higher in accuracy.
And step 106, determining to switch to the day mode or keep the night mode according to the scene state of the period.
In the embodiment of the present invention, it is determined that the mode of the camera is switched to the daytime mode according to the fact that the scene state of the present period determined in step 105 is the daytime state; alternatively, the mode of the camera is determined to remain in the night mode according to the determination that the scene state of the present period is the night state in step 105.
Therefore, according to the mode switching method for the camera with the infrared supplementary lighting lamp provided by the embodiment of the invention, the current illumination intensity of the camera and the first scene state determined in the previous period are obtained periodically. Then, according to different first scene states, different judgment conditions are adopted to obtain judgment results of the scene states, and mode switching of the camera is carried out according to the judgment results, namely: if the first scene state is the daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value, and determining to switch to a night mode or keep the daytime mode according to the scene state of the period; if the first scene state is the night state, calculating to obtain a current red/green component ratio according to an image when the current illumination intensity is obtained, determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, a night illumination intensity threshold value and a preset red component/green component ratio threshold value, and determining to switch to the day mode or keep the night mode according to the scene state of the period. The embodiment of the invention utilizes the principle that under the condition that the infrared fill light is turned on, the ratio of the red component to the green component caused by the infrared reflected light is larger, different scene state judging conditions are adopted in the daytime state and the night state, and in the night state, the current illumination intensity is compared with the night illumination intensity threshold value, and the ratio of the red component to the green component is also compared with the preset threshold value of the ratio of the red component to the green component.
As another embodiment, referring to fig. 2, fig. 2 is another flowchart of a mode switching method of a camera with an infrared fill-in light according to an embodiment of the present invention. The method comprises the following steps:
step 211, taking the time length corresponding to shooting one frame of image as a period, obtaining the current illumination intensity of the camera and the first scene state determined in the previous period. Wherein the first scene state comprises a day state or a night state.
In the embodiment of the present invention, periodically acquiring the current illumination intensity of the camera belongs to the prior art, and may include the following steps:
the method comprises the steps of firstly, taking the time length corresponding to shooting of a frame of image as a period, and obtaining the current gain and the current exposure time of an image sensor amplifying circuit when shooting of a current frame of image.
In the embodiment of the invention, the period is the time corresponding to one frame of image shot by the camera, the time is related to the characteristics of the image sensor of the camera, and the time can be set according to industrial requirements or user requirements. The duration is measured in seconds or milliseconds, etc. For example, it is calculated that 25 frames of images are taken in 1 second, and the duration for taking one frame of image is 40 milliseconds.
In the embodiment of the present invention, the current Gain and the current Exposure time Exposure of the image sensor amplifying circuit when the current frame image is captured are acquired, so that the current Gain and the current Exposure time are used for the calculation of the fourth step.
It should be noted that the unit of the current gain in the embodiment of the present invention needs to be converted from dB to multiple.
Second, an average value of the red pixel components, an average value of the green pixel components, and an average value of the blue pixel components of the current frame image are calculated.
From the optical knowledge, after the light passes through the color filter array of the image sensor of the camera, each pixel of the image is one of three components, namely a red pixel component, a green pixel component and a blue pixel component. The red pixel component, the green pixel component, and the blue pixel component are represented by an R component, a G component, and a B component, respectively. In the embodiment of the invention, the average values of all the pixel components are calculated and respectively recorded as the average value Ravg of the red pixel component, the average value Gavg of the green pixel component and the average value Bavg of the blue pixel component.
And thirdly, calculating and obtaining the average brightness of the current frame image according to the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components.
The average brightness of one frame image is weighted by the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components, and the average brightness is expressed by the formula:
Brightness=CoefR_Y*Ravg+CoefG_Y*Gavg+CoefB_Y*Bavg
where Brightness is the average Brightness of the current frame image, CoefR _ Y is the weighting coefficient of the red pixel component, CoefG _ Y is the weighting coefficient of the green pixel component, and CoefB _ Y is the weighting coefficient of the blue pixel component. Wherein CoefR _ Y, CoefG _ Y, CoefB _ Y is a known value.
And fourthly, obtaining the current illumination intensity according to the average brightness, the current gain and the current exposure time of the current frame image.
The current Illumination intensity Illumination is calculated according to the following formula:
Illumination=Brightness/Gain/Exposure
step 212, in a case that the first scene state is the daytime state, determining whether a first determination condition is satisfied, where the first determination condition is: the current illumination intensity is smaller than a preset daytime illumination intensity threshold value. If the first determination condition is satisfied, execute step 213, add the switch point number to a first preset number; if the first determination condition is not satisfied, step 218 is executed to decrement the switch point number by a second preset number, and step 219 is continuously executed to determine that the scene state of the present cycle is the daytime state. In the embodiment of the present invention, a first determination condition is adopted for a daytime state as a scene state, the first determination condition is similar to the prior art, and the first determination condition is expressed by a formula as:
Illumination<th_low
wherein Illumination is the current Illumination intensity, th _ low is a preset daytime Illumination intensity threshold, and th _ low is a fixed value.
It should be noted that the first preset quantity and the second preset quantity are values set according to industrial requirements, user requirements, a large amount of experience data and the like, and the first preset quantity and the second preset quantity can be changed according to requirements. As a preferred embodiment, in the embodiment of the present invention, the first preset number is 1, and the second preset number is 2.
Step 214, judging whether the switching point number is greater than a preset switching point number threshold th _ switch, if so, executing step 215, determining that the scene state of the period is a night state, and continuing to execute step 216 to zero the switching point number; if not, step 219 is executed to determine that the scene state of the present period is the daytime state.
After the first judgment condition is used for obtaining the judgment result, the scene state of the period is not determined immediately according to the judgment result and the mode is switched, but a plurality of periods are accumulated, and the scene state of the period is not determined and the mode is switched until the switching point number is greater than the switching point number threshold value. The embodiment of the invention accumulates a plurality of periods for judgment, and can avoid the mode oscillation problem of the camera caused by frequent mode switching.
And step 217, determining that the mode of the camera is switched to the night mode according to the scene state of the present period determined in step 215 as the night state.
Step 220, determining that the mode of the camera maintains the daytime mode according to the scene state of the present period determined in step 219 as the daytime state.
The method of the embodiment of the invention further comprises the steps of after the mode of the camera is determined to be switched to the night mode in step 217, turning on the infrared light supplement lamp, and switching the infrared filter into the infrared light sensing mode; and after the mode of the camera is determined to be kept in the daytime mode in step 220, the infrared fill light is kept turned off, and the infrared filter is kept in the cut-off infrared light mode.
In the embodiment of the invention, when the first scene state is the daytime state, the current illumination intensity of a third preset number of periods is obtained after the period is switched to the night mode, and the average value of the current illumination intensity of the third preset number of periods is calculated. And re-determining the upper limit threshold value of the night illumination intensity and the middle limit threshold value of the night illumination intensity through the average value of the current illumination intensities of the third preset number of periods, the preset upper limit threshold coefficient of the night illumination intensity and the preset middle limit threshold coefficient of the night illumination intensity, so that the re-determined upper limit threshold value of the night illumination intensity and the re-determined middle limit threshold value of the night illumination intensity are used in the second determination condition of the later period. The method specifically comprises the following steps:
step 221, wait for the next frame.
Step 222, obtaining the current Illumination intensity Illumination.
Step 223, determining whether the current Illumination intensity of the third preset number of periods has been obtained, specifically, determining whether the Illumination intensity Illumination of N frames has been obtained. If yes, go to step 224, calculate the average value i _ avg of the current illumination intensity of the N frames; if not, go back to step 221. The third preset number is N, where N is a natural number greater than 0, such as 10.
In step 225, the night light intensity upper threshold and the night light intensity middle threshold are re-determined according to the formulas th _ high _ avg _ α and th _ mid _ i _ avg _ β, so that the re-determined night light intensity upper threshold and the night light intensity middle threshold are used in the second determination condition of the following period.
Where th _ high is an upper night light intensity threshold, i _ avg is an average value of current light intensities of a third preset number of cycles, α is a preset upper night light intensity threshold coefficient, th _ mid is a middle night light intensity threshold, and β is a preset middle night light intensity threshold coefficient, α and β may set different values according to requirements, for example, α is equal to 1.25, and β is equal to 0.75.
The method of the embodiment of the invention is different from the prior art that the night illumination intensity threshold value is a fixed value, and updates the night illumination intensity upper limit threshold value and the night illumination intensity middle limit threshold value in the second determination condition according to the average value of the illumination intensity, the night illumination intensity upper limit threshold value coefficient and the night illumination intensity middle limit threshold value coefficient in the preset time period just after the day mode is switched to the night mode. Therefore, the method provided by the embodiment of the invention can obtain the night illumination intensity threshold value with higher matching degree with the existing scene state, and obtain the scene state judgment result with higher accuracy, so that the mode switching result with higher accuracy is obtained.
It should be noted that, in the process from step 221 to step 225 according to the embodiment of the present invention, the determination of the scene state and the mode switching are stopped, but since the time for this process is very short in milliseconds, the accuracy of the scene state and the mode switching of the method according to the embodiment of the present invention is not affected.
In step 226, if the first scene state is the night state, calculating to obtain a ratio of the average value of the red pixel components to the average value of the green pixel components according to the image when the current illumination intensity is obtained.
In the embodiment of the present invention, according to the average value of each pixel component obtained in the second step in step 211, a current Ratio of red component to green component is calculated and obtained as R-G Ratio, which is Ravg/Gavg.
From prior optical knowledge, the R-G Ratio of normal ambient light is generally less than the R-GRatio of infrared reflected light alone. When the infrared light supplement lamp is turned on, light rays collected by an image sensor of the camera are normal ambient light and infrared reflected light. Thus, the R-G Ratio of the image captured by the camera should be between that of normal ambient light and that of the IR reflected light alone. In the prior art, when the infrared light supplement lamp is turned on, only the current illumination intensity is used for judgment, and the fact that the current illumination intensity is generated due to normal ambient light or light of the infrared light supplement lamp cannot be identified, so that the accuracy of judgment on the scene state in the prior art is not high. According to the existing optical knowledge, when the infrared light supplement lamp is turned on, if the R-G Ratio is smaller, the probability that the scene state of the camera is in the daytime state is higher, and if the R-G Ratio is larger, the probability that the scene state of the camera is in the nighttime state is higher, so that when the infrared light supplement lamp is turned on, the judgment of the scene state by combining the R-G Ratio is reasonable and effective.
Step 227, determining whether a second determination condition is satisfied, where the second determination condition is: the current illumination intensity is greater than or equal to the night illumination intensity upper limit threshold value and greater than or equal to the night illumination intensity expansion threshold value, and the current red component/green component ratio is smaller than the threshold value of the preset red component/green component ratio; or, the current illumination intensity is greater than or equal to the night illumination intensity extension threshold, and is less than or equal to the night illumination intensity middle limit threshold, and the current red component/green component ratio is less than the preset red component/green component ratio threshold, if the second determination condition is met, executing step 228, adding the first preset number to the number of switching points; if the second determination condition is not satisfied, step 233 is executed to decrement the switch point number by a second preset number, and step 234 is continuously executed to determine that the scene state of the present period is the night state.
In the embodiment of the present invention, a second determination condition is adopted for a night state as a scene state, the second determination condition is different from the prior art, and the second determination condition is expressed by a formula as follows:
illumination is ≧ th _ high and Illumination ≧ th _ ext and R-G Ratio < R or
Illumination is not less than th _ ext, Illumination is not less than th _ mid, and R-G Ratio is less than R
Wherein Illumination is the current Illumination intensity, th _ high is the upper limit threshold of the night Illumination intensity, th _ mid is the middle limit threshold of the night Illumination intensity, th _ ext is the preset expansion threshold of the night Illumination intensity, R-G Ratio is the current Ratio of red component to green component, R is the threshold of the preset Ratio of red component to green component, th _ high and th _ mid are dynamically updated values, th _ ext and R are fixed values, and th _ high > th _ mid.
It should be noted that the preset night illumination intensity extension threshold th _ ext is usually smaller than the middle limit threshold th _ mid of the night illumination intensity, but does not exclude the existence of th _ mid < th _ ext < th _ high or th _ ext > th _ high in some special cases.
For the first scene state being the night state, the prior art adopts the current illumination intensity to compare with the illumination intensity threshold, and the illumination intensity threshold of the prior art is a fixed value, namely: and if the current illumination intensity is greater than the illumination intensity threshold value, switching to the daytime mode. The embodiment of the invention compares the current illumination intensity with three night illumination intensity threshold values, and simultaneously compares the current red component/green component ratio with a preset red component/green component ratio threshold value. The improvement of the determination condition that the first scene state is the night state in the embodiment of the present invention is to adapt to the frequently changed scene state to perform more accurate scene determination, especially for some more extreme or special scenes, which is exemplified below.
In example 1, preset th _ low is 200, and th _ ext is 800.
The camera changes from a strong illumination scene to an indoor non-illumination scene, the illumination intensity is low at the moment, the current illmination is obtained to be 100, the camera is switched to a night mode at the moment because a first judgment condition is met, an infrared light supplement lamp is turned on, and an infrared filter is set to be an infrared sensing mode. Because the indoor environment is narrow and small, the infrared reflected light is too strong, the illumination intensity is improved instantly after the infrared light supplement lamp is turned on, and the average value i _ avg of the drilling obtained within the preset time period is 2000.
Calculated from i _ avg:
th_high=2000*1.25=2500
th_mid=2000*0.75=1500
then, the user carries the camera to enter the outdoor space, the current outdoor space is at the evening or in the cloudy day, although the illumination intensity is slightly low, the infrared light supplement lamp does not need to be turned on, and the mode is the daytime mode. However, since the outdoor environment is open and the infrared reflected light is very weak, the intensity of light received by the sensor of the camera is reduced, and the intensity of light obtained is reduced to 1000. If it is determined in the prior art that, for example, the illumination intensity threshold of the prior art is 2000, the current illumination intensity is smaller than the illumination intensity threshold, and the night mode should be maintained according to the prior art. This is inconsistent with the actual usage requirements and decisions. But it can be obtained that at this time the R-G Ratio has decreased below R because the outdoor light is mainly composed of natural light. Therefore, according to the embodiment of the present invention, the second determination condition is satisfied, and the daytime mode should be switched. Therefore, the embodiment of the invention is consistent with the actual use requirement and judgment, and compared with the prior art, the mode switching accuracy of the embodiment of the invention is higher.
Step 229, judging whether the switching point number is greater than a preset switching point number threshold value, if so, executing step 230, determining that the scene state of the period is the daytime state, and continuing executing step 231 to zero the switching point number; if not, go to step 234 to determine the scene status of the present period is night status.
After the second determination condition is used to obtain the determination result, the scene state of the period is not determined immediately according to the determination result and the mode switching is performed, but a plurality of periods are accumulated, and the scene state of the period is determined and the mode switching is performed until the switching point number is greater than the switching point number threshold. The embodiment of the invention accumulates a plurality of periods for judgment, and can avoid the mode oscillation problem of the camera caused by frequent mode switching.
And step 232, determining that the mode of the camera is switched to the daytime mode according to the fact that the scene state of the period determined in step 230 is the daytime state.
In step 235, it is determined that the mode of the camera remains in the night mode according to the night state of the scene in the present period determined in step 234.
The method of the embodiment of the invention further comprises the steps of turning off the infrared fill-in light and switching the infrared filter into a cut-off infrared light mode after the mode of the camera is determined to be switched to the daytime mode in step 232; and after determining that the mode of the camera is kept in the night mode in the step 235, keeping turning on the infrared light supplement lamp and keeping the infrared filter in the infrared sensing mode.
The following describes a mode switching process of a camera with an infrared fill-in light according to an embodiment of the present invention with reference to the accompanying drawings, referring to fig. 3 and 4, fig. 3 is a schematic diagram of a ratio of a red component to a green component changing with time in the mode switching process according to the embodiment of the present invention; fig. 4 is a schematic diagram of the change of the illumination intensity with time during the mode switching process according to the embodiment of the invention corresponding to fig. 3.
In fig. 3 and 4, the short-interval dashed lines indicate different times t0, t1, t2, t3, and t4, and the short-interval dashed lines in fig. 3 and 4 demarcate the different times for the convenience of viewing the change of the red component/green component Ratio R/G Ratio and the Illumination intensity Illumination at the different times. In fig. 3, a rectangular dotted broken line indicates the threshold value R of the red component/green component ratio. In fig. 4, the long-interval broken line indicates the daytime illumination intensity threshold value th _ low, the single-dot line indicates the night illumination intensity upper limit threshold value th _ high, the double-dot line indicates the night illumination intensity middle limit threshold value th _ mid, and the triangular-shaped broken line indicates the night illumination intensity extension threshold value th _ ext.
With reference to fig. 3 and 4, the mode switching process of the camera with the infrared fill-in light according to the embodiment of the present invention is as follows:
at the time of t0, the camera is in a daytime mode, the infrared light supplement lamp of the camera is in an off state, and the infrared filter is in an infrared light cut-off mode.
As time advances, Illumination decreases, and when the scene state determination of the present cycle is performed at time t1, the first determination condition is adopted, and it is detected that the first determination condition is satisfied: and (3) after adding 1 to the switching point number, finding that the switching point number is greater than the switching point number threshold value at the moment, switching to a night mode, starting an infrared light supplement lamp, and switching the infrared optical filter to an infrared sensing mode. Then the Illumination is increased instantaneously. According to the i _ avg of a period of time, th _ high and th _ mid are updated.
And at the time of t2, when the scene state of the period is judged, adopting a second judgment condition, detecting that Illumination is more than or equal to th _ high, Illumination is more than or equal to th _ ext and R-G Ratio is less than R, adding 1 to the switching point number, and finding that the switching point number is more than a switching point number threshold value at the moment, so that the mode is switched to the daytime mode, the infrared light supplement lamp is turned off, and the infrared filter is switched to the infrared light cut-off mode.
At the time of t3, when the scene state of the period is judged, the first judgment condition is adopted, Illumination < th _ low is detected, the switching point number is added with 1, and then the switching point number is found to be larger than the switching point number threshold value, so that the night mode is switched, the infrared light supplement lamp is started, and the infrared filter is switched to the infrared sensing mode. Th _ high and th _ mid are updated again according to i _ avg for a period of time.
At time t4, when the scene state of the present cycle is determined, the second determination condition is adopted to detect that
And if the Illumination is more than or equal to th _ ext, the Illumination is less than or equal to th _ mid, and the R-G Ratio is less than R, adding 1 to the switching point number, and switching to the daytime mode when the switching point number is greater than the switching point number threshold. And turning off the infrared light supplement lamp, and switching the infrared filter to a cut-off infrared light mode.
Therefore, according to the mode switching method for the camera with the infrared supplementary lighting lamp provided by the embodiment of the invention, the current illumination intensity of the camera and the first scene state determined in the previous period are obtained periodically. Then according to different first scene states, adopting different judgment conditions to obtain a judgment result of the scene states, and completing the mode switching of the camera according to the judgment result, namely: if the first scene state is the daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value, and determining to switch to a night mode or keep the daytime mode according to the scene state of the period; if the first scene state is the night state, calculating to obtain a current red component/green component ratio according to an image when the current illumination intensity is obtained, determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, a night illumination intensity threshold value and a preset red component/green component ratio threshold value, and determining to switch to the day mode or keep the night mode according to the scene state of the period. The embodiment of the invention utilizes the principle that the ratio of the red component to the green component caused by the ambient infrared reflected light is larger under the condition that the infrared fill light is turned on, adopts different scene state judgment conditions at the daytime state and at the night state, not only utilizes the comparison between the current illumination intensity and the night illumination intensity threshold value, but also introduces the comparison between the ratio of the red component to the green component and the preset threshold value of the ratio of the red component to the green component at the night state, and compared with the prior art which only uses the comparison between the illumination intensity and the illumination intensity threshold value to determine the scene state, the judgment conditions of the embodiment of the invention are finer, the judgment result of the scene state with higher accuracy can be obtained, and the mode switching result with higher accuracy can be obtained. Meanwhile, after the day mode is switched to the night mode, the embodiment of the invention dynamically updates the upper limit threshold value of the night illumination intensity and the middle limit threshold value of the night illumination intensity through the average value of the illumination intensity in the preset time period after switching, and uses the updated upper limit threshold value of the night illumination intensity and the updated middle limit threshold value of the night illumination intensity for the subsequent scene state judgment, thereby not only improving the adaptability of the camera to scenes with different illumination intensities, but also further improving the mode switching accuracy of the camera.
Referring to fig. 5, fig. 5 is a structural diagram of a mode switching device of a camera with an infrared fill-in light according to an embodiment of the present invention. The method comprises the following steps:
the obtaining module 501 is configured to periodically obtain the current illumination intensity of the camera and a first scene state determined in a previous period, where the first scene state includes a day state or a night state.
The first scene state determining module 502 is configured to determine the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold if the first scene state is the daytime state.
A first mode switching module 503, configured to determine to switch to a night mode or maintain a day mode according to the scene state of the present period.
A night state calculating module 504, configured to calculate and obtain a current red component/green component ratio according to an image obtained when the current illumination intensity is obtained if the first scene state is the night state.
The second scene state determining module 505 is configured to determine a scene state of the current period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold, and a preset threshold of the red component/green component ratio.
And a second mode switching module 506, configured to determine to switch to the day mode or maintain the night mode according to the scene state of the present period.
Therefore, the mode switching device of the camera with the infrared supplementary lighting lamp, provided by the embodiment of the invention, firstly obtains the current illumination intensity of the camera periodically and the first scene state determined in the previous period. Then, according to different first scene states, different judgment conditions are adopted to obtain judgment results of the scene states, and mode switching of the camera is carried out according to the judgment results, namely: if the first scene state is the daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value, and determining to switch to a night mode or keep the daytime mode according to the scene state of the period; if the first scene state is the night state, calculating to obtain a current red component/green component ratio according to an image when the current illumination intensity is obtained, determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, a night illumination intensity threshold value and a preset red component/green component ratio threshold value, and determining to switch to the day mode or keep the night mode according to the scene state of the period. The embodiment of the invention utilizes the principle that the ratio of the red component to the green component caused by infrared reflected light is larger under the condition that the infrared fill light is turned on, adopts different scene state judging conditions at the daytime state and at the night state, not only utilizes the comparison between the current illumination intensity and the night illumination intensity threshold value, but also introduces the comparison between the ratio of the red component to the green component and the preset threshold value of the ratio of the red component to the green component at the night state, and compared with the prior art that only the comparison between the illumination intensity and the illumination intensity threshold value is used for determining the scene state, the judging conditions of the embodiment of the invention are finer, the judging result of the scene state with higher accuracy can be obtained, and the mode switching result with higher accuracy can be obtained.
It should be noted that, the apparatus in the embodiment of the present invention is an apparatus that applies the mode switching method of the camera with the infrared fill-in light, and all embodiments of the mode switching method of the camera with the infrared fill-in light are applicable to the apparatus and can achieve the same or similar beneficial effects.
As another embodiment, referring to fig. 6, fig. 6 is another structural diagram of a mode switching device of a camera with an infrared fill-in light according to an embodiment of the present invention. The method comprises the following steps:
the obtaining module 601 includes:
the gain and exposure time obtaining sub-module 6011 is configured to obtain a current gain and a current exposure time of the image sensor amplifying circuit when the current frame image is captured, with a time duration corresponding to the capturing of the one frame image as a period.
A pixel component calculating sub-module 6012, configured to calculate an average value of the red pixel components, an average value of the green pixel components, and an average value of the blue pixel components of the current frame image.
And an average brightness operator module 6013, configured to calculate an average brightness of the current frame image according to the average value of the red pixel components, the average value of the green pixel components, and the average value of the blue pixel components.
And the illumination intensity calculation operator module 6014 is configured to obtain the current illumination intensity according to the average brightness of the current frame image, the current gain, and the current exposure time.
A first scene state determination module 602, comprising:
the first determination submodule 6021 is configured to determine whether the first determination condition is satisfied or not when the first scene state is the daytime state, and add the first preset number to the number of switching points when the first determination condition is satisfied; under the condition that the first judgment condition is not met, reducing the number of switching points by a second preset number; the first determination condition is: the current illumination intensity is smaller than a preset daytime illumination intensity threshold value.
The first scene state determination submodule 6022 is configured to judge whether the switching point number is greater than a preset switching point number threshold, and if so, determine that the scene state of the period is a night state, and clear the switching point number; if not, determining that the scene state of the period is the daytime state.
A first mode switching module 603 comprising:
the first mode holding sub-module 6031 is configured to determine to hold the daytime mode according to whether the scene status of the present period is the daytime status.
The first mode switching sub-module 6032 is configured to determine to switch to the night mode according to that the scene state of the present period is the night state.
The illumination intensity average value calculating module 604 is configured to, when the first scene state is the daytime state, obtain the current illumination intensity of the third preset number of periods after the first mode switching sub-module switches the period to the night mode, and calculate an average value of the current illumination intensity of the third preset number of periods.
A night light intensity threshold calculation module 605, configured to re-determine the night light intensity upper limit threshold and the night light intensity middle limit threshold according to an average value of current light intensities of a third preset number of cycles, a preset night light intensity upper limit threshold coefficient and a preset night light intensity middle limit threshold coefficient, so that the re-determined night light intensity upper limit threshold and the night light intensity middle limit threshold are used in a second determination condition of a subsequent cycle.
The night illumination intensity threshold calculation module 605 is specifically configured to re-determine an upper night illumination intensity threshold and a middle night illumination intensity threshold according to formulas th _ high _ i _ avg _ α and th _ mid _ i _ avg _ β, where th _ high is the upper night illumination intensity threshold, i _ avg is an average value of current illumination intensities of a third preset number of cycles, α is a preset upper night illumination intensity threshold coefficient, th _ mid is the middle night illumination intensity threshold, and β is the preset middle night illumination intensity threshold coefficient.
And a night state calculating module 606, configured to calculate, if the first scene state is a night state, a ratio of the average value of the red pixel components to the average value of the green pixel components according to the current illumination intensity.
A second scene state determination module 607 comprising:
a second determining sub-module 6071, configured to determine whether a second determining condition is met, and add the number of switching points to the first preset number when the second determining condition is met; under the condition that a second judgment condition is not met, reducing the number of switching points by a second preset number; the second determination condition is: the current illumination intensity is greater than or equal to the night illumination intensity upper limit threshold value and greater than or equal to the night illumination intensity expansion threshold value, and the current red component/green component ratio is smaller than the threshold value of the preset red component/green component ratio; or the current illumination intensity is greater than or equal to the night illumination intensity expansion threshold and less than or equal to the night illumination intensity middle limit threshold, and the current red component/green component ratio is less than the preset red component/green component ratio threshold.
The night illumination intensity threshold comprises: the method comprises the following steps of (1) setting an upper limit threshold value of night illumination intensity, a middle limit threshold value of night illumination intensity and a preset night illumination intensity expansion threshold value; wherein the upper limit threshold of the night illumination intensity is larger than the middle limit threshold of the night illumination intensity.
A second scene state determination submodule 6072, configured to determine whether the number of switching points is greater than a preset switching point threshold, and if so, determine that the scene state of the present period is a daytime state, and clear the number of switching points; if not, determining that the scene state in the period is the night state.
In this embodiment of the present invention, similar to the first mode switching module, the second mode switching module 608 includes:
and a second mode switching submodule 6081 configured to determine to switch to the daytime mode according to whether the scene state of the present period is the daytime state.
The second mode holding sub-module 6082 is configured to determine to hold the night mode according to the night state of the scene state in the present cycle.
Therefore, the mode switching device of the camera with the infrared supplementary lighting lamp, provided by the embodiment of the invention, firstly obtains the current illumination intensity of the camera periodically and the first scene state determined in the previous period. Then according to different first scene states, adopting different judgment conditions to obtain a judgment result of the scene states, and completing the mode switching of the camera according to the judgment result, namely: if the first scene state is the daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value, and determining to switch to a night mode or keep the daytime mode according to the scene state of the period; if the first scene state is the night state, calculating to obtain a current red component/green component ratio according to an image when the current illumination intensity is obtained, determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, a night illumination intensity threshold value and a preset red component/green component ratio threshold value, and determining to switch to the day mode or keep the night mode according to the scene state of the period. The embodiment of the invention utilizes the principle that the ratio of the red component to the green component caused by infrared reflected light is larger under the condition that the infrared fill light is turned on, adopts different scene state judging conditions at the daytime state and at the night state, not only utilizes the comparison between the current illumination intensity and the night illumination intensity threshold value, but also introduces the comparison between the ratio of the red component to the green component and the preset threshold value of the ratio of the red component to the green component at the night state, and compared with the prior art that only the comparison between the illumination intensity and the illumination intensity threshold value is used for determining the scene state, the judging conditions of the embodiment of the invention are finer, the judging result of the scene state with higher accuracy can be obtained, and the mode switching result with higher accuracy can be obtained. Meanwhile, after the day mode is switched to the night mode, the embodiment of the invention dynamically updates the upper limit threshold value of the night illumination intensity and the middle limit threshold value of the night illumination intensity through the average value of the illumination intensity in the preset time period after switching, and uses the updated upper limit threshold value of the night illumination intensity and the updated middle limit threshold value of the night illumination intensity for the subsequent scene state judgment, thereby not only improving the adaptability of the camera to scenes with different illumination intensities, but also further improving the mode switching accuracy of the camera.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A mode switching method of a camera with an infrared fill-in light is characterized by comprising the following steps:
periodically acquiring the current illumination intensity of a camera and a first scene state determined in the previous period, wherein the first scene state comprises a day state or a night state;
if the first scene state is a daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value;
according to the scene state of the period, determining to switch to a night mode or keep a day mode;
if the first scene state is a night state, calculating to obtain a current red component/green component ratio according to the image when the current illumination intensity is obtained;
determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold;
according to the scene state of the period, determining to switch to a day mode or keep a night mode;
if the first scene state is a daytime state, determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value, wherein the step comprises the following steps:
judging whether a first judgment condition is met or not under the condition that the first scene state is the daytime state, and adding a first preset number to the switching points under the condition that the first judgment condition is met; reducing the number of switching points by a second preset number under the condition that the first judgment condition is not met; the first determination condition is: the current illumination intensity is smaller than a preset daytime illumination intensity threshold value;
judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining that the scene state of the period is a night state, and resetting the switching point number; if not, determining that the scene state of the period is the daytime state.
2. The method of claim 1, wherein the step of periodically obtaining the current illumination intensity of the camera comprises:
taking the duration corresponding to the shooting of one frame of image as a period, and acquiring the current gain and the current exposure time of an image sensor amplifying circuit when the current frame of image is shot;
calculating the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components of the current frame image;
calculating and obtaining the average brightness of the current frame image according to the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components;
obtaining the current illumination intensity according to the average brightness of the current frame image, the current gain and the current exposure time;
the step of calculating to obtain the ratio of the current red component to the current green component comprises the following steps: and calculating to obtain the ratio of the average value of the red pixel components to the average value of the green pixel components.
3. The method of claim 1, wherein the night light intensity threshold comprises: the method comprises the following steps of (1) setting an upper limit threshold value of night illumination intensity, a middle limit threshold value of night illumination intensity and a preset night illumination intensity expansion threshold value; wherein the night illumination intensity upper limit threshold is larger than the night illumination intensity middle limit threshold; the night illumination intensity upper limit threshold and the night illumination intensity middle limit threshold are calculated on the basis of the average value of the current illumination intensity in a preset time period; the preset night illumination intensity expansion threshold is smaller than the night illumination intensity middle limit threshold and larger than the preset day illumination intensity threshold;
the step of determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold comprises:
judging whether a second judgment condition is met, and adding a first preset number to the number of switching points under the condition that the second judgment condition is met; reducing the number of switching points by a second preset number under the condition that the second judgment condition is not met; the second determination condition is: the current illumination intensity is greater than or equal to the night illumination intensity upper limit threshold value and greater than or equal to the night illumination intensity expansion threshold value, and the current red component/green component ratio is smaller than the threshold value of the preset red component/green component ratio; or, the current illumination intensity is greater than or equal to the night illumination intensity expansion threshold and less than or equal to the night illumination intensity middle limit threshold, and the current red component/green component ratio is less than the preset red component/green component ratio threshold;
judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining that the scene state of the period is a daytime state, and resetting the switching point number; if not, determining that the scene state in the period is the night state.
4. The method of claim 1, further comprising:
when the first scene state is a daytime state, the current illumination intensity of a third preset number of periods is obtained after the period is switched to a night mode, and the average value of the current illumination intensity of the third preset number of periods is calculated;
and re-determining the night illumination intensity upper limit threshold and the night illumination intensity middle limit threshold according to the average value of the current illumination intensities of the third preset number of periods, the preset night illumination intensity upper limit threshold coefficient and the preset night illumination intensity middle limit threshold coefficient, so that the re-determined night illumination intensity upper limit threshold and the night illumination intensity middle limit threshold are used in the second determination condition of the later period.
5. The method of claim 4, wherein the re-determining the night light intensity upper threshold and the night light intensity middle threshold by the average of the current light intensity of the third preset number of cycles, the preset night light intensity upper threshold coefficient and the preset night light intensity middle threshold coefficient comprises:
re-determining an upper night illumination intensity threshold and a middle night illumination intensity threshold according to formulas th _ high _ avg _ α and th _ mid _ i _ avg _ β, wherein th _ high is the upper night illumination intensity threshold, i _ avg is an average value of current illumination intensities of the third preset number of cycles, α is the preset upper night illumination intensity threshold coefficient, th _ mid is the middle night illumination intensity threshold, and β is the preset middle night illumination intensity threshold coefficient.
6. The utility model provides a mode switching device of camera with infrared light filling lamp which characterized in that, mode switching device includes:
the system comprises an acquisition module, a display module and a control module, wherein the acquisition module is used for periodically acquiring the current illumination intensity of a camera and a first scene state determined in the previous period, and the first scene state comprises a day state or a night state;
the first scene state determining module is used for determining the scene state of the period according to the current illumination intensity and a preset daytime illumination intensity threshold value if the first scene state is the daytime state;
the first mode switching module is used for determining to switch to a night mode or keep a day mode according to the scene state of the period;
the night state calculation module is used for calculating and obtaining a current red component/green component ratio according to the image when the current illumination intensity is obtained if the first scene state is the night state;
the second scene state determining module is used for determining the scene state of the period according to the current illumination intensity, the current red component/green component ratio, the night illumination intensity threshold and a preset red component/green component ratio threshold;
the second mode switching module is used for determining to switch to a day mode or keep a night mode according to the scene state of the period;
the first scene state determination module includes:
the first judgment submodule is used for judging whether a first judgment condition is met or not under the condition that the first scene state is the daytime state, and adding a first preset number to the number of switching points under the condition that the first judgment condition is met; reducing the number of switching points by a second preset number under the condition that the first judgment condition is not met; the first determination condition is: the current illumination intensity is smaller than a preset daytime illumination intensity threshold value;
the first scene state determining submodule is used for judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining the scene state of the period as a night state, and resetting the switching point number; if not, determining that the scene state of the period is the daytime state.
7. The apparatus of claim 6, wherein the obtaining module comprises:
the gain and exposure time acquisition submodule is used for acquiring the current gain and the current exposure time of the image sensor amplifying circuit when a current frame image is shot by taking the time length corresponding to the shot frame image as a period;
the pixel component calculating submodule is used for calculating the average value of the red pixel component, the average value of the green pixel component and the average value of the blue pixel component of the current frame image;
the average brightness calculation submodule is used for calculating and obtaining the average brightness of the current frame image according to the average value of the red pixel components, the average value of the green pixel components and the average value of the blue pixel components;
the illumination intensity calculation sub-module is used for obtaining the current illumination intensity according to the average brightness of the current frame image, the current gain and the current exposure time;
the night state calculation module is specifically configured to: and calculating to obtain the ratio of the average value of the red pixel components to the average value of the green pixel components.
8. The apparatus of claim 6, wherein the night light intensity threshold comprises: the method comprises the following steps of (1) setting an upper limit threshold value of night illumination intensity, a middle limit threshold value of night illumination intensity and a preset night illumination intensity expansion threshold value; wherein the night illumination intensity upper limit threshold is larger than the night illumination intensity middle limit threshold; the night illumination intensity upper limit threshold and the night illumination intensity middle limit threshold are calculated on the basis of the average value of the current illumination intensity in a preset time period; the preset night illumination intensity expansion threshold is smaller than the night illumination intensity middle limit threshold and larger than the preset day illumination intensity threshold;
the second scene state determination module includes:
the second judgment sub-module is used for judging whether a second judgment condition is met or not, and adding the first preset number to the number of switching points under the condition that the second judgment condition is met; reducing the number of switching points by a second preset number under the condition that the second judgment condition is not met; the second determination condition is: the current illumination intensity is greater than or equal to the night illumination intensity upper limit threshold value and greater than or equal to the night illumination intensity expansion threshold value, and the current red component/green component ratio is smaller than the threshold value of the preset red component/green component ratio; or, the current illumination intensity is greater than or equal to the night illumination intensity expansion threshold and less than or equal to the night illumination intensity middle limit threshold, and the current red component/green component ratio is less than the preset red component/green component ratio threshold;
the second scene state determining submodule is used for judging whether the switching point number is larger than a preset switching point number threshold value or not, if so, determining the scene state of the period as the daytime state, and resetting the switching point number; if not, determining that the scene state in the period is the night state.
9. The apparatus of claim 6, wherein the first mode switching module comprises:
the first mode keeping submodule is used for determining to keep the daytime mode according to the condition that the scene state of the period is the daytime state;
the first mode switching submodule is used for determining to switch to a night mode according to the condition that the scene state of the period is the night state;
the device further comprises:
the illumination intensity average value calculating module is used for acquiring the current illumination intensity of a third preset number of periods after the first scene state is the daytime state and the first mode switching sub-module switches the period to the night mode, and calculating and acquiring the average value of the current illumination intensity of the third preset number of periods;
and the night illumination intensity threshold value calculation module is used for re-determining the night illumination intensity upper limit threshold value and the night illumination intensity middle limit threshold value according to the average value of the current illumination intensities of the third preset number of periods, the preset night illumination intensity upper limit threshold value coefficient and the preset night illumination intensity middle limit threshold value coefficient, so that the re-determined night illumination intensity upper limit threshold value and the re-determined night illumination intensity middle limit threshold value are used in the second determination condition of the later period.
10. The apparatus of claim 9, wherein the night light intensity threshold calculation module is specifically configured to:
re-determining an upper night illumination intensity threshold and a middle night illumination intensity threshold according to formulas th _ high _ avg _ α and th _ mid _ i _ avg _ β, wherein th _ high is the upper night illumination intensity threshold, i _ avg is an average value of current illumination intensities of the third preset number of cycles, α is the preset upper night illumination intensity threshold coefficient, th _ mid is the middle night illumination intensity threshold, and β is the preset middle night illumination intensity threshold coefficient.
CN201710014669.XA 2017-01-10 2017-01-10 Mode switching method and device of camera with infrared light supplement lamp Active CN108289164B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710014669.XA CN108289164B (en) 2017-01-10 2017-01-10 Mode switching method and device of camera with infrared light supplement lamp

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710014669.XA CN108289164B (en) 2017-01-10 2017-01-10 Mode switching method and device of camera with infrared light supplement lamp

Publications (2)

Publication Number Publication Date
CN108289164A CN108289164A (en) 2018-07-17
CN108289164B true CN108289164B (en) 2020-07-03

Family

ID=62819644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710014669.XA Active CN108289164B (en) 2017-01-10 2017-01-10 Mode switching method and device of camera with infrared light supplement lamp

Country Status (1)

Country Link
CN (1) CN108289164B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109040540A (en) * 2018-07-20 2018-12-18 王健 A kind of night vision switching method and supervisory-controlled robot based on characteristics of image
CN109302566A (en) * 2018-11-22 2019-02-01 深圳市景阳科技股份有限公司 A kind of method, apparatus and terminal device of determining screening-mode
CN111510636B (en) * 2019-01-30 2021-07-09 华为技术有限公司 Method and device for acquiring brightness evaluation value and computer storage medium
CN110505377B (en) * 2019-05-31 2021-06-01 杭州海康威视数字技术股份有限公司 Image fusion apparatus and method
CN113132616B (en) * 2019-12-31 2022-07-22 富联国基(上海)电子有限公司 Working mode switching device and working mode switching detection method
CN111385477A (en) * 2020-03-17 2020-07-07 浙江大华技术股份有限公司 Mode switching control method and device for camera, camera and storage medium
CN111601041B (en) * 2020-06-03 2021-12-31 普联技术有限公司 Camera scene mode switching method and device and intelligent equipment
CN111988532B (en) * 2020-07-16 2022-07-12 哈尔滨海能达科技有限公司 Control method and device for night vision compensation lamp switch
CN112235506B (en) * 2020-10-09 2022-08-16 浙江大华技术股份有限公司 Camera focusing processing method, device, storage medium and electronic device
CN112383688B (en) * 2020-11-10 2023-03-24 珠海格力电器股份有限公司 Camera shooting light supplement method and device, electronic equipment and intelligent terminal

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012095223A (en) * 2010-10-28 2012-05-17 Canon Inc Imaging device, imaging method, and program
KR20130019519A (en) * 2011-08-17 2013-02-27 엘지이노텍 주식회사 Network camera having infrared light emitting diode illumination
CN103716527A (en) * 2012-09-29 2014-04-09 浙江大华技术股份有限公司 Method and equipment for determining working mode of camera equipment
CN103781261A (en) * 2014-02-28 2014-05-07 深圳英飞拓科技股份有限公司 Infrared lamp control method for infrared network camera
CN104301616A (en) * 2014-10-31 2015-01-21 苏州科达科技股份有限公司 Method and system for controlling day-to-night switching mode of camera and method and system for controlling night-to-day switching mode of camera
CN104980639A (en) * 2014-04-03 2015-10-14 杭州华为企业通信技术有限公司 Infrared control device, infrared control method and image camera
CN105554409A (en) * 2015-12-16 2016-05-04 浙江宇视科技有限公司 Method and device for detecting day-night switching
CN106101549A (en) * 2016-07-07 2016-11-09 浙江宇视科技有限公司 Automatic switching method, Apparatus and system round the clock

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5471550B2 (en) * 2010-02-10 2014-04-16 ソニー株式会社 IMAGING DEVICE, IMAGING DEVICE CONTROL METHOD, AND PROGRAM

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012095223A (en) * 2010-10-28 2012-05-17 Canon Inc Imaging device, imaging method, and program
KR20130019519A (en) * 2011-08-17 2013-02-27 엘지이노텍 주식회사 Network camera having infrared light emitting diode illumination
CN103716527A (en) * 2012-09-29 2014-04-09 浙江大华技术股份有限公司 Method and equipment for determining working mode of camera equipment
CN103781261A (en) * 2014-02-28 2014-05-07 深圳英飞拓科技股份有限公司 Infrared lamp control method for infrared network camera
CN104980639A (en) * 2014-04-03 2015-10-14 杭州华为企业通信技术有限公司 Infrared control device, infrared control method and image camera
CN104301616A (en) * 2014-10-31 2015-01-21 苏州科达科技股份有限公司 Method and system for controlling day-to-night switching mode of camera and method and system for controlling night-to-day switching mode of camera
CN105554409A (en) * 2015-12-16 2016-05-04 浙江宇视科技有限公司 Method and device for detecting day-night switching
CN106101549A (en) * 2016-07-07 2016-11-09 浙江宇视科技有限公司 Automatic switching method, Apparatus and system round the clock

Also Published As

Publication number Publication date
CN108289164A (en) 2018-07-17

Similar Documents

Publication Publication Date Title
CN108289164B (en) Mode switching method and device of camera with infrared light supplement lamp
CN110351490B (en) Exposure method, exposure device and image pickup equipment
CN102271218B (en) Scene-oriented ultra-intelligent video camera and camera shooting method thereof
CN107743590B (en) Method and apparatus for performing exposure estimation using time-of-flight sensor
CN103533252B (en) Method and device for automatically switching day and night modes
KR101124778B1 (en) Camera flash module and method for controlling same
KR102612365B1 (en) A method for assessing ambient light during night mode image acquisition
CN103945201B (en) A kind of IR-Cut filter changing method, device and video camera
CN101442679B (en) Automatic white balance control system and method thereof
JPH03179879A (en) Method and apparatus for exposure control of video camera
CN102413280A (en) Imaging apparatus and method for controlling same
CN105915807B (en) Method for calculating light quantity change characteristic and electronic device
CN105867047A (en) Flashlight adjusting method and shooting device
CN117676323A (en) AE-based method for controlling day and night mode switching
CN116546317A (en) Control method of image pickup apparatus, computer apparatus, and storage medium
JP7121832B2 (en) How to improve the performance of your camcorder
EP1615451A2 (en) Digital video camera with automatic white balance and a method thereof
US10270979B2 (en) Automatically depth-of-field adjusting method and camera
KR102261439B1 (en) Method of sensing an event
WO2019156774A1 (en) Systems and methods for automatic white balance
KR101546917B1 (en) System and method for controlling night image correction
JP6391319B2 (en) Imaging device, control method thereof, and control program
JP2023001975A (en) Information processing apparatus, information processing method, and program
WO2023236215A1 (en) Image processing method and apparatus, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant