Monitoring mode switching method and device, electronic equipment and storage medium

By using the current lighting value and pixel color proportion in smart night vision mode to update the lighting threshold group, the problem of inaccurate switching of monitoring mode in environments with insufficient light is solved, and more flexible and accurate monitoring mode switching is achieved.

CN119520983APending Publication Date: 2025-02-25SHENZHEN WATER WORLD INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411373950.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Smart night vision mode may have frequent switching or non-switching in environments with insufficient light, especially at critical points between day and night, resulting in low accuracy of monitoring mode switching.

Method used

By obtaining the current lighting value and the lighting value at the previous sampling time, it is determined whether it is in the target change state. If it is in the target change state, the currently captured image frame is extracted, the historical lighting threshold group is updated according to the pixel color proportion, the current lighting threshold group is obtained, and the monitoring mode switching is performed according to the threshold group.

Benefits of technology

It realizes more flexible and accurate monitoring mode switching under diversified environmental conditions, and improves the accuracy of monitoring mode switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520983A_ABST
    Figure CN119520983A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a monitoring mode switching method. The method comprises the steps of obtaining a current illumination value of a position where target monitoring equipment is located and an illumination value collected at a previous sampling moment; determining whether the target monitoring equipment is in a target change state or not based on the current illumination value and an illumination value collected at the previous sampling moment; if the target monitoring device is in the target change state, extracting a current shot image frame of the target monitoring device; updating a historical illumination threshold group corresponding to the target monitoring equipment based on the pixel color ratio to obtain a current illumination threshold group; and performing monitoring mode switching on the target monitoring equipment based on the current illumination threshold group. According to the embodiment of the invention, the illumination threshold group is dynamically updated according to the corresponding pixel color ratio, so that when the monitoring mode of the target monitoring equipment is switched according to the current illumination threshold group, diversified environmental conditions can be more flexibly handled, and the purpose of improving the monitoring mode switching accuracy is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a monitoring mode switching method, device, electronic equipment and storage medium. Background Art

[0002] At present, with the rise of intelligent night vision technology, the adaptability of terminal devices under different lighting conditions has been greatly improved, allowing the device to automatically switch to night vision mode according to the ambient brightness. However, in an environment with insufficient light, when the ambient brightness is at the critical point between day and night, the intelligent night vision mode may encounter the problem of frequent switching or no switching, and the accuracy of its monitoring mode switching is low. Therefore, how to provide a method that can monitor the accuracy of mode switching has become an urgent problem to be solved. Summary of the invention

[0003] The embodiment of the present invention provides a monitoring mode switching method, which aims to solve the problem of low monitoring mode switching accuracy. Whether the target is in a change state is determined by the current illumination value and the illumination value collected at the previous sampling moment. When the target is in a change state, the current captured image frame is extracted, so that the illumination threshold group is dynamically updated according to the corresponding pixel color proportion, and then when the monitoring mode of the target monitoring device is switched according to the current illumination threshold group, it can more flexibly respond to various environmental conditions, so as to achieve the purpose of improving the accuracy of monitoring mode switching.

[0004] In a first aspect, an embodiment of the present invention provides a monitoring mode switching method, the method comprising the following steps:

[0005] Obtain the current light value at the location of the target monitoring device and the light value collected at the previous sampling moment;

[0006] Determining whether the target monitoring device is in a target change state based on the current light value and the light value collected at the previous sampling moment;

[0007] If the target is in the target change state, extracting a current captured image frame of the target monitoring device, wherein the current captured image frame includes at least one pixel color ratio;

[0008] Based on the pixel color proportion, the historical illumination threshold group corresponding to the target monitoring device is updated to obtain a current illumination threshold group;

[0009] Based on the current illumination threshold group, the monitoring mode of the target monitoring device is switched.

[0010] Optionally, the historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, and the determining whether the target monitoring device is in a target change state based on the current illumination value and the illumination value collected at the previous sampling moment includes:

[0011] When the current illumination value is greater than the first historical threshold and less than the second historical threshold, calculating the illumination difference between the current illumination value and the illumination value collected at the previous sampling moment;

[0012] Based on the illumination difference value, it is determined whether the target monitoring device is in a target change state.

[0013] Optionally, determining whether the target monitoring device is in a target change state based on the illumination difference value includes:

[0014] Acquire a historical environment state corresponding to the target monitoring device, where the historical environment state is night or day;

[0015] When the historical environment state is the dark night and the illumination difference is a positive number, the target monitoring device is in a target change state;

[0016] When the historical environment state is daytime and the light difference is a negative number, the target monitoring device is in a target change state.

[0017] Optionally, updating the historical illumination threshold group corresponding to the target monitoring device based on the pixel color proportion to obtain the current illumination threshold group includes:

[0018] Determining an average brightness value of the currently captured image frame;

[0019] Based on the average brightness value and the pixel color ratio, determine the current environment state corresponding to the target monitoring device;

[0020] The historical illumination threshold group corresponding to the target monitoring device is updated based on the current environmental state to obtain a current illumination threshold group.

[0021] Optionally, the current environment state is night or day, the pixel color proportion includes a first color proportion and a second color proportion, and determining the current environment state corresponding to the target monitoring device based on the average brightness value and the pixel color proportion includes:

[0022] When the average brightness value is greater than a preset brightness threshold, and the first color proportion is greater than a preset first color proportion threshold, and the second color proportion is greater than a preset second color proportion threshold, the current environment state corresponding to the target monitoring device is daytime;

[0023] When the average brightness value is less than a preset brightness threshold, and the first color proportion is less than a preset first color proportion threshold, and the second color proportion is less than a preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is the night.

[0024] Optionally, the determining the current environment state corresponding to the target monitoring device based on the average brightness value and the pixel color proportion further includes:

[0025] Determining the overall color contrast of the currently captured image frame;

[0026] When the average brightness value is greater than a preset brightness threshold, and the first color proportion is not greater than a preset first color proportion threshold or the second color proportion is not greater than a preset second color proportion threshold, determine the current environment state corresponding to the target monitoring device based on the overall color contrast;

[0027] When the average brightness value is less than the preset brightness threshold, and the first color proportion is not less than the preset first color proportion threshold or the second color proportion is not less than the preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is determined based on the overall color contrast.

[0028] Optionally, it is characterized in that the historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, the current illumination threshold group includes a first current threshold and a second current threshold, the first current threshold is less than the second current threshold, the current environment state is night or day, and the historical illumination threshold group corresponding to the target monitoring device is updated based on the current environment state to obtain the current illumination threshold group, including:

[0029] When the current environment state is the night, comparing the first historical threshold with the current light value to obtain a first comparison result, updating the first historical threshold based on the first comparison result to obtain a first current threshold, and using the second historical threshold as the second current threshold;

[0030] When the current environmental state is daytime, the second historical threshold is compared with the current light value to obtain a second comparison result, the second historical threshold is updated based on the second comparison result to obtain a second current threshold, and the first historical threshold is used as the first current threshold.

[0031] In a second aspect, an embodiment of the present invention further provides a monitoring mode switching device, the monitoring mode switching device comprising:

[0032] An acquisition module is used to obtain the current light value of the location of the target monitoring device and the light value collected at the previous sampling moment;

[0033] A determination module, configured to determine whether the target monitoring device is in a target change state based on the current light value and the light value collected at the previous sampling moment;

[0034] An extraction module, configured to extract a current captured image frame of the target monitoring device if the target is in the target change state, wherein the current captured image frame includes at least one pixel color ratio;

[0035] An updating module, configured to update a historical illumination threshold group corresponding to the target monitoring device based on the pixel color proportion to obtain a current illumination threshold group;

[0036] A switching module is used to switch the monitoring mode of the target monitoring device based on the current light threshold group.

[0037] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the monitoring mode switching method provided in the embodiment of the present invention when executing the computer program.

[0038] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the monitoring mode switching method provided in the embodiment of the invention are implemented.

[0039] In an embodiment of the present invention, the current illumination value of the location of the target monitoring device and the illumination value collected at the previous sampling moment are obtained; based on the current illumination value and the illumination value collected at the previous sampling moment, it is determined whether the target monitoring device is in a target change state; if it is in the target change state, the current captured image frame of the target monitoring device is extracted, and the current captured image frame includes at least one pixel color ratio; based on the pixel color ratio, the historical illumination threshold group corresponding to the target monitoring device is updated to obtain the current illumination threshold group; based on the current illumination threshold group, the monitoring mode of the target monitoring device is switched. Whether it is in a target change state is determined by the current illumination value and the illumination value collected at the previous sampling moment. When it is in a target change state, the current captured image frame is extracted, and according to the corresponding pixel color ratio, the current environmental situation is further judged, and the illumination threshold group is dynamically updated accordingly. Then, when the target monitoring device is switched to a monitoring mode according to the current illumination threshold group in the target change state, it can more flexibly respond to diverse environmental conditions to achieve the purpose of improving the accuracy of monitoring mode switching. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 is a flow chart of a monitoring mode switching method provided by an embodiment of the present invention;

[0042] Figure 2 is a flow chart of another monitoring mode switching method provided by an embodiment of the present invention;

[0043] Figure 3 is a structural schematic diagram of a monitoring mode switching device provided in an embodiment of the present invention;

[0044] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] like Figure 1 As shown, Figure 1 1 is a flow chart of a monitoring mode switching method provided by an embodiment of the present invention, comprising:

[0047] 101. Obtain the current illumination value of the location of the target monitoring device and the illumination value collected at the previous sampling moment.

[0048] In an embodiment of the present invention, the above-mentioned monitoring mode switching method can be applied to the above-mentioned target monitoring device, and can also be applied to the monitoring device management platform. The above-mentioned monitoring mode may include a day mode and a night mode (or understood as a night vision mode). The above-mentioned target monitoring device can be any monitoring device with a day mode and a night mode. The above-mentioned monitoring device management platform can be constructed by a server or a server cluster. The above-mentioned server or server cluster can be any electronic device with functions such as image processing, image recognition, data storage, data analysis and data transmission.

[0049] When the above monitoring mode switching method is applied to the above target monitoring device, the above target monitoring device can implement any one of the monitoring mode switching methods provided in the embodiments of the present invention to achieve the switching of the monitoring mode (i.e., day mode or night mode). When the above monitoring mode switching method is applied to the above monitoring device management platform, the above monitoring device management platform can implement any one of the monitoring mode switching methods provided in the embodiments of the present invention through the above target monitoring device, and send a mode switching instruction to the above target monitoring device through the above data transmission function to achieve the switching of the monitoring mode.

[0050] The above-mentioned light values ​​can be collected by any light collection sensor that can collect light values. For example, the above-mentioned light collection sensor can be a photodiode (Photodiode), a phototransistor (Phototransistor), a photoresistor (Photoresistor or LDR), a photodiode (Photodiode), a photosensor module, etc.

[0051] The illumination value collected at the previous sampling moment is earlier than the current illumination value in time. Specifically, the illumination value collected at the previous sampling moment may be an illumination value that is one time period earlier than the current illumination value. For example, the illumination value collected at the previous sampling moment may be an illumination value one second before the current illumination moment, or an illumination value one minute before the current illumination moment. Specifically, assuming that the above time period is the previous minute, there is an illumination value corresponding to each second. If the current illumination value is obtained at 8:00:00, the illumination value at 7:59:00 is the illumination value collected at the previous sampling moment. At 8:00:01, the illumination value corresponding to 8:00:00 can be cached and used as the illumination value collected at the previous sampling moment relative to 8:00:01. The setting of the above time period can be specifically set based on the experience of switching the historical monitoring mode, or obtained through a limited number of experiments, or can be set based on actual needs.

[0052] In one embodiment, specifically, the illumination values ​​can also be cached according to the time period. At the 8th hour 00:00, the illumination values ​​from 7:59:00 to 7:59:59 can be cached, and at the 8th hour 00:01, the illumination value at 8:00:00 is cached, and at the same time, the illumination value corresponding to 7:59:00 is deleted from the cache. By caching the time period, when the illumination value collected at the previous sampling moment needs to be extracted, it can be directly extracted from the cache without saving the illumination values ​​of all moments (for example, the illumination values ​​of the previous day or the previous week), which can effectively improve the utilization rate of the storage space, and when the illumination value collected at the previous sampling moment needs to be extracted, the illumination value of the earliest moment that can be quickly directly extracted from the cache is the illumination value collected at the previous sampling moment, which can effectively improve the extraction efficiency of the illumination value collected at the previous sampling moment, and thus can correspondingly improve the switching efficiency of the monitoring mode switching.

[0053] It should be noted that the above description is only an example. Whether there is a corresponding light value for every second depends on the collection granularity of the light collection sensor. If the collection granularity of the light collection sensor is to collect one light value per second, then there is a corresponding light value per second. If the collection granularity of the light collection sensor is to collect n light values ​​per second, then the median value or average value can be taken from the n light values ​​to determine the light value corresponding to each second. If the light collection sensor collects a light value at intervals of n seconds, then the light value collected at the nth second can be used as the light value in the time range from the nth second to the n+nth second, where n is a number greater than one.

[0054] 102. Based on the current illumination value and the illumination value collected at the previous sampling moment, determine whether the target monitoring device is in a target change state.

[0055] In an embodiment of the present invention, the above-mentioned target change state indicates a brightness state where the ambient brightness is before and after the critical point between day and night, and may include a state where day transitions to night and night transitions to day, wherein the state where day transitions to night can be understood as the gradual darkening of the evening, and the state where night transitions to day can be understood as the gradual brightening of the dawn.

[0056] Therefore, when the current illumination value is between the illumination value during the day and the illumination value at night, the illumination difference between the current illumination value and the illumination value collected at the previous sampling moment can be calculated, and based on the above illumination difference, it can be determined whether the target monitoring device is in a target change state.

[0057] 103. If the target is in a target change state, extract the current captured image frame of the target monitoring device.

[0058] In an embodiment of the present invention, the target monitoring device continuously collects images according to its own device parameters. Therefore, when the target is in a change state, the image frame captured by the target monitoring device at the current moment can be extracted as the currently captured image frame. The currently captured image frame includes at least one pixel color ratio. The pixel color ratio can be the ratio of the number of pixels of any color to the number of all pixels. Usually, the pixel color ratio can be the ratio of the number of pixels of the basic color to the number of all pixels. The basic color can be a color related to day and night.

[0059] It should be noted that the illumination value collected by the illumination acquisition sensor (i.e., the current illumination value and the illumination value collected at the previous sampling moment) is used to determine whether the target is in a target change state. Only when the target is in a target change state will the current captured image frame of the target monitoring device be extracted, and the subsequent steps (i.e., updating the historical illumination threshold group, and switching the monitoring mode through the current illumination threshold group) are performed according to the current captured image frame to switch the monitoring mode of the target monitoring device. Through the collaborative work of hardware (i.e., the illumination acquisition sensor and other hardware-related content) and software (i.e., the subsequent update of the historical illumination threshold group and other software-related content), the monitoring mode of the target monitoring device is switched, which can not only overcome the limitations of the hardware, but also significantly reduce the problem of increased operating burden caused by the use of too many software algorithms. In turn, the target monitoring device can be more flexibly responded to diverse environmental conditions to enhance the stability and reliability of the target monitoring device.

[0060] 104. Update the historical illumination threshold group corresponding to the target monitoring device based on the pixel color ratio to obtain the current illumination threshold group.

[0061] In an embodiment of the present invention, the current environment state corresponding to the target monitoring device can be determined based on the pixel color ratio. The current environment state can be daytime or dark, and the historical illumination threshold group can include a first historical threshold and a second historical threshold, wherein the first historical threshold is less than the second historical threshold, and the first historical threshold can be understood as a lower threshold, that is, when the illumination value is lower than the first historical threshold, it is night, and the second historical threshold can be understood as an upper threshold, that is, when the illumination value is higher than the second historical threshold, it is daytime. The current illumination threshold group can include a first current threshold and a second current threshold, wherein the first current threshold corresponds to the first historical threshold, and the difference between the two is the time, the first historical threshold is obtained when the illumination threshold group was last updated, and the first current threshold is obtained by updating the illumination threshold group at the current moment. Therefore, when the current environment state is daytime, the second historical threshold can be updated according to the current illumination value to obtain the second current threshold, and the first historical threshold is used as the first current threshold.

[0062] In a possible embodiment, it is assumed that the colors related to day and night may include yellow and blue. The yellow pixel color ratio and the blue pixel color ratio in the current captured image frame may be calculated. When the yellow pixel color ratio is greater than a preset yellow pixel color ratio threshold, and the blue pixel color ratio is greater than a preset blue pixel color ratio threshold, the current environment state is daytime. When the yellow pixel color ratio is less than a preset yellow pixel color ratio threshold, and the blue pixel color ratio is less than a preset blue pixel color ratio threshold, the current environment state is night.

[0063] 105. Based on the current illumination threshold group, switch the monitoring mode of the target monitoring device.

[0064] In the embodiment of the present invention, after the update is completed, the above-mentioned current illumination threshold group (i.e., including the first current threshold and the second current threshold) can be obtained, and the current illumination value is compared with the first current threshold and the second current threshold respectively. If the current illumination value is less than the first current threshold, the monitoring mode of the target monitoring device is switched to the night mode, and if the current illumination value is greater than the second current threshold, the monitoring mode of the target monitoring device is switched to the day mode.

[0065] It is understandable that, since the first current threshold or the second current threshold is updated according to the current light intensity, the current light intensity will not be greater than the first current threshold but less than the second current threshold. After the update is completed, when the monitoring mode of the target monitoring device is switched based on the current light threshold group, it can be switched to a more accurate monitoring mode.

[0066] In an embodiment of the present invention, the current illumination value of the location of the target monitoring device and the illumination value collected at the previous sampling moment are obtained; based on the current illumination value and the illumination value collected at the previous sampling moment, it is determined whether the target monitoring device is in a target change state; if it is in the target change state, the current captured image frame of the target monitoring device is extracted, and the current captured image frame includes at least one pixel color ratio; based on the pixel color ratio, the historical illumination threshold group corresponding to the target monitoring device is updated to obtain the current illumination threshold group; based on the current illumination threshold group, the monitoring mode of the target monitoring device is switched. Whether it is in a target change state is determined by the current illumination value and the illumination value collected at the previous sampling moment. When it is in a target change state, the current captured image frame is extracted, so that the illumination threshold group is dynamically updated according to the corresponding pixel color ratio, and then when the monitoring mode of the target monitoring device is switched according to the current illumination threshold group, it can more flexibly respond to various environmental conditions to achieve the purpose of improving the accuracy of monitoring mode switching.

[0067] It is understandable that in the specific implementation of the present application, data related to lighting values, current captured image frames, historical environmental conditions, etc., when the embodiments in the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data and the construction, training and use of related models need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0068] It should be noted that the monitoring mode switching method provided in the embodiment of the present invention can be applied to devices such as computers and servers that can perform monitoring mode switching.

[0069] Optionally, in the step of determining whether the target monitoring device is in a target change state based on the current illumination value and the illumination value collected at the previous sampling moment, it is also possible to calculate the illumination difference between the current illumination value and the illumination value collected at the previous sampling moment when the current illumination value is greater than the first historical threshold and less than the second historical threshold; based on the illumination difference, determine whether the target monitoring device is in a target change state.

[0070] In an embodiment of the present invention, the above-mentioned historical illumination threshold group includes a first historical threshold and a second historical threshold, and the above-mentioned first historical threshold is less than the above-mentioned second historical threshold. The above-mentioned first historical threshold is a lower threshold. When the illumination value is lower than the first historical threshold, the environmental state is night. The second historical threshold is an upper threshold. When the illumination value is higher than the second historical threshold, the environmental state is daytime. Therefore, when the current illumination value is between the first historical threshold and the second historical threshold (that is, greater than the first historical threshold and less than the second historical threshold), it means that the current environmental state cannot be determined only based on the illumination acquisition sensor and the historical illumination threshold group. At this time, the illumination difference between the current illumination value and the illumination value collected at the previous sampling moment can be calculated, and it can be determined based on the illumination difference whether it is the above-mentioned state of gradually brightening at dawn or gradually darkening at dusk. If so, it is determined that the target monitoring device is in a target change state. Otherwise, it is determined that the target monitoring device is not in a target change state.

[0071] Specifically, assuming that the first historical threshold is α1, the second historical threshold is β1, and the current illumination value is L new Then when α1<L new When β<β1, the above illumination difference can be calculated, and the above illumination difference can be calculated according to the following formula:

[0072] Δ=L new -L old

[0073] Wherein, the above Δ represents the above illumination difference, and the above L new Represented as the current illumination value above, the above L old It represents the illumination value collected at the previous sampling moment.

[0074] Optionally, in the step of determining whether the target monitoring device is in a target change state based on the light difference, the historical environmental state corresponding to the target monitoring device can also be obtained, and the historical environmental state is night or day; when the historical environmental state is night and the light difference is a positive number, the target monitoring device is in a target change state; when the historical environmental state is daytime and the light difference is a negative number, the target monitoring device is in a target change state.

[0075] In an embodiment of the present invention, the above-mentioned historical environmental state may be an environmental state determined before the current moment, that is, the last environmental state. The above-mentioned historical environmental state may be manually observed and recorded, or may be determined by the illumination difference at the last corresponding moment.

[0076] Specifically, when the historical environmental state is night and the light difference is a positive number (i.e., Δ>0), the target monitoring device is in a target change state (i.e., the above-mentioned state of gradually getting brighter at dawn), or when the historical environmental state is daytime and the light difference is a negative number (i.e., Δ<0), the target monitoring device is in a target change state (i.e., the above-mentioned state of gradually getting darker at dusk).

[0077] Optionally, in the step of updating the historical light threshold group corresponding to the target monitoring device based on the pixel color ratio to obtain the current light threshold group, the average brightness value of the currently captured image frame can also be determined; based on the average brightness value and the pixel color ratio, the current environmental state corresponding to the target monitoring device is determined; based on the current environmental state, the historical light threshold group corresponding to the target monitoring device is updated to obtain the current light threshold group.

[0078] In an embodiment of the present invention, if the current captured image frame is in the R (red) G (green) B (blue) color space, it is necessary to convert the current captured image frame into the HSV color space or the YUV color space. In HSV, H represents hue, S represents saturation, and V represents brightness, while in the YUV, Y represents brightness, U represents hue, and V represents saturation. If the current captured image frame is in the HSV color space or the YUV color space, no conversion is required.

[0079] After the conversion is completed, the sum of the brightness value of each pixel (i.e., the V value of each pixel in the HSV color space or the Y value of each pixel in the YUV color space) and the total number of pixels can be counted, and the sum of the above brightness values ​​divided by the above total number can obtain the above average brightness value.

[0080] After calculating the above average brightness value, the above average brightness value can be compared with the preset brightness threshold. When the average brightness value is higher than the preset brightness threshold, it means that the current environment state may be daytime, so it can be further determined whether the current environment state is daytime according to the pixel color ratio, thereby updating the historical light threshold group according to the current environment state to obtain the current light threshold group. When the average brightness value is lower than the preset brightness threshold, it means that the current environment state may be night, so it can be further determined whether the current environment state is night according to the pixel color ratio, thereby updating the historical light threshold group according to the current environment state to obtain the current light threshold group.

[0081] It is understandable that, since the historical illumination threshold group includes a lower threshold (i.e., the first historical threshold) and an upper threshold (i.e., the second historical threshold), when the current environmental state is daytime, only the upper threshold related to daytime needs to be updated, and when the current environmental state is nighttime, only the lower threshold related to nighttime needs to be updated. Through the current environmental state, the historical thresholds that need to be updated in the historical illumination threshold group can be more accurately determined without all being updated, so the updating accuracy of the threshold group can be further improved, thereby improving the switching accuracy of the monitoring mode.

[0082] Optionally, in the step of determining the current environmental state corresponding to the target monitoring device based on the average brightness value and the pixel color ratio, when the average brightness value is greater than a preset brightness threshold, and the first color ratio is greater than the preset first color ratio threshold, and the second color ratio is greater than the preset second color ratio threshold, the current environmental state corresponding to the target monitoring device is daytime; when the average brightness value is less than the preset brightness threshold, and the first color ratio is less than the preset first color ratio threshold, and the second color ratio is less than the preset second color ratio threshold, the current environmental state corresponding to the target monitoring device is night.

[0083] In an embodiment of the present invention, the current environment state is night or day, and the pixel color ratio includes a first color ratio and a second color ratio, and the first color ratio and the second color ratio are the ratios of the basic colors, that is, the colors related to day and night. The first color ratio can be the color ratio corresponding to blue, and the second color ratio can be the color ratio corresponding to yellow. Or the first color ratio and the second color ratio can also be the color ratios corresponding to other colors related to day and night. The preset brightness threshold, the preset first color ratio threshold and the preset second color ratio threshold can all be set through historical monitoring mode switching experience, or can be obtained through a limited number of experiments. Alternatively, the preset brightness threshold can also be set according to the brightness value of the critical point when the day transitions to the night. For example, if the first color ratio is the color ratio corresponding to blue, and the second color ratio is the color ratio corresponding to yellow, then the preset first color ratio threshold can be set to 30%, the preset second color ratio threshold can be set to 20%, and the preset brightness threshold can be set to 50%, wherein the brightness threshold can be expressed in the above percentage, or can be expressed in absolute value, for example, it can be set to 128 (grayscale value range is 0-255).

[0084] It can be understood that since the brightness threshold can be set according to the brightness value of the above-mentioned critical point, when the average brightness value is greater than the preset brightness threshold, it indicates that the current environmental state may be daytime. Therefore, when the average brightness value is greater than the preset brightness threshold, and the first color proportion is greater than the preset first color proportion threshold, and the second color proportion is greater than the preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is daytime.

[0085] Similarly, when the average brightness value is less than the preset brightness threshold, it indicates that the current environment state may be night. Therefore, when the average brightness value is less than the preset brightness threshold, and the first color proportion is less than the preset first color proportion threshold, and the second color proportion is less than the preset second color proportion threshold, the current environment state corresponding to the target monitoring device is night.

[0086] Specifically, assuming that the average brightness value is L, the preset brightness threshold is L th , the first color proportion (i.e. the color proportion corresponding to blue) is B, and the preset first color proportion threshold is B th , the second color proportion (i.e. the color proportion corresponding to yellow) is Y, and the preset second color proportion threshold is Y th .

[0087] If L>L th , and B>B th , Y>Y th , then the current environment state is daytime. If L<L th , and B<B th , Y<Y th , the current environment state is night.

[0088] Optionally, in the step of determining the current environmental state corresponding to the target monitoring device based on the average brightness value and the pixel color ratio, the overall color contrast of the currently captured image frame can also be determined; when the average brightness value is greater than a preset brightness threshold, and the first color ratio is not greater than the preset first color ratio threshold or the second color ratio is not greater than the preset second color ratio threshold, the current environmental state corresponding to the target monitoring device is determined based on the overall color contrast; when the average brightness value is less than the preset brightness threshold, and the first color ratio is not less than the preset first color ratio threshold or the second color ratio is not less than the preset second color ratio threshold, the current environmental state corresponding to the target monitoring device is determined based on the overall color contrast.

[0089] In the embodiment of the present invention, the above-mentioned overall color contrast can be determined by methods such as histogram analysis, standard deviation calculation, differentiation method or RMS contrast.

[0090] When the average brightness value is greater than the preset brightness threshold, the proportion of the first color is not greater than the preset first color proportion threshold or the proportion of the second color is not greater than the preset second color proportion threshold, it means that the current environmental state cannot be determined by the color proportion and the average brightness value to determine whether the current environmental state is daytime. At this time, the overall color contrast can be used to determine the current environmental state.

[0091] Specifically, when the average brightness value is greater than a preset brightness threshold, the first color proportion is not greater than a preset first color proportion threshold or the second color proportion is not greater than a preset second color proportion threshold, the overall color contrast can be compared with a preset overall color contrast threshold, and if the overall color contrast is greater than the preset overall color contrast threshold, the current environment state is daytime, otherwise, if the overall color contrast is not greater than the preset overall color contrast threshold, the current environment state is nighttime.

[0092] Similarly, when the average brightness value is less than the preset brightness threshold, the first color proportion is not less than the preset first color proportion threshold or the second color proportion is not less than the preset second color proportion threshold, it means that the current environmental state cannot be determined by the color proportion and the average brightness value to determine whether the current environmental state is night. At this time, the overall color contrast can be used to determine the current environmental state.

[0093] Specifically, when the average brightness value is less than the preset brightness threshold, the first color proportion is not less than the preset first color proportion threshold or the second color proportion is not less than the preset second color proportion threshold. The overall color contrast can be compared with the preset overall color contrast threshold. If the overall color contrast is less than the preset overall color contrast threshold, the current environment state is night. Conversely, if the overall color contrast is not less than the preset overall color contrast threshold, the current environment state is night.

[0094] The preset overall color contrast threshold can be set by historical monitoring mode switching experience, or can be obtained through a limited number of experiments. For example, it can be set to 40%, or in addition to being set in percentage, it can also be expressed in absolute values, such as 40 or 50.

[0095] Optionally, in the step of updating the historical light threshold group corresponding to the target monitoring device based on the current environmental state to obtain the current light threshold group, when the current environmental state is night, the first historical threshold is compared with the current light value to obtain a first comparison result, the first historical threshold is updated based on the first comparison result to obtain the first current threshold, and the second historical threshold is used as the second current threshold; when the current environmental state is daytime, the second historical threshold is compared with the current light value to obtain a second comparison result, the second historical threshold is updated based on the second comparison result to obtain the second current threshold, and the first historical threshold is used as the first current threshold.

[0096] In an embodiment of the present invention, the above-mentioned historical light threshold group includes a first historical threshold and a second historical threshold, the above-mentioned first historical threshold is smaller than the above-mentioned second historical threshold, the above-mentioned current light threshold group includes a first current threshold and a second current threshold, the above-mentioned first current threshold is smaller than the above-mentioned second current threshold, and the above-mentioned current environmental state is night or day.

[0097] Specifically, the first comparison result may be L new ≤α1 or L new >α1, where L new is the current illumination value, and α1 is the first historical threshold mentioned above. If L new ≤α1, then α1 can be directly determined as α2 (i.e., the first current threshold), and the second historical threshold can be determined as the second current threshold to complete the above update. new >α1, then L new As α2, the second historical threshold is determined as the second current threshold to complete the above update.

[0098] Similarly, the second comparison result can be L new ≥β1 or L new <β1, where β1 is the second historical threshold mentioned above, if L new ≥β1, then β1 can be directly determined as β2 (i.e., the second current threshold), and the first historical threshold can be determined as the first current threshold to complete the above update. new <β1, then L new As β2, and determine the first historical threshold as the first current threshold to complete the above update.

[0099] In a possible embodiment, at the initial stage (i.e., before the threshold value group is updated, or after the program is initialized), the first threshold value (i.e., α) can be set to 3lux, and the second threshold value (i.e., β) can be set to 5lux, that is, when the light value is less than 3lux, it is night, and when it is greater than 5lux, it is daytime. After the above-mentioned first threshold value and second threshold value are initially set, if it is detected that the above-mentioned target change state is in place, the above-mentioned first threshold value and second threshold value can be determined as the first historical threshold value and the second historical threshold value, and any one of the monitoring mode switching methods provided in the embodiments of the present invention is implemented to update the above-mentioned first historical threshold value and the second historical threshold value.

[0100] like Figure 2 As shown, the embodiment of the present invention also provides a flowchart of another monitoring mode switching method, which includes:

[0101] The first step is to set the light intensity threshold (i.e., historical light threshold group), which can be set based on historical monitoring mode switching experience or a limited number of experiments;

[0102] The second step is to collect light intensity data, that is, to obtain light values ​​through light collection sensors;

[0103] The third step is to process the data, which can be to determine whether it is in a target change state according to the light value;

[0104] The fourth step is to adjust the threshold, that is, if the target is in a change state, the light intensity threshold can be adjusted according to the pixel color ratio of the current captured image frame, and the monitoring mode of the target monitoring device can be switched according to the light intensity threshold.

[0105] It can be understood that any one of the monitoring mode switching methods provided in the embodiments of the present invention can dynamically adjust the light intensity threshold so that the target monitoring device can better adapt to different environments, thereby improving the stability and reliability of the device and avoiding the problem of frequent switching of monitoring modes in insufficient light or at the boundary between day and night.

[0106] like Figure 3 As shown, an embodiment of the present invention further provides a monitoring mode switching device, comprising:

[0107] The acquisition module 301 is used to acquire the current light value of the location of the target monitoring device and the light value collected at the previous sampling moment;

[0108] A determination module 302, configured to determine whether the target monitoring device is in a target change state based on the current light value and the light value collected at the previous sampling moment;

[0109] An extraction module 303 is used to extract a current captured image frame of the target monitoring device if the target is in the target change state, wherein the current captured image frame includes at least one pixel color ratio;

[0110] An updating module 304 is configured to update a historical illumination threshold group corresponding to the target monitoring device based on the pixel color proportion to obtain a current illumination threshold group;

[0111] The switching module 305 is used to switch the monitoring mode of the target monitoring device based on the current illumination threshold group.

[0112] Optionally, the historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, and the determination module 302 includes:

[0113] A first calculation submodule, configured to calculate a light difference between the current light value and the light value collected at a previous sampling moment when the current light value is greater than the first historical threshold and less than the second historical threshold;

[0114] The first determination submodule is used to determine whether the target monitoring device is in a target change state based on the illumination difference value.

[0115] Optionally, the first determining submodule includes:

[0116] A first acquisition unit is used to acquire a historical environment state corresponding to the target monitoring device, where the historical environment state is night or day;

[0117] A first processing unit, configured to, when the historical environment state is the dark night and the illumination difference is a positive number, the target monitoring device is in a target change state;

[0118] The second processing unit is used to, when the historical environmental state is daytime and the light difference is a negative number, the target monitoring device is in a target change state.

[0119] Optionally, the updating module 304 includes:

[0120] A second determination submodule, used to determine the average brightness value of the currently captured image frame;

[0121] A third determination submodule, configured to determine a current environment state corresponding to the target monitoring device based on the average brightness value and the pixel color ratio;

[0122] The first updating submodule is used to update the historical illumination threshold group corresponding to the target monitoring device based on the current environmental state to obtain the current illumination threshold group.

[0123] Optionally, the current environment state is night or day, the pixel color proportion includes a first color proportion and a second color proportion, and the third determination submodule includes:

[0124] A third processing unit is used for, when the average brightness value is greater than a preset brightness threshold, the first color proportion is greater than a preset first color proportion threshold, and the second color proportion is greater than a preset second color proportion threshold, the current environment state corresponding to the target monitoring device is the daytime;

[0125] The fourth processing unit is used to, when the average brightness value is less than a preset brightness threshold, and the first color proportion is less than a preset first color proportion threshold, and the second color proportion is less than a preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is the night.

[0126] Optionally, the third determining submodule further includes:

[0127] A first determining unit, configured to determine the overall color contrast of the currently captured image frame;

[0128] a fifth processing unit, configured to determine, based on the overall color contrast, a current environment state corresponding to the target monitoring device when the average brightness value is greater than a preset brightness threshold and the first color proportion is not greater than a preset first color proportion threshold or the second color proportion is not greater than a preset second color proportion threshold;

[0129] The sixth processing unit is used to determine the current environmental state corresponding to the target monitoring device based on the overall color contrast when the average brightness value is less than a preset brightness threshold and the first color proportion is not less than a preset first color proportion threshold or the second color proportion is not less than a preset second color proportion threshold.

[0130] Optionally, the historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, the current illumination threshold group includes a first current threshold and a second current threshold, the first current threshold is less than the second current threshold, the current environment state is night or day, and the first updating submodule includes:

[0131] a first updating unit, configured to, when the current environmental state is the night, compare the first historical threshold with the current illumination value to obtain a first comparison result, update the first historical threshold based on the first comparison result to obtain a first current threshold, and use the second historical threshold as the second current threshold;

[0132] The second updating unit is used to compare the second historical threshold with the current light value when the current environmental state is daytime to obtain a second comparison result, update the second historical threshold based on the second comparison result to obtain a second current threshold, and use the first historical threshold as the first current threshold.

[0133] like Figure 4 As shown, an embodiment of the present invention further provides an electronic device, characterized in that it includes a processor, and the processor can execute any one of the above-mentioned monitoring mode switching methods.

[0134] Specifically, it includes a processor 401 and a memory 402, and a computer program for executing the monitoring mode switching method stored in the memory 402 and capable of running on the processor 401, wherein:

[0135] The processor 401 runs the computer program of the monitoring mode switching method stored in the memory 402 to perform the following steps:

[0136] Obtain the current light value at the location of the target monitoring device and the light value collected at the previous sampling moment;

[0137] Determining whether the target monitoring device is in a target change state based on the current light value and the light value collected at the previous sampling moment;

[0138] If the target is in the target change state, extracting a current captured image frame of the target monitoring device, wherein the current captured image frame includes at least one pixel color ratio;

[0139] Based on the pixel color proportion, the historical illumination threshold group corresponding to the target monitoring device is updated to obtain a current illumination threshold group;

[0140] Based on the current illumination threshold group, the monitoring mode of the target monitoring device is switched.

[0141] Optionally, the historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, and the processor 401 determines whether the target monitoring device is in a target change state based on the current illumination value and the illumination value collected at the previous sampling moment, including:

[0142] When the current illumination value is greater than the first historical threshold and less than the second historical threshold, calculating the illumination difference between the current illumination value and the illumination value collected at the previous sampling moment;

[0143] Based on the illumination difference value, it is determined whether the target monitoring device is in a target change state.

[0144] Optionally, the determining, based on the illumination difference, whether the target monitoring device is in a target change state performed by the processor 401 includes:

[0145] Acquire a historical environment state corresponding to the target monitoring device, where the historical environment state is night or day;

[0146] When the historical environment state is the dark night and the illumination difference is a positive number, the target monitoring device is in a target change state;

[0147] When the historical environment state is daytime and the light difference is a negative number, the target monitoring device is in a target change state.

[0148] Optionally, the updating of the historical illumination threshold group corresponding to the target monitoring device based on the pixel color proportion to obtain the current illumination threshold group performed by the processor 401 includes:

[0149] Determining an average brightness value of the currently captured image frame;

[0150] Based on the average brightness value and the pixel color ratio, determine the current environment state corresponding to the target monitoring device;

[0151] The historical illumination threshold group corresponding to the target monitoring device is updated based on the current environmental state to obtain a current illumination threshold group.

[0152] Optionally, the current environment state is night or day, the pixel color proportion includes a first color proportion and a second color proportion, and the processor 401 determines the current environment state corresponding to the target monitoring device based on the average brightness value and the pixel color proportion, including:

[0153] When the average brightness value is greater than a preset brightness threshold, and the first color proportion is greater than a preset first color proportion threshold, and the second color proportion is greater than a preset second color proportion threshold, the current environment state corresponding to the target monitoring device is daytime;

[0154] When the average brightness value is less than a preset brightness threshold, and the first color proportion is less than a preset first color proportion threshold, and the second color proportion is less than a preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is the night.

[0155] Optionally, the determining of the current environment state corresponding to the target monitoring device based on the average brightness value and the pixel color proportion performed by the processor 401 further includes:

[0156] Determining the overall color contrast of the currently captured image frame;

[0157] When the average brightness value is greater than a preset brightness threshold, and the first color proportion is not greater than a preset first color proportion threshold or the second color proportion is not greater than a preset second color proportion threshold, determine the current environment state corresponding to the target monitoring device based on the overall color contrast;

[0158] When the average brightness value is less than the preset brightness threshold, and the first color proportion is not less than the preset first color proportion threshold or the second color proportion is not less than the preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is determined based on the overall color contrast.

[0159] Optionally, the historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, the current illumination threshold group includes a first current threshold and a second current threshold, the first current threshold is less than the second current threshold, the current environmental state is night or day, and the processor 401 executes the updating of the historical illumination threshold group corresponding to the target monitoring device based on the current environmental state to obtain the current illumination threshold group, including:

[0160] When the current environment state is the night, comparing the first historical threshold with the current light value to obtain a first comparison result, updating the first historical threshold based on the first comparison result to obtain a first current threshold, and using the second historical threshold as the second current threshold;

[0161] When the current environmental state is daytime, the second historical threshold is compared with the current light value to obtain a second comparison result, the second historical threshold is updated based on the second comparison result to obtain a second current threshold, and the first historical threshold is used as the first current threshold.

[0162] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the monitoring mode switching method or the application-side monitoring mode switching method provided in the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0163] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0164] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A monitoring mode switching method, characterized in that: The method comprises the following steps: Obtain the current light value at the location of the target monitoring device and the light value collected at the previous sampling moment; Determining whether the target monitoring device is in a target change state based on the current light value and the light value collected at the previous sampling moment; If the target is in the target change state, extracting a current captured image frame of the target monitoring device, wherein the current captured image frame includes at least one pixel color ratio; Based on the pixel color proportion, the historical illumination threshold group corresponding to the target monitoring device is updated to obtain a current illumination threshold group; Based on the current illumination threshold group, the monitoring mode of the target monitoring device is switched.

2. The monitoring mode switching method according to claim 1, characterized in that: The historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, and the determining whether the target monitoring device is in a target change state based on the current illumination value and the illumination value collected at the previous sampling moment includes: When the current illumination value is greater than the first historical threshold and less than the second historical threshold, calculating the illumination difference between the current illumination value and the illumination value collected at the previous sampling moment; Based on the illumination difference value, it is determined whether the target monitoring device is in a target change state.

3. The monitoring mode switching method according to claim 2, characterized in that: The determining, based on the illumination difference, whether the target monitoring device is in a target change state comprises: Acquire a historical environment state corresponding to the target monitoring device, where the historical environment state is night or day; When the historical environment state is the dark night and the illumination difference is a positive number, the target monitoring device is in a target change state; When the historical environment state is daytime and the light difference is a negative number, the target monitoring device is in a target change state.

4. The monitoring mode switching method according to claim 1, characterized in that: The updating of the historical illumination threshold group corresponding to the target monitoring device based on the pixel color proportion to obtain the current illumination threshold group includes: Determining an average brightness value of the currently captured image frame; Based on the average brightness value and the pixel color ratio, determine the current environment state corresponding to the target monitoring device; The historical illumination threshold group corresponding to the target monitoring device is updated based on the current environmental state to obtain a current illumination threshold group.

5. The monitoring mode switching method according to claim 4, characterized in that: The current environment state is night or day, the pixel color ratio includes a first color ratio and a second color ratio, and determining the current environment state corresponding to the target monitoring device based on the average brightness value and the pixel color ratio includes: When the average brightness value is greater than a preset brightness threshold, and the first color proportion is greater than a preset first color proportion threshold, and the second color proportion is greater than a preset second color proportion threshold, the current environment state corresponding to the target monitoring device is daytime; When the average brightness value is less than a preset brightness threshold, and the first color proportion is less than a preset first color proportion threshold, and the second color proportion is less than a preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is the night.

6. The monitoring mode switching method according to claim 5, characterized in that: The determining, based on the average brightness value and the pixel color proportion, of the current environment state corresponding to the target monitoring device further includes: Determining the overall color contrast of the currently captured image frame; When the average brightness value is greater than a preset brightness threshold, and the first color proportion is not greater than a preset first color proportion threshold or the second color proportion is not greater than a preset second color proportion threshold, determine the current environment state corresponding to the target monitoring device based on the overall color contrast; When the average brightness value is less than the preset brightness threshold, and the first color proportion is not less than the preset first color proportion threshold or the second color proportion is not less than the preset second color proportion threshold, the current environmental state corresponding to the target monitoring device is determined based on the overall color contrast.

7. The monitoring mode switching method according to any one of claims 4 to 6, characterized in that: The historical illumination threshold group includes a first historical threshold and a second historical threshold, the first historical threshold is less than the second historical threshold, the current illumination threshold group includes a first current threshold and a second current threshold, the first current threshold is less than the second current threshold, the current environment state is night or day, and the historical illumination threshold group corresponding to the target monitoring device is updated based on the current environment state to obtain the current illumination threshold group, including: When the current environment state is the night, comparing the first historical threshold with the current light value to obtain a first comparison result, updating the first historical threshold based on the first comparison result to obtain a first current threshold, and using the second historical threshold as the second current threshold; When the current environmental state is daytime, the second historical threshold is compared with the current light value to obtain a second comparison result, the second historical threshold is updated based on the second comparison result to obtain a second current threshold, and the first historical threshold is used as the first current threshold.

8. A monitoring mode switching device, characterized in that: The monitoring mode switching device comprises: An acquisition module is used to obtain the current light value of the location of the target monitoring device and the light value collected at the previous sampling moment; A determination module, configured to determine whether the target monitoring device is in a target change state based on the current light value and the light value collected at the previous sampling moment; An extraction module, configured to extract a current captured image frame of the target monitoring device if the target is in the target change state, wherein the current captured image frame includes at least one pixel color ratio; An updating module, configured to update a historical illumination threshold group corresponding to the target monitoring device based on the pixel color proportion to obtain a current illumination threshold group; A switching module is used to switch the monitoring mode of the target monitoring device based on the current light threshold group.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the monitoring mode switching method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the monitoring mode switching method according to any one of claims 1 to 7 are implemented.