Camera mode switching method, camera device and computer readable storage medium

By detecting the primary color distribution in the image data of the camera device in the fog penetration mode, the problem of insufficient accuracy in mode switching of the camera device is solved, and accurate mode switching in harsh environments is achieved.

CN115225810BActive Publication Date: 2024-10-22ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210576156.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-24
Publication Date
2024-10-22
Estimated Expiration
2042-05-24

AI Technical Summary

Technical Problem

Existing camera devices have insufficient accuracy when switching camera modes, especially when the fog has not dissipated. It is easy to switch to the fog penetration mode by mistake.

Method used

By acquiring the image data captured by the camera device in the fog-transmitting mode, the primary color distribution of the pixels in the image data is detected, and the fog-transmitting mode is maintained or switched to daylight mode according to the primary color distribution.

Benefits of technology

It improves the accuracy of camera mode switching, reduces errors, and ensures accurate camera mode switching in harsh environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115225810B_ABST
    Figure CN115225810B_ABST
Patent Text Reader

Abstract

The present application discloses a camera mode switching method, a camera device and a computer-readable storage medium, wherein the camera mode switching method comprises: obtaining image data captured by the camera device in the through-fog mode; wherein the filter is covered at the lens of the camera device when the camera device is in the through-fog mode; detecting the image data to obtain the primary color distribution of the pixel points in the image; based on the primary color distribution, choosing to maintain the through-fog mode or switch to the daylight mode; wherein the filter is not covered at the lens of the camera device when the camera device is in the daylight mode. The above scheme can accurately switch the camera mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a camera mode switching method, a camera device and a computer-readable storage medium. Background Art

[0002] With the continuous development of electronic information technology, various camera devices are widely used in people's daily life. Among them, camera devices with fog-penetrating function are mainly used in extreme weather with low visibility (such as rainy days, heavy fog, haze) to improve the monitoring quality and make the image more transparent and clear.

[0003] However, existing camera devices rarely have the ability to switch camera modes intelligently and automatically. Although some camera devices have the function of mode switching, the accuracy of mode switching still needs to be improved. For example, the fog-penetrating mode is mistakenly switched before the fog has dissipated. In view of this, how to accurately switch the camera mode has become an urgent problem to be solved. Summary of the invention

[0004] The main technical problem solved by the present application is to provide a camera mode switching method, a camera device and a computer-readable storage medium, which can accurately switch the camera mode.

[0005] In order to solve the above-mentioned technical problems, the first aspect of the present application provides a camera mode switching method, including: obtaining image data taken by a camera device in a through-fog mode; wherein, when the camera device is in the through-fog mode, a filter is covered at the lens of the camera device; the image data is detected to obtain the primary color distribution of pixel points in the image; based on the primary color distribution, it is selected to maintain the through-fog mode or switch to the daylight mode; wherein, when the camera device is in the daylight mode, the filter is not covered at the lens.

[0006] In order to solve the above-mentioned technical problems, the second aspect of the present application provides a camera device, including a memory, an image sensor and a processor, and the memory and the image sensor are both coupled to the processor, and the processor is used to execute program instructions stored in the memory to implement the camera mode switching method of the first aspect mentioned above.

[0007] In order to solve the above technical problem, the third aspect of the present application provides a computer-readable storage medium, which stores program instructions that can be executed by a processor, and the program instructions are used to implement the camera mode switching method in the above first aspect.

[0008] In the above scheme, by acquiring the image data captured by the camera device in the through-fog mode and detecting the distribution of the primary colors of the pixels in the image data, the through-fog mode is maintained or switched to the daylight mode according to the distribution of the primary colors. Therefore, by detecting the distribution of the primary colors of the pixels in the image data, it is possible to accurately analyze the transmission of each primary color light in the current environment, thereby improving the accuracy of determining whether the current environment is in the through-fog mode, which is conducive to reducing errors as much as possible, and thus accurately switching the camera mode. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 It is a flowchart of an embodiment of a camera mode switching method of the present application;

[0010] Figure 2 It is the response curve of the camera device to the three optical primary colors of red, green and blue;

[0011] Figure 3 It is a schematic diagram of setting the filter transmittance based on the response curve;

[0012] Figure 4 is a flowchart of another embodiment of the camera mode switching method of the present application;

[0013] Figure 5 It is a schematic diagram of the framework of an embodiment of the imaging device of the present application;

[0014] Figure 6 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application;

[0015] Figure 7 It is a schematic diagram of the framework of an embodiment of a camera mode switching device. DETAILED DESCRIPTION

[0016] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0017] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0018] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.

[0019] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of a camera mode switching method of the present application. Specifically, the camera mode switching method in this embodiment may include the following steps:

[0020] Step S11: acquiring image data captured by the camera device in the fog penetration mode.

[0021] In this embodiment, the camera device is a device for realizing the camera function, including but not limited to CCD (Charge Coupled Device) camera, CMOS (Complementary Metal-Oxide-Semiconductor) camera and the like.

[0022] In this embodiment, the fog-through mode refers to a mode in which the camera device works by covering the filter at the lens, which can improve the monitoring quality in extreme weather with low visibility (such as rainy days, heavy fog, and haze); the daylight mode refers to a mode in which the camera device works without covering the filter at the lens, and generally shoots in normal weather.

[0023] In one implementation scenario, the image data includes data information such as pictures and videos taken by the camera element in the fog-penetrating mode.

[0024] In one implementation scenario, the filter uses the optical fog-penetrating principle to realize the fog-penetrating mode of the imaging device. Generally, the filter is set with a bandpass according to the wavelength range, which can cut off light in a part of the wavelength range and transmit light in another part of the wavelength range. Ultimately, it is beneficial to ensure that light of a specific wavelength is clearly imaged on the imaging device in harsh environments.

[0025] In a specific implementation scenario, the filter can be an optical filter that cuts off light in the range of 400nm-700nm and transmits light in the range of 700nm-1000nm; the filter can also be an optical filter that cuts off light in the range of 400nm-750nm and transmits light in the range of 750nm-1000nm; the filter can also be an optical filter that cuts off light in the range of 400nm-800nm ​​and transmits light in the range of 800nm-1000nm. The specific wavelength range is not specifically limited here.

[0026] In one implementation scenario, after the light passes through the filter, the relative response values ​​of the first primary color, the second primary color, and the third primary color on the imaging device meet the preset relationship in the first band, and do not meet the preset relationship in the second band. The relative response value represents the ratio of the radiance received by a certain color to the incident radiance at each wavelength of the imaging device.

[0027] In a specific implementation scenario, the first primary color, the second primary color and the third primary color may preferably be the three optical primary colors of red, green and blue. In some special scenarios, the first primary color, the second primary color and the third primary color may also be other colors such as yellow, purple, black, etc., which are not specifically limited here.

[0028] In a specific implementation scenario, the first band may be a wavelength range of 400nm-700nm, the second band may be a wavelength range of 700nm-1000nm, and the preset relationship may be that the relative response value of the first primary color is greater than the relative response value of either the second primary color or the third primary color.

[0029] In another specific implementation scenario, the first band can also be a wavelength range of 400nm-750nm, the second band can be a wavelength range of 750nm-1000nm, and the preset relationship can be the ratio of the relative response values ​​of the first primary color to the second primary color, and the ratio of the relative response values ​​of the first primary color to the second primary color are both greater than 150%, 200% or other specific ratios.

[0030] In another specific implementation scenario, the first band may also be a wavelength range of 400nm-800nm, the second band may be a wavelength range of 800nm-1000nm, and the preset relationship may be that the relative response value of the first primary color is greater than 80%, and the relative response value of either the second primary color or the third primary color is less than 40%.

[0031] Therefore, the relative response values ​​of the three primary colors on the imaging device after the light passes through the filter meet the requirements of the preset relationship, which facilitates the subsequent analysis of the image data, so as to ultimately achieve accurate switching of the imaging mode.

[0032] In another implementation scenario, in the first band, the minimum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color, and the minimum value of the difference between the relative response value of the first primary color and the relative response value of the third primary color are both greater than the first preset difference; in the second band, the maximum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color, and the maximum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color are both not greater than the second preset difference. The first preset difference can be a specific value such as 0.3, 0.4, etc., and the second preset difference can be a specific value such as 0.05, 0.1, etc. that is smaller than the first preset difference.

[0033] In a specific implementation scenario, the description of the first primary color, the second primary color, the third primary color, and the first band and the second band can refer to the above-mentioned embodiment. At this time, the first preset difference is 0.3, the second preset difference is 0.05, and in the wavelength range of 400nm-800nm, the minimum value of the green relative response value is 0.8, the maximum value of the red relative response value is 0.3, and the maximum value of the blue relative response value is 0.35; in the wavelength range of 800nm-1000nm, the relative response values ​​of green, red, and blue remain consistent, all of which are 0.4. Therefore, in the wavelength range of 400nm-800nm, the minimum value of the difference between the green relative response value and the red relative response value is 0.5, and the minimum value of the difference between the green relative response value and the blue relative response value is 0.45, both of which are greater than the first preset difference of 0.3; in the wavelength range of 800nm-1000nm, the difference between the green relative response value and the red relative response value and the difference between the green relative response value and the blue relative response value are both 0, both of which are less than the second preset difference of 0.05.

[0034] In another specific implementation scenario, similarly, the first preset difference is set to 0.5, the second preset difference is set to 0.1, and within the wavelength range of 400nm-700nm, the minimum value of the red relative response value is 0.9, the maximum value of the green relative response value is 0.3, and the maximum value of the blue relative response value is 0.25; within the wavelength range of 700nm-1000nm, the green, red, and blue relative response values ​​are all within the numerical range of 0.3-0.4. Therefore, within the wavelength range of 400nm-700nm, the minimum value of the difference between the red relative response value and the green relative response value is 0.6, and the minimum value of the difference between the red relative response value and the blue relative response value is 0.65, both of which are greater than the first preset difference of 0.5; since within the wavelength range of 700nm-1000nm, the green, red, and blue relative response values ​​are all within the numerical range of 0.3-0.4, the difference between the red relative response value and the green relative response value and the difference between the red relative response value and the blue relative response value are both less than the second preset difference of 0.1.

[0035] Therefore, after the light passes through the filter, the relative response value of one primary color is highlighted in the first band, and the relative response values ​​of the three primary colors in the second band are almost consistent, so that the light shows a significant difference in the two bands after passing through the filter, which is conducive to subsequent image analysis.

[0036] In another implementation scenario, the transmittance of the filter can be set based on the response curve of the imaging device to the three primary colors in daylight mode (the filter is not covered at the lens), so as to achieve that the relative response values ​​of the first primary color, the second primary color and the third primary color on the imaging device after the light passes through the filter meet the preset relationship in the first band, and do not meet the preset relationship in the second band.

[0037] Furthermore, for ease of understanding, the wavelength range of light can be simply divided according to the wavelength range. The wavelength range of the first band is 400nm-800nm, which is recorded as the visible light band; the wavelength range of the second band is 800nm-1000nm, which is recorded as the near-infrared band. Figure 2 , Figure 2 It is the response curve of the camera device to the three optical primary colors of red, green and blue. Figure 2 As shown, the relative response values ​​of the three primary colors of red, green and blue are almost the same in the near-infrared band, but the relative response values ​​of the three in the visible light band are significantly different. In order to facilitate the setting of the transmittance of the light-transmitting film, the response curve can be referred to to screen out the wavelength range in which the camera device has a higher relative response value for the primary color. As for green, it can be seen that the relative response value of green is the highest in the wavelength range of 505nm-575nm in the visible light band, so the transmittance of the light-transmitting film can be set to be relatively high in the wavelength range of 505nm-575nm in the visible light band. Similarly, it can also be seen that the relative response value of red is higher in the wavelength range of 575nm-700nm in the visible light band, and the relative response value of blue is higher in the wavelength range of 400nm-480nm in the visible light band.

[0038] In a specific implementation scenario, the first primary color may be green, the second primary color may be red, and the third primary color may be blue. Figure 2 and Figure 3 , Figure 3 This is a schematic diagram of setting the filter transmittance based on the response curve, such as Figure 3 As shown, the filter can be set to have a transmittance greater than 80% in the wavelength range of 505nm-575nm in the visible light band, and a transmittance greater than 80% in the wavelength range of 800nm-1000nm in the near infrared band. In addition, it is also necessary to set the transmittance in the wavelength ranges of 400nm-505nm and 575nm-800nm ​​in the visible light band to be less than 40%, and the final filter is a bandpass filter. Further explanation, since the filter has a higher transmittance only in the wavelength range of 505nm-575nm in the visible light band, and the relative response value of green is the highest in this wavelength range, when the camera device finally forms an image, the green component in the image must be higher. Similarly, the transmittance of the filter in the near infrared band is relatively high, and the transmittance of green, red and blue in the near infrared band is almost the same, so when the camera device finally forms an image, the proportion of the three components is almost the same. There is a significant difference in imaging in the visible light band and the near infrared band, which is conducive to accurate switching of the camera mode.

[0039] In another specific implementation scenario, similarly, the first primary color can be selected as red, the second primary color can be green, and the third primary color can be blue. The filter can be set to have a transmittance greater than 80% in the visible light band 575nm-700nm wavelength range, and a transmittance greater than 80% in the near infrared band 800nm-1000nm wavelength range. In addition, it is also necessary to set the transmittance in the visible light band 400nm-575nm and 700nm-800nm ​​wavelength ranges to be less than 40%.

[0040] In another specific implementation scenario, similarly, the first primary color can be selected as blue, the second primary color can be green, and the third primary color can be red. The filter can be set to have a transmittance greater than 80% in the visible light band 400nm-480nm wavelength range, and a transmittance greater than 80% in the near infrared band 800nm-1000nm wavelength range. In addition, it is also necessary to set it to be less than 40% in the visible light band 480nm-800nm ​​wavelength range.

[0041] It should be noted that, based on the response curve of the imaging device to the three primary colors, the transmittance conditions of the filter for the first primary color, the second primary color and the third primary color are set, including but not limited to the above-mentioned methods. Therefore, according to the response curve of the imaging device to the three optical primary colors of red, green and blue, the wavelength range with a higher response value of the imaging device to the primary colors is directly selected for setting, making the setting of the filter simpler and easier to implement.

[0042] Step S12: Detect the image data to obtain the primary color distribution of the pixels in the image.

[0043] In one implementation scenario, each pixel point included in the image is detected to obtain the primary color distribution of each pixel point. The primary color distribution of each pixel point includes: a first ratio between a pixel component of a first primary color and a pixel component of a second primary color, and a second ratio between a pixel component of the first primary color and a pixel component of a third primary color.

[0044] In a specific implementation scenario, the three optical primary colors of red, green and blue are also set as primary colors. Further, green is selected as the first primary color, red is selected as the second primary color, and blue is selected as the third primary color. The primary color distribution of the pixel point includes the ratio of the green component to the red component and the ratio of the green component to the blue component in the pixel point.

[0045] In another implementation scenario, the primary color distribution of each pixel includes the proportion of the first primary color component to the entire pixel.

[0046] In a specific implementation scenario, the three optical primary colors of red, green and blue are also set as primary colors. Further, green is selected as the first primary color, and the primary color distribution of the pixel point includes the proportion of the green component in the pixel point to the entire pixel point.

[0047] Step S13: Based on the distribution of primary colors, choose to maintain the fog-penetrating mode or switch to the daylight mode.

[0048] In one implementation scenario, the proportion of pixels in the image data whose primary color distribution conditions meet the preset conditions is counted, and the fog penetration mode is maintained or switched to the daylight mode is selected according to the proportion of the number. When the primary color distribution conditions include a first ratio between a pixel component of a first primary color and a pixel component of a second primary color, and a second ratio between a pixel component of the first primary color and a pixel component of a third primary color, the preset conditions may include that the first ratio is greater than a first threshold value and the second ratio is greater than a second threshold value.

[0049] In a specific implementation scenario, the first threshold and the second threshold can be specific values ​​such as 1.5 and 2, and no specific limitation is made here. As mentioned above, the number of pixels in the image that satisfy the ratio of green component to red component greater than 1.5 and the ratio of green component to blue component greater than 2 is counted to be 500, and the total number of pixels in the image is 1000, and the number accounts for 50% at this time.

[0050] It should be noted that the first threshold and the second threshold can be set to be equal or unequal. Preferably, the statistical efficiency is improved by setting the first threshold and the second threshold to be equal.

[0051] In another implementation scenario, the number of pixels in the image data that meet the preset conditions is counted, and the fog penetration mode is maintained or switched to the daylight mode according to the number of pixels. When the primary color distribution includes the proportion of the first primary color component to the entire pixel, the preset condition can be set to include the proportion being greater than the proportion threshold.

[0052] In a specific implementation scenario, the ratio threshold can be set to a specific value such as 50%, and no specific limitation is made here. As mentioned above, the number of pixels in the image data that meet the requirement that the ratio of green components to pixels exceeds 50% is 600.

[0053] In the above scheme, pixels that meet the requirements in the image data are screened out through preset conditions, and mode switching is achieved based on the proportion of these pixels in the image data. By analyzing a large number of pixels, the possibility of erroneous switching is greatly reduced.

[0054] Furthermore, in one implementation scenario, the mist penetration mode is maintained or switched to the daylight mode according to the number ratio. In response to the number ratio being not less than the preset ratio, the mode is switched to the daylight mode; and / or, in response to the number ratio being less than the preset ratio, the mist penetration mode is maintained. Similarly, the preset ratio can be set to a specific value such as 60%, 70%, etc., which is not specifically limited here.

[0055] It is easy to understand that meeting the preset conditions indicates that the proportion of the first primary color in the pixel exceeds a certain threshold requirement, and the pixel can be understood as a pixel generated in the first band (visible light band). Therefore, the proportion of the number of pixels that meet the preset conditions in the image data reflects the proportion of pixels in the first band (visible light band) in the image data. The higher the proportion, the higher the visibility of the camera environment. When it exceeds the preset proportion, it can be switched to daylight mode. Therefore, by switching judgment based on the proportion, the possibility of erroneous mode switching due to analysis errors or statistical errors of some pixels is minimized as much as possible, ensuring the accuracy of mode switching.

[0056] In a specific implementation scenario, the preset ratio is set to 60%. As mentioned above, the number of pixels that meet the preset conditions is counted as 500, and the total number of pixels in the image is 1000. At this time, the number accounts for 50%, which is less than 60%. Therefore, the fog penetration mode is maintained without any operation.

[0057] In another specific implementation scenario, the preset ratio is set to 60%. As mentioned above, the number of pixels that meet the preset conditions is counted as 700, and the total number of pixels in the image is 1000. At this time, the number accounts for 70%, and 70% is not less than 60%. Therefore, it is chosen to switch to daylight mode and remove the filter covering the lens.

[0058] In another implementation scenario, the fog-penetrating mode is maintained or switched to the daylight mode according to the number of pixels that meet the preset conditions. In response to the number of pixels that meet the preset conditions being not less than a preset number threshold, the mode is switched to the daylight mode; and / or, in response to the number of pixels that meet the preset conditions being less than a preset number threshold, the fog-penetrating mode is maintained.

[0059] In a specific implementation scenario, the preset number threshold is 800. As mentioned above, 500 pixels are counted that meet the preset conditions, and 500 is less than 800. Therefore, the fog penetration mode is maintained without any operation.

[0060] In another specific implementation scenario, the preset number threshold is 800. As mentioned above, the number of pixels meeting the preset conditions is counted as 900, and 900 is not less than 800. Therefore, it is chosen to switch to daylight mode and remove the filter covering the lens.

[0061] In the above scheme, by acquiring the image data captured by the camera device in the through-fog mode and detecting the distribution of the primary colors of the pixels in the image data, the through-fog mode is maintained or switched to the daylight mode according to the distribution of the primary colors. Therefore, by detecting the distribution of the primary colors of the pixels in the image data, it is possible to accurately analyze the transmission of each primary color light in the current environment, thereby improving the accuracy of determining whether the current environment is in the through-fog mode, which is conducive to reducing errors as much as possible, and thus accurately switching the camera mode.

[0062] See also Figure 4 , Figure 4 1 is a flow chart of another embodiment of the camera mode switching method of the present application. Specifically, the camera mode switching method in this embodiment may include the following steps:

[0063] Step S401: Acquire the response curve of the imaging device, and modify the filter transmittance based on the response curve.

[0064] Obtaining the response curve of the imaging device and modifying the transmittance of the filter based on the response curve is equivalent to "setting the transmittance of the filter based on the response curve of the imaging device to the three primary colors in daylight mode (the filter is not covered at the lens)" in the aforementioned embodiment. The specific implementation steps can be referred to the aforementioned embodiment and will not be repeated here.

[0065] Step S402: Acquire image data captured by the camera device in the fog penetration mode.

[0066] Acquiring the image data captured by the camera device in the fog penetration mode is completely consistent with step S11 in the aforementioned embodiment. The specific implementation steps can refer to the aforementioned embodiment and will not be repeated here.

[0067] Step S403: Detect the image data to obtain the primary color distribution of the pixels in the image.

[0068] The image data is detected to obtain the distribution of primary colors of pixels in the image, which is completely consistent with step S12 in the aforementioned embodiment. The specific implementation steps can refer to the aforementioned embodiment and will not be repeated here.

[0069] Step S404: Determine whether the primary color distribution meets the preset distribution condition. If yes, execute step S405; otherwise, execute step S407.

[0070] Determining whether the primary color distribution satisfies the preset distribution conditions is equivalent to the “counting the proportion of pixel points in the image data whose primary color distribution meets the preset conditions” and determining the size relationship between the “quantity proportion” and the “preset ratio” or “counting the number of pixel points in the image data that meet the preset conditions” and determining the size relationship between the “number of pixel points” and the “preset number threshold” in the aforementioned embodiments. The specific implementation steps can refer to the aforementioned embodiments and will not be repeated here.

[0071] Step S405: the camera device is switched to the daylight mode.

[0072] In response to the primary color distribution satisfying a preset distribution condition, the camera device switches to a daylight mode, which is equivalent to removing the filter covering the lens.

[0073] Step S406: In response to the fog concentration satisfying a preset switching condition, the camera device switches to the fog penetration mode.

[0074] In one implementation scenario, the camera device in the daylight mode obtains the fog concentration in real time, and switches to the fog-penetrating mode when the fog concentration meets the preset switching concentration, which is equivalent to covering the filter at the lens.

[0075] Step S407: the camera device maintains the fog-penetrating mode.

[0076] In response to the primary color distribution not satisfying the preset distribution condition, the camera device maintains the fog penetration mode without performing any operation.

[0077] Step S408: Return to execute step S402 and subsequent steps.

[0078] After step S406 and step S407 are completed, the process returns to step S402 and subsequent steps to continue analyzing and judging the image data, so that the entire camera mode switching method can be executed in a closed loop.

[0079] In the above scheme, the transmittance of the filter is modified so that the transmittance of light is significantly different in the first band and the second band, and then the image data taken by the camera device in the through-fog mode is obtained, and the primary color distribution of the pixel points in the image data is detected. According to the primary color distribution and the significant difference in the light transmittance in the first band and the second band, it is selected to maintain the through-fog mode or switch to the daylight mode, and the closed-loop execution continues. Therefore, by detecting the primary color distribution of the pixel points in the image data, it can help to accurately analyze the transmission of each primary color light in the current environment, thereby improving the accuracy of determining whether the current environment is to maintain the through-fog mode, which is conducive to reducing errors as much as possible, and then accurately switching the camera mode.

[0080] See also Figure 5 , Figure 5 1 is a schematic diagram of a framework of an embodiment of an imaging device 50 of the present application. Specifically, the imaging device 50 includes a memory 51, an image sensor 52 and a processor 53, and the memory 51 and the image sensor 52 are both coupled to the processor 53. The processor 53 is used to execute the program instructions stored in the memory 51 to implement the steps in the imaging mode switching method of any of the above embodiments.

[0081] Specifically, the processor 53 can control itself as well as the memory 51 and the image sensor 52 to perform the steps in the camera mode switching method of any of the above embodiments. The processor 53 can also be called a CPU (Central Processing Unit). The processor 53 may be an integrated circuit chip with signal processing capabilities. The processor 53 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 53 can be implemented by multiple integrated circuit chips.

[0082] In another implementation scenario, the camera device 50 further includes a lens, a filter, and a transmission mechanism, and the transmission mechanism is used to cover the lens with the filter, or remove the filter from the lens under the control of the processor 53. When the filter covers the lens, it indicates that the camera device 50 is in the fog-penetrating mode; when the filter does not cover the lens, it indicates that the camera device 50 is in the daylight mode.

[0083] In the above scheme, by acquiring the image data captured by the camera device in the through-fog mode and detecting the distribution of the primary colors of the pixels in the image data, the through-fog mode is maintained or switched to the daylight mode according to the distribution of the primary colors. Therefore, by detecting the distribution of the primary colors of the pixels in the image data, it is possible to accurately analyze the transmission of each primary color light in the current environment, thereby improving the accuracy of determining whether the current environment is in the through-fog mode, which is conducive to reducing errors as much as possible, and thus accurately switching the camera mode.

[0084] See also Figure 6 , Figure 61 is a schematic diagram of a framework of an embodiment of a computer-readable storage medium 60 of the present application. In this embodiment, the computer-readable storage medium 60 stores program instructions 601 executable by a processor, and the program instructions 601 are used to execute the steps in the above-mentioned camera mode switching method embodiment.

[0085] The computer-readable storage medium 60 may specifically be a medium that can store program instructions, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the program instructions. The server may send the stored program instructions to other devices for execution, or may execute the stored program instructions by itself.

[0086] In the above scheme, by acquiring the image data captured by the camera device in the through-fog mode and detecting the distribution of the primary colors of the pixels in the image data, the through-fog mode is maintained or switched to the daylight mode according to the distribution of the primary colors. Therefore, by detecting the distribution of the primary colors of the pixels in the image data, it is possible to accurately analyze the transmission of each primary color light in the current environment, thereby improving the accuracy of determining whether the current environment is in the through-fog mode, which is conducive to reducing errors as much as possible, and thus accurately switching the camera mode.

[0087] See also Figure 7 , Figure 7 : is a schematic diagram of a framework of an embodiment of a camera mode switching device 70. Specifically, the camera mode switching device 70 includes an image data acquisition module 71, an image data detection module 72 and a camera mode switching module 73. The image data acquisition module 71 is used to acquire image data captured by the camera device in the through-fog mode; wherein the camera device covers the filter at the lens of the camera device when the camera device is in the through-fog mode; the image data detection module 72 is used to detect the image data to obtain the primary color distribution of the pixel points in the image; the camera mode switching module 73 is used to select to maintain the through-fog mode or switch to the daylight mode based on the primary color distribution; wherein the camera device does not cover the filter at the lens when the camera device is in the daylight mode.

[0088] In the above scheme, by acquiring the image data captured by the camera device in the through-fog mode and detecting the distribution of the primary colors of the pixels in the image data, the through-fog mode is maintained or switched to the daylight mode according to the distribution of the primary colors. Therefore, by detecting the distribution of the primary colors of the pixels in the image data, it is possible to accurately analyze the transmission of each primary color light in the current environment, thereby improving the accuracy of determining whether the current environment is in the through-fog mode, which is conducive to reducing errors as much as possible, and thus accurately switching the camera mode.

[0089] In some disclosed embodiments, the camera mode switching module 73 includes a pixel number counting unit, which is used to count the number of pixel points in the image data whose primary color distribution meets preset conditions, and the proportion of the pixel points in the image data; the camera mode switching module 73 chooses to maintain the fog-proof mode or switch to the daylight mode based on the number proportion.

[0090] Therefore, pixels that meet the requirements in the image data are screened out through preset conditions, and mode switching is achieved based on the proportion of these pixels in the image data. By analyzing a large number of pixels, the possibility of erroneous switching is greatly reduced.

[0091] In some disclosed embodiments, the relative response values ​​of the first primary color, the second primary color and the third primary color on the imaging device after the light passes through the filter satisfy: a preset relationship is met in the first band, and the preset relationship is not met in the second band; wherein the first band belongs to the visible light band, the second band belongs to the near-infrared band, the filter is a filter with passbands in the first band and the second band, the preset relationship includes: the relative response value of the first primary color is greater than the relative response value of either the second primary color or the third primary color, the primary color distribution includes: a first ratio between the pixel component of the first primary color and the pixel component of the second primary color, and a second ratio between the pixel component of the first primary color and the pixel component of the third primary color, and the preset conditions include: the first ratio is greater than the first threshold value, and the second ratio is greater than the second threshold value.

[0092] Therefore, the relative response values ​​of the three primary colors on the imaging device after the light passes through the filter meet the requirements of the preset relationship, which facilitates the subsequent analysis of the image data, so as to ultimately achieve accurate switching of the imaging mode.

[0093] In some disclosed embodiments, in the first band, the minimum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color, and the minimum value of the difference between the relative response value of the first primary color and the relative response value of the third primary color are both greater than the first preset difference, and in the second band, the maximum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color, and the maximum value of the difference between the relative response value of the first primary color and the relative response value of the third primary color are both not greater than the second preset difference, wherein the first preset difference is greater than the second preset difference.

[0094] Therefore, after the light passes through the filter, the relative response value of one primary color is highlighted in the first band, and the relative response values ​​of the three primary colors in the second band are almost consistent, so that the light shows a significant difference in the two bands after passing through the filter, which is conducive to subsequent image analysis.

[0095] In some disclosed embodiments, the camera mode switching module 73 includes a daylight mode switching unit and / or a through-fog mode switching unit. The daylight mode switching unit is used to select switching to the daylight mode in response to the number ratio being not less than a preset ratio; and / or the through-fog mode switching unit is used to select maintaining the through-fog mode in response to the number ratio being less than a preset ratio.

[0096] Therefore, switching judgment is performed through ratio, which reduces the possibility of erroneous mode switching due to analysis errors of some pixels or statistical errors, and ensures the accuracy of mode switching.

[0097] In some disclosed embodiments, in response to the camera mode switching module 73 selecting to maintain the fog penetration mode, the image data acquisition module 71 and the image data detection module 72 are restarted, and the steps of switching the relevant camera modes are re-executed.

[0098] Therefore, after the camera mode switching module selects to maintain the fog penetration mode, the camera mode switching device is started and executed again, thereby ensuring the closed-loop operation of the camera mode switching device.

[0099] In some disclosed embodiments, the camera mode switching device 70 includes a fog concentration acquisition unit. In response to the camera mode switching module 73 switching to the daylight mode, the fog concentration acquisition unit is used to acquire the fog concentration. In response to the fog concentration satisfying a preset switching concentration, the camera mode switching module 73 switches the camera device to the fog penetration mode, restarts the image data acquisition module 71 and the image data detection module 72, and re-executes the relevant camera mode switching steps.

[0100] Therefore, after the camera mode switching module chooses to maintain the daylight mode, it further switches back to the fog penetration mode based on the fog concentration acquisition unit, and then the camera mode switching device is started and executed again, ensuring the closed-loop operation of the camera mode switching device.

[0101] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0102] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0103] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0104] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0105] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

Claims

1. A camera mode switching method, characterized in that: include: Acquire image data captured by an imaging device in a through-fog mode; wherein, when the imaging device is in the through-fog mode, a filter is covered at a lens of the imaging device, and after light passes through the filter, relative response values ​​of the first primary color, the second primary color, and the third primary color on the imaging device satisfy: a preset relationship is met in a first band, and the preset relationship is not met in a second band, the first band belongs to a visible light band, the second band belongs to a near-infrared band, the filter is a filter with passbands in the first band and the second band, and the preset relationship includes: a relative response value of the first primary color is greater than a relative response value of any one of the second primary color and the third primary color; Detecting the image data to obtain primary color distribution of pixel points in the image; Counting the percentage of pixel points in the image data whose primary color distribution conditions meet preset conditions; wherein the primary color distribution conditions include: a third ratio between a pixel component of the first primary color in the pixel point and a pixel component in the pixel point, and the preset condition includes: the third ratio is greater than a ratio threshold; or, the primary color distribution conditions include: a first ratio between a pixel component of the first primary color and a pixel component of the second primary color in the pixel point, and a second ratio between a pixel component of the first primary color and a pixel component of the third primary color in the pixel point, and the preset condition includes: the first ratio is greater than a first threshold and the second ratio is greater than a second threshold; Based on the number ratio, it is selected to maintain the fog-penetrating mode or switch to the daylight mode; wherein, the filter is not covered at the lens of the imaging device in the daylight mode.

2. The method according to claim 1, characterized in that In the first band, the minimum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color, and the minimum value of the difference between the relative response value of the first primary color and the relative response value of the third primary color are both greater than a first preset difference, and in the second band, the maximum value of the difference between the relative response value of the first primary color and the relative response value of the second primary color, and the maximum value of the difference between the relative response value of the first primary color and the relative response value of the third primary color are both not greater than a second preset difference, wherein the first preset difference is greater than the second preset difference.

3. The method according to claim 1, characterized in that The selecting to maintain the mist penetration mode or switch to the daylight mode based on the quantity ratio includes: In response to the number ratio being not less than a preset ratio, selecting to switch to the daylight mode; And / or, in response to the number ratio being less than a preset ratio, the mist penetration mode is selected to be maintained.

4. The method according to claim 1, characterized in that: The method further comprises: In response to selecting to maintain the through-fog mode, the step of acquiring the image data captured by the imaging device in the through-fog mode and subsequent steps are re-executed.

5. The method according to claim 1, characterized in that The method further comprises: In response to selecting to switch to the daylight mode, obtaining a target fog concentration; Based on the fog concentration satisfying the preset switching concentration, the imaging device switches to the fog penetration mode, and the step of acquiring the image data shot by the imaging device in the fog penetration mode and subsequent steps are re-executed.

6. An imaging device, characterized in that: It includes a memory, an image sensor and a processor, and the memory and the image sensor are coupled to the processor, and the processor is used to execute program instructions stored in the memory to implement the camera mode switching method described in any one of claims 1 to 5.

7. The imaging device according to claim 6, characterized in that: The imaging device further comprises a lens, a filter and a transmission mechanism, wherein the transmission mechanism is used to cover the lens with the filter or remove the filter from the lens under the control of the processor.

8. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the camera mode switching method described in any one of claims 1 to 5.