Disclosure of Invention
In order to solve the technical problems, the invention aims to provide an intelligent detection method for automobile part configuration, which adopts the following technical scheme:
one embodiment of the invention provides an intelligent detection method for automobile part configuration, which comprises the following steps:
obtaining a surface image of a bearing dust cover; obtaining the width of a circular ring representing the dustproof cover in the surface image, and obtaining a plurality of circular tracks of the dustproof cover area in the surface image, wherein the number of the circular tracks is equal to the width of the circular ring; calculating the abnormal index of each pixel point on each annular track based on the gray value of the pixel point on each annular track; the pixel points with the abnormal index larger than or equal to the preset threshold are abnormal pixel points;
clustering based on the distance of the abnormal pixel points to obtain a plurality of clusters; acquiring a defect index of each cluster based on the number of pixels in each cluster, the variance of gray values of the pixels and the density of the pixels; obtaining clusters with defect indexes larger than or equal to a first threshold value, wherein the clusters are suspicious clusters, and pixel points in the suspicious clusters form suspicious defect areas;
avoiding the suspicious defect area to filter the surface image to obtain the filtered surface image; and detecting based on the filtered surface image to obtain a defect area.
Preferably, obtaining the surface image of the bearing dust cap comprises: and capturing a surface image of the bearing dust cover by using a CCD industrial flaw detection camera, wherein the surface image is a gray image, and carrying out normalization processing on the surface image to obtain a final surface image.
Preferably, the circular track comprises: the center of each annular track is the same as the center of the ring representing the dust cover on the surface image.
Preferably, the abnormal index of each pixel point on each circular track is as follows:
wherein,
representing a circular locus of radius vThe abnormal index of the ith pixel point;
representing the gray value of the ith pixel point on the circular track with the radius v;
expressing the gray average value of all pixel points on the circular track with the radius v;
represents the length of the circular track with the radius v, namely the number of pixel points on the circular track with the radius v;
representing a bi-tangent function.
Preferably, the defect index of each cluster is:
wherein,
denotes the first
Defect index of individual clusters;
is shown as
The number of pixels of each cluster;
is shown as
Clustered togetherVariance of gray values of pixel points;
is shown as
Density of clustered pixels;
representing a bi-tangent function; e represents a natural constant;
、
and
respectively, are the weight coefficients of the image data,
=0.5、
=0.3、
。
preferably, the filtering the surface image to avoid the suspicious defect region, and the obtaining the filtered surface image includes: and filtering the surface image by using mean filtering, and avoiding suspicious defect areas in the surface image in the filtering process.
Preferably, the detecting based on the filtered surface image to obtain the defect region includes:
and carrying out edge detection on the filtered surface image to obtain a region with a closed edge in the suspicious defect region, wherein the region with the closed edge is the defect region.
The embodiment of the invention at least has the following beneficial effects: obtaining a plurality of annular tracks of a dust cover area in a surface image; calculating the abnormal index of each pixel point on each annular track based on the gray value of the pixel point on each annular track; the pixel points with the abnormal index larger than or equal to the preset threshold are abnormal pixel points; clustering based on the distance of the abnormal pixel points to obtain a plurality of clusters; acquiring a defect index of each cluster based on the number of pixels in each cluster, the variance of gray values of the pixels and the density of the pixels; obtaining clusters with defect indexes larger than or equal to a first threshold value, wherein the clusters are suspicious clusters, and pixel points in the suspicious clusters form suspicious defect areas; avoiding the suspicious defect area to filter the surface image to obtain the filtered surface image; and detecting based on the filtered surface image to obtain a defect area. Aiming at the problem that the surface defect detection of the dust cover of the bearing is easily interfered by background texture noise, the invention provides a method for determining a suspicious defect area by using local abnormal points to smoothly guide the average filtering, so that the background texture noise is removed, the defect details are kept from being smoothed, a large number of redundant detection results can not be generated in the defect detection of the dust cover, and the defect of the dust cover can be identified more quickly and accurately.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the method for intelligently detecting the configuration of the vehicle components according to the present invention, the specific implementation manner, the structure, the features and the effects thereof are provided in conjunction with the accompanying drawings and the preferred embodiments. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following describes a specific scheme of the intelligent detection method for automobile part configuration provided by the invention in detail with reference to the accompanying drawings.
Example (b):
the main application scenarios of the invention are as follows: the invention relates to a detection system for surface defects and sealing performance of a bearing dust cap, which is used for detecting the defects and sealing performance of the bearing dust cap.
Referring to fig. 1, a flowchart of a method for intelligently detecting an automobile part configuration according to an embodiment of the present invention is shown, where the method includes the following steps:
s1, obtaining a surface image of a bearing dust cover; obtaining the width of a circular ring representing the dustproof cover in the surface image, and obtaining a plurality of circular tracks of the dustproof cover area in the surface image, wherein the number of the circular tracks is equal to the width of the circular ring; calculating the abnormal index of each pixel point on each annular track based on the gray value of the pixel point on each annular track; and the pixel points with the abnormal index being more than or equal to the preset threshold are abnormal pixel points.
Firstly, a CCD industrial flaw detection camera is used for capturing surface image data of a bearing dust cover, namely, a surface image of the dust cover is obtained, the surface image collected by the CCD industrial flaw detection camera is a gray image, but in order to avoid highlight pixel points in the image, normalization processing needs to be carried out on the gray image, the gray range of the pixel points is converted into 0-255, and a final surface image is obtained.
The bearing dust cap is made of a cold-rolled electroplated tin steel plate, the surface of the dust cap presents a dense and rough granular feeling after being amplified by a flaw detection camera, and the dense and rough grains are interference information for defect detection due to traces left after the surface of the dust cap is polished and corroded, so that a large amount of redundant detection results appear in the detection results, false detection and missed detection are easily caused, and a large amount of interference information brought by the surface texture characteristics of the dust cap needs to be reduced. But now interference information, these background textures can be considered as noise information in the image.
The surface of the dust cover can be smoothed by mean filtering, but if the surface of the dust cover has defects, the defect area is smoothed after filtering, so that the details and even the edges of the defects are lost, and the accuracy of the detection result is seriously disturbed. Therefore, it is necessary to guide the smoothing filtering to stop filtering at the suspicious defect region, so as to achieve smooth background noise while preserving details at the defect.
Furthermore, local abnormal pixel points need to be screened out, and regions suspected of defects on the surface image need to be marked to serve as guidance of smooth filtering. However, because the texture of the surface of the dust cover is complex, it is difficult to identify suspicious defect pixel points and suspicious defect regions on the surface image of the whole dust cover by the discreteness of the gray level of the pixel points, so that the method is not as good as that of directly targeting a single pixel point, analyzing the discreteness of the single pixel point on the circular track to determine abnormal pixel points by taking the circular track corresponding to the radius of the pixel point as a local reference region, and then screening the locally abnormal pixel points in the next step to determine the suspicious defect pixel points. The basis for judging the suspicious defect area or the suspicious defect pixel point is as follows: it has anomaly and discreteness on the same-radius circular track and aggregation in the vicinity of the area where the circular track is located.
The circular tracks corresponding to each radius have a radius of a distance from a center point to a certain point on the dust cap, and the dust cap is in a precise and uniform-width circular shape, so that the number of the circular tracks is equal to the width of the dust cap in the surface image, the dust cap is a circular ring in the surface image, the width of the dust cap is expressed by the number of pixels, the width of the circular ring expressing the dust cap is L, and the number of the circular tracks is L. It should be noted that the circular track is a circle, and the center of the circle is the same as the center of the circle representing the dust cap on the surface image.
And finally, calculating the abnormal index of each pixel point on each annular track:
wherein,
expressing the abnormal index of the ith pixel point on the circular track with the radius v;
representing the gray value of the ith pixel point on the circular track with the radius v;
expressing the gray average value of all pixel points on the circular track with the radius v;
represents the length of the circular track with the radius v, namely the number of pixel points on the circular track with the radius v;
representing a double tangent function.
Representing the gray variance of the pixel points on the circular track with the radius v; the essence of the method is that the dispersion of the gray value of each pixel point relative to the average gray value is
Carry out accumulation averaging, thereby
The meaning of (1) is the difference between the dispersion of the gray value of the ith pixel point on the circular track with the radius of v relative to the average gray value and the integral or average dispersion of all the pixel points on the circular track when
When larger, the representative pixel point
The original discrete pixel point set on the same-radius track is more discrete, so that local abnormal pixel points are screened out on the background with complex dustproof cover textures.
Then to use the hyperbolic tangent function will
The value of (A) is normalized in proportion to be between 0 and 1,
the larger the value between 0 and 1, the larger the value represents a pixel point
The higher the local abnormality.
Setting a preset threshold, preferably, setting the value of the preset threshold to be 0.85, and an implementer can adjust according to actual conditions, and when the abnormal index of a pixel is greater than or equal to the preset threshold, the pixel is an abnormal pixel, and obtaining and marking the abnormal pixel on each circular track to obtain all the abnormal pixels. The abnormal pixel points are local abnormal pixel points obtained on the basis of each annular track.
And (3) carrying out phase difference on the discreteness of the local average gray value and the discreteness of the local whole gray value of the single pixel point gray value to obtain local abnormal pixel points under the complex background. In short, a pixel is more discrete than the integral discreteness of the pixel point set where the pixel point is located, and the pixel point is an abnormal pixel point in a complex background.
Originally, local abnormal pixel points are calculated, the gray characteristic difference of the pixel points is used for screening, but for the special complex texture background of the dust cover, the algorithm screens the abnormal pixel points by using the discreteness characteristic with higher dimensionality, and the algorithm is more suitable for the detection scene of the dust cover.
S2, clustering based on the distance of the abnormal pixel points to obtain a plurality of clusters; acquiring a defect index of each cluster based on the number of pixels in each cluster, the variance of gray values of the pixels and the density of the pixels; and obtaining clusters with the defect index larger than or equal to the first threshold value as suspicious clusters, wherein pixel points in the suspicious clusters form a suspicious defect area.
In step S1, an abnormal pixel is obtained, and further analysis needs to be performed based on the aggregations of the abnormal pixel. And clustering all marked abnormal pixel points on the surface image. The clustering aims to obtain the characteristic that the abnormal pixel points have clustering property near the area where the abnormal pixel points are located, the clustering algorithm is essentially classified based on distance, the gray feature difference of the abnormal pixel points is disregarded, clusters formed by a plurality of abnormal pixel points are obtained only by taking the close distance as a unique clustering standard, then the feature calculation is carried out on the cluster points in the same cluster, namely, the clustering features of the suspicious pixel points and the pixel area are extracted from three layers of whether the number of the abnormal pixel points close to the distance is large, whether the gray value difference between the abnormal pixel points is small and whether the density between the abnormal pixel points is large, and the suspicious area can be determined to a high degree according to the three features of the number of the internal pixel points in the cluster, the gray value variance of the pixel points and the density of the pixel points.
Defect index of each cluster based on the number of pixels in each cluster, the variance of gray values of the pixels, and the density of the pixels:
wherein,
denotes the first
Defect index of individual clusters;
is shown as
The number of pixels of each cluster;
is shown as
The gray value variance of the clustered pixel points;
is shown as
Density of clustered pixels;
representing a bi-tangent function; e represents a natural constant;
、
and
respectively, are the weight coefficients of the image data,
=0.5、
=0.3、
。
、
、
respectively represent
The number of abnormal pixel points in each cluster, the variance of gray values of the pixel points and the density of the pixel points, wherein the larger the number is, the higher the doubtability is, the smaller the variance is, the higher the doubtability is, and the higher the density is, so that a hyperbolic tangent function th pair is utilized
、
Normalized calculation of direct proportion relation is carried out to obtain
、
Using pairs of exponential functions
Carrying out normalization calculation of inverse proportion relation to obtain
The higher the doubtful of the three, the larger the value between 0 and 1. The three parts need to set weights to correct the influence of the three parts on suspicious defect regions, the quantity characteristic of abnormal points in the cluster has the highest influence, and the similar types of the abnormal pixels in the cluster can represent that the abnormal pixels possibly come from the same defect region, so that the influence of the variance is inferior, and the minimum is the density characteristic, namely the density characteristic
、
、
Respectively as
、
、
Weight coefficient of (1) following
Due to the fact that
And is made of
、
、
The larger the value of (a) is between 0 and 1, the more suspicious the result is, so the larger the output result is between 0 and 1 after the three characteristics are weighted, the higher the value is
The more likely an individual cluster is to be a suspicious cluster, i.e., the first
The more likely a region made up of pixels within a cluster is a suspicious defect region.
Setting a first threshold, preferably, the value of the first threshold is 0.7, if the defect index of the cluster is greater than or equal to the first threshold, the cluster is a suspicious cluster, and pixel points in the suspicious cluster form a suspicious defect region.
S3, avoiding the suspicious defect area to filter the surface image to obtain a filtered surface image; and detecting based on the filtered surface image to obtain a defect area.
And smoothing the dustproof cover image by using mean filtering, wherein the filtering size is 5*5, the filtering is performed clockwise along the surface of the annular dustproof cover, the determined suspicious region is shielded in the process, the filtering is performed when the suspicious region is skipped, the detail characteristics of the defect region can be reserved, and the filtered surface image is obtained.
Because the texture noise on the surface of the dust cover can generate a large number of redundant detection results when the threshold detection is directly carried out, and the detection results can be distorted when the threshold is adjusted, the local abnormal pixel points on the annular track corresponding to each radius are calculated, then the local abnormal data are projected on the complete surface image, the aggregation of the abnormal pixel points is calculated for the area where the local abnormal pixel points are located according to the characteristic of the aggregation of the abnormal pixel points, so that the suspicious defect area is marked, and the background noise of other textures outside the suspicious area is smoothed by means of mean value filtering, so that the filtered surface image is obtained.
After the processing, the edge detection is carried out on the filtered surface image, so that a large number of redundant edge detection results caused by background noise can be greatly reduced, and the final defect area is determined only from the closed edge area detected in the suspicious defect area.
All edge detection results in the suspicious region are obtained, and the defect region damages the original surface structure of the dust cover, so that the defect region is necessarily a closed region, other edge results in the same suspicious defect region are all non-closed regions (damaged and truncated by the defect), and the defect can be determined only by determining whether the detection result of each suspicious defect region meets the characteristics. The algorithm for judging the closed region is more conventional, and can be determined according to the connection relation of adjacent pixel points on the edge without specific explanation, so that the defect region in the suspicious defect region can be obtained by edge detection.
It should be noted that the texture background noise is a texture feature originally existing on the dust cap, and the negative effect thereof is to bring a large amount of interference detection results, rather than distorting the defect area as the image noise, so that after the texture background noise is removed, a clear defect edge can still be obtained, but the redundant detection results are greatly reduced, so as to help better and faster identifying and locking the defect.
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. And specific embodiments thereof have been described above. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.