Ventilation plug hole detection method
By identifying and counting ventilation plug holes and calculating the hole center distance, the problem of difficulty in detecting the number and distance of ventilation plug holes in the prior art is solved, and standard detection of holes is achieved.
Patent Information
- Application Number
- CN202510132242.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-05-06
AI Technical Summary
The prior art is difficult to effectively detect the number of ventilation plug holes and mutual distances, and cannot meet the strict detection requirements.
By collecting and detecting images, identifying ventilation plug holes. After rotating the ventilation plug X1 circle, counting the holes, obtaining the maximum number of continuous holes, and calculating the center distance of the holes. If the standard number of holes does not meet the standard number of holes or the center distance exceeds the preset value, an error signal and error point will be generated.
It realizes the specifications and standards of ventilation plug holes, which is simple, effective, and easy to use.
Smart Images

Figure CN119936022A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of hole detection, and in particular to a method for detecting holes in vent plugs. Background Art
[0002] The patent with publication number CN113834826A discloses a hole detection system and a hole detection method. The hole detection system includes a back plate unit, an image capture unit and a lighting unit. The back plate unit has a first reflective surface for carrying an object, and the object has a through hole and a hole wall surrounding the through hole. The image capture unit is used to capture an image of the through hole or the hole wall. The lighting unit and the image capture unit are arranged on the same side of the first reflective surface of the corresponding back plate unit, and provide a light beam to the through hole. Thereby, the hole detection system and the hole detection method provided by the present invention can reduce the overall volume of the detection system by setting the back plate unit so that the image capture unit and the lighting unit can be arranged on the same side of the back plate unit, and greatly increase the configuration flexibility of components.
[0003] However, for ventilation plugs, there are strict requirements on the number of holes and the distances between them. But how to detect them and provide a reasonable and practical method is a difficult problem. Based on this, a solution is provided. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art; To this end, the present invention proposes a method for detecting holes in vent plugs, which specifically comprises the following steps: The target object is identified from the collected detection image. The target object is the hole of the vent plug. When collecting the detection image, the vent plug is rotated by X1 circles, and the value of X1 is greater than 1. After identifying the target object, count several rows of target objects to obtain the maximum number of target objects that meet the continuity requirement that the center distance between two adjacent target objects is less than or equal to the preset value X2, and mark it as real-time counting. If the real-time count is less than the standard number of holes, an error signal is generated, and at the same time, the error points formed by any two target objects whose center distance exceeds X2 are obtained, and the center distance is marked; The error information formed by integrating the error point and the error signal is displayed to the administrator.
[0005] Furthermore, X1 is a preset value.
[0006] Furthermore, the CCD device is used to take pictures of the surrounding side of the ventilation plug hole. When taking pictures, the rotation speed is controlled by the number of pulses of the private service motor, and one pulse corresponds to a rotation of 0.18°.
[0007] Furthermore, the center distance between two target objects is obtained by: Draw a perpendicular line in the vertical direction, moving from one side of the first target object to the other side of the target object, and the distance between the points that first touch the two target objects is marked as the center distance.
[0008] Furthermore, the distance is calculated using the following method: Get the number of pixels occupied by the center distance and mark it as the actual occupied pixels; under the same shooting environment, shoot an object of set length X3, then get the number of pixels where it is located, mark it as the standard pixels, divide X3 by the standard pixels, and mark the resulting value as the conversion rate; multiply the actual occupied pixels by the conversion rate, and mark the resulting value as the center distance.
[0009] Furthermore, when counting target objects, if the center distance between any two target objects is less than or equal to X2, counting will be restarted after crossing the corresponding two target objects.
[0010] Furthermore, the value of X1 is determined by rotation analysis, and the specific method of rotation analysis is as follows: Count the number of holes in the vent plug from zero, and then change the value of X1 from 1.1 to a value of 0.1 at intervals until the value reaches 2; mark the number of circles X1 as the measuring circle; Each time a value of X1 is determined, the real-time missing number representing the number of error points is obtained, and the mean value of the real-time missing number is marked as the parallax value of the corresponding measurement circle; the measurement circle with the smallest parallax value is marked as the initial value; Then, the number of missing holes is increased by one point each time until the number of missing holes is three. Each time a missing hole number is determined, an initial value under the missing hole number is obtained. In this process, the real-time missing number is the number of corresponding error points minus the number of missing holes. The final initial state value is determined based on the fact that the initial state value is inversely proportional to the number of holes, and the value is assigned to X1.
[0011] Furthermore, the initial state value is determined by selecting the minimum value, and the selected value = initial state value / (number of missing holes+1).
[0012] Furthermore, the target object is identified as follows: Under the same conditions as the test image, a hole image of a standard vent plug is collected, scaled down to three-quarters and marked as a standard template; The standard template is embedded into the detection image. When a picture consistent with the standard template can be detected and the sample covered by the standard template can be marked as the target object.
[0013] Compared with the prior art, the present invention has the following beneficial effects: The present application identifies the target object from the collected detection image, where the target object is the hole in the ventilation plug. When collecting the detection image, it is ensured that the ventilation plug is rotated X1 circles. After the target object is identified, several rows of target objects are counted to obtain the maximum number of target objects that meet the continuity requirement that the center distance between two adjacent target objects is less than or equal to a preset value X2. The number is marked as a real-time count, and if the real-time count is less than the standard number of holes, an error signal is generated, and at the same time, error points formed by any two target objects whose center distance exceeds X2 are obtained; thereby achieving standard detection of the specifications of the holes. The present application is simple, effective, and easy to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A flow chart of the method is provided for the present invention; Figure 2 A sample schematic diagram of a detection diagram of the present invention; Figure 3 This is a schematic diagram of the detection diagram of the present invention detecting that the center distance is too large; Figure 4 Schematic diagram of hole counting in the detection diagram of the present invention. DETAILED DESCRIPTION
[0015] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] See also Figure 1 The present application provides a method for detecting holes in vent plugs, which specifically comprises the following steps: Step 1: First, collect pictures; The CCD device is used to take pictures of the surroundings of the holes of the vent plugs. When taking pictures, the rotation speed is controlled by the number of pulses of the private motor. One pulse corresponds to a rotation of 0.18°, and the rotation is set to X1 circle. Here, X1 circle is a preset value, which is generally 1.5 circles, that is, corresponding to three thousand pulses. Of course, other values can also be taken. The collected pictures are processed into black-background pictures, and the holes are displayed in white. The obtained pictures are marked as detection pictures. Step 2: Identify the test image. The specific identification method is: like Figure 2 As shown in the figure, the holes in the identified detection image are white circular areas, which are directly marked as holes. For the convenience of subsequent description, they are uniformly called target objects here. Then, all target objects are obtained, and several rows of target objects are obtained according to one row. Step 3: Count the target objects. The specific counting method is: First, select any row of target objects, take any target object in the row as the starting point, and then start counting from the starting point. The counting needs to satisfy that the center distance between two target objects is less than or equal to X2; The center distance between two target objects is obtained by drawing a vertical line from one side of the first target object to the other side of the target object. The distance between the points that first touch the two target objects is marked as the center distance. Of course, the distance between the center points of the two target objects can also be used for measurement if the center points are easy to obtain. The distance measurement method can be used in the following ways: Get the number of pixels occupied by the center distance and mark it as occupied pixels; Then, in the same shooting environment, take a picture of an object of set length X3, and then obtain the number of pixels where it is located, mark it as the standard pixel number, divide X3 by the standard pixel number, and the resulting value is marked as the conversion rate; Multiply the actual occupied pixels by the conversion rate, and the resulting value is marked as the center distance; In addition, X2 is a preset value. Generally, it is set to 3.5. Usually, according to the drawing, theoretically, the distance between the two small holes of the standard ventilation plug is 2.356mm. If one hole is missing or blocked, the distance between the two holes is about 3.9mm, so the value of X2 is set to 3.5. Perform continuous counting, starting from 1. If the center distance between any two target objects is less than or equal to X2, after crossing the corresponding two target objects, restart the counting to obtain the number of target objects in the corresponding row, mark it as real-time counting, compare the real-time counting with the standard number of holes, and generate an error signal if the real-time counting is less than the standard number of holes; and obtain the part where the center distance between any two target objects exceeds X2, mark the distance and re-mark it as an error point; the standard number of holes is set by the administrator, and the number of holes of the ventilation plug mentioned in this application is 24, that is, the standard number of holes in this application is 24; Merge error signals and error points to form error information; Perform the same process on the target object in the next row to obtain all the error information in the corresponding image; If no error message is generated, a pass signal is generated; Step 4: Get the error information and display it to the administrator for real-time processing; Embodiment 2, as another embodiment of the present application, this embodiment is implemented on the basis of embodiment 1, and the difference is that in this embodiment, a rotation of X1 circles is set, and X1 is not a set value, but is obtained through rotation analysis. In embodiment 1, X1 circles are set, and the reason why X1 generally takes a value of 1.5 is that, under normal circumstances, since the rotation has certain acceleration and deceleration, in order to avoid the image instability effect caused by acceleration and deceleration, the image width is cropped after rotation for detection. The detection width of 3370 is just one circle of the product rotation, which causes the product to have a hole blockage and appear in the edge area without detection. The edge area here refers to the phenomenon that it appears at the end of one circle of rotation. Therefore, multiple circles of detection are required, but if the number of circles is too many, it will lead to a longer detection time, and the energy waste caused by multiple circles of rotation may not be obvious for a single ventilation plug, but for large-scale detection, it will cause a lot of useless work; Therefore, this embodiment determines the value of X1 through rotation analysis, that is, determines the number of rotations; The specific method of rotation analysis is: First, set the number of missing holes of the ventilation plug. The number of missing holes refers to the situation that there are missing holes or blocked holes in the ventilation plug. First, set the number of missing holes to 0, and then obtain the corresponding ventilation plug; For the ventilation plug, firstly, the measured number of circles X1 is marked as the measurement circle, and X1 is set to be 1.1. At this time, the number of pulses is 2,000, that is, the number of pulses for one full rotation; then, after performing several tests on it in the manner of the first embodiment, the number of detected error points is obtained and marked as the real-time missing number, and each real-time missing number is marked as Ci, i=1, ..., n, where the value of n is greater than or equal to 30; Calculate the mean value of Ci and mark it as the parallax value of the corresponding measurement circle; Then the value of X1 is automatically increased by 0.1, that is, 200 pulses are added, and the rotation is 1.1 circles. Several tests are performed to obtain the real-time missing number at this time, and the same processing is performed when X1 is 1 to obtain the parallax value of the new measurement circle value; Repeatedly increase the value of X1 by 0.1 until the value of X1 reaches 2, and obtain the disparity values corresponding to 10 measurement circles. Mark the measurement circle value with the smallest disparity value as the initial value. Then, the missing hole number value is increased by one, and the operation when the missing hole number is zero is repeated until the missing hole number reaches three, and a new initial state value is obtained, and a total of four initial state values are obtained; when the missing hole number value is not 0, the real-time missing number collected is the number of corresponding error points minus the missing hole number; The initial state value is updated using the number of missing holes, and the obtained value is marked as the selected value. The specific calculation formula is: Selected value = initial value / (number of holes + 1); Get the selection value corresponding to each initial state value, and mark the initial state value with the smallest selection value as the approved circle number; Assign the value of the approved number of circles to X1, thereby determining the value of X1; As the third embodiment of the present application, this embodiment is carried out on the basis of the first embodiment, except that this embodiment provides a method for identifying a target object, which is specifically carried out through the existing technology, and specifically can be carried out in the following manner: Threshold segmentation method: According to the difference in grayscale, color and other features between the ventilation plug holes and the background, select an appropriate threshold to perform binary processing on the image and separate the hole area from the background. For example, if the ventilation plug holes are dark in color, a lower grayscale threshold can be set to achieve segmentation.
[0017] Edge detection method: Utilize the mutation information of the grayscale value of pixels at the edge of the hole, and use operators such as Sobel and Canny to detect the edge contour of the hole, and then determine the position and shape of the hole.
[0018] As the fourth embodiment of the present application, this embodiment is carried out on the basis of the first embodiment, except that this embodiment provides a method for identifying a target object. The identification method in this embodiment is: Under the same acquisition conditions as in the first embodiment, a standard hole image of a ventilation plug is acquired, and then the image is proportionally reduced to three-quarters, and the reduced image is marked as a standard template; The standard template is then embedded into the detection image. When a picture consistent with the standard template can be detected and the sample covered by the standard template can be marked as the target object.
[0019] The setting of reducing by three quarters is to avoid the situation where holes cannot be identified due to sampling problems caused by rotation or other problems.
[0020] As another embodiment of the present application, the technical solution of this embodiment is to integrate all the above embodiments into one implementation.
[0021] Some of the data in the above formula are calculated by removing the dimensions and taking their numerical values. The formula is a formula that is closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0022] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. The present invention discloses a method for detecting holes in ventilation plugs, which relates to the technical field of hole detection. The method identifies a target object from a collected detection image, where the target object is a hole in the ventilation plug. When collecting the detection image, the ventilation plug is rotated X1 times. After the target object is identified, several rows of target objects are counted to obtain the maximum number of target objects whose continuity satisfies that the center distance between two adjacent target objects is less than or equal to a preset value X2. The number of target objects is marked as a real-time count. If the real-time count is less than the standard number of holes, an error signal is generated, and at the same time, error points formed by any two target objects whose center distance exceeds X2 are obtained; thereby, standard detection of hole specifications is achieved. The present application is simple, effective, and easy to use.
Citation Information
Patent Citations
Hole detection system and hole detection method
CN113834826A