Instrument detection device, method and storage medium
By designing a combination of instrument fixture and image processor, image analysis technology is used to achieve efficient and accurate detection of multiple instruments, solving the problems of low detection accuracy and low efficiency in the prior art.
Patent Information
- Application Number
- CN202210975199.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2042-08-15
AI Technical Summary
The detection methods of existing mechanical pointer instruments rely on visual evaluation, have poor accuracy, and can only detect one instrument at a time, which is inefficient.
An instrument detection device is designed, including an instrument fixing device, a voltage controller, an image acquisition device and an image processor. Through image analysis technology, multiple instruments are detected at one time to improve detection efficiency and accuracy.
It realizes efficient and accurate detection of multiple instruments, reduces the dependence of manual evaluation, and improves detection efficiency and accuracy.
Smart Images

Figure CN115540926B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of instrument detection, and in particular, to an instrument detection device, method and storage medium. Background Art
[0002] Mechanical pointer instruments are common numerical display devices. Mechanical pointer instruments have the advantages of price deviation and high sensitivity, and are widely used in various electronic devices.
[0003] During the factory inspection of pointer instruments, it is necessary to test the pointer movement range by powering on. That is, by simulating input data, the pointer is moved between its minimum and maximum angles. The inspection personnel use the naked eye to observe and judge whether the pointer reaches the corresponding position during the back-and-forth swing, thereby performing a qualified inspection of the pointer instrument.
[0004] However, the visual assessment method has poor accuracy and can only detect one instrument at a time, which is inefficient. Summary of the invention
[0005] The embodiments of the present application provide an instrument detection device, method and storage medium, which realize the detection of multiple instruments at one time, improve the instrument detection efficiency, and perform instrument detection by image analysis with high detection accuracy.
[0006] In a first aspect, an embodiment of the present application provides an instrument detection device, including an instrument fixing device, an instrument voltage controller, an image acquisition device, and an image processor;
[0007] The instrument fixing device comprises a plurality of instrument accommodating cavities, each of which can be used to place an instrument to be tested;
[0008] The instrument voltage controller is used to provide a variable input voltage to the instrument to be tested placed on the instrument fixture to drive the pointer of the instrument to be tested to move;
[0009] The image acquisition device is used to acquire detection images of an instrument fixture on which multiple instruments to be detected are placed under multiple input voltages;
[0010] The image processor is used to perform qualified detection of the multiple instruments to be detected based on the detection image.
[0011] Optionally, the image processor includes:
[0012] An image segmentation module is used to segment the detection image for each frame of the image to be detected to obtain a group of detection sub-images, each detection sub-image corresponding to a meter to be detected;
[0013] A pointer recognition module, used to recognize the pointer in each detected sub-image;
[0014] The instrument detection module is used to perform qualified detection of the multiple instruments to be detected according to the position of the pointer in each detection sub-image.
[0015] Optionally, the pointer identification module is specifically used to:
[0016] For each detection sub-image, obtaining the texture features of each pixel in the detection sub-image;
[0017] Comparing the texture features of each pixel in the detection sub-image and in an adjacent detection sub-image corresponding to the same instrument to be detected as the detection sub-image;
[0018] According to the comparison result, converting the detection sub-image into a binary image;
[0019] The angle of the pointer in the detection sub-image is determined according to the binary image corresponding to the detection sub-image.
[0020] Accordingly, the instrument detection module is specifically used for:
[0021] According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage.
[0022] Optionally, the instrument detection module includes a pointer position detection unit, and the pointer position detection unit is used to:
[0023] For each detection sub-image, determining a weight of the angle of the pointer in the detection sub-image according to a difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group;
[0024] According to the angles and weights of the pointers in each detection sub-image of the same group, a standard angle under the corresponding input voltage is determined;
[0025] According to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
[0026] Optionally, the instrument detection module further includes:
[0027] A motion region determination unit, for superimposing, for each instrument to be detected, a binary image corresponding to the instrument to be detected under each input voltage, to obtain a pointer motion region of the instrument to be detected;
[0028] The range detection unit is used to determine whether the range of each instrument to be detected is qualified according to the pointer movement area.
[0029] Optionally, the range detection unit is specifically used for:
[0030] According to the contour of each pointer movement area, determine the pointer movement angle of each instrument to be tested;
[0031] Determine the weight of each pointer movement angle according to the difference between the pointer movement angles;
[0032] According to the movement angles of each pointer and their weights, the standard movement angle is determined;
[0033] For each instrument to be tested, whether the measuring range of the instrument to be tested is qualified is judged according to the difference between the standard movement angle and the pointer movement angle of the instrument to be tested.
[0034] Optionally, the instrument detection device further includes a switching fixture for fixing the instrument to be detected in the corresponding instrument accommodating cavity.
[0035] In a second aspect, the embodiment of the present application further provides an instrument detection method, comprising:
[0036] Acquire detection images under multiple input voltages, wherein the detection images include images of multiple instruments to be detected placed on an instrument fixture, and pointers of the instruments to be detected move under the drive of the input voltages;
[0037] According to the detection images under the multiple input voltages, the qualified detection of the multiple instruments to be detected is performed.
[0038] Optionally, performing qualified detection of the multiple instruments to be detected according to the detection images under multiple input voltages includes:
[0039] For each frame of the image to be detected, the detection image is segmented to obtain a group of detection sub-images, each detection sub-image corresponds to a meter to be detected;
[0040] identifying the pointer in each detected sub-image;
[0041] According to the position of the pointer in each detection sub-image, the qualified detection of the multiple instruments to be detected is performed.
[0042] Optionally, identify the pointer in each detected sub-image, including:
[0043] For each detection sub-image, obtaining the texture features of each pixel in the detection sub-image;
[0044] Comparing the texture features of each pixel in the detection sub-image and in an adjacent detection sub-image corresponding to the same instrument to be detected as the detection sub-image;
[0045] According to the comparison result, converting the detection sub-image into a binary image;
[0046] The angle of the pointer in the detection sub-image is determined according to the binary image corresponding to the detection sub-image.
[0047] Correspondingly, according to the position of the pointer in each detection sub-image, the qualified detection of the multiple instruments to be detected is performed, including:
[0048] According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage.
[0049] Optionally, judging whether the angle of the pointer of each instrument to be tested is qualified under the corresponding input voltage according to the angle of the pointer in each detection sub-image includes:
[0050] For each detection sub-image, determining a weight of the angle of the pointer in the detection sub-image according to a difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group;
[0051] According to the angles and weights of the pointers in each detection sub-image of the same group, a standard angle under the corresponding input voltage is determined;
[0052] According to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
[0053] Optionally, the method further includes:
[0054] For each instrument to be detected, superimpose the binary images corresponding to the instrument to be detected under each input voltage to obtain the pointer motion area of the instrument to be detected;
[0055] According to the pointer movement area, it is judged whether the measuring range of each instrument to be tested is qualified.
[0056] Optionally, judging whether the range of each instrument to be tested is qualified according to the pointer movement area includes:
[0057] According to the contour of each pointer movement area, determine the pointer movement angle of each instrument to be tested;
[0058] Determine the weight of each pointer movement angle according to the difference between the pointer movement angles;
[0059] According to the movement angles of each pointer and their weights, the standard movement angle is determined;
[0060] For each instrument to be tested, whether the measuring range of the instrument to be tested is qualified is judged according to the difference between the standard movement angle and the pointer movement angle of the instrument to be tested.
[0061] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, an instrument detection method provided in any embodiment of the present application is implemented.
[0062] In a fourth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the instrument detection method provided in any embodiment of the present application.
[0063] The embodiment of the present application provides an instrument detection device, method and storage medium, wherein a plurality of instruments to be detected are placed during testing through an instrument fixture in the instrument detection device. Each instrument to be detected is arranged in an instrument accommodating cavity. After the instrument to be detected is placed, a variable input voltage is provided to the instrument to be detected placed on the instrument fixture based on an instrument voltage controller, thereby driving the pointer of the instrument to be detected to move, and then an image acquisition device acquires an image of the instrument fixture, thereby obtaining a detection image including a plurality of instruments to be detected at a corresponding input voltage. Based on the acquired detection images of each frame, the detection of a plurality of instruments to be detected is completed at one time, thereby improving the efficiency of instrument detection, and using image analysis technology to perform instrument detection, the detection accuracy is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0065] Figure 1 A schematic diagram of an instrument detection process provided by an embodiment of the present application;
[0066] Figure 2 A schematic diagram of the structure of an instrument detection device provided in one embodiment of the present application;
[0067] Figure 3 A schematic diagram of the structure of an instrument detection device provided in another embodiment of the present application;
[0068] Figure 4 For this application Figure 2 A schematic diagram of the structure of the image processor in the illustrated embodiment;
[0069] Figure 5 A schematic diagram of a flow chart of an instrument detection method provided in one embodiment of the present application;
[0070] Figure 6 For this application Figure 5 A schematic diagram of the process of step S502 in the illustrated embodiment;
[0071] Figure 7A schematic diagram of a detection image provided by an embodiment of the present application;
[0072] Figure 8 For this application Figure 6 A schematic diagram of the process of step S602 in the illustrated embodiment;
[0073] Fig. 9 For this application Figure 8 A schematic diagram of pixel texture features in the illustrated embodiment;
[0074] Fig.10 A schematic flow chart of an instrument detection method provided in another embodiment of the present application;
[0075] Fig.11 For this application Fig.10 A schematic diagram of the pointer motion area in the illustrated embodiment.
[0076] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0077] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0078] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0079] Meters are a general term for instruments that display numerical values. The pointer is a component on the meter that indicates data. The movement principle of the meter pointer is: the magnetic field generated by the current flowing through the meter head controls the hairspring to move the pointer for deflection. By applying different input voltages or currents, magnetic fields with different field strengths can be generated, causing the pointer to rotate at different angles, and the input voltage or current is indicated by the pointer reading.
[0080] The pointer instrument needs to be tested before it leaves the factory. Figure 1 A schematic diagram of an instrument detection process provided by an embodiment of the present application, such as Figure 1 As shown, in the related art, when testing the meter 10, the tester powers on the meter 10 and controls the pointer 11 of the meter 10 to read at the minimum reading min ( Figure 1 0) and the maximum reading max ( Figure 1 160) in the figure, and then the inspection personnel visually count the readings of the pointer 11 under each input voltage Vin, and judge whether the meter 10 is qualified based on the statistical results.
[0081] Manual observation for instrument testing is time-consuming and labor-intensive, with low testing efficiency and low testing accuracy.
[0082] In view of the above problems, the present application provides a high-efficiency and high-accuracy instrument detection device, which can detect multiple instruments to be detected at one time without calibrating the position of the pointer. During instrument detection, multiple instruments to be detected are placed in an instrument fixture, and a variable input voltage is applied to the instruments to be detected. The detection image of each instrument to be detected placed on the instrument fixture under each input voltage is collected by an image acquisition device, and the detection of the instrument to be detected is realized based on the detection image, such as pointer position accuracy detection, pointer range detection, etc.
[0083] Figure 2 A schematic diagram of the structure of an instrument detection device provided in one embodiment of the present application is shown in FIG. Figure 2 As shown, the instrument detection device 200 includes: an instrument fixing device 210 , an instrument voltage controller 220 , an image acquisition device 230 and an image processor 240 .
[0084] The instrument fixing device 210 includes a plurality of instrument accommodating cavities 211. Figure 2 Taking two instrument accommodating cavities 211 as an example, an instrument 100 to be detected can be placed in each instrument accommodating cavity 211; the instrument voltage controller 220 is used to provide a variable input voltage for the instrument 100 to be detected placed on the instrument fixture 210 to drive the movement of the pointer of the instrument 100 to be detected; the image acquisition device 230 is used to acquire the detection images of the instrument fixture 210 with multiple instruments 100 to be detected placed under multiple input voltages; the image processor 240 is used to perform qualified detection of multiple instruments 100 to be detected based on the detection images.
[0085] The instrument fixing device 210 may be a matrix structure, including N rows and M columns of instrument accommodating cavities 211 , thereby supporting the detection of N*M instruments to be detected at one time. Figure 1 In the example, N is 3 and M is 3. You can configure N and M based on your needs.
[0086] During testing, the instrument 100 to be tested can be detachably placed in each instrument accommodating cavity through a fixing component.
[0087] Exemplarily, the fixing component may be a fixing frame, a clamp, etc., to prevent the instrument 100 to be tested from moving during testing.
[0088] The instruments 100 to be inspected of the same batch placed on the instrument fixture 210 are of the same model, so that the instruments 100 to be inspected included in the inspection image are of the same model, so that the inspection of each instrument 100 to be inspected is performed by identifying the position of the pointer of each instrument 100 to be inspected in the inspection image.
[0089] The meter voltage controller 220 is electrically connected to each meter 100 to be tested that is disposed on the meter fixture 210 to provide a variable input voltage to the meter 100 to be tested.
[0090] The input voltage provided by the meter voltage controller 220 varies within the operating voltage range of the meter 100 to be tested.
[0091] The input voltage provided by the meter voltage controller 220 may vary according to a preset rule.
[0092] Specifically, the instrument voltage controller 220 can gradually increase the input voltage according to the set step size, and when it increases to the maximum voltage, gradually reduce the input voltage to the minimum voltage according to the set step size, thus completing the control of the input voltage for one cycle. The input voltage can be controlled for multiple cycles, so that the image acquisition device 230 can collect more frames of detection images to improve the accuracy of instrument detection, and at the same time, the aging detection of the instrument can be realized. The set step size can be 0.1V, 0.5V, 1V or other values, which can be determined according to the working voltage range of the instrument 100 to be detected.
[0093] The image acquisition device 230 may be an image sensor, a camera, a webcam, a video recorder, etc.
[0094] The detection image can be a grayscale image, or a color image in RGB or YUV format, preferably in YUV format. The image in YUV format occupies less memory, which can reduce the resources occupied by instrument detection.
[0095] The image acquisition device 230 is arranged relative to the instrument fixture 210, and its field of view is such that the captured detection image includes the side of the instrument fixture 210 facing the image acquisition device 230, so that the detection image includes the image of each instrument 100 to be detected placed on the instrument fixture 210.
[0096] The image acquisition device 230 acquires detection images at a first frequency, and the instrument voltage controller 220 adjusts the input voltage at a second frequency. The first frequency may be an integer multiple of the second frequency, so that one or more detection images may be acquired at each input voltage.
[0097] Specifically, the synchronous control of the actions of the image acquisition device 230 and the instrument voltage controller 220 can be achieved through time synchronization control, so that the number of detection images collected under each input voltage is as equal as possible.
[0098] The image processor 240 receives and stores the images captured by the image acquisition device 230 in real time, identifies the position of the pointer of each instrument 100 to be detected in the detection image for each frame of the detection image, and then uses the average value of the position of the pointer of each instrument to be detected as the standard position, calculates the deviation of the pointer position of each instrument 100 to be detected from the standard position, and determines whether each instrument 100 to be detected is qualified in combination with the deviation corresponding to each instrument 100 to be detected in the multiple frames of detection images collected.
[0099] In one embodiment, the image processor 240 may be integrated into the image acquisition device 230, or the image processor 240 may be disposed outside the image acquisition device 230 as a separate device, such as an image processing platform.
[0100] The instrument detection device provided in this embodiment places multiple instruments to be detected during testing through the instrument fixing device in the instrument detection device. Each instrument to be detected is set in an instrument accommodating cavity. After the instrument to be detected is placed, the instrument voltage controller provides a variable input voltage to the instrument to be detected placed on the instrument fixing device, thereby driving the pointer of the instrument to be detected to move, and then the image acquisition device acquires the image of the instrument fixing device, thereby obtaining a detection image including multiple instruments to be detected at the corresponding input voltage. Based on the acquired detection images of each frame, the detection of multiple instruments to be detected is completed at one time, thereby improving the efficiency of instrument detection, and the image analysis technology is used to perform instrument detection, and the detection accuracy is high.
[0101] Figure 3 This is a schematic diagram of the structure of an instrument detection device provided in another embodiment of the present application, combined with Figure 2 and Figure 3 In this embodiment, the instrument detection device 200 further includes a switching fixture 250 , and the instrument 100 to be detected can be fixed to the corresponding instrument accommodating cavity 211 through the switching fixture 250 .
[0102] A matching adapter fixture 250 can be selected for different types of instruments 100 to be tested, so as to adapt to the testing of various types of instruments 100 to be tested.
[0103] Optional, Figure 4 For this application Figure 2 The structural diagram of the image processor in the embodiment shown is as follows: Figure 4 As shown, the image processor 240 includes: an image segmentation module 241 , a pointer recognition module 242 and an instrument detection module 243 .
[0104] Among them, the image segmentation module 241 is used to segment the detection image for each frame of the image to be detected to obtain a group of detection sub-images, each detection sub-image corresponds to an instrument to be detected; the pointer recognition module 242 is used to identify the pointer in each detection sub-image; the instrument detection module 243 is used to perform qualified detection of the multiple instruments to be detected according to the position of the pointer in each detection sub-image.
[0105] Optionally, the pointer identification module 242 is specifically used for:
[0106] For each detection sub-image, the texture features of each pixel in the detection sub-image are obtained; the texture features of each pixel in the detection sub-image and in an adjacent detection sub-image corresponding to the same instrument to be detected as the detection sub-image are compared; according to the comparison result, the detection sub-image is converted into a binary image; according to the binary image corresponding to the detection sub-image, the angle of the pointer in the detection sub-image is determined.
[0107] Accordingly, the instrument detection module 243 is specifically used for:
[0108] According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage.
[0109] Optionally, the instrument detection module 243 includes a pointer position detection unit, and the pointer position detection unit is used to:
[0110] For each detection sub-image, the weight of the angle of the pointer in the detection sub-image is determined according to the difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group; the standard angle under the corresponding input voltage is determined according to the angle of the pointer in each detection sub-image in the same group and its weight; according to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
[0111] Optionally, the instrument detection module 243 further includes:
[0112] The motion region determination unit is used to superimpose the binary images corresponding to each instrument to be detected under each input voltage to obtain the pointer motion region of the instrument to be detected; the range detection unit is used to determine whether the range of each instrument to be detected is qualified according to the pointer motion region.
[0113] Optionally, the range detection unit is specifically used for:
[0114] According to the contour of each pointer movement area, the pointer movement angle of each instrument to be tested is determined; according to the difference between each pointer movement angle, the weight of each pointer movement angle is determined; according to each pointer movement angle and its weight, the standard movement angle is determined; for each instrument to be tested, according to the difference between the standard movement angle and the pointer movement angle of the instrument to be tested, whether the range of the instrument to be tested is qualified is judged.
[0115] The image processor 240 provided in the embodiment of the present application can execute the instrument detection method provided in any subsequent embodiment, and has the corresponding functional modules and beneficial effects of the execution method.
[0116] For related instructions, please refer to Figure 5 , Figure 6 , Figure 8 as well as Fig.10 The relevant descriptions and effects corresponding to the steps are understood, and no further elaboration is given here.
[0117] Figure 5 A flow chart of an instrument detection method provided for an embodiment of the present application. The instrument detection method provided in this embodiment can be executed by an image processor, an image processing platform, an image processing device, etc., and can also be executed by an instrument detection device, such as the instrument detection device 200 or the image processor 240 provided in the above embodiments.
[0118] like Figure 5 As shown, the instrument detection method includes the following steps:
[0119] Step S501 : acquiring detection images under multiple input voltages, wherein the detection images include images of multiple instruments to be detected placed on an instrument fixture, and pointers of the instruments to be detected move under the influence of the input voltages.
[0120] The instrument fixing device may be the instrument fixing device 210 provided in the above embodiment, or other devices capable of placing a plurality of instruments to be tested.
[0121] Each instrument to be tested can be arranged in an instrument accommodating cavity of the instrument fixing device.
[0122] Specifically, the image acquisition device may be controlled to capture the image of the instrument fixing device according to the first frequency, thereby obtaining a frame of detection image.
[0123] Under each input voltage, the image acquisition device is controlled to acquire at least one frame of detection image to obtain at least one frame of detection image corresponding to the input voltage.
[0124] Each frame of the detection image includes images of all the instruments to be detected placed on the instrument fixture under the corresponding input voltage.
[0125] After obtaining each frame of the detection image, the detection image can also be preprocessed, such as image conversion, image filtering, image segmentation, etc. For example, the color detection image can be converted into a grayscale image through image conversion, and only the image corresponding to the instrument fixture in the detection image is retained through image segmentation operation, and the blank area is deleted, thereby reducing the amount of data for subsequent image processing.
[0126] The method further comprises: controlling the instrument voltage controller to provide a variable input voltage to the instrument to be detected placed on the instrument fixture to drive the pointer of the instrument to be detected to move.
[0127] The method further includes: adjusting input voltages of a plurality of instruments to be tested placed on the instrument fixture according to a preset rule.
[0128] Step S502: performing qualification detection of the multiple instruments to be detected according to the detection images under multiple input voltages.
[0129] For each frame of the detection image, the position or rotation angle of the pointer of each instrument to be detected in the detection image is identified, and whether each detection instrument is qualified is determined based on the position or rotation angle of the pointer of each instrument to be detected in each frame of the detection image.
[0130] Furthermore, the detection results of each instrument to be detected can also be output.
[0131] The instrument detection method provided in the embodiment of the present application realizes the detection of multiple instruments to be detected at one time based on the collected detection images of each frame, thereby improving the efficiency of instrument detection, and uses image analysis technology to perform instrument detection with high detection accuracy.
[0132] Optional, Figure 6 For this application Figure 5 The flowchart of step S502 in the embodiment shown is as follows: Figure 6 As shown, step S502 may include the following steps:
[0133] Step S601 : for each frame of the image to be detected, segment the detection image to obtain a group of detection sub-images.
[0134] Each detection sub-image corresponds to an instrument to be detected.
[0135] Specifically, the segmentation method of the detection image can be determined according to the arrangement of the instrument accommodating cavities in the instrument fixing device, and based on the segmentation method, the image to be detected is segmented into multiple detection sub-images, that is, a group of detection sub-images.
[0136] Exemplarily, each group of detection sub-images may be composed of N*M sub-images to be detected, where N and M are the number of rows and columns of the instrument accommodating cavity of the instrument fixture, respectively.
[0137] Figure 7 A schematic diagram of a detection image provided by an embodiment of the present application, such as Figure 7 As shown in the figure, the detection image includes 3 rows and 3 columns of images of the instrument to be detected. Figure 7 The dotted lines shown in , divide the detection image into 9 detection sub-images, such as Figure 7 img1 to img9 in the.
[0138] Specifically, the edge of the instrument accommodating cavity in the image to be detected may be identified first, and the image to be detected may be segmented into a group of detection sub-images based on the edge of the instrument accommodating cavity.
[0139] Step S602: identifying the pointer in each detected sub-image.
[0140] Specifically, the moving pointer in the detection sub-image of the current frame may be identified based on two or more adjacent detection sub-images corresponding to the same instrument to be detected.
[0141] Specifically, based on a pre-trained pointer recognition model, the pointer in each detected sub-image is identified, and the position of the pointer in the image is marked.
[0142] Step S603: performing qualified detection of the multiple instruments to be detected according to the position of the pointer in each detection sub-image.
[0143] Specifically, based on the position of the pointer of each detection sub-image in the same group of detection sub-images, the deviation between the pointer position and the standard position of the corresponding instrument to be detected under the corresponding input voltage of the group can be calculated, and then combined with the deviation corresponding to each instrument to be detected under each input voltage, it is determined whether each detection instrument is qualified.
[0144] The standard position may be a theoretical value of the pointer position of the instrument to be tested under the corresponding input voltage. The standard position used in each group may also be an average value of the pointer positions of each detection sub-image in the group of detection sub-images.
[0145] By segmenting the detection image, a sub-image corresponding to each instrument to be detected is obtained, which reduces the influence of images of other instruments to be detected during pointer recognition and improves the accuracy of pointer position recognition.
[0146] Optional, Figure 8 For this application Figure 6 The flowchart of step S602 in the embodiment shown is as follows: Figure 8 As shown, step S602 may include the following steps:
[0147] Step S801: for each detection sub-image, obtain the texture feature of each pixel in the detection sub-image.
[0148] Specifically, for each pixel in the detection sub-image, the texture feature of the pixel may be determined according to the pixel value of the pixel and the pixel values of pixels surrounding the pixel.
[0149] Furthermore, the texture features of each pixel in the detection sub-image may be determined based on a texture detection algorithm, such as a Local Binary Pattern (LBP) algorithm.
[0150] Texture features can be represented in binary form. Fig. 9 For this application Figure 8 A schematic diagram of pixel texture features in the embodiment shown is as follows: Fig. 9 As shown, in the detection sub-image, the pixel values of the 8 adjacent pixels of a certain pixel (pixel value is 5) are arranged clockwise as 9, 3, 1, 2, 6, 4, 7 and 8, and the values of the adjacent pixels with higher pixel values than the pixel value of the pixel are set to 1, and the values of the adjacent pixels with lower pixel values than the pixel value of the pixel are set to 0, thereby obtaining the binary texture feature corresponding to the pixel, that is, 10001011. Fig. 9 In the figure, 8 adjacent pixels are taken as an example, but it can also be 4 adjacent pixels, 15 adjacent pixels, etc.
[0151] Step S802 : comparing the texture features of each pixel in the detection sub-image and the adjacent detection sub-image corresponding to the same instrument to be detected as the detection sub-image.
[0152] Specifically, for each detection sub-image, the texture features of each pixel of the adjacent detection sub-image of the detection sub-image are obtained; and the texture features of the pixels at corresponding positions in the detection sub-image and the adjacent detection sub-image are compared.
[0153] The adjacent detection sub-images and the detection sub-image are detection sub-images corresponding to the same instrument to be detected and whose acquisition time of the detection images to which they belong is adjacent.
[0154] In one embodiment, an XOR operation may be performed on the texture features of pixels corresponding to the positions, thereby retaining a pointer for detecting motion in the sub-image.
[0155] Step S803: convert the detected sub-image into a binary image according to the comparison result.
[0156] Among them, the pixel with a pixel value of 0 (black) in the binary image is a pixel whose texture features are different from those of the pixel at the position in the detection sub-image and the adjacent detection sub-image. The pixel with a pixel value of 255 (white) in the binary image is a pixel whose texture features are the same as those of the pixel at the position in the detection sub-image and the adjacent detection sub-image.
[0157] If the XOR operation result of the texture features of the pixel corresponding to the position is 0, the pixel value at that position in the detection sub-image is determined to be 255; if the XOR operation result of the texture features of the pixel corresponding to the position is not 0, the pixel value at that position in the detection sub-image is determined to be 0.
[0158] Step S804: determining the angle of the pointer in the detection sub-image according to the binary image corresponding to the detection sub-image.
[0159] Through the above steps, usually only the image corresponding to the pointer is retained in the binary image, and the angle (or rotation angle) of the pointer in the binary image can be determined by linear fitting, that is, the angle of the pointer in the detection sub-image can be obtained.
[0160] In one embodiment, the angle of the pointer in the binary image may be determined based on the pixel coordinates of a plurality of pixel points with a preset pixel value of 0 in the binary image.
[0161] Accordingly, the above step S603 is specifically as follows:
[0162] According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage.
[0163] Specifically, the angle of the pointer determined based on the detection sub-image at each input voltage can be compared with the angle deviation of the standard angle of the pointer at each input voltage to determine whether the angle of the pointer of the instrument to be tested is qualified at each input voltage, and then determine whether the instrument to be tested is qualified.
[0164] Through the above steps, the recognition of moving objects in the detection sub-image is realized, the recognition logic complexity is low and the recognition efficiency is high; based on the recognition result, the detection sub-image is converted into a binary image, which reduces the influence of the stationary parts of the monitored instrument on the pointer angle calculation and improves the accuracy of the pointer angle determination.
[0165] In order to avoid the deviation of the pointer angle caused by the setting posture of the instrument to be detected, the fixing components can be adjusted so that the postures of the instruments to be detected in the corresponding instrument accommodating cavities are the same. Then the standard angle corresponding to each group of detection sub-images can be determined by the pointer angle corresponding to each detection sub-image in the group of detection sub-images.
[0166] Specifically, taking each group of detection sub-images as a unit, after obtaining the angle of the pointer in each detection sub-image in each group of detection sub-images, the standard angle corresponding to the group of detection sub-images is determined based on the various angles corresponding to the group of detection sub-images, and then the angle of the pointer corresponding to each detection sub-image in the group of detection sub-images and the angular deviation from the standard angle are calculated; based on the angular deviation corresponding to each detection sub-image corresponding to the instrument to be detected, it is judged whether the instrument to be detected is qualified.
[0167] Optionally, judging whether the angle of the pointer of each instrument to be tested is qualified under the corresponding input voltage according to the angle of the pointer in each detection sub-image includes:
[0168] For each detection sub-image, the weight of the angle of the pointer in the detection sub-image is determined according to the difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group; the standard angle under the corresponding input voltage is determined according to the angle of the pointer in each detection sub-image in the same group and its weight; according to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
[0169] Specifically, the pointer angle set corresponding to the group is formed by the angles of the pointers in the same group of detection sub-images, and each angle in the pointer angle set is traversed. Based on the number of angles in the pointer angle set whose difference with the current angle is less than or equal to the preset difference, the weight corresponding to the angle is determined, and so on, the weight of the pointer angle in each detection sub-image in each group of detection sub-images is obtained. Then, the weighted average of the pointer angles in each detection sub-image of the same group is obtained to obtain the standard angle corresponding to the group. The angle deviation between the pointer angle in each detection sub-image and the corresponding standard angle is calculated to obtain the angle deviation of the pointer of each instrument to be detected at each input voltage. Based on the angle deviation of the pointer of the instrument to be detected at each input voltage, it is judged whether the pointer position of the instrument to be detected is qualified.
[0170] Exemplarily, if there is an angle deviation greater than a first preset deviation among the angle deviations corresponding to the instrument to be tested, the instrument to be tested is determined to be unqualified, and the first preset deviation may be 7°, 5°, 3° or other values.
[0171] Exemplarily, if the proportion of angle deviations corresponding to the angle deviations of the instrument to be tested that are greater than the second preset deviation is higher than the preset proportion, the instrument to be tested is determined to be unqualified, the second preset deviation is smaller than the first preset deviation, the second preset deviation can be 5°, 4°, 3° or other values, and the preset proportion can be 50%, 30% or other percentages.
[0172] The first preset deviation, the second preset deviation and the preset proportion are all configurable parameters.
[0173] The standard angle is determined by the pointer angle of the same group of detection sub-images in a weighted manner. The standard angle is determined with reference to the same group of detection sub-images. Compared with the traditional method of using a unified standard angle, the overall angle deviation caused by the placement of the instrument is taken into account, thereby improving the accuracy of angle detection. At the same time, there is no need to calibrate the pointer during detection, thereby improving detection efficiency.
[0174] In one embodiment, the standard angle can be determined in the following manner: the pointer angle set corresponding to the detection sub-images belonging to the same group is For example, j i Indicates the angle of the pointer in the i-th detection sub-image in the group of detection sub-images. For each group of detection sub-images, take the pointer angle set corresponding to the group as the initial value of the target set, start from i=1, take out the first element in the current pointer angle set, and record it as j min , j min The initial value is j1, and the remaining elements are searched for the angle at The target element in the range is taken out and j min and its target element are placed at the end of the target set to improve j min and the weight of its target element, if j min If the corresponding target element is 0, the next loop is performed directly to take out the first element in the current pointer angle set, and so on, until the current pointer angle set is an empty set, thus obtaining the final target set, and calculating the average value of each element in the target set to obtain the standard angle corresponding to the group of detection sub-images.
[0175] For example, taking each group of detection sub-images including 4 detection sub-images as an example, assuming that the pointer angle set is {10 1114 12}, is 1, then the target set obtained through the above steps is {10 11 14 12 10 11}, and the corresponding standard angle is 11.33°.
[0176] Through the above-mentioned weighting method, the weight of the angle with a smaller angle difference is increased, thereby improving the accuracy of the calculated standard angle and the accuracy of the pointer angle detection.
[0177] Fig.10 A flow chart of an instrument detection method provided in another embodiment of the present application is as follows: Fig.10 As shown, this embodiment is based on the above-mentioned instrument detection method embodiment, and adds the following steps to realize the range detection of the instrument to be detected, so as to enrich the detection function:
[0178] Step S1001 : for each instrument to be detected, superimpose the binary images corresponding to the instrument to be detected under various input voltages to obtain the pointer motion area of the instrument to be detected.
[0179] The pointer movement area is used to represent the range or measurement range of the pointer movement under each input voltage. The pointer movement area can be a sector, a semicircle, or a shape similar to these shapes.
[0180] For example, Fig.11 For this application Fig.10 The schematic diagram of the pointer motion area in the embodiment shown is as follows: Fig.11 As shown, the pointer movement area is a fan-shaped figure.
[0181] Step S1002: judging whether the measuring range of each instrument to be tested is qualified according to the pointer movement area.
[0182] Specifically, the starting angle and the ending angle of the pointer movement can be determined according to the pointer movement area, and based on the difference between the ending angle of the pointer movement and the starting angle, it can be judged whether the range of each instrument to be tested is qualified.
[0183] Furthermore, the standard measuring range of the instrument to be tested can be obtained, and whether the measuring range of each instrument to be tested is qualified can be determined based on the difference between the ending angle of the pointer movement minus the starting angle and the standard measuring range.
[0184] Optionally, judging whether the range of each instrument to be tested is qualified according to the pointer movement area includes:
[0185] According to the contour of each pointer movement area, the pointer movement angle of each instrument to be tested is determined; according to the difference between each pointer movement angle, the weight of each pointer movement angle is determined; according to each pointer movement angle and its weight, the standard movement angle is determined; for each instrument to be tested, according to the difference between the standard movement angle and the pointer movement angle of the instrument to be tested, whether the range of the instrument to be tested is qualified is judged.
[0186] Specifically, for the pointer motion area corresponding to each instrument to be detected, the outline of the pointer motion area is extracted, and based on the outline of the pointer motion area, two pointer motion angles, namely the starting angle and the ending angle of the pointer motion, are determined; based on the difference between the starting angle and the ending angle of the pointer motion, the angle variation range of the pointer of each instrument to be detected is obtained.
[0187] In one embodiment, the starting angle and the ending angle may be represented by the angle of the line corresponding to the set pixel points in the pointer motion area.
[0188] According to the difference between the starting angles corresponding to each detection instrument, the weight of the starting angle corresponding to each detection instrument is determined, and the weighted average of the starting angles is calculated to obtain the standard starting angle; according to the difference between the ending angles corresponding to each detection instrument, the weight of the ending angle corresponding to each detection instrument is determined, and the weighted average of the ending angles is calculated to obtain the standard ending angle; the difference between the standard ending angle and the standard starting angle is calculated to obtain the standard range (or standard movement angle), and according to the difference between the standard range and the angle change range of the instrument to be detected, it is judged whether the range of the instrument to be detected is qualified.
[0189] Exemplarily, if the absolute value of the difference between the standard range and the angle variation range of the instrument to be tested is greater than a set threshold, it is determined that the range of the instrument to be tested is unqualified. The set threshold can be 5°, 3° or other values. The set threshold can be configured according to parameters such as the range and accuracy requirements of the instrument to be tested.
[0190] In one embodiment, the standard starting angle and the standard ending angle can be determined by referring to the method of determining the standard angle. Taking the starting angle as an example, the starting angle set of each instrument to be detected is For example, s i Indicates the starting angle of the i-th instrument to be tested. is the initial value of the target set. Starting from i=1, take out the first element in the current starting angle set and record it as s min ,s min The initial value is s1, and the remaining elements are searched for the angle at The target element in the range is taken out and s min and its target element are placed at the end of the target set to improve s min and the weight of its target element, if s min If the corresponding target element is 0, the next loop is performed directly to take out the first element in the current starting angle set, and so on, until the current starting angle set is an empty set, thus obtaining the final target set, and calculating the average value of each element in the target set to obtain the standard starting angle.
[0191] The process of determining the standard end angle is similar to the above process, and only the start angle is replaced by the end angle. The corresponding start angle set is the end angle set, which will not be repeated here.
[0192] Through the above-mentioned weighting method, the weight of the angle with a smaller angle difference is increased, thereby improving the accuracy of the calculated standard angle and the accuracy of the pointer range detection.
[0193] Furthermore, the above-mentioned instrument detection method can also be performed for a long time to realize aging test of the instruments to be detected. For example, after executing the above-mentioned instrument detection method multiple times (such as 1000 times, 10000 times, etc.), the above-mentioned instrument detection method is executed again to determine whether multiple instruments to be detected are still qualified, thereby realizing the detection of instrument durability and further enriching the function of instrument detection.
[0194] The present application also provides an instrument detection device, including:
[0195] An image acquisition module is used to acquire detection images under multiple input voltages, wherein the detection images include images of multiple instruments to be detected placed on an instrument fixture, and the pointers of the instruments to be detected move under the drive of the input voltage; and a qualified detection module is used to perform qualified detection of the multiple instruments to be detected based on the detection images under the multiple input voltages.
[0196] Optional, conformity testing modules include:
[0197] An image segmentation unit is used to segment the detection image for each frame of the image to be detected to obtain a group of detection sub-images, each detection sub-image corresponding to a meter to be detected;
[0198] A pointer identification unit, used for identifying a pointer in each detection sub-image;
[0199] The qualified detection unit is used to perform qualified detection of the multiple instruments to be detected according to the position of the pointer in each detection sub-image.
[0200] Optionally, the pointer identification unit is specifically used to:
[0201] For each detection sub-image, obtaining the texture features of each pixel in the detection sub-image;
[0202] Comparing the texture features of each pixel in the detection sub-image and in an adjacent detection sub-image corresponding to the same instrument to be detected as the detection sub-image;
[0203] According to the comparison result, converting the detection sub-image into a binary image;
[0204] The angle of the pointer in the detection sub-image is determined according to the binary image corresponding to the detection sub-image.
[0205] Accordingly, the qualified detection unit is specifically used for:
[0206] According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage.
[0207] Optionally, the qualification detection unit includes a pointer position detection subunit, and the pointer position detection subunit is used to:
[0208] For each detection sub-image, determining a weight of the angle of the pointer in the detection sub-image according to a difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group;
[0209] According to the angles and weights of the pointers in each detection sub-image of the same group, a standard angle under the corresponding input voltage is determined;
[0210] According to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
[0211] Optionally, the qualified detection unit further includes:
[0212] The motion region determination subunit is used to superimpose the binary images corresponding to each instrument to be detected under each input voltage to obtain the pointer motion region of the instrument to be detected;
[0213] The range detection subunit is used to determine whether the range of each instrument to be detected is qualified according to the pointer movement area.
[0214] Optionally, the range detection subunit is specifically used for:
[0215] According to the contour of each pointer movement area, determine the pointer movement angle of each instrument to be tested;
[0216] Determine the weight of each pointer movement angle according to the difference between the pointer movement angles;
[0217] According to the movement angles of each pointer and their weights, the standard movement angle is determined;
[0218] For each instrument to be tested, whether the measuring range of the instrument to be tested is qualified is judged according to the difference between the standard movement angle and the pointer movement angle of the instrument to be tested.
[0219] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the instrument detection method provided by any of the above embodiments of the present application.
[0220] Among them, the computer readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0221] An embodiment of the present application provides a computer program product, including a computer program, which is executed by a processor of an instrument detection device to control the instrument detection device to implement the instrument detection method provided by any of the above embodiments of the present application.
[0222] The processor may be an integrated circuit chip having the ability to process signals. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The disclosed methods, steps and logic block diagrams in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0223] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules 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 modules, which can be electrical, mechanical or other forms.
[0224] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the disclosure disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0225] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An instrument detection device, characterized in that: It includes an instrument fixture, an instrument voltage controller, an image acquisition device and an image processor; The instrument fixing device comprises a plurality of instrument accommodating cavities, each of which can be used to place an instrument to be tested; The instrument voltage controller is used to provide a variable input voltage to the instrument to be tested placed on the instrument fixture to drive the pointer of the instrument to be tested to move; The image acquisition device is used to acquire detection images of an instrument fixture on which multiple instruments to be detected are placed under multiple input voltages; The image processor is used to perform qualified detection of the multiple instruments to be detected according to the detection image; The image processor comprises: An image segmentation module is used to segment the detection image for each frame of the image to be detected to obtain a group of detection sub-images, each detection sub-image corresponding to a meter to be detected; A pointer recognition module, used to recognize the pointer in each detected sub-image; An instrument detection module, used for performing qualified detection of the multiple instruments to be detected according to the position of the pointer in each detection sub-image; The pointer identification module is specifically used for: For each detection sub-image, obtaining the texture features of each pixel in the detection sub-image; Comparing the texture features of each pixel in the detection sub-image and in an adjacent detection sub-image corresponding to the same instrument to be detected as the detection sub-image; According to the comparison result, converting the detection sub-image into a binary image; determining the angle of the pointer in the detection sub-image according to the binary image corresponding to the detection sub-image; The instrument detection module is specifically used for: According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage; The instrument detection module includes a pointer position detection unit, and the pointer position detection unit is used to: For each detection sub-image, determining a weight of the angle of the pointer in the detection sub-image according to a difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group; According to the angles and weights of the pointers in each detection sub-image of the same group, a standard angle under the corresponding input voltage is determined; According to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
2. The device according to claim 1, characterized in that The instrument detection module also includes: A motion region determination unit, for superimposing, for each instrument to be detected, a binary image corresponding to the instrument to be detected under each input voltage, to obtain a pointer motion region of the instrument to be detected; The range detection unit is used to determine whether the range of each instrument to be detected is qualified according to the pointer movement area.
3. The device according to claim 2, characterized in that The range detection unit is specifically used for: According to the contour of each pointer movement area, determine the pointer movement angle of each instrument to be tested; Determine the weight of each pointer movement angle according to the difference between the pointer movement angles; According to the movement angles of each pointer and their weights, the standard movement angle is determined; For each instrument to be tested, whether the measuring range of the instrument to be tested is qualified is judged according to the difference between the standard movement angle and the pointer movement angle of the instrument to be tested.
4. The device according to claim 1, characterized in that It also includes a transfer fixture for fixing the instrument to be tested in the corresponding instrument accommodating cavity.
5. An instrument detection method, characterized in that: include: Acquire detection images under multiple input voltages, wherein the detection images include images of multiple instruments to be detected placed on an instrument fixture, and pointers of the instruments to be detected move under the drive of the input voltages; Performing qualified detection of the multiple instruments to be detected according to the detection images under multiple input voltages; According to the detection images under the multiple input voltages, the qualified detection of the multiple instruments to be detected is performed, including: For each frame of the image to be detected, the detection image is segmented to obtain a group of detection sub-images, each detection sub-image corresponds to a meter to be detected; identifying the pointer in each detected sub-image; According to the position of the pointer in each detection sub-image, the qualified detection of the multiple instruments to be detected is performed; The step of performing qualified detection of the plurality of instruments to be detected according to the positions of the pointers in the detection sub-images includes: According to the angle of the pointer in each detection sub-image, it is judged whether the angle of the pointer of each instrument to be detected is qualified under the corresponding input voltage; The step of judging whether the angle of the pointer of each instrument to be tested is qualified under the corresponding input voltage according to the angle of the pointer in each detection sub-image includes: For each detection sub-image, determining a weight of the angle of the pointer in the detection sub-image according to a difference between the angle of the pointer in the detection sub-image and the angle of the pointer in each detection sub-image in the same group; According to the angles and weights of the pointers in each detection sub-image of the same group, a standard angle under the corresponding input voltage is determined; According to the difference between the detection sub-image and the corresponding standard angle, it is judged whether the angle of the pointer of the instrument to be detected corresponding to the detection sub-image is qualified under the corresponding input voltage.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the instrument detection method according to claim 5 is implemented.
Citation Information
Patent Citations
Machine vision method for identifying dial plate information of multi-pointer instrument
CN102176228A