Bolt and nut connection anti-loosening performance quantitative evaluation method based on machine vision
Through machine vision technology, the nut video is read and image processing is performed to determine the loosening angle of the nut, which solves the problem that the bolt connection anti-loosening performance in the existing technology is difficult to accurately evaluate the anti-loosening performance of bolt and nut connections, and realizes the accurate evaluation of the anti-loosening performance of bolt and nut connections. .
Patent Information
- Application Number
- CN202411137063.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-19
AI Technical Summary
The existing bolt connection anti-loosening performance evaluation methods are difficult to accurately evaluate quantity, the calculation process is complicated and there are many influencing factors, making it difficult to determine the threshold for rotation loosening.
Using a machine vision-based method, by reading the nut video, grayscale processing, Gaussian filtering, Canny edge detection and contour extraction, the loosening angle of the nut is determined, thereby judging the critical lateral force, and achieving anti-loosening performance of bolt and nut connections Quantitative evaluation.
Accurately judging the initial loosening of the nut improves the accuracy of quantitative evaluation of the anti-loosening performance of the nut and achieves accurate judgment of the critical lateral force range.
Smart Images

Figure CN119027399A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of nut anti-loosening performance detection, and in particular to a method for quantitatively evaluating the anti-loosening performance of a bolt and nut connection based on machine vision. Background Art
[0002] Bolt connections have the advantages of simple structure, easy assembly and disassembly, and low price, and are widely used in various industrial products and mechanical structures. Engineering experience shows that bolt connections are prone to loosening and failure in a vibration environment, which is a common problem that threatens the reliability of mechanical products. Therefore, it is necessary to evaluate the anti-loosening performance of bolt connections.
[0003] The evaluation methods for the anti-loosening performance of bolted connection structures can be divided into two categories, namely qualitative evaluation and quantitative evaluation. Among them, Chinese Patent 202010393182.9 proposes a quantitative evaluation method that uses the critical lateral force that triggers rotational loosening of bolted connections as an indicator. This method is based on the lateral vibration test and calculates the rate of preload decay (the percentage of the preload decayed per cycle to the initial preload) according to the data of the second stage of the preload decay curve under different lateral force conditions. When the rate of preload decay exceeds a certain threshold, it is judged that rotational loosening has occurred in the bolted connection, where the minimum lateral force that triggers rotational loosening of the bolted connection is called the critical lateral force. However, when calculating the rate of preload decay, this method has a complicated calculation process, and the factors that affect the decay rate include other factors other than rotational loosening (such as micro-wear), making it difficult to determine the threshold of the preload decay rate corresponding to the triggering of rotational loosening.
[0004] Therefore, there is an urgent need for an accurate and quantitative evaluation method for anti-loosening performance. Summary of the invention
[0005] The present application provides a method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision to solve the technical problem that the anti-loosening performance of nuts cannot be accurately and quantitatively evaluated.
[0006] The present application provides a method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision, comprising: reading a video of a nut; wherein the nut is in a connected state; obtaining all frame images in the video; graying all frame images to obtain multiple first images; performing Gaussian filtering on the first image to obtain a second image; using a Canny edge detection algorithm to determine edge pixel points in a target image; wherein the target image is any second image; determining target edge pixel points among edge pixel points; wherein the target edge pixel points are obtained after denoising the edge pixel points; and using a FindContours function to determine all edge pixel points in a target image among multiple target edge pixel points. contour; determining the coordinates of contour pixel points in all contours; using the minAreaRect function to determine the minimum circumscribed rectangle in the contour point set, and determining the deflection angle of the minimum circumscribed rectangle relative to the coordinate axis according to the coordinates of the four vertices of the minimum circumscribed rectangle; wherein the contour point set includes the coordinates of the contour pixel points, and the deflection angle is the rotation angle of the nut between the target image and the second image of the previous frame; determining whether the nut is loose according to the deflection angle, and taking the minimum lateral force that causes the nut to loosen as the critical lateral force of the nut; evaluating the anti-loosening performance of the bolt and nut connection with the critical lateral force; wherein, the greater the critical lateral force, the better the anti-loosening performance of the bolt and nut, and the smaller the critical lateral force, the worse the anti-loosening performance of the bolt and nut.
[0007] In some feasible implementations, grayscale processing is performed on all frame images to obtain the first image, including: using a weighted average method to process all frame images, and the calculation formula is as follows:
[0008] Gray(i,j)=0.114·B(i,j)+0.578·G(i,j)+0.299·R(i,j); where i and j are the row and column numbers of the pixel, respectively. B(i,j), G(i,j) and R(i,j) are the values of the B channel, G channel and R channel components corresponding to the pixel in the i-th row and j-th column, respectively. Gray(i,j) is the grayscale value corresponding to the pixel in the i-th row and j-th column.
[0009] In some feasible implementations, Gaussian filtering is performed on the first image to obtain the second image, including: using a probability density function of a two-dimensional Gaussian distribution to determine a weight matrix corresponding to the convolution kernel, wherein the weight matrix is calculated using the following formula:
[0010] G(x,y) is the size of the elements in the weight matrix; σ is the standard deviation of the Gaussian distribution; (x,y) is the coordinate of the elements in the weight matrix; the convolution kernel is determined according to the weight matrix; the second image is determined according to the convolution kernel and the first image.
[0011] In some feasible implementations, the Canny edge detection algorithm is used to determine the edge pixels in the target image, including: using the Canny edge detection algorithm to calculate the change gradient of the grayscale values of all pixels in the target image; wherein the change gradient of the grayscale value includes the gradient amplitude G and the gradient direction θ, and the calculation formulas of the gradient amplitude G and the gradient direction θ are as follows:
[0012] G x is the horizontal component of the gradient amplitude G, which is the first-order derivative of the gray value in the horizontal direction, G y is the vertical component of the gradient amplitude G, is the first-order derivative of the gray value in the vertical direction, and the horizontal component G x and the vertical component G y The calculation formula is as follows:
[0013] I is a matrix composed of the grayscale values of the current pixel and its adjacent domain pixels; all pixels are traversed to determine the pixel with the largest gradient amplitude in the same set of gradient directions as the edge pixel; wherein the same set of gradient directions means that the straight lines where the gradient directions are located coincide.
[0014] In some feasible implementations, determining a target edge pixel point among edge pixel points includes: determining the relationship between the edge pixel point and a first threshold and a second threshold respectively; wherein the first threshold is greater than the second threshold; retaining the first edge pixel point; wherein the first edge pixel point is an edge pixel point whose gradient amplitude is greater than the first threshold; retaining the second edge pixel point; wherein the second edge pixel point is an edge pixel point whose gradient amplitude is greater than or equal to the second threshold and less than or equal to the first threshold, and is connected to the first edge pixel point; the target edge pixel points include the first edge pixel point and the second edge pixel point.
[0015] In some feasible implementations, determining the target edge pixel point among the edge pixel points further includes: removing a third edge pixel point; wherein the third edge pixel point is an edge pixel point whose gradient amplitude is less than a second threshold.
[0016] In some feasible implementations, the FindContours function is used to determine all contours in the target image among multiple target edge pixels, including: using an edge tracking algorithm in the FindContours function to determine all contours in the target image based on the connectivity between target edge pixels.
[0017] In some feasible implementations, a minAreaRect function is used to determine a minimum enclosing rectangle in a contour point set, including: using the Sklansky algorithm in the minAreaRect function to determine the convex hull of the contour; wherein the convex hull is a convex polygon with the smallest area formed by connecting the contour point set, and all pixel points in the contour point set are located on the edge of the convex hull or inside the convex hull; using an enumeration method, using different sides of the convex hull as enclosing rectangles, and determining the enclosing rectangle with the smallest area as the minimum enclosing rectangle.
[0018] In some feasible implementations, the deflection angle of the minimum enclosing rectangle relative to the coordinate axis is determined based on the coordinates of the four vertices of the minimum enclosing rectangle, including: determining the number of vertices with the smallest value in the y-axis direction of the minimum enclosing rectangle in the global coordinate system oxy of the target image; if the number is one, determining the vertex with the smallest value as the origin o' of the local coordinate system o'x'y' where the minimum enclosing rectangle is located; if the number is two, determining the vertex with the smallest value in the x-axis direction of the minimum enclosing rectangle in the global coordinate system oxy as the origin o' of the local coordinate system o'x'y'; establishing a local coordinate system o'x'y' with the origin o', the x' axis and the y' axis; wherein the positive direction of the x' axis is the same as the positive direction of the x axis in the global coordinate system oxy, and the positive direction of the y' axis is opposite to the positive direction of the y axis in the global coordinate system oxy; with the origin o' as the center, the angle through which the positive semi-axis of the x' axis rotates counterclockwise until it first coincides with the side of the minimum enclosing rectangle is the deflection angle of the nut.
[0019] In some feasible implementations, determining whether the nut is loose according to the deflection angle includes: determining a loosening angle of the nut according to the deflection angle; and determining whether the nut is loose according to the loosening angle.
[0020] The machine vision-based quantitative evaluation method for the anti-loosening performance of bolt and nut connections provided in the present application can accurately determine the initial loosening of the nut, achieve accurate judgment of the critical lateral force range, and improve the accuracy of the quantitative evaluation of the anti-loosening performance of the nut. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0022] Figure 1a It is a schematic diagram of the basic principle of a lateral vibration test;
[0023] Figure 1b It is a structural schematic diagram of a lateral vibration test device;
[0024] Figure 2It is a schematic diagram of the attenuation process of the preload force of a bolt connection under lateral vibration test conditions;
[0025] Figure 3 It is a flow chart of a method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision provided in an embodiment of the present application;
[0026] Figure 4 It is a schematic diagram of the recording effect of a nut video provided in an embodiment of the present application;
[0027] Figure 5a is a schematic diagram of a BGR image provided in an embodiment of the present application;
[0028] Figure 5b is a schematic diagram of a grayscale image provided in an embodiment of the present application;
[0029] Figure 6 This is a schematic diagram of a Gaussian filtering principle provided in an embodiment of the present application;
[0030] Figure 7a is a coordinate diagram of elements in a weight matrix provided in an embodiment of the present application;
[0031] Figure 7b It is a schematic diagram of the size of elements in a weight matrix provided in an embodiment of the present application;
[0032] Figure 8a It is a gradient schematic diagram provided in an embodiment of the present application;
[0033] Figure 8b It is a schematic diagram of a gradient example provided in an embodiment of the present application;
[0034] Figure 9a is a gradient schematic diagram for determining edge pixels provided in an embodiment of the present application;
[0035] Figure 9b is another schematic diagram of determining the gradient of edge pixels provided in an embodiment of the present application;
[0036] Fig.10 This is a schematic diagram of screening edge pixels provided in an embodiment of the present application;
[0037] Fig.11 It is a schematic diagram of contour extraction provided in an embodiment of the present application;
[0038] Fig.12a It is a structural schematic diagram of calculating a contour convex hull provided in an embodiment of the present application;
[0039] Figure 12b It is a structural schematic diagram of an enumeration method for calculating the minimum circumscribed rectangle of a contour provided in an embodiment of the present application;
[0040] Fig.13a is a structural schematic diagram of a deflection angle provided in an embodiment of the present application;
[0041] Fig.13b is a structural schematic diagram of another deflection angle provided in an embodiment of the present application;
[0042] Fig.14a This is a grayscale processing effect diagram provided in an embodiment of the present application;
[0043] Fig.14b This is a Gaussian filtering effect diagram provided by an embodiment of the present application;
[0044] Fig.14c This is a Canny edge detection effect diagram provided by an embodiment of the present application;
[0045] Fig.14d This is a schematic diagram of calculating a minimum circumscribed rectangle provided in an embodiment of the present application;
[0046] Fig.15 This is a schematic diagram of a nut loosening angle change curve provided in an embodiment of the present application;
[0047] Fig.16 It is a flow chart of a method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision in a specific implementation method provided in an embodiment of the present application;
[0048] Fig.17 It is a schematic diagram of a nut loosening angle algorithm flow in a specific implementation provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be described clearly below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments of the present application, other embodiments obtained by ordinary technicians in this field without making creative work all belong to the protection scope of the present application.
[0050] In the following, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0051] In addition, in the present application, directional terms such as "upper", "lower", "inner" and "outer" are defined relative to the orientation of the components schematically placed in the drawings. It should be understood that these directional terms are relative concepts. They are used for relative description and clarification, and they can change accordingly according to the changes in the orientation of the components placed in the drawings.
[0052] Bolted connections have the advantages of simple structure, easy assembly and disassembly, and low price, and are widely used in various industrial products and mechanical structures. Engineering experience shows that bolted connections are prone to loosening and failure in a vibration environment, which is a common problem that threatens the reliability of mechanical products. A large number of studies at home and abroad have fully proved that lateral vibration loads are usually the main load form that causes bolted connections to loosen. Therefore, in engineering, the anti-loosening performance of bolted connections is usually tested based on lateral vibration tests.
[0053] Figure 1a It is a schematic diagram of the basic principle of a lateral vibration test.
[0054] Figure 1b It is a structural schematic diagram of a lateral vibration test device.
[0055] Combination Figure 1a and Figure 1b , this test is mainly carried out on typical bolt connection structures, including bolts, nuts, and two pressed parts. During the test, one pressed part is fixed (fixed part), and a periodic reciprocating load is applied to the other pressed part (movable part), so as to obtain the preload attenuation curve under different load conditions, and then realize the evaluation of the anti-loosening performance of the bolt connection. The principle of this test method was first seen in a paper published by German scholar Junker in 1969. This test method has been standardized, and the commonly used standards are my country's national standard GB / T 10431, German standard DIN-65151, and international standard ISO 16130. The basic principles of the tests specified in these standards are the same, but there are differences in the test process, load control method and result interpretation. Among them, Figure 1b The test device shown is designed according to the requirements of national standard ISO 16130.
[0056] Figure 2 It is a schematic diagram of the attenuation process of the preload force of a bolt connection under lateral vibration test conditions.
[0057] like Figure 2As shown in the figure, the typical process of preload attenuation of bolted connections during lateral vibration tests should include three stages. In stage one, the preload will decay rapidly. The main reasons for the preload attenuation in this stage include plastic deformation, stress redistribution and rotational loosening. In stage two, the preload will decay more smoothly. The main reason for the preload attenuation in this stage is rotational loosening. In stage three, the bolted connection will experience an accelerated rate of preload attenuation due to the appearance of fatigue cracks, and eventually break. The preload attenuation in all three stages actually involves the factor of fretting wear, but the amount of preload attenuation caused by fretting wear is relatively small. Figure 2 Not marked in.
[0058] When calculating the rate at which the preload force decays, the calculation process is complicated, and the factors that affect the decay rate include other factors besides rotational loosening (such as micro-motion wear), making it difficult to determine the threshold of the preload force decay rate that triggers rotational loosening.
[0059] In order to solve the above problems, the present invention proposes a quantitative evaluation method for the anti-loosening performance of bolt and nut connections based on machine vision. During the lateral vibration test, the loosening angle of the nut is directly measured to determine whether the nut has rotational loosening, and then determine the critical lateral force, thereby achieving accurate judgment of the critical lateral force and accurate quantitative evaluation of the anti-loosening performance.
[0060] The present invention directly measures the loosening angle of the nut during the lateral vibration process, determines whether the nut is rotationally loosened by the loosening angle, and further determines the critical lateral force, and uses the critical lateral force as an indicator to quantitatively evaluate the anti-loosening performance of the bolt connection structure.
[0061] Figure 3 It is a flow chart of a method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision provided in an embodiment of the present application.
[0062] See also Figure 3 The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision provided in the embodiment of the present application can be implemented by the following steps S1 to S11.
[0063] Step S1: Read the video of the nut.
[0064] The nut is in a connected state. By shooting a video of the nut in the connected state, it is possible to determine from the video whether the nut is initially loose.
[0065] Specifically, during the lateral vibration test, a camera may be used to record a video of the nut.
[0066] Step S2: Acquire all frame images in the video.
[0067] Figure 4 It is a schematic diagram of the recording effect of a nut video provided in an embodiment of the present application.
[0068] See also Figure 4 The nut is a hexagonal nut. The shooting direction should be along the axis of the nut, and the resulting video should include the nut completely.
[0069] Step S3: grayscale all frame images to obtain multiple first images.
[0070] Figure 5a It is a schematic diagram of a BGR image provided in an embodiment of the present application.
[0071] Figure 5b It is a schematic diagram of a grayscale image provided in an embodiment of the present application.
[0072] In the video recorded by Nut, all frame images are acquired. The format of the image read from the video is BGR image, which is a color three-channel image. In the program, it is saved in the form of a three-dimensional matrix and participates in calculations. Figure 5a , the image includes three channels, namely B (Blue), G (Green) and R (Red). The color of each pixel in the image is determined by three components, B, G and R. Each component occupies one byte, and the value range of each component is 0 to 255. Therefore, a pixel may have 255 3 colors. Although the BGR image contains more color information, the complexity of the matrix leads to large amount of calculation and low calculation efficiency. Therefore, in order to improve the calculation efficiency, the BGR image can be grayed to obtain the corresponding grayscale image. Grayscale image is a single-channel image, which is saved and calculated in the form of a two-dimensional matrix in the program. See Figure 5b , Figure 5b Can be Figure 5a Obtained after grayscale processing. Figure 5b In the image, the color of each pixel is determined by one component, so a pixel can only have 255 colors. Although the grayscale image loses some color features, it does not affect the feature extraction of subsequent images. In addition, the matrix dimension is changed from the three-dimensional matrix corresponding to the BGR image to the two-dimensional matrix corresponding to the grayscale image, which significantly reduces the amount of calculation.
[0073] Specifically, the weighted average method can be used to process all frame images, and the grayscale value can be calculated by the following formula (1):
[0074] Gray(i,j)=0.114·B(i,j)+0.578·G(i,j)+0.299·R(i,j) (1)
[0075] In formula (1), i and j are the row and column numbers of the pixel, respectively; B(i,j), G(i,j) and R(i,j) are the values of the B (blue) channel, G (green) channel and R (red) channel components corresponding to the pixel in the i-th row and j-th column, respectively; Gray(i,j) is the grayscale value corresponding to the pixel in the i-th row and j-th column.
[0076] Step S4: Perform Gaussian filtering on the first image to obtain a second image.
[0077] In the process of shooting videos, due to lighting problems, such as insufficient brightness or uneven light distribution, Gaussian noise may easily appear in the video image. Gaussian noise refers to noise whose probability density function obeys Gaussian distribution (i.e., normal distribution). Therefore, in order to reduce noise and improve the accuracy of image processing, it is necessary to perform Gaussian filtering on the grayscale image.
[0078] The Gaussian filtering process is actually to form a matrix with the grayscale values of its neighborhood pixels for each pixel in the image, calculate the sum of the products (convolution) of this matrix and the corresponding elements of a two-dimensional filter matrix (convolution kernel), and use the sum of the products as the grayscale value after filtering to replace the grayscale value before filtering.
[0079] Among them, step S4 can be implemented by the following steps S41 to S43.
[0080] Step S41: using the probability density function of the two-dimensional Gaussian distribution to determine the weight matrix corresponding to the convolution kernel.
[0081] The size of the elements in the weight matrix corresponding to the convolution kernel is calculated using the following formula (2):
[0082]
[0083] G(x,y) is the size of the elements in the weight matrix; σ is the standard deviation of the Gaussian distribution, which needs to be set by the user, and (x,y) is the coordinate of the elements in the weight matrix.
[0084] Step S42: Determine the convolution kernel according to the weight matrix.
[0085] Step S43: Determine the second image according to the convolution kernel and the first image.
[0086] Figure 6 It is a schematic diagram of the Gaussian filtering principle provided in an embodiment of the present application.
[0087] In a specific implementation, see Figure 6, in the image before filtering, the gray value of the current pixel is 5, and the gray value calculation formula after filtering is (1×0.1+2×0+3×0+…+8×0.2+9×0.1), and the gray value after filtering is 5.8. If all pixels are calculated according to this formula, the gray values of all pixels after filtering can be obtained, that is, the filtered image. Among them, the first image can be the image before filtering, and the second image can be the image after filtering.
[0088] At the same time, from Figure 6 As can be seen from the figure, the core of Gaussian filtering lies in the convolution kernel, which assigns different weights to the grayscale values of the current pixel and its neighboring pixels, and then sums them up to get the grayscale value after filtering. Next, the calculation method of the convolution kernel is introduced.
[0089] The convolution kernel is essentially a matrix, and the size of the elements in the matrix reflects the weight of the grayscale values of different pixels during the filtering process. In Gaussian filtering, the convolution kernel assigns weights to the grayscale values of different pixels according to the two-dimensional Gaussian distribution. Therefore, the idea of calculating the convolution kernel is to first determine the size of the convolution kernel, then calculate the weight matrix corresponding to the convolution kernel through the two-dimensional Gaussian distribution, and finally normalize the weight matrix. Among them, the size of the convolution kernel m×n is defined by the user. Generally, m=n and is an odd number. The commonly used convolution kernel size is 3×3 or 5×5.
[0090] Figure 7a It is a coordinate diagram of elements in a weight matrix provided in an embodiment of the present application.
[0091] Figure 7b It is a schematic diagram of the sizes of elements in a weight matrix provided in an embodiment of the present application.
[0092] Specifically, the method for defining the coordinates of the elements in the weight matrix is as follows: the coordinates of the center position element are defined as (0, 0), and the distance between adjacent elements is 1. Then the coordinates of other elements can be calculated using the rectangular coordinate system method, such as Figure 7a As shown. The weight matrix calculated according to formula 2 is as follows Figure 7b shown.
[0093] Since the sum of the elements in the weight matrix is not necessarily 1, the weight matrix needs to be normalized to ensure that the brightness of the filtered image remains unchanged. Normalization is to first calculate the sum of the elements in the weight matrix, and then divide all the elements in the weight matrix by the sum of the elements. The matrix after the normalization of the weight matrix is the convolution kernel.
[0094] Step S5: Use the Canny edge detection algorithm to determine edge pixels in the target image.
[0095] The target image is any second image.
[0096] Specifically, step S5 can be implemented by the following steps S51 to S52.
[0097] Step S51: using the Canny edge detection algorithm to calculate the gradient of grayscale values of all pixels in the target image.
[0098] After the grayscale image is Gaussian filtered, the Canny edge detection algorithm needs to be used to find edge pixels in the image. The principle of the Canny edge detection algorithm is to calculate the gradient of the grayscale values of all pixels in the image, determine whether the pixel is an edge pixel based on whether the gradient amplitude is a maximum value in the gradient direction, and select it according to certain rules.
[0099] The gray value gradient can be calculated by the following formula (3) and formula (4):
[0100]
[0101] The grayscale value gradient includes the gradient amplitude G and the gradient direction θ. The horizontal component G of the gradient amplitude G is x is the first-order derivative of the gray value in the horizontal direction, and the vertical component G of the gradient amplitude G y is the first-order derivative of the gray value in the vertical direction, according to the first-order derivative of the gray value in the horizontal direction G x and the first derivative in the vertical direction G y , the gradient amplitude G and gradient direction θ of the gray value change can be calculated, and the horizontal component G x and the vertical component G y It can be calculated by the following formula (5) and formula (6):
[0102]
[0103] Specifically, I is a matrix consisting of the grayscale values of the current pixel and its neighboring pixels, and its size is the same as the convolution kernel.
[0104] Figure 8a It is a gradient schematic diagram provided in an embodiment of the present application.
[0105] See also Figure 8a , the gradient has a direction and a numerical value, and the direction θ of the gradient is the angle between the gradient amplitude G and the horizontal direction. In order to facilitate calculation, the value of θ can be set to a fixed value, such as 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315° and 360°. In other words, when the gradient direction is 40°, it can be approximated to 45° to facilitate subsequent calculations.
[0106] Figure 8bThis is a schematic diagram of a gradient example provided in an embodiment of the present application.
[0107] In a specific implementation, see Figure 8b , we can see that the final calculated gradient includes two parts: gradient magnitude G and gradient direction θ. Let’s take “2↑” in the first row and first column as an example for a brief introduction, where “2” is the gradient magnitude and “↑” represents the gradient direction. At this time, θ is 90°.
[0108] After calculating the gray value change gradients of all pixels, step S52 is executed.
[0109] Step S52: Traverse all pixel points and determine the pixel points with the largest gradient amplitude in the same set of gradient directions as edge pixel points.
[0110] Specifically, after obtaining the change gradient of the grayscale value of all pixels in the second image, all pixels are traversed to determine whether the gradient amplitude of the current pixel is the maximum in the same set of gradient directions. If it is the maximum, the current pixel is identified as an edge pixel. If it is not the maximum, the current pixel is identified as a non-edge pixel. Among them, the same set of gradient directions is the coincidence of the straight lines where the gradient directions are located. For example, the positive and negative directions are the same set of gradient directions. In other words, "↑" and "↓" are the same set of gradient directions.
[0111] Figure 9a This is a gradient schematic diagram for determining edge pixels provided in an embodiment of the present application.
[0112] See also Figure 9a , pixel A is the current pixel, pixel B and pixel C have the same gradient direction as pixel A. If the gradient amplitude of pixel A is greater than the gradient amplitudes of pixel B and pixel C, pixel A is identified as an edge pixel. Otherwise, pixel A is identified as a non-edge pixel.
[0113] Figure 9b This is another gradient schematic diagram for determining edge pixels provided in an embodiment of the present application.
[0114] In a specific implementation, see Figure 9b, in the same set of gradient directions, the pixel with the largest gradient amplitude is identified as an edge pixel and is represented by a white background, and the remaining pixels are identified as non-edge pixels and are represented by a black background. Here, the fourth row and first column "7↑" is taken as an example for a brief introduction, where the direction of "7↑" is represented by "↑", and the angle between θ and the horizontal direction is 90°. At this time, the same set of gradient directions includes "↑" and "↓", then the same gradient direction where the pixel "7↑" is located includes "2↑", "3↓", "4↑", "7↑" and "6↑". Among the five pixels, the gradient amplitudes are "2", "3", "4", "7" and "6" respectively. Here, the gradient amplitude of the pixel "7↑" is the maximum, so the pixel "7↑" is an edge pixel and is marked with a white background. And so on, determine the remaining edge pixels.
[0115] Step S6: Determine the target edge pixel point among the edge pixel points.
[0116] After all pixels are judged as edge pixels, all edges are retained in the current image. However, some of the edges may be caused by noise. Therefore, in order to improve the accuracy of nut loosening judgment and to judge the loose state at the early stage of nut loosening, it is necessary to further screen the edge pixels.
[0117] Specifically, the target edge pixel point can be obtained by performing denoising screening on the gradient amplitude of the grayscale value of the edge pixel point, wherein the target edge pixel point is the edge pixel point after denoising.
[0118] The denoising process may be implemented by setting a threshold, and step S6 may be implemented by the following steps S61 to S63.
[0119] Step S61: Determine the relationship between the edge pixel point and the first threshold and the second threshold respectively.
[0120] In the embodiment of the present application, a first threshold and a second threshold are set, wherein the first threshold may be a high threshold maxVal, the second threshold may be a low threshold minVal, and the first threshold is greater than the second threshold.
[0121] Step S62: retain the first edge pixel point.
[0122] Specifically, in the judgment process, if the gradient amplitude of the current edge pixel is greater than the first threshold, the current edge pixel is defined as the first edge pixel, wherein the first edge pixel may be a strong edge pixel. The strong edge pixel is retained, and its grayscale value is changed to 1, marking the background of the pixel as white.
[0123] Step S63: retain the second edge pixel point.
[0124] Specifically, if the gradient amplitude of the current edge pixel is between the second threshold and the first threshold, that is, the gradient amplitude of the current pixel is greater than or equal to the second threshold, and less than or equal to the first threshold, then the current edge pixel is defined as a virtual edge pixel. If the virtual edge pixel is connected to the strong edge pixel, then the virtual edge pixel is retained and defined as the second edge pixel, its gray value is changed to 1, and the background of the pixel is marked as white. Among them, the target edge pixel includes the first edge pixel and the second edge pixel.
[0125] In some feasible implementations, step S6 may further include step S64.
[0126] Step S64: removing the third edge pixel.
[0127] Specifically, if the gradient amplitude of the current edge pixel is less than the second threshold, the current edge pixel is defined as the third edge pixel. The third edge pixel is a weak edge pixel, the weak edge pixel is removed, and its gray value is changed to 0, marking the background of the pixel as black.
[0128] In some feasible implementations, step S6 may further include step S65.
[0129] Step S65: removing the fourth edge pixel.
[0130] If the virtual edge pixel is not connected to the strong edge pixel, define the current edge pixel as the fourth edge pixel, remove the fourth edge pixel, change its gray value to 0, and mark the background of the pixel as black.
[0131] It is worth noting that there is no strict execution order between step S62 to step S65, and they can be executed in any order.
[0132] Fig.10 This is a schematic diagram of screening edge pixels provided in an embodiment of the present application.
[0133] See also Fig.10 , four edge pixels with different gradient amplitudes are given as examples, namely A1, B1, C1 and D1. Among them, the gradient amplitude of the A1 edge pixel is greater than the first threshold, so it is retained as a strong edge pixel; the gradient amplitude of the B1 edge pixel is less than the second threshold, so it is removed as a weak edge pixel; although the gradient amplitude of the C1 edge pixel is between the second threshold and the first threshold, it is connected to the strong edge pixel A1, so it is retained as a virtual edge pixel; the gradient amplitude of the D1 edge pixel is between the second threshold and the first threshold, and it is not connected to the strong edge pixel, so it is removed as a virtual edge pixel.
[0134] At this point, the edge pixel points have been identified through Canny edge detection, but these edge pixel points are still discrete and do not form a complete contour. Therefore, step S7 is performed next.
[0135] Step S7: using the FindContours function to determine all contours in the target image from a plurality of target edge pixels.
[0136] In step S7, the FindContours function can use an edge tracking algorithm to traverse all edge pixels, and determine whether they belong to the same contour based on the connectivity relationship between the target edge pixels, thereby identifying all contours in the target image, and extracting the coordinates of the pixels constituting the contours based on the identified contours. The connectivity relationship includes connectivity and non-connectivity.
[0137] Step S8: Determine the coordinates of contour pixels in all contours.
[0138] Fig.11 This is a schematic diagram of contour extraction provided in an embodiment of the present application.
[0139] See also Fig.11 By judging the connection relationship between edge pixels, it is recognized that the image contains two rectangular contours. In addition, in order to simplify the subsequent calculation, when extracting the coordinates of the contour pixels, only the coordinates of the inflection points of the rectangular contour can be extracted. Fig.11 In this way, compared with extracting the coordinates of all pixel points on the two rectangular contours, only eight vertices in the two rectangular contours are extracted, which can effectively reduce the amount of calculation and improve the calculation efficiency.
[0140] After obtaining the coordinates of the contour pixel points, the set of the coordinates of the contour pixel points is formed into a contour point set. Next, the minAreaRect function can calculate the minimum bounding rectangle of the contour according to the contour point set, and calculate the deflection angle relative to the coordinate axis according to the four vertices of the minimum bounding rectangle. Specifically, step S9 is performed.
[0141] Step S9: using the minAreaRect function to determine the minimum bounding rectangle in the contour point set, and determining the deflection angle of the minimum bounding rectangle relative to the coordinate axis according to the coordinates of the four vertices of the minimum bounding rectangle. The contour point set is composed of a coordinate set of contour pixel points, the deflection angle of the minimum bounding rectangle is the loosening angle of the nut, and the deflection angle is the rotation angle of the nut between the target image and the second image of the previous frame.
[0142] Specifically, the step of determining the minimum circumscribed rectangle in step S9 can be implemented by steps S91 and S92.
[0143] Step S91: Use the Sklansky algorithm in the minAreaRect function to determine the convex hull of the contour.
[0144] Specifically, the minimum circumscribed rectangle of the contour is calculated based on the convex hull of the contour. The convex hull is a convex polygon formed by connecting the contour point set. The coordinates of all pixel points in the contour point set are located on the edge of the convex hull or inside the convex hull. At the same time, the convex polygon is the one with the smallest area that meets the above conditions.
[0145] Fig.12a It is a structural schematic diagram of calculating a contour convex hull provided in an embodiment of the present application.
[0146] See also Fig.12a , the Sklansky algorithm in the minAreaRect function is used to determine the convex hull of the contour.
[0147] Figure 12b It is a structural schematic diagram of an enumeration method for calculating the minimum circumscribed rectangle of a contour provided in an embodiment of the present application.
[0148] See also Figure 12b The convex hull includes four edges, namely edge L1, edge L2, edge L3 and edge L4.
[0149] Step S92: using an enumeration method to respectively use different sides of the convex hull as circumscribed rectangles, and determining the circumscribed rectangle with the smallest area as the minimum circumscribed rectangle.
[0150] See also Figure 12b Based on the conclusion that one side of the minimum circumscribed rectangle of a polygon is collinear with one of the sides of the polygon, we can use the enumeration method to make circumscribed rectangles with different sides of the convex hull, and determine the circumscribed rectangle with the smallest area among these circumscribed rectangles as the minimum circumscribed rectangle. Figure 12b In the figure, the circumscribed rectangle made by the side L1 of the convex hull is circumscribed rectangle ①, the circumscribed rectangle made by the side L2 of the convex hull is circumscribed rectangle ②, the circumscribed rectangle made by the side L3 of the convex hull is circumscribed rectangle ③, and the circumscribed rectangle made by the side L4 of the convex hull is circumscribed rectangle ④.
[0151] After obtaining the minimum circumscribed rectangle of the contour, calculate its deflection angle relative to the coordinate axis.
[0152] Specifically, the step of determining the deflection angle in step S9 can be implemented by steps S93 to S97.
[0153] Step S93: Determine the number of vertices with the smallest value in the y-axis direction of the minimum circumscribed rectangle in the global coordinate system oxy of the target image.
[0154] The deflection angle can be determined by establishing a local coordinate system o′x′y′. To establish the local coordinate system o′x′y′, the origin must be determined first. The vertex of the minimum circumscribed rectangle is preferably used as the origin of the local coordinate system o′x′y′.
[0155] In step S93, if the number is one, execute step S94, and if the number is two, execute step S95.
[0156] Step S94: If the number is one, determine the vertex with the smallest value as the origin o′ of the local coordinate system o′x′y′.
[0157] In other words, when there is only one vertex with the smallest y value, this vertex is taken as the origin o′.
[0158] Step S95: If the number is two, determine the vertex of the minimum circumscribed rectangle with the smallest value in the x-axis direction in the global coordinate system oxy as the origin o′ of the local coordinate system o′x′y′.
[0159] In other words, if there are two vertices with the same minimum y value, the vertex with the minimum x value is taken as the origin o′.
[0160] Step S96: Establish a local coordinate system o′x′y′ with the origin o′, x′ axis and y′ axis; wherein the positive direction of the x′ axis is the same as the positive direction of the x axis in the global coordinate system oxy, and the positive direction of the y′ axis is opposite to the positive direction of the y axis in the global coordinate system oxy.
[0161] After determining the origin, the positive direction of the x-axis in the global coordinate system oxy of the second image is used as the positive direction of the x′ axis of the local coordinate system o′x′y′, and the negative direction of the y-axis in the global coordinate system oxy of the second image is used as the positive direction of the y′ axis of the local coordinate system o′x′y′.
[0162] Step S97: With the origin o′ as the center, the positive half axis of the x′ axis rotates counterclockwise until it coincides with the side of the minimum circumscribed rectangle for the first time. The angle rotated is the deflection angle of the nut.
[0163] In step S97, the range of the deflection angle is [-π / 2, 0).
[0164] Fig.13a It is a structural schematic diagram of a deflection angle provided in an embodiment of the present application.
[0165] Fig.13b It is a structural schematic diagram of another deflection angle provided in an embodiment of the present application.
[0166] See also Fig.13a , the deflection angle is -π / 6; see Fig.13b , the deflection angle is -π / 2.
[0167] Step S10: determining whether the nut is loose according to the deflection angle, and taking the minimum lateral force that causes the nut to loosen as the critical lateral force of the nut.
[0168] Specifically, the step of determining whether the nut is loose in step S10 can be implemented by the following steps S101 and S102.
[0169] Step S101: determining the loosening angle of the nut according to the deflection angle.
[0170] By calculating the difference in the deflection angle between the minimum circumscribed rectangles in two adjacent frames of the second image, we can get the relative rotation angle between the minimum circumscribed rectangles, that is, the relative rotation angle between the nuts in two adjacent frames of the second image. If we calculate and sum the relative rotation angles between the nuts in all two adjacent frames of the second image, we can get the loose angle of the nut in the entire video. The loose state of the nut can be determined later by the loose angle.
[0171] Step S102: Determine whether the nut is loose according to the loosening angle.
[0172] During the lateral vibration test, after calculating the size of the loose angle, the loose angle can be used to determine whether the nut is loose. When the loose angle of the nut continues to increase, it is determined that rotational loosening has occurred. When the loose angle of the nut is basically zero or there is a small loose angle at the beginning of vibration but it does not continue to increase, it is determined that rotational loosening has not occurred.
[0173] Among them, in step S102, by adjusting the lateral force setting of the lateral vibration test bench, the test is repeatedly carried out under different lateral force conditions, and the minimum lateral force that triggers rotational loosening is gradually found, which is the critical lateral force. The critical lateral force is a quantitative evaluation index of anti-loosening performance. The larger the critical lateral force, the better the anti-loosening performance. Therefore, determining the critical lateral force means that the anti-loosening performance of the current bolt connection has been quantitatively evaluated.
[0174] Specifically, the range of the critical lateral force of the nut can be determined by multiple deflection angles. Specifically, the range of the critical lateral force can be determined by the loosening angle calculated by multiple deflection angles. When the minimum lateral force is within the critical lateral force range and the minimum value of the critical lateral force range acts on the vibration test bench, the nut does not loosen; when the maximum value of the critical lateral force range acts on the vibration test bench, the nut loosens. At this time, the loosening of the nut is determined by the loosening angle calculated by the deflection angle. The range of the critical lateral force of the nut can be obtained by the maximum and minimum values of the critical lateral force.
[0175] Step S11: Evaluate the anti-loosening performance of the bolt and nut connection with a critical lateral force.
[0176] Specifically, the critical lateral force is positively correlated with the anti-loosening performance of the bolts and nuts, that is, the larger the critical lateral force is, the better the anti-loosening performance of the bolts and nuts is, and the smaller the critical lateral force is, the worse the anti-loosening performance of the bolts and nuts is.
[0177] Fig.14a This is a grayscale processing effect diagram provided in an embodiment of the present application.
[0178] Fig.14b This is a Gaussian filtering effect diagram provided in an embodiment of the present application.
[0179] Fig.14c This is a Canny edge detection effect diagram provided in an embodiment of the present application.
[0180] Fig.14d It is a schematic diagram of calculating a minimum circumscribed rectangle provided in an embodiment of the present application.
[0181] In a specific implementation, Fig.14a The step S3 is used to process; Fig.14b The step S4 is used to process; Fig.14c The step S5 is used to process; Fig.14d It is obtained by processing in step S9.
[0182] Fig.15 It is a schematic diagram of a nut loosening angle change curve provided in an embodiment of the present application.
[0183] In a specific implementation, see Fig.15 When vibration is applied to the nut, the loosening angle of the nut tends to increase with the increase of vibration time.
[0184] The machine vision-based quantitative evaluation method for the anti-loosening performance of bolt and nut connections provided in the embodiment of the present application can accurately determine the initial loosening of the nut, achieve accurate judgment of the critical lateral force range, and improve the accuracy of the quantitative evaluation of the anti-loosening performance of the nut.
[0185] Fig.16 It is a flow chart of a method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision in a specific implementation method provided in an embodiment of the present application.
[0186] In a specific implementation, see Fig.16 , the evaluation method can be implemented by the following steps S201 to S204.
[0187] Step S201: lateral vibration test.
[0188] Step S202: Recording video.
[0189] Wherein, step S201 can be implemented synchronously with step S202. Step S202 can be recorded by a camera installed on the test platform.
[0190] Step S203: Calculate the loose angle.
[0191] The image processing and calculation in the recorded video can be performed through the program.
[0192] Step S204: Determine whether the rotation is loose.
[0193] Determine whether the nut is loose based on the calculated loose angle.
[0194] Step S205: critical lateral force.
[0195] When the nut is loose, determine the critical lateral force.
[0196] Fig.17 It is a schematic diagram of a nut loosening angle algorithm flow in a specific implementation provided in an embodiment of the present application.
[0197] In a specific implementation, see Fig.17 The loose angle algorithm can be implemented by the following steps S301 to S308.
[0198] Step S301: Read the video.
[0199] Step S302: all frame images.
[0200] The purpose of step S301 and step S302 is to obtain an image. Step S301 may correspond to step S1 provided in the above embodiment, and step S302 may correspond to step S2 provided in the above embodiment.
[0201] Step S303: grayscale processing.
[0202] Step S304: Gaussian filtering.
[0203] The purpose of step S303 and step S304 is to pre-process the image. Step S303 may correspond to step S3 provided in the above embodiment, and step S304 may correspond to step S4 provided in the above embodiment.
[0204] Step S305: Canny edge detection.
[0205] Step S306: FindContours contour extraction.
[0206] The purpose of step S305 and step S306 is to detect and extract the contour. Step S305 may correspond to step S5 provided in the above embodiment, and step S306 may correspond to step S7 provided in the above embodiment.
[0207] Step S307: the minAreaRect function calculates the minimum bounding rectangle and the relative coordinate axis deflection angle.
[0208] Step S308: Loose angle of the nut.
[0209] The purpose of step S307 and step S308 is to calculate the loosening angle of the nut. S307 may correspond to step S8 provided in the above embodiment.
[0210] In this implementation, first, the recorded video is read and all frame images in the video are preprocessed. The image preprocessing includes grayscale processing and Gaussian filtering. Then, the Canny edge detection algorithm and the FindContours function are used to detect and extract edges. Finally, the minAreaRect function is used to calculate the minimum circumscribed rectangle of the image and its deflection angle relative to the coordinate axis. The relative rotation angle between the minimum circumscribed rectangles in two adjacent frames of the image can be obtained, that is, the relative rotation angle between the nuts. If the relative rotation angle between the nuts in all two adjacent frames of the image is calculated and summed, the loosening angle of the nuts in the entire video can be obtained.
[0211] It should be noted that those skilled in the art will easily think of other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variation, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0212] It should be understood that the present application is not limited to the precise construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof, the true scope being indicated by the present application.
Claims
1. A quantitative evaluation method for the anti-loosening performance of bolt and nut connections based on machine vision. It is characterized in that include: A video of reading a nut; wherein the nut is in a connected state; Acquire all frame images in the video; Performing grayscale processing on all the frame images to obtain a plurality of first images; Performing Gaussian filtering on the first image to obtain a second image; Using the Canny edge detection algorithm to determine edge pixel points in a target image; wherein the target image is any one of the second images; Determining a target edge pixel point among the edge pixel points; wherein the target edge pixel point is obtained after the edge pixel point is subjected to denoising processing; Using the FindContours function to determine all contours in the target image from a plurality of target edge pixel points; Determine the coordinates of contour pixels in all the contours; The minAreaRect function is used to determine the minimum enclosing rectangle in the contour point set, and the deflection angle of the minimum enclosing rectangle relative to the coordinate axis is determined according to the coordinates of the four vertices of the minimum enclosing rectangle; wherein the contour point set includes the coordinates of the contour pixel points, and the deflection angle is the rotation angle of the nut between the target image and the second image of the previous frame; determining whether the nut is loose according to the deflection angle, and using the minimum lateral force that causes the nut to loosen as the critical lateral force of the nut; The anti-loosening performance of the bolt and nut connection is evaluated using the critical lateral force; wherein, the greater the critical lateral force, the better the anti-loosening performance of the bolt and nut, and the smaller the critical lateral force, the worse the anti-loosening performance of the bolt and nut.
2. According to the method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision in claim 1, It is characterized in that Grayscale processing is performed on all the frame images to obtain a first image, including: The weighted average method is used to process all the frame images, and the calculation formula is as follows: Gray(i,j)=0.114·B(i,j)+0.578·G(i,j)+0.299·R(i,j); Among them, i and j are the row and column numbers of the pixel respectively, B(i,j), G(i,j) and R(i,j) are the values of the B channel, G channel and R channel components corresponding to the pixel in the i-th row and j-th column respectively, and Gray(i,j) is the grayscale value corresponding to the pixel in the i-th row and j-th column.
3. The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 2, It is characterized in that Performing Gaussian filtering on the first image to obtain a second image includes: The probability density function of the two-dimensional Gaussian distribution is used to determine the weight matrix corresponding to the convolution kernel, wherein the weight matrix is calculated using the following formula: G(x,y) is the size of the element in the weight matrix; σ is the standard deviation of the Gaussian distribution; (x,y) is the coordinate of the element in the weight matrix; Determining the convolution kernel according to the weight matrix; A second image is determined according to the convolution kernel and the first image.
4. According to the method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision in claim 3, It is characterized in that The Canny edge detection algorithm is used to determine the edge pixels in the target image, including: The Canny edge detection algorithm is used to calculate the change gradient of the grayscale value of all pixels in the target image; wherein the change gradient of the grayscale value includes the gradient amplitude G and the gradient direction θ, and the calculation formula of the gradient amplitude G and the gradient direction θ is as follows: G x is the horizontal component of the gradient amplitude G, is the first-order derivative of the gray value in the horizontal direction, G y is the vertical component of the gradient amplitude G, is the first-order derivative of the gray value in the vertical direction, and the horizontal component G x and the vertical component G y The calculation formula is as follows: I is the matrix composed of the grayscale values of the current pixel and its adjacent pixels; Traversing all the pixel points, the pixel points with the largest gradient amplitude in the same set of gradient directions are determined to be edge pixel points; wherein the same set of gradient directions are the coincidence of straight lines where the gradient directions are located.
5. According to the method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 4, It is characterized in that Determining a target edge pixel point among the edge pixel points includes: Determine the relationship between the edge pixel point and a first threshold and a second threshold respectively; wherein the first threshold is greater than the second threshold; Retaining a first edge pixel point; wherein the first edge pixel point is the edge pixel point whose gradient amplitude is greater than the first threshold; Retain a second edge pixel point; wherein the second edge pixel point is an edge pixel point whose gradient amplitude is greater than or equal to the second threshold and less than or equal to the first threshold, and is connected to the first edge pixel point; and the target edge pixel point includes the first edge pixel point and the second edge pixel point.
6. The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 5, It is characterized in that Determining a target edge pixel point among the edge pixel points further includes: The third edge pixel point is removed; wherein the third edge pixel point is the edge pixel point whose gradient amplitude is less than the second threshold.
7. The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 6, It is characterized in that The FindContours function is used to determine all contours in the target image from a plurality of target edge pixels, including: The edge tracking algorithm in the FindContours function is used to determine all contours in the target image based on the connectivity relationship between the target edge pixels.
8. The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 7, It is characterized in that The minAreaRect function is used to determine the minimum enclosing rectangle in the contour point set, including: The convex hull of the contour is determined using the Sklansky algorithm in the minAreaRect function; wherein the convex hull is a convex polygon with the smallest area formed by connecting the contour point set, and all pixel points in the contour point set are located on the edge of the convex hull or inside the convex hull; By adopting the enumeration method, different sides of the convex hull are used as circumscribed rectangles respectively, and the circumscribed rectangle with the smallest area is determined as the minimum circumscribed rectangle.
9. The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 8, It is characterized in that Determining the deflection angle of the minimum circumscribed rectangle relative to the coordinate axis according to the coordinates of the four vertices of the minimum circumscribed rectangle includes: Determine the number of vertices of the minimum circumscribed rectangle having the smallest value in the y-axis direction in the global coordinate system oxy of the target image; If the number is one, then determining the vertex with the smallest value as the origin o′ of the local coordinate system o′x′y′ where the minimum circumscribed rectangle is located; If the number is two, determine the vertex of the minimum circumscribed rectangle with the smallest value in the x-axis direction in the global coordinate system oxy as the origin o′ of the local coordinate system o′x′y′; The local coordinate system o′x′y′ is established with the origin o′, the x′ axis and the y′ axis; wherein the positive direction of the x′ axis is the same as the positive direction of the x axis in the global coordinate system oxy, and the positive direction of the y′ axis is opposite to the positive direction of the y axis in the global coordinate system oxy; With the origin o′ as the center, the angle at which the positive half axis of the x′ axis rotates counterclockwise until it coincides with the side of the minimum circumscribed rectangle for the first time is the deflection angle of the nut.
10. The method for quantitatively evaluating the anti-loosening performance of bolt and nut connections based on machine vision according to claim 9, It is characterized in that Determining whether the nut is loose according to the deflection angle includes: determining a loosening angle of the nut according to the deflection angle; Whether the nut is loose is determined according to the loose angle.
Citation Information
Patent Citations
Train bolt loosening detection method based on anti-loosening line identification
CN113469966A
Method for monitoring vehicle bottom bolt tightness and electronic equipment
CN114399518A
Bolt detection method and device based on machine vision
CN117333696A
Self-locking nut
CN210769784U
Looseness prevention device and flange structure
JP2016217417A
