A method, device, equipment and medium for testing a flickering state of an instrument warning light
Patent Information
- Application Number
- CN202310239743.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2043-03-13
Smart Images

Figure CN116481773B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automobiles, in particular to a testing method, device, equipment and medium for a flickering state of an instrument warning light. BACKGROUND
[0002] An automobile instrument is an important interface for a driver to exchange information with an automobile. With the development of automobile electronic technology, the amount of information of automobile driving conditions and various mechanisms and parts has significantly increased. When driving a vehicle, a driver must know more and more timely whether various parameters of the automobile and engine are normal, so as to take timely measures to prevent accidents. Among them, whether the on-off and flickering frequency of the instrument screen warning light meets the requirements is an important part of pre-delivery detection work.
[0003] At present, instrument automatic testing is generally performed by screen capture or external camera shooting, which can only automatically determine the on-off of the indicator light, and the indicator light with flickering requirements is generally tested by visual inspection, resulting in low accuracy of the detection result of the flickering frequency of the instrument screen warning light. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a testing method, device, equipment and medium for a flickering state of an instrument warning light, which can realize automatic determination of the flickering state of the instrument warning light.
[0005] In a first aspect, the present application provides a testing method for a flickering state of an instrument warning light, which comprises the following steps:
[0006] sending a warning instruction to a to-be-detected instrument to make the warning light of the to-be-detected instrument flicker at a set frequency; and shooting the to-be-detected instrument to obtain a video file of the flickering of the warning light;
[0007] dissolving the video file into continuous multiple pictures frame by frame, and performing template matching comparison on each picture to determine the flickering state of the warning light in each picture; wherein the flickering state of the warning light includes on and off;
[0008] counting the flickering state of the warning light in each picture, and calculating the flickering frequency of the warning light according to the counting result.
[0009] In a possible implementation, the shooting area of the to-be-detected instrument covers the entire display interface of the to-be-detected instrument.
[0010] In a possible implementation, the template matching comparison on each picture to determine the flickering state of the warning light in each picture comprises the following steps:
[0011] establishing a reference image as a template in advance; wherein the reference image is a local display image of the alarm lamp in the display interface of the instrument to be detected when the alarm lamp is bright;
[0012] calculating a similarity value of each overlapping region and the reference image by means of a sliding image block for each frame of image;
[0013] determining the flickering state of the alarm lamp in each frame of image based on the similarity value; wherein if there is an overlapping region with a similarity value exceeding a set threshold in the frame of image, it is judged that the flickering state of the alarm lamp in the frame of image is bright; if there is no overlapping region with a similarity value exceeding a set threshold in the frame of image, it is judged that the flickering state of the alarm lamp in the frame of image is off.
[0014] In a possible implementation, the method further comprises the following steps:
[0015] calculating the similarity value of each overlapping region and the reference image by means of a normalized square difference matching method, a normalized correlation matching method and a normalized correlation coefficient matching method respectively; wherein if the three similarity values obtained all exceed a set threshold, it is judged that the flickering state of the alarm lamp in the frame of image is bright.
[0016] In a possible implementation, the flickering frequency of the alarm lamp is calculated according to the statistical result of the flickering state of the alarm lamp in each frame of image, comprising the following steps:
[0017] selecting sample images from each frame of image disassembled from the video file; the sample images include a group of images with the flickering state of the alarm lamp being continuously bright and the flickering state of the alarm lamp being continuously off;
[0018] obtaining the number of sample images;
[0019] obtaining the frame frequency of the instrument to be detected;
[0020] calculating the flickering frequency of the alarm lamp based on the number of sample images and the frame frequency of the instrument to be detected.
[0021] In a possible implementation, the flickering frequency of the alarm lamp is calculated by the following formula: f = 1 / (N*(1 / fps)), wherein N is the number of sample images, and fps is the frame frequency of the instrument to be detected.
[0022] In a possible implementation, the length of time for photographing the instrument to be detected is set to 5-10 seconds.
[0023] In a second aspect, the application provides a testing device for the flickering state of an alarm lamp of an instrument, comprising:
[0024] a control module configured to send an alarm instruction to the instrument to be detected, so that an alarm lamp of the instrument to be detected flashes at a set frequency, and take a photo of the instrument to be detected to obtain a video file of the flashing alarm lamp;
[0025] a judgment module configured to disassemble the video file into a plurality of continuous pictures frame by frame, and perform template matching comparison on each picture to determine a flashing state of the alarm lamp in each picture, wherein the flashing state of the alarm lamp includes on and off;
[0026] a calculation module configured to count the flashing state of the alarm lamp in each picture, and calculate the flashing frequency of the alarm lamp according to the counting result.
[0027] In a third aspect, the present application provides an electronic device, which comprises a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, and the machine readable instructions are executed by the processor to perform the steps of the instrument alarm lamp flashing state test method according to the first aspect.
[0028] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the steps of the instrument alarm lamp flashing state test method according to the first aspect.
[0029] The instrument alarm lamp flashing state test method, device, equipment and medium provided by the embodiment send an alarm instruction to the instrument to be detected, so that the alarm lamp of the instrument to be detected flashes at a set frequency, and take a photo of the instrument to be detected to obtain a video file of the flashing alarm lamp, disassemble the video file into a plurality of continuous pictures frame by frame, and perform template matching comparison on each picture to determine a flashing state of the alarm lamp in each picture, count the flashing state of the alarm lamp in each picture, and calculate the flashing frequency of the alarm lamp according to the counting result. Thus, the automatic determination of the instrument alarm lamp flashing state is realized. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0031] Figure 1A flowchart of a test method for the flashing state of the instrument warning light in an embodiment of the present application;
[0032] Figure 2 A code diagram for photographing the instrument to be detected and decomposing the video file into continuous pictures in an embodiment of the present application;
[0033] Figure 3 A diagram of the display interface of the instrument to be detected in an embodiment of the present application;
[0034] Figure 4 A flowchart of template matching and comparison of each picture to determine the flashing state of the warning light in each picture in an embodiment of the present application;
[0035] Figure 5 A diagram of the reference image in an embodiment of the present application;
[0036] Figure 6 A code diagram for template matching and comparison of each picture in an embodiment of the present application;
[0037] Figure 7 A code diagram for calculating the flashing frequency of the warning light in an embodiment of the present application;
[0038] Figure 8 A structural block diagram of the test device for the flashing state of the instrument warning light in an embodiment of the present application;
[0039] Figure 9 A structural block diagram of the electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0040] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in detail with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the accompanying drawings in the present application are only used for the purpose of description and illustration, and do not limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn according to the actual proportions. The flowchart shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowchart or one or more operations can be removed from the flowchart under the guidance of the content of the present application.
[0041] In addition, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0042] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0043] In view of the technical problems proposed in the background art, the present application provides a test method, device, equipment and medium for the flickering state of an instrument warning light, which can realize automatic determination of the flickering state of the instrument warning light.
[0044] Referring to the drawings accompanying Figure 1 In an embodiment, the present application provides a test method for the flickering state of an instrument warning light, which comprises the following steps:
[0045] S1, sending an alarm instruction to a to-be-detected instrument, so that the alarm light of the to-be-detected instrument flickers at a set frequency; and photographing the to-be-detected instrument to obtain a video file of the flickering of the alarm light;
[0046] In step S1, the to-be-detected instrument can be connected with the host computer through a CAN communication line for sending an alarm instruction; for example, in this embodiment, an alarm instruction is sent to the to-be-detected instrument when a safety belt is not buckled or a safety belt buckle switch fails during driving, so that the to-be-detected instrument responds to the alarm instruction and makes the safety belt light flicker at a set frequency; specifically, the host computer realizes CAN message sending through the dynamic link library of PCAN.
[0047] In addition, the host computer is also connected with a photographing device, such as a camera, through a USB data line, and the connected camera is adjusted and fixed so that the display interface of the to-be-detected instrument can be entirely within the shooting range of the camera, and then the host computer controls the camera to perform real-time shooting on the display interface of the to-be-detected instrument. Preferably, the host computer sends an alarm instruction to the to-be-detected instrument at the same time as sending an instruction to start shooting to the camera.
[0048] It should be noted that after the host computer is connected with the camera through the USB data line, the resolution, frame rate and other parameters of the camera need to be set, and these parameters, especially the shooting frame rate, are recorded. The frame rate is the frequency (rate) of the continuous appearance of bitmap images in frames on the display. For example, the shooting frame rate fps of the camera is 50, that is, 20ms per frame, and there are 50 pictures per second. Therefore, after the host computer sets and stores the corresponding shooting parameters, it controls the real-time shooting of the display interface of the instrument to be detected to obtain the video file of the alarm lamp flickering.
[0049] In an embodiment, in order to be able to completely shoot the state of the alarm lamp in multiple flickering periods, and to reduce the timeliness of subsequent judgment of the flickering state of the alarm lamp, preferably, the shooting duration is set to 5-10 seconds.
[0050] S2, the video file is disassembled into a plurality of continuous pictures frame by frame, and template matching comparison is performed on each picture to determine the flickering state of the alarm lamp in each picture; wherein the flickering state of the alarm lamp includes bright and dark;
[0051] In step S2, if the video file is shot by the camera with a frame rate fps of 50 and a duration of 5 seconds, the video file is disassembled into 250 pictures frame by frame; if the video file is shot by the camera with a frame rate fps of 50 and a duration of 10 seconds, the video file is disassembled into 500 pictures frame by frame. Wherein, the host computer panel can be programmed and designed by Python language and QT5, the real-time shooting of the camera on the entire display interface of the instrument to be detected can be realized, and the operation of disassembling the pictures of the obtained video file by frame can be realized. Part of the code can be seen in the attached Figure 2 , which will not be repeated here.
[0052] In an embodiment, each disassembled image can be seen in the attached Figure 3 , that is, the display interface of the instrument to be detected.
[0053] In addition, referring to the attached Figure 4 , the template matching comparison of each picture is performed to determine the flickering state of the alarm lamp in each picture, including the following steps:
[0054] S201, a reference image as a template is established in advance; wherein the reference image is a local display image of the alarm lamp in the display interface of the instrument to be detected when the flickering state of the alarm lamp is bright;
[0055] S202, for each image, the similarity value of each overlapping area with the reference image is calculated by sliding the image block;
[0056] S203, determine the flashing state of the alarm lamp in each frame of picture based on the similarity value; wherein, if the frame image has an overlapping area with a similarity value exceeding a set threshold, it is determined that the flashing state of the alarm lamp in the frame image is on; if the frame image does not have an overlapping area with a similarity value exceeding a set threshold, it is determined that the flashing state of the alarm lamp in the frame image is off.
[0057] Specifically, in step S201, the reference image can refer to the description of the drawings Figure 5 The reference image only refers to the partial image of the alarm lamp display in the display interface of the instrument to be detected, which is the partial image displayed when the safety belt lamp is on in this embodiment. The so-called template matching method refers to finding the position of the target template in a frame image, and the place most similar to the template is the target. Therefore, as long as all sub-regions in the entire image are compared with the target template, the sub-region most similar to the target template is found, which is the position of the target. As described in step S202, since the size of the reference image is smaller than each frame of image split by the video file, when matching, the reference image is similar to being slid through each frame of image to be detected, and the similarity of each overlapping area is calculated.
[0058] When calculating the similarity value of each overlapping area (sub-region) and the reference image, there are various methods, such as the normalized square difference matching method CV_TM_SQDIFF_NORMED, which uses square difference for matching, and the best matching value is 0. The worse the matching is, the larger the matching value is; the normalized correlation matching method CV_TM_CCORR_NORMED, which uses multiplication operation, and the larger the value is, the better the matching degree is; and the normalized correlation coefficient matching method CV_TM_CCOEFF_NORMED, which indicates perfect matching as 1 and worst matching as -1.
[0059] Since the above three methods of calculating the similarity value will have errors when matching different pictures, in this application, before the formal inspection, the matching results of all alarm lamps are compared, and a threshold is set. That is, in the actual detection process, the above three methods are used to match and calculate each frame of picture to be detected and the reference picture, three similarity values are obtained, and then the matching score of the normalized correlation coefficient matching method CV_TM_CCOEFF_NORMED needs to be greater than 0.9; the matching score of the normalized correlation matching method CV_TM_CCORR_NORMED needs to be greater than 0.95; and the matching score of the normalized square difference matching method CV_TM_SQDIFF_NORMED needs to be less than 0.2, which is determined as a successful matching.
[0060] In step S203, if the three similarity values obtained all meet the set threshold, it is judged that the flashing state of the alarm lamp in the frame image is on; if one or two of the three similarity values obtained do not meet the set threshold, it is judged that the flashing state of the alarm lamp in the frame image is off.
[0061] In which, the upper computer panel can be programmed and designed by Python language and QT5, the operation of template matching comparison of each frame of picture is realized, and part of the code programming can be seen in the description Figure 6 , which will not be repeated here.
[0062] In other embodiments, the reference image can also refer to the partial image displayed when the safety belt lamp is off, and the above three methods are also used, and the corresponding threshold is set, which will not be repeated. For example, the matching score of the normalized correlation coefficient matching method CV_TM_CCOEFF_NORMED needs to be greater than 0.93; the matching score of the normalized correlation matching method CV_TM_CCORR_NORMED needs to be greater than 0.97; the matching score of the normalized square difference matching method CV_TM_SQDIFF_NORMED needs to be less than 0.18, which is determined as matching success; if the three similarity values obtained all meet the set threshold, it is judged that the flashing state of the alarm lamp in the frame image is off; if one or two of the three similarity values obtained do not meet the set threshold, it is judged that the flashing state of the alarm lamp in the frame image is on.
[0063] In other embodiments, each frame of image of the video file can be preprocessed first, such as cropping according to the outline of the safety belt lamp to obtain a preprocessed image with the same size as the reference image, and then template matching is performed.
[0064] S3, the flashing state of the alarm lamp in each frame of picture is counted, and the flashing frequency of the alarm lamp is calculated according to the counting result.
[0065] In step S3, when counting the flashing state of each frame of image continuously split from the video file, sample images are first selected, the sample images are a group of pictures with the alarm lamp flashing state being continuous on and the alarm lamp flashing state being continuous off selected from the middle part, and then the number N of the sample images is counted, that is, all the pictures presented by the alarm lamp flashing once; since the frame frequency fps of taking pictures of the instrument to be detected has been stored in step S1, the flashing frequency of the alarm lamp can be calculated based on the number N of sample images and the frame frequency fps of taking pictures of the instrument to be detected, and the formula used is f=1 / (N*(1 / fps)).
[0066] For example, the frame frequency fps of the instrument to be detected is 50, the selected sample images include 25 pictures of the alarm lamp in the continuous bright flashing state and 25 pictures of the alarm lamp in the continuous dark flashing state, which indicates that the time length of the alarm lamp in the bright flashing state is equal to the time length of the alarm lamp in the dark flashing state; the number of sample images N = 25 + 25 = 50; the flashing frequency f of the alarm lamp = 1 / (50*(1 second / 50)) = 1 times / second;
[0067] For example, the frame frequency fps of the instrument to be detected is 50, the selected sample images include 60 pictures of the alarm lamp in the continuous bright flashing state and 40 pictures of the alarm lamp in the continuous dark flashing state, which indicates that the time length of the alarm lamp in the bright flashing state is greater than the time length of the alarm lamp in the dark flashing state; the number of sample images N = 60 + 40 = 100; the flashing frequency f of the alarm lamp = 1 / (100*(1 second / 50)) = 0.5 times / second.
[0068] The same can be realized by using Python language and QT5 to write and design the upper computer panel to calculate the flashing frequency of the alarm lamp, and part of the code writing can be referred to the code in the description attached Figure 7 , which will not be repeated here.
[0069] The test method for the alarm lamp flashing state of the instrument provided in the present application adopts an external camera to shoot a video of the instrument to be detected, and the video file is disassembled into pictures by frame, and the pictures are compared frame by frame to detect the flashing state of the alarm lamp in each picture, and then the flashing frequency of the alarm lamp is calculated to determine whether the flashing frequency of the alarm lamp meets the requirements, which is fast and accurate, thereby solving the problem that the flashing state of the alarm lamp of the instrument cannot be automatically determined in the prior art.
[0070] Based on the same inventive concept, the test device for the alarm lamp flashing state of the instrument is also provided in the embodiments of the present application. Since the principle of solving problems in the device of the embodiments of the present application is similar to the test method for the alarm lamp flashing state of the instrument described above, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be repeated here.
[0071] As shown in the description attached Figure 8 , the present application also provides a test device for the alarm lamp flashing state of the instrument, which comprises:
[0072] The control module 801 is configured to send an alarm instruction to the instrument to be detected, so that the alarm lamp of the instrument to be detected flashes at a set frequency; and the instrument to be detected is shot to obtain a video file of the alarm lamp flashing;
[0073] The judging module 802 is configured to disassemble the video file into continuous pictures frame by frame, and perform template matching comparison on each picture to determine the flashing state of the alarm lamp in each picture; wherein the flashing state of the alarm lamp includes on and off.
[0074] The calculating module 803 is configured to count the flashing state of the alarm lamp in each picture and calculate the flashing frequency of the alarm lamp according to the counting result.
[0075] In some embodiments, the control module 801 sets the time length for taking a picture of the instrument to be detected to 5-10 seconds, and the area for taking a picture of the instrument to be detected covers the entire display interface of the instrument to be detected.
[0076] In some embodiments, the judging module 802 performs template matching comparison on each picture to determine the flashing state of the alarm lamp in each picture, including:
[0077] establishing a reference image as a template in advance; wherein the reference image is a local display image of the display interface of the instrument to be detected when the flashing state of the alarm lamp is on;
[0078] calculating the similarity value of each overlapping area with the reference image by means of sliding image blocks for each picture;
[0079] determining the flashing state of the alarm lamp in each picture based on the similarity value; wherein if there is an overlapping area with a similarity value exceeding a set threshold in the picture, it is determined that the flashing state of the alarm lamp in the picture is on; if there is no overlapping area with a similarity value exceeding a set threshold in the picture, it is determined that the flashing state of the alarm lamp in the picture is off;
[0080] wherein the normalized square difference matching method, the normalized correlation matching method and the normalized correlation coefficient matching method are used to calculate the similarity value of each overlapping area with the reference image; and if the three similarity values obtained all exceed a set threshold, it is determined that the flashing state of the alarm lamp in the picture is on.
[0081] In some embodiments, the calculating module 803 counts the flashing state of the alarm lamp in each picture and calculates the flashing frequency of the alarm lamp according to the counting result, including:
[0082] selecting sample images from each picture disassembled from the video file; the sample images include a group of pictures with the flashing state of the alarm lamp being on continuously and the flashing state of the alarm lamp being off continuously;
[0083] obtaining the number of sample images;
[0084] Acquire frame frequency of photographing the instrument to be detected;
[0085] Calculate the flashing frequency of the alarm lamp based on the number of sample images and the frame frequency of photographing the instrument to be detected;
[0086] Wherein, the flashing frequency f of the alarm lamp is calculated by the following formula: f = 1 / (N*(1 / fps)), wherein, N is the number of sample images, and fps is the frame frequency of photographing the instrument to be detected.
[0087] The testing device for the flashing state of the alarm lamp of the instrument provided in the application sends an alarm instruction to the instrument to be detected through the control module, so that the alarm lamp of the instrument to be detected flashes at a set frequency; the instrument to be detected is photographed to acquire a video file of the flashing of the alarm lamp; the video file is disassembled into continuous multiple pictures by the judgment module frame by frame, and each picture is compared through template matching to determine the flashing state of the alarm lamp in each picture; the flashing state of the alarm lamp in each picture is counted by the calculation module, and the flashing frequency of the alarm lamp is calculated according to the counting result. Thus, the automatic determination of the flashing state of the alarm lamp of the instrument is realized.
[0088] Based on the same concept of the application, the specification attached Figure 9 The electronic device 900 provided in the embodiments of the application has the structure as shown in the specification, which comprises at least one processor 901, at least one network interface 904 or other user interface 903, a memory 905, and at least one communication bus 902. The communication bus 902 is used to realize the connection and communication among the components. The electronic device 900 can optionally comprise a user interface 903, including a display (for example, a touch screen, an LCD, a CRT, holographic imaging (Holographic) or a projector (Projector) and the like), a keyboard or a clicking device (for example, a mouse, a trackball, a touchpad or a touch screen and the like).
[0089] The memory 905 can comprise a read-only memory and a random access memory, and provide instructions and data for the processor 901. A part of the memory 905 can also comprise a non-volatile random access memory (NVRAM).
[0090] In some embodiments, the memory 905 stores the following elements, protectable modules or data structures, or a subset of them, or an extended set of them:
[0091] An operating system 9051 comprises various system programs, used to realize various basic services and process hardware-based tasks;
[0092] The application program module 9052 includes various application programs, such as a launcher, a media player, a browser, and the like, for implementing various application services.
[0093] In the embodiment of the present application, the processor 901 is configured to execute the steps in the method for testing the flickering state of the instrument warning light by calling the program or instruction stored in the memory 905, so that the automatic determination of the flickering state of the instrument warning light can be realized.
[0094] The present application also provides a computer readable storage medium, which stores a computer program. When the computer program is run by a processor, the steps in the method for testing the flickering state of the instrument warning light are executed.
[0095] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, or the like. When the computer program stored in the storage medium is run, the method for testing the flickering state of the instrument warning light can be executed.
[0096] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interface, and can be electrical, mechanical or other forms.
[0097] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the present embodiment.
[0098] In addition, each functional unit in the embodiments provided in the present application can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit.
[0099] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts of the prior art that make contributions or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0100] Finally, it should be noted that: the above embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or replace some technical features with equivalent ones. The modification, change or replacement does not make the corresponding technical solution deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method of testing the flicker state of an instrument warning light, characterized by, The method comprises the following steps: sending an alarm instruction to the instrument to be detected, so that the alarm lamp of the instrument to be detected flashes at a set frequency; and taking a photo of the instrument to be detected to obtain a video file of the flashing alarm lamp; the video file is disassembled into a plurality of continuous pictures frame by frame, and template matching comparison is performed on each picture to determine the flashing state of the alarm lamp in each picture; wherein the flashing state of the alarm lamp includes bright and off; the template matching comparison of each picture to determine the flashing state of the alarm lamp in each picture comprises the following steps: a reference image serving as a template is established in advance; wherein the reference image is a local display image of the alarm lamp in the display interface of the instrument to be detected when the flashing state of the alarm lamp is bright; for each image, the similarity value of each overlapping region with the reference image is calculated by sliding the image block; the flashing state of the alarm lamp in each picture is determined based on the similarity value; wherein if there is an overlapping region with a similarity value exceeding a set threshold in the frame image, it is judged that the flashing state of the alarm lamp in the frame image is bright; if there is no overlapping region with a similarity value exceeding a set threshold in the frame image, it is judged that the flashing state of the alarm lamp in the frame image is off; the flashing frequency of the alarm lamp is calculated according to the statistical result.
2. The method of claim 1, wherein the method further comprises: The area for taking a photo of the instrument to be detected covers the entire display interface of the instrument to be detected.
3. The test method for the flashing state of an instrument alarm light according to claim 2, characterized in that, The normalized square difference matching method, the normalized correlation matching method and the normalized correlation coefficient matching method are used to calculate the similarity value of each overlapping region with the reference image; wherein if the three similarity values obtained all exceed a set threshold, it is judged that the flashing state of the alarm lamp in the frame image is bright.
4. The method of claim 3, wherein the step of determining the state of the instrument cluster warning light comprises the steps of: determining the state of the instrument cluster warning light by determining the state of the instrument cluster warning light using the first and second signals. The flashing frequency of the alarm lamp is calculated according to the statistical result. sample images are selected from each picture disassembled from the video file; the sample images include a group of pictures in which the flashing state of the alarm lamp is continuously bright and the flashing state of the alarm lamp is continuously off; the number of sample images is obtained; the frame frequency of taking a photo of the instrument to be detected is obtained; the flashing frequency of the alarm lamp is calculated based on the number of sample images and the frame frequency of taking a photo of the instrument to be detected.
5. The method of claim 4, wherein the step of determining the state of the instrument cluster warning light comprises the steps of: determining the state of the instrument cluster warning light by determining the state of the instrument cluster warning light using the first and second signals. The flashing frequency f of the alarm lamp is calculated by the following formula: f = 1 / (N * (1 second / fps)), wherein N is the number of sample images, and fps is the frame frequency of taking a photo of the instrument to be detected.
6. The method of claim 5, wherein the step of determining the state of the instrument cluster warning light comprises the steps of: determining the state of the instrument cluster warning light by determining the state of the instrument cluster warning light using the first and second signals. The duration of taking a photo of the instrument to be detected is set to 5-10 seconds.
7. A test device for the flicker state of an instrument warning light, characterized in that The device comprises: a control module for sending an alarm instruction to the instrument to be detected, so that the alarm lamp of the instrument to be detected flashes at a set frequency; and taking a photo of the instrument to be detected to obtain a video file of the flashing alarm lamp; The judgment module is configured to disassemble the video file into continuous pictures frame by frame, and perform template matching comparison on each picture to determine the flashing state of the alarm lamp in each picture; wherein the flashing state of the alarm lamp includes bright and dark; the template matching comparison on each picture to determine the flashing state of the alarm lamp in each picture comprises: establishing a reference image as a template in advance; wherein the reference image is a local display image of the flashing state of the alarm lamp in the display interface of the instrument to be detected when the flashing state is bright; calculating the similarity value of each overlapping area with the reference image by means of sliding image blocks for each picture; determining the flashing state of the alarm lamp in each picture based on the similarity value; wherein if there is an overlapping area with a similarity value exceeding a set threshold in the picture, it is determined that the flashing state of the alarm lamp in the picture is bright; if there is no overlapping area with a similarity value exceeding a set threshold in the picture, it is determined that the flashing state of the alarm lamp in the picture is dark. The calculation module is configured to count the flashing state of the alarm lamp in each picture and calculate the flashing frequency of the alarm lamp according to the counting result.
8. An electronic device, comprising: The processor, the memory and the bus, the memory stores machine readable instructions executable by the processor, when the electronic device runs, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to execute the steps of the test method of the flashing state of the alarm lamp of the instrument as claimed in any one of claims 1 to 6. The computer readable storage medium stores a computer program, which is executed by the processor to execute the steps of the test method of the flashing state of the alarm lamp of the instrument as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Method and system for testing flickering of vehicle warning lamp
CN105652217A
Bullet train overhauling shop pipe corridor illumination detection method, device, system and storage medium
CN107727366A
Indicator light state recognition method and device, computer equipment and storage medium
CN111639647A
Crimping defect detection method and device for crimping type strain clamp
CN112907536A