Camera IR-CUT automatic detection method and system

Through the IR-CUT automatic detection algorithm, image processing technology is used to automatically judge the camera mode, solving the problems of manual detection errors and low efficiency in the prior art, and achieving fast and accurate detection.

CN118984378APending Publication Date: 2024-11-19TIANJIN HUALAI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411277017.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

In the prior art, the detection of camera IR-CUT function relies on artificial naked eyes, and the standards cannot be clearly formulated, there are misjudgment problems, the detection efficiency is low, and the environment is uncontrollable.

Method used

The IR-CUT automatic detection algorithm is used to collect real-time images of infrared lamps, perform grayscale image processing, mean blur and binary processing, calculate the image area, compare it with the set threshold range, and automatically determine whether the camera mode is good.

Benefits of technology

It realizes unified detection standards and environment, avoids misjudgment, fast detection speed, reduces labor costs, and improves detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984378A_ABST
    Figure CN118984378A_ABST
Patent Text Reader

Abstract

The invention provides an IR-CUT automatic detection method and system for a camera, and the method comprises the steps: collecting a first real-time image of an infrared lamp through a to-be-detected camera when the IR-CUT of the to-be-detected camera is switched to a daytime mode; inputting the first real-time image into an IR-CUT automatic detection algorithm, and outputting a first detection result; when the first detection result is false, the current mode of the to-be-detected camera is bad; when the first detection result is true, the current mode of the to-be-detected camera is a good product; when the IR-CUT of the to-be-tested camera is switched to the night vision mode, acquiring a second real-time image of the infrared lamp through the to-be-tested camera; inputting the second real-time image into an IR-CUT automatic detection algorithm, and outputting a second detection result; when the second detection result is false, the current mode of the to-be-detected camera is bad; when the second detection result is true, the current mode of the to-be-detected camera is a good product; detection speed is fast, detection efficiency is improved, and labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of camera detection, and in particular to an IR-CUT automatic detection method and system for a camera. Background Art

[0002] IR-CUT (infrared cut filter) is a small device in the camera that can automatically switch between day mode and night vision mode. In day mode, it blocks infrared rays to make the picture color more natural and realistic; in night vision mode, it allows infrared rays to pass through to help the camera take clear images in the dark. In order to improve contrast and clarity, the pictures in night vision mode are usually processed into black and white images.

[0003] IR-CUT allows the camera to maintain the quality of photos under different lighting conditions. IR-CUT day mode failure means that when switching to day mode, IR-CUT remains in night vision mode; IR-CUT night vision failure means that when switching to night vision mode, IR-CUT remains in day mode.

[0004] The current factory's way of checking whether the camera's IR-CUT function is normal is manual testing. First, switch the IR-CUT to day mode. At this time, the IR-CUT will block infrared light from entering the camera's image sensor. Workers can confirm whether the IR-CUT is normal by checking whether the real-time picture taken by the camera is pink. Normal is no pink. Then switch the IR-CUT to night vision mode. At this time, the IR-CUT will allow infrared light to enter the camera's image sensor. Since the image has been processed into a black and white image, workers need to aim the camera at the turned-on infrared light and check whether there is a halo around the infrared light on the real-time image to confirm whether the IR-CUT is normal. Normal is halo.

[0005] The current detection method relies on manual visual identification, so it is impossible to clearly establish standards and the features are not obvious, so workers’ subjective judgment may lead to misjudgment. In addition, the environment in which real-time images are captured during the detection process is uncontrollable, and workers need to constantly rotate the camera to capture different environments to avoid misjudgment caused by weak infrared light, so the detection efficiency is low. Summary of the invention

[0006] In view of this, the purpose of the present invention is to provide an IR-CUT automatic detection method and system for a camera, unify the detection standards and detection environment, and avoid misjudgment; the IR-CUT automatic detection algorithm has a fast detection speed, improves detection efficiency, and reduces labor costs.

[0007] In a first aspect, an embodiment of the present invention provides an IR-CUT automatic detection method for a camera, the method comprising:

[0008] When the IR-CUT of the camera to be tested is switched to the day mode, a first real-time image of the infrared light is collected by the camera to be tested;

[0009] Inputting the first real-time image into an IR-CUT automatic detection algorithm and outputting a first detection result;

[0010] When the first detection result is false, the current mode of the camera to be tested is bad;

[0011] When the first detection result is true, the current mode of the camera to be tested is a good product;

[0012] When the IR-CUT of the camera to be tested is switched to a night vision mode, a second real-time image of the infrared lamp is collected by the camera to be tested;

[0013] Inputting the second real-time image into the IR-CUT automatic detection algorithm and outputting a second detection result;

[0014] When the second detection result is false, the current mode of the camera to be tested is bad;

[0015] When the second detection result is true, the current mode of the camera to be tested is a good product.

[0016] Further, the first real-time image is input into an IR-CUT automatic detection algorithm, and a first detection result is output, including:

[0017] intercepting the first real-time image according to a set position to obtain an intercepted image;

[0018] Converting the captured image to obtain a grayscale image;

[0019] Performing mean blur processing on the grayscale image to obtain a blurred image;

[0020] Performing binarization processing on the blurred image to obtain a binarized image;

[0021] Performing contour search on the binarized image to obtain a contour range that reaches a set brightness;

[0022] Calculate the area sum according to the areas of all images that reach the contour range of the set brightness;

[0023] Compare the area sum with a day mode area threshold range / a night vision mode area threshold range to obtain a first comparison result;

[0024] The first comparison result is used as the first detection result.

[0025] Further, the area sum is compared with the day mode area threshold range / night vision mode area threshold range to obtain a first comparison result, including:

[0026] When the area is within the day mode area threshold range / the night vision mode area threshold range, the current mode of the camera to be tested is a good product;

[0027] When the area sum is not within the day mode area threshold range / the night vision mode area threshold range, the current mode of the camera to be tested is bad.

[0028] Further, the first real-time image is intercepted according to the set position to obtain the intercepted image, including:

[0029] The first real-time image is input into a picture copy creation algorithm, and the first real-time image is intercepted according to the interception coordinates to obtain the intercepted image.

[0030] Further, the captured image is converted to obtain a grayscale image, including:

[0031] The captured image is input into a color conversion algorithm, and the grayscale image is obtained according to color-to-black-white conversion parameters.

[0032] Further, the blurred image is subjected to a binarization image processing to obtain a binarized image, comprising:

[0033] The blurred image is subjected to binarization image processing by a binarization image processing algorithm, and the binarized image is obtained according to a binarization brightness threshold, a set color value and a binarization threshold type.

[0034] Further, performing contour search on the binarized image to obtain a contour range that reaches a set brightness includes:

[0035] The binarized image is input into a contour search algorithm for contour search, and a boundary composed of continuous points with the same gray value in the binarized image is obtained according to contour search parameters, and is used as a contour range that reaches the set brightness.

[0036] In a second aspect, an embodiment of the present invention provides an IR-CUT automatic detection system for a camera, the system comprising:

[0037] A first acquisition module, used for acquiring a first real-time image of the infrared light through the camera to be tested when the IR-CUT of the camera to be tested is switched to a day mode;

[0038] A first input module, used for inputting the first real-time image into an IR-CUT automatic detection algorithm and outputting a first detection result;

[0039] A first detection module, configured to: when the first detection result is false, the current mode of the camera to be tested is bad; when the first detection result is true, the current mode of the camera to be tested is good;

[0040] A second acquisition module is used to acquire a second real-time image of the infrared lamp through the camera to be tested when the IR-CUT of the camera to be tested is switched to a night vision mode;

[0041] A second input module, used for inputting the second real-time image into the IR-CUT automatic detection algorithm and outputting a second detection result;

[0042] The second detection module is used to determine that, when the second detection result is false, the current mode of the camera to be tested is bad; and when the second detection result is true, the current mode of the camera to be tested is good.

[0043] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method described above when executing the computer program.

[0044] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the method as described above.

[0045] The embodiment of the present invention provides an IR-CUT automatic detection method and system for a camera, including: when the IR-CUT of a camera to be tested is switched to a daytime mode, a first real-time image of an infrared lamp is collected through the camera to be tested; the first real-time image is input into an IR-CUT automatic detection algorithm, and a first detection result is output; when the first detection result is false, the current mode of the camera to be tested is bad; when the first detection result is true, the current mode of the camera to be tested is good; when the IR-CUT of the camera to be tested is switched to a night vision mode, a second real-time image of the infrared lamp is collected through the camera to be tested; the second real-time image is input into an IR-CUT automatic detection algorithm, and a second detection result is output; when the second detection result is false, the current mode of the camera to be tested is bad; when the second detection result is true, the current mode of the camera to be tested is good; unifying detection standards and detection environments to avoid misjudgment; the IR-CUT automatic detection algorithm has a fast detection speed, improves detection efficiency, and reduces labor costs.

[0046] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0049] Figure 1 A flow chart of the IR-CUT automatic detection method of a camera provided in Embodiment 1 of the present invention;

[0050] Figure 2 A schematic diagram of an IR-CUT automatic detection system for a camera provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are 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.

[0052] To facilitate understanding of this embodiment, the embodiment of the present invention is described in detail below.

[0053] Embodiment 1:

[0054] Figure 1 This is a flow chart of the IR-CUT automatic detection method of the camera provided in Embodiment 1 of the present invention.

[0055] Reference Figure 1 , the method comprises the following steps:

[0056] Step S101, when the IR-CUT of the camera to be tested is switched to the day mode, a first real-time image of the infrared light is collected by the camera to be tested;

[0057] Step S102, inputting the first real-time image into the IR-CUT automatic detection algorithm, and outputting a first detection result;

[0058] Here, the first detection result is a Boolean value, and whether the current mode is good or bad is determined according to the truth or falsity of the Boolean value.

[0059] Step S103, when the first detection result is false, the current mode of the camera to be tested is bad;

[0060] Step S104, when the first detection result is true, the current mode of the camera to be tested is a good product;

[0061] Step S105, when the IR-CUT of the camera to be tested is switched to the night vision mode, a second real-time image of the infrared light is collected by the camera to be tested;

[0062] Step S106, inputting the second real-time image into the IR-CUT automatic detection algorithm, and outputting a second detection result;

[0063] Step S107, when the second detection result is false, the current mode of the camera to be tested is bad;

[0064] Step S108, when the second detection result is true, the current mode of the camera to be tested is a good product.

[0065] In this embodiment, by optimizing the test environment and adopting the IR-CUT automatic detection algorithm, based on the light filtering principle of IR-CUT, the automatic, rapid and accurate detection of IR-CUT is achieved.

[0066] Based on the filtering principle of IR-CUT, the camera to be tested and the infrared light are placed in the same dark environment through physical shielding, so that the camera to be tested can capture the infrared light, and the captured image is used for IR-CUT automatic detection algorithm detection.

[0067] At the same time, a new mode is created in which the IR-CUT night vision mode only switches the filter without processing the image into a black and white image. Through this processing, the only variable is maintained, and the images of good and defective products in the IR-CUT day mode and night vision mode are turned into a control group, that is, the images taken by good products in the day mode are consistent with the images taken by defective products in the night vision mode, and the images taken by good products in the night vision mode are consistent with the images taken by defective products in the day mode. Therefore, it is only necessary to use the same IR-CUT automatic detection algorithm and set different contrast thresholds to perform detection in the two modes separately.

[0068] Specifically, the difference between IR-CUT switching between day mode and night vision mode is whether to filter infrared light. However, since the infrared filter used in the camera cannot completely filter the infrared light of the infrared lamp, it is not possible to judge whether it is a good product by simply using the presence of light. Instead, it is necessary to judge whether the real-time image taken by the camera to be tested has filtered the infrared light. In a dark environment with only one infrared light source, the infrared light taken by a good product in day mode will be darker than that taken by a good product in night vision mode. Therefore, the brightness combined with the light area can be used for judgment.

[0069] Further, step S102 includes the following steps:

[0070] Step S201, intercepting the first real-time image according to a set position (the center position of the image where the night vision light is located) to obtain an intercepted image;

[0071] Here, the intercepted image is obtained by interception to facilitate subsequent detection.

[0072] Step S202, converting the captured image to obtain a grayscale image;

[0073] Here, the captured image is converted into a grayscale image to remove image information that is irrelevant to the algorithm.

[0074] Step S203, performing mean blur processing on the grayscale image to obtain a blurred image;

[0075] Here, mean blurring is performed on the grayscale image to reduce noise interference in the image.

[0076] Step S204, performing binarization processing on the blurred image to obtain a binarized image;

[0077] Here, according to the set brightness threshold, the blurred image is subjected to binary image processing, and the image is divided into two ranges: reaching the brightness threshold and being lower than the brightness threshold.

[0078] Step S205, performing contour search on the binarized image to obtain a contour range that reaches a set brightness;

[0079] Step S206, calculating the area sum according to the areas of all images that reach the contour range of the set brightness;

[0080] Step S207, comparing the area sum with the day mode area threshold range / night vision mode area threshold range to obtain a first comparison result;

[0081] Step S208: taking the first comparison result as the first detection result.

[0082] Here, the implementation process of inputting the second real-time image into the IR-CUT automatic detection algorithm and outputting the second detection result is similar to the above implementation process, which will not be described in detail here.

[0083] Specifically, the brightness threshold, the day mode area threshold range, and the night vision mode area threshold range are obtained by:

[0084] Multiple good cameras are used to collect multiple groups of pictures under the above environment; the brightness near the edge of the bright spot in the picture is used as the brightness threshold; then the brightness threshold is used to perform area statistics through the above steps S201 to S203, and the images in the day mode and the night vision mode are processed respectively to obtain the day mode area threshold range and the night vision mode area threshold range respectively.

[0085] Further, step S207 includes the following steps:

[0086] Step S301, when the area is within the day mode area threshold range / night vision mode area threshold range, the current mode of the camera to be tested is good;

[0087] Step S302: When the area sum is not within the day mode area threshold range / night vision mode area threshold range, the current mode of the camera to be tested is bad.

[0088] Further, step S201 includes:

[0089] The first real-time image is input into the picture copy creation algorithm (Bitmap.Clone), and the first real-time image is intercepted according to the interception coordinates (including the range) to obtain the intercepted image.

[0090] Further, step S202 includes:

[0091] The captured image is input into the color conversion algorithm (Cv2.CvtColor), and a grayscale image is obtained according to the color-to-black and white parameters. A grayscale image includes images of different shades of gray, and the color of each point is represented by different levels of gray from pure black to pure white.

[0092] Further, step S204 includes:

[0093] The blurred image is processed by the binary image processing algorithm (Cv2.Threshold), and the binary processed image is obtained according to the binary brightness threshold, the set color value and the binary threshold type. Among them, the pixels exceeding the brightness threshold are set to the specified color value (here white).

[0094] Further, step S205 includes:

[0095] The binarized image is input into the contour search algorithm (Cv2.FindContours) for contour search. According to the contour search parameters, the boundary composed of continuous points with the same gray value in the binarized image is obtained and used as the contour range that reaches the set brightness.

[0096] In addition, mean blur processing: Cv2.Blur (mean blur processing function), pass in the grayscale image and blur parameters, and you can get the image after mean blurring the grayscale image.

[0097] Take the brightness threshold: Mat.At (get the brightness of the specified pixel in the grayscale image), pass in the image and pixel coordinates, and you can get the brightness of the pixel at the specified coordinates.

[0098] Embodiment 2:

[0099] Figure 2 A schematic diagram of an IR-CUT automatic detection system for a camera provided in Embodiment 2 of the present invention.

[0100] Reference Figure 2 , the system comprises:

[0101] A first acquisition module, used for acquiring a first real-time image of the infrared light through the camera to be tested when the IR-CUT of the camera to be tested is switched to a day mode;

[0102] A first input module, used for inputting a first real-time image into an IR-CUT automatic detection algorithm and outputting a first detection result;

[0103] A first detection module, for when the first detection result is false, the current mode of the camera to be tested is bad; when the first detection result is true, the current mode of the camera to be tested is good;

[0104] A second acquisition module is used to acquire a second real-time image of the infrared light through the camera to be tested when the IR-CUT of the camera to be tested is switched to a night vision mode;

[0105] A second input module, used for inputting a second real-time image into the IR-CUT automatic detection algorithm and outputting a second detection result;

[0106] The second detection module is used to determine that the current mode of the camera to be tested is bad when the second detection result is false; and that the current mode of the camera to be tested is good when the second detection result is true.

[0107] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the IR-CUT automatic detection method of the camera provided in the above embodiment are implemented.

[0108] An embodiment of the present invention also provides a computer-readable medium having a non-volatile program code executable by a processor, wherein a computer program is stored on the computer-readable medium, and when the computer program is executed by the processor, the steps of the IR-CUT automatic detection method of the camera of the above embodiment are executed.

[0109] The computer program product provided in the embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment and will not be repeated here.

[0110] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0111] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0112] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. 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, etc., which can store program codes.

[0113] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0114] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A camera IR-CUT automatic detection method, characterized in that: The method comprises: When the IR-CUT of the camera to be tested is switched to the day mode, a first real-time image of the infrared light is collected by the camera to be tested; Inputting the first real-time image into an IR-CUT automatic detection algorithm and outputting a first detection result; When the first detection result is false, the current mode of the camera to be tested is bad; When the first detection result is true, the current mode of the camera to be tested is a good product; When the IR-CUT of the camera to be tested is switched to a night vision mode, a second real-time image of the infrared lamp is collected by the camera to be tested; Inputting the second real-time image into the IR-CUT automatic detection algorithm and outputting a second detection result; When the second detection result is false, the current mode of the camera to be tested is bad; When the second detection result is true, the current mode of the camera to be tested is a good product.

2. The IR-CUT automatic detection method of a camera according to claim 1, characterized in that: Inputting the first real-time image into the IR-CUT automatic detection algorithm and outputting a first detection result includes: intercepting the first real-time image according to a set position to obtain an intercepted image; Converting the captured image to obtain a grayscale image; Performing mean blur processing on the grayscale image to obtain a blurred image; Performing binarization processing on the blurred image to obtain a binarized image; Performing contour search on the binarized image to obtain a contour range that reaches a set brightness; Calculate the area sum according to the areas of all images that reach the contour range of the set brightness; Compare the area sum with a day mode area threshold range / a night vision mode area threshold range to obtain a first comparison result; The first comparison result is used as the first detection result.

3. The IR-CUT automatic detection method of a camera according to claim 2, characterized in that: Comparing the area sum with the daytime mode area threshold range / night vision mode area threshold range to obtain a first comparison result, including: When the area is within the day mode area threshold range / the night vision mode area threshold range, the current mode of the camera to be tested is a good product; When the area sum is not within the day mode area threshold range / the night vision mode area threshold range, the current mode of the camera to be tested is bad.

4. The IR-CUT automatic detection method of a camera according to claim 2, characterized in that: The first real-time image is intercepted according to the set position to obtain an intercepted image, including: The first real-time image is input into a picture copy creation algorithm, and the first real-time image is intercepted according to the interception coordinates to obtain the intercepted image.

5. The IR-CUT automatic detection method of a camera according to claim 2, characterized in that: Converting the captured image to obtain a grayscale image includes: The captured image is input into a color conversion algorithm, and the grayscale image is obtained according to color-to-black-white conversion parameters.

6. The IR-CUT automatic detection method of a camera according to claim 2, characterized in that: The blurred image is subjected to binarization image processing to obtain a binarized image, comprising: The blurred image is subjected to binarization image processing by a binarization image processing algorithm, and the binarized image is obtained according to a binarization brightness threshold, a set color value and a binarization threshold type.

7. The IR-CUT automatic detection method of a camera according to claim 2, characterized in that: Performing contour search on the binarized image to obtain a contour range that reaches a set brightness includes: The binarized image is input into a contour search algorithm for contour search, and a boundary composed of continuous points with the same gray value in the binarized image is obtained according to contour search parameters, and is used as a contour range that reaches the set brightness.

8. An IR-CUT automatic detection system for a camera, characterized in that: The system comprises: A first acquisition module, used for acquiring a first real-time image of the infrared light through the camera to be tested when the IR-CUT of the camera to be tested is switched to a day mode; A first input module, used for inputting the first real-time image into an IR-CUT automatic detection algorithm and outputting a first detection result; A first detection module, configured to: when the first detection result is false, the current mode of the camera to be tested is bad; when the first detection result is true, the current mode of the camera to be tested is good; A second acquisition module is used to acquire a second real-time image of the infrared lamp through the camera to be tested when the IR-CUT of the camera to be tested is switched to a night vision mode; A second input module, used for inputting the second real-time image into the IR-CUT automatic detection algorithm and outputting a second detection result; The second detection module is used to determine that, when the second detection result is false, the current mode of the camera to be tested is bad; and when the second detection result is true, the current mode of the camera to be tested is good.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the method according to any one of claims 1 to 7.