CN115830033B - Automobile hub surface defect detection method based on machine vision - Google Patents

Automobile hub surface defect detection method based on machine vision Download PDF

Info

Publication number
CN115830033B
CN115830033B CN202310153944.1A CN202310153944A CN115830033B CN 115830033 B CN115830033 B CN 115830033B CN 202310153944 A CN202310153944 A CN 202310153944A CN 115830033 B CN115830033 B CN 115830033B
Authority
CN
China
Prior art keywords
point
value
image
defect
attention
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310153944.1A
Other languages
Chinese (zh)
Other versions
CN115830033A (en
Inventor
唐承舜
张锡洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Weihai Ruixinfeng Metal Technology Co ltd
Original Assignee
Weihai Ruixinfeng Metal Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Weihai Ruixinfeng Metal Technology Co ltd filed Critical Weihai Ruixinfeng Metal Technology Co ltd
Priority to CN202310153944.1A priority Critical patent/CN115830033B/en
Publication of CN115830033A publication Critical patent/CN115830033A/en
Application granted granted Critical
Publication of CN115830033B publication Critical patent/CN115830033B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The invention relates to the technical field of image processing, in particular to a machine vision-based automobile hub surface defect detection method, which comprises the steps of obtaining a gray image of an automobile hub area and obtaining an original scale parameter of each pixel point in the gray image; acquiring attention points in the gray level image and defect approximation degree of each attention point; three-dimensional reconstruction is carried out on the gray level image to obtain surface images under all view angles, and an improvement factor of the corresponding attention point is obtained according to the difference of defect approximation degree of each attention point in the gray level image and the belonging surface image; obtaining self-adaptive scale parameters of the corresponding attention points by using the improvement factors of each attention point; and carrying out image enhancement on the gray level image by using a Retinex algorithm based on the self-adaptive scale parameter and the original scale parameter, and carrying out automobile hub surface defect detection on the gray level image after image enhancement. The invention improves the accuracy of defect detection on the surface of the automobile hub.

Description

Automobile hub surface defect detection method based on machine vision
Technical Field
The invention relates to the technical field of image processing, in particular to an automobile hub surface defect detection method based on machine vision.
Background
Automobile hubs refer to the metal components in automobile tires that center on the axle and support the tire. Defects can be generated due to improper production raw materials, improper parameter setting of manufacturing equipment and the like, wherein the cracking defects can bring about great potential safety hazards to automobile use.
The automobile hub is made of metal, so that when the hub surface image is collected for defect detection, the collected hub surface image can be subjected to uneven illumination and the like, and the collected hub surface image is directly subjected to defect detection, so that deviation can be caused in detection.
For the condition that the hub surface image is uneven in illumination, a Retinex algorithm is generally adopted at present to strengthen the hub surface image so as to remove illumination influence, and then defect detection is carried out on the enhanced hub surface image.
Because the Retinex algorithm realizes image enhancement by eliminating or reducing the influence of an incident illumination component on an image, but the incident illumination component is obtained by convolving an original image with the same Gaussian surrounding function, namely, the image enhancement is performed by the Retinex algorithm with a single scale, when a cracking defect occurs in an illumination brightness transition region, the image is enhanced by utilizing a fixed incident illumination component obtained by a single scale parameter, so that the defect is blurred, and the defect detection is influenced.
Disclosure of Invention
In order to solve the problem that defects are blurred and defect detection is affected when a Retinex algorithm of a single scale parameter is used for enhancing a hub surface image, the invention aims to provide an automobile hub surface defect detection method based on machine vision, and the adopted technical scheme is as follows:
the embodiment of the invention provides a machine vision-based automobile hub surface defect detection method, which comprises the following steps:
acquiring a gray image of an automobile hub area, and obtaining an original scale parameter of each pixel point in the gray image by setting the scale parameter of a Gaussian surrounding function in a Retinex algorithm;
acquiring a gradient value and a gradient direction of each pixel point in the gray level image; acquiring a focus point in the pixel point according to the difference of the gradient values; acquiring defect approximation degree of each attention point based on the gradient direction and the gray value of the pixel point;
three-dimensional reconstruction is carried out on the gray level images to obtain surface images under all view angles, and defect approximation degree of each concern point in each surface image is obtained;
obtaining improvement factors of corresponding attention points according to the difference of defect approximation degrees of each attention point in the gray level image and the surface image respectively; adjusting the original scale parameters by utilizing the improvement factors of each concern point to obtain the self-adaptive scale parameters of the corresponding concern points;
and carrying out image enhancement on the gray level image by using a Retinex algorithm based on the self-adaptive scale parameter and the original scale parameter, and carrying out automobile hub surface defect detection on the gray level image after image enhancement.
Further, the method for acquiring the attention point includes:
obtaining a maximum gradient value and a minimum gradient value according to the gradient value of each pixel point in the gray level image, calculating the difference value of the maximum gradient value and the minimum gradient value, taking the difference value as a denominator, taking the difference value of the gradient value of any pixel point and the minimum gradient value as the ratio obtained by molecules, and marking the ratio as the characteristic value of the corresponding pixel point; and taking the pixel point with the characteristic value larger than the characteristic value threshold value as the attention point.
Further, the method for obtaining the defect approximation degree comprises the following steps:
taking any one of the attention points as a target point, acquiring gradient direction average values of all the neighborhood attention points in a preset neighborhood range of the target point, calculating a difference absolute value between the gradient direction of the target point and the gradient direction average value, and recording the difference absolute value as a first value; wherein, the numerical value of the gradient direction when participating in calculation refers to the included angle between the gradient direction and the horizontal direction;
acquiring a pixel point closest to the target point in the opposite direction of the gradient direction of the target point, and marking the pixel point as a first pixel point; acquiring a focus point closest to the target point in the gradient direction of the target point, marking the focus point as a first focus point, and acquiring a pixel point closest to the first focus point in the opposite direction of the gradient direction of the first focus point, marking the pixel point as a second pixel point;
calculating the absolute value of the difference value of the gray value between the first pixel point and the second pixel point, and recording the absolute value as a second value; and calculating the addition result of the constant 1 and the first value, and taking the reciprocal of the product of the addition result and the second value as the defect approximation degree of the target point.
Further, the method for obtaining the improvement factor comprises the following steps:
for any one attention point, calculating a defect approximation degree average value according to the defect approximation degree of the attention point in each affiliated surface image; calculating the defect approximation degree of the focus point in the gray level image and the difference absolute value of the defect approximation degree in any one of the affiliated surface images, calculating the average value of the difference absolute values according to the difference absolute values corresponding to all the affiliated surface images of the focus point, and marking the average value as a first result; normalizing the product of the defect approximation mean value and the first result, and taking the normalized result as a second result;
normalizing the defect approximation degree of the focus point in the gray level image, and taking the normalized result as a third result; normalizing the addition result of the second result and the third result, and taking the normalized result as an improvement factor of the attention point.
Further, the method for acquiring the adaptive scale parameter comprises the following steps:
for any one point of interest, calculating the difference between the constant 1 and the improvement factor of the point of interest, and taking the product of the difference and the original scale parameter as the adaptive scale parameter of the point of interest.
Further, the method for enhancing the gray image by using the Retinex algorithm based on the self-adaptive scale parameter and the original scale parameter comprises the following steps:
acquiring an incident illumination component of each attention point according to the self-adaptive scale parameter of each attention point, and enhancing each attention point in the gray level image by using a Retinex algorithm based on the incident illumination component;
and acquiring an incident illumination component of each non-attention point according to the original scale parameter of each non-attention point, and enhancing each non-attention point in the gray image by using a Retinex algorithm based on the incident illumination component.
Further, the NeRF neural radiation field model is utilized to reconstruct the gray level image in three dimensions.
Further, the original scale parameter of each pixel point in the gray image is the scale parameter of the gaussian surrounding function in the set Retinex algorithm.
Further, the method for three-dimensionally reconstructing the gray image to obtain the surface image under all viewing angles includes:
and (3) three-dimensional reconstruction is carried out to obtain a three-dimensional automobile hub, the three-dimensional automobile hub is rotated along a space rectangular coordinate system O-xyz at a preset rotation angle, and surface images of the automobile hub under different visual angles are obtained.
The invention has the following beneficial effects:
because the enhancement effect of the Retinex algorithm depends on the scale parameters of the Gaussian surrounding function, the invention acquires the gray image of the automobile hub area, and the original scale parameters of each pixel point in the gray image are obtained by setting the scale parameters of the Gaussian surrounding function in the Retinex algorithm; considering that the original scale parameters of each pixel point in the gray image are the same, the enhancement processing is directly carried out on the gray image, which can cause damage to the defect and influence the defect detection, so that the invention aims to ensure the integrity of the defect and simultaneously remove as many light transition areas which influence the defect detection as possible, and the attention points in the pixel points and the defect approximation degree of each attention point are obtained according to the gradient value and the gradient direction of each pixel point in the gray image; the defect positions are random, and meanwhile, the light reflecting areas are random, so that the situation that cracking defects fall at light boundaries exists, and defects are mistakenly regarded as light transition areas only according to analysis of defect approximation degree, so that three-dimensional reconstruction is carried out on gray images to obtain surface images under each view angle, and defect approximation degree of each focus point in each surface image is obtained; according to the difference of defect approximation degree of each attention point in the gray level image and the surface image, an improvement factor of the corresponding attention point is obtained, and the improvement factor reflects the defect condition of the attention point, so that in order to enable the scale parameter of the attention point to be more practical, the original scale parameter is adjusted by utilizing the improvement factor of each attention point, and the self-adaptive scale parameter of the corresponding attention point is obtained; after the self-adaptive scale parameter of each pixel point in the gray image is obtained, the image enhancement is carried out on the gray image by using a Retinex algorithm based on the self-adaptive scale parameter and the original scale parameter, so that the detail of the enhanced image is better preserved, and the accuracy of detecting the surface defects of the automobile hub on the gray image after the image enhancement is further improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of steps of a method for detecting a surface defect of an automobile hub based on machine vision according to an embodiment of the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following is a specific implementation, structure, characteristics and effects of the machine vision-based automobile hub surface defect detection method according to the invention, which are described in detail below with reference to the accompanying drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
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 invention provides a specific scheme of an automobile hub surface defect detection method based on machine vision, which is specifically described below with reference to the accompanying drawings.
The specific scene aimed by the invention is as follows: when the surface defect is carried out on the automobile hub, as the automobile hub is made of metal, the phenomenon of uneven illumination can occur in the image when the image is acquired, and defect detection is carried out after the image is enhanced.
Referring to fig. 1, a flowchart of a method for detecting a surface defect of an automobile hub based on machine vision according to an embodiment of the invention is shown, where the method includes:
step S001, acquiring a gray image of an automobile hub area, and obtaining an original scale parameter of each pixel point in the gray image by setting the scale parameter of a Gaussian surround function in a Retinex algorithm.
Specifically, an image acquisition device is placed on an automobile hub production line to acquire the surface image of the produced automobile hub. In order to eliminate background interference, the acquired automobile hub surface image is subjected to threshold segmentation pretreatment, the pixel value of a background part pixel point in the automobile hub surface image is set to be 0, the pixel value of other part pixel points is set to be 1, namely, a binary image of an automobile hub area is obtained, and the binary image at the moment is used as a mask image to be multiplied with the automobile hub surface image, so that an automobile hub area image with the background part removed is obtained. The image of the automobile hub area is subjected to graying processing to obtain a corresponding gray image, wherein the graying processing and the threshold segmentation processing are known techniques, and are not described in detail in this embodiment.
Since the estimation result of the incident light in the Retinex algorithm directly affects the enhancement effect of the image, and the incident light component is obtained by convolving the acquired image with the gaussian surrounding function, the quality of the incident light component is closely related to the gaussian surrounding function. The enhancement effect of the Retinex algorithm depends on the scale parameters of a gaussian surround function, which is
Figure SMS_1
Wherein, the method comprises the steps of, wherein,
Figure SMS_2
the value of the scale parameter is generally 80-100;
Figure SMS_3
for normalizing constant, satisfy
Figure SMS_4
Figure SMS_5
Coordinates of the pixel points; in the scheme, the scale parameters of the Gaussian surround function in the Retinex algorithm are set according to experience
Figure SMS_6
80, the scale parameter is recorded as the original scale parameter of each pixel point in the gray image
Figure SMS_7
Step S002, obtaining the gradient value and gradient direction of each pixel point in the gray level image; acquiring a focus point in the pixel point according to the difference of the gradient values; and obtaining the defect approximation degree of each attention point based on the gradient direction and the gray value of the pixel point.
Specifically, the scale parameter in the Retinex algorithm set in step S001
Figure SMS_8
Is fixed, i.e. the original scale parameters of each pixel in the greyscale image
Figure SMS_9
Similarly, the enhancement processing is directly carried out on the gray level image, which can cause damage to the defect and influence the defect detection. The invention needs to ensure the integrity of the defect and remove as many light transition areas affecting the defect detection as possible, and the light transition areas have larger changed cut-off positions, so the invention needs to set the self-adaptive scale parameters for each pixel point in the gray level image, and further obtains the self-adaptive incident light component, namely, when the pixel point is at the defect position, the original scale parameters are adjusted to keep the defect, and when the pixel point is at the uneven illumination position and is not the defect, the original scale parameters are directly utilized for enhancement treatment.
The Sobel operator is used to obtain the gradient value and gradient direction of each pixel point in the gray image, wherein the Sobel operator is in the prior art, and the embodiment is not repeated. Since the defect edge and the light transition area are analyzed later and the gradient values of the two pixel points are larger, the attention point in the pixel points, namely the pixel points of the defect edge and the light transition area, is obtained according to the difference of the gradient values, and the attention point is specifically as follows: obtaining a maximum gradient value and a minimum gradient value according to the gradient value of each pixel point in the gray level image, calculating the difference value of the maximum gradient value and the minimum gradient value, taking the difference value as a denominator, taking the difference value of the gradient value of any pixel point and the minimum gradient value as the ratio obtained by molecules, and marking the ratio as the characteristic value of the corresponding pixel point; and acquiring the characteristic value of each pixel point, and taking the pixel point with the characteristic value larger than the characteristic value threshold value as the attention point.
As an example, the calculation formula of the eigenvalue of the pixel point is:
Figure SMS_10
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_11
the gradient value of the ith pixel point;
Figure SMS_12
the characteristic value of the ith pixel point;
Figure SMS_13
the minimum value of the gradient values of all pixel points in the surface gray level image is the minimum gradient value;
Figure SMS_14
the maximum value of the gradient values of all pixel points in the surface gray level image is the maximum gradient value.
When the gradient value of the pixel point is larger,
Figure SMS_15
the closer to 1, the smaller the gradient value of the pixel point, on the contrary,
Figure SMS_16
the closer to 0.
Because the gradient values of the corresponding pixel points of the defect edge and the light transition area are larger, the threshold value of the characteristic value is set to be 0.5, and an implementer can adjust the characteristic value according to the situation. And extracting pixel points with characteristic values larger than a characteristic value threshold value in the gray image, marking the pixel points as attention points, and analyzing the attention points.
Because the shapes of the light transition areas are different, and the shapes of the cracking defect parts are approximate to straight lines, the difference of included angles between each defect edge point and adjacent points is small; meanwhile, the light transition area may have a shape similar to the shape of the defect, but for the light transition area, the pixel values of the pixel points at two sides of the edge point have larger difference, and for the crack defect, the pixel values of the pixel points at two sides of the defect have smaller difference, so the defect approximation degree of each concerned point is constructed according to the characteristics, and the method is used for detecting the degree that the concerned point is the defective pixel, and specifically comprises the following steps: taking any one of the attention points as a target point, acquiring gradient direction average values of all the neighborhood attention points in a preset neighborhood range of the target point, calculating a difference absolute value between the gradient direction of the target point and the gradient direction average value, and recording the difference absolute value as a first value; wherein, the numerical value of the gradient direction when participating in calculation refers to the included angle between the gradient direction and the horizontal direction; acquiring a pixel point closest to the target point in the opposite direction of the gradient direction of the target point, and marking the pixel point as a first pixel point; acquiring a focus point closest to the target point in the gradient direction of the target point, marking the focus point as a first focus point, and acquiring a pixel point closest to the first focus point in the opposite direction of the gradient direction of the first focus point, marking the pixel point as a second pixel point; calculating the absolute value of the difference value of the gray value between the first pixel point and the second pixel point, and recording the absolute value as a second value; and calculating the addition result of the constant 1 and the first value, and taking the reciprocal of the product of the addition result and the second value as the defect approximation degree of the target point.
As an example, in this embodiment, the value of the gradient direction when participating in the calculation refers to the angle between the gradient direction and the horizontal direction, and the calculation formula of the defect approximation degree of the point of interest is:
Figure SMS_17
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_18
defect approximation for the kth point of interest;
Figure SMS_19
gradient direction for the kth point of interest;
Figure SMS_20
the gradient direction mean value of all neighborhood attention points in the preset neighborhood range of the kth attention point is the same as the gradient direction mean value of all neighborhood attention points in the preset neighborhood range of the kth attention pointIn the scheme, a preset neighborhood range is an eight-neighborhood range;
Figure SMS_21
the gray value of the pixel point i closest to the kth attention point in the opposite direction of the gradient direction of the kth attention point, namely the gray value of the first pixel point;
Figure SMS_22
the gray value of the pixel j closest to the first attention point in the opposite direction of the gradient direction of the first attention point, namely the gray value of the second pixel, and the first attention point refers to the attention point closest to the kth attention point in the gradient direction of the kth attention point;
Figure SMS_23
to take absolute value.
It should be noted that the larger the difference between the gradient direction in the neighborhood of the point of interest and the point of interest, the more the point of interest is the pixel point in the light transition region, not the pixel point of the crack defect, and therefore
Figure SMS_24
The larger the value of (2), the smaller the defect approximation degree of the corresponding point of interest; because the pixel values of the pixel points at the two sides of the light transition area are larger, and the pixel values of the pixel points at the two sides of the defect at the cracking defect are smaller, the light transition area is characterized in that
Figure SMS_25
The smaller the value of (2), the more the pixel points of the attention points are the cracking defect positions, and the greater the defect approximation degree of the corresponding attention points is;
Figure SMS_26
the larger, the greater the likelihood that the point of interest is at the edge of the defect,
Figure SMS_27
the smaller the value, the greater the likelihood that the point of interest is within the ray transition region.
So far, the defect approximation degree of each attention point is respectively obtained by using a calculation formula of the defect approximation degree of the attention point.
Step S003, carrying out three-dimensional reconstruction on the gray level images to obtain surface images under all view angles, and obtaining the defect approximation degree of each focus point in each surface image; and obtaining an improvement factor of the corresponding attention point according to the difference of defect approximation degree of each attention point in the gray level image and the surface image.
Specifically, since the positions of the defects are random, and the reflective areas are random, there is a situation that the cracking defects fall at the light boundaries, and at this time, the defects are mistakenly regarded as light transition areas only according to the processing in step S002, so that further analysis is required, which is specifically as follows:
since the crack has a longitudinal feature, i.e. will extend downwards, the feature is present in the image at different viewing angles, whereas for the light transition region there is a difference in the image at different viewing angles, i.e. when the defect is located at the light demarcation, the difference is larger because the grey values on both sides are affected by the light, so that it is in the original grey image
Figure SMS_28
The value is smaller, and the value is mistaken as an illumination boundary position at the moment; but due to the longitudinally extending features of the crack, in the resulting image at other angles of view
Figure SMS_29
The value is larger. Therefore, a NeRF neural radiation field model is used for carrying out three-dimensional reconstruction on a gray level image, and the surface images of the automobile hub under different visual angles are obtained, specifically: and (3) three-dimensional reconstruction is carried out to obtain a three-dimensional automobile hub, the three-dimensional automobile hub is rotated along a space rectangular coordinate system O-xyz at a preset rotation angle, and surface images of the automobile hub under different visual angles are obtained.
The preset angle is 5, wherein the NeRF neural radiation field model models the three-dimensional scene of the object in the image, which is a known technique and will not be described in detail herein.
The method for acquiring the surface image of the three-dimensional object at multiple angles of view is a method for acquiring the image of the three-dimensional object at multiple angles of view described in, for example, patent CN 108198215B.
Since the defect is only misidentified as a light transition point here when the defect falls at the light boundary point according to the defect approximation degree, the defect is destroyed here, and the defect approximation degree of each concerned point is adjusted to construct an improvement factor in consideration of the fact that the cracking defect has a longitudinal extension characteristic and different under different viewing angles, so that the defect point is preserved when the defect point is processed, and the illumination uneven area affecting the defect detection is removed.
The method for obtaining the improvement factor is as follows: for any one attention point, calculating a defect approximation degree average value according to the defect approximation degree of the attention point in each affiliated surface image; calculating the defect approximation degree of the focus point in the gray level image and the difference absolute value of the defect approximation degree in any one of the affiliated surface images, calculating the average value of the difference absolute values according to the difference absolute values corresponding to all the affiliated surface images of the focus point, and marking the average value as a first result; normalizing the product of the defect approximation mean value and the first result, and taking the normalized result as a second result; normalizing the defect approximation degree of the focus point in the gray level image, and taking the normalized result as a third result; normalizing the addition result of the second result and the third result, and taking the normalized result as an improvement factor of the attention point.
As an example, since each point of interest in the gray image does not completely exist in the surface image at different viewing angles, that is, each surface image does not include all the points of interest in the gray image, but some pixels in the gray image may exist in any surface image, and therefore, according to the difference between the defect approximation degree of the point of interest in the surface image where the point of interest is located and the defect approximation degree of the point of interest in the gray image, an improvement factor of the point of interest is constructed, and the calculation formula of the improvement factor is:
Figure SMS_30
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_33
an improvement factor for the A-th point of interest;
Figure SMS_36
the approximate degree of the trap of the A-th attention point in the gray image is obtained;
Figure SMS_38
the approximate degree of the subsidence of the A-th focus point in the surface image of the a-th focus point;
Figure SMS_32
the number of surface images to which the point of interest belongs, that is, the number of surface images containing the point of interest;
Figure SMS_35
is a normalization function;
Figure SMS_37
the defect approximation degree average value of the A-th focus point in all the surface images is obtained;
Figure SMS_39
is the first result;
Figure SMS_31
is the second result;
Figure SMS_34
and is the third result.
When the defect falls at the illumination boundary, the gray scale difference is the same as that in the case of uneven illumination, i.e. the gray scale value difference is larger at both sides
Figure SMS_41
Smaller, but with the presence of longitudinal features of cracking, corresponding to other viewing angles and no illumination effects
Figure SMS_45
The values are all larger, thereby
Figure SMS_48
Larger and bigger,
Figure SMS_42
Larger, corresponding to the second result
Figure SMS_43
Larger; whereas when it is only the light transition region, the light distribution is random, the focus is in the original gray image
Figure SMS_46
May be larger or smaller, and the point of interest is at other viewing angles
Figure SMS_49
The values are smaller
Figure SMS_40
The size of the particles is smaller and the particles,
Figure SMS_44
smaller; therefore, when the point of interest is a defective pixel point in the light transition region, the defect approximation degree of the corresponding point of interest is smaller, and the image is at other angles of view
Figure SMS_47
The larger the value is, the corresponding second result
Figure SMS_50
The larger the value of (c) and thus the larger the improvement factor.
The method for obtaining the defect approximation degree of the focus point in each belonging surface image is the same as the method for obtaining the defect approximation degree of the focus point in the gray scale image, that is, the method for obtaining the defect approximation degree of the focus point in each belonging surface image is utilized in step S002.
So far, according to the calculation formula of the improvement factor, the improvement factor of each attention point in the gray level image is obtained.
Step S004, adjusting the scale parameters by utilizing the improvement factors of each concern point to obtain the self-adaptive scale parameters of the corresponding concern points; and carrying out image enhancement on the gray level image by using a Retinex algorithm based on the self-adaptive scale parameter and the original scale parameter, and carrying out automobile hub surface defect detection on the gray level image after image enhancement.
Specifically, because step S003 has obtained the improvement factor of each focus point in the gray level image, according to the priori knowledge, when the scale parameter is larger, the enhanced image color has better fidelity, but the reservation of details is worse, and more detail information is lost; when the scale parameters are smaller, the details of the enhanced image are better preserved, so that the original scale parameters are adjusted by utilizing the improvement factors of each concern point to obtain the self-adaptive scale parameters of the corresponding concern point, and the specific acquisition method is as follows: for any one point of interest, calculating the difference between the constant 1 and the improvement factor of the point of interest, and taking the product of the difference and the original scale parameter as the adaptive scale parameter of the point of interest.
As an example, the calculation formula of the adaptive scale parameter of the point of interest is:
Figure SMS_51
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_52
the adaptive scale parameter is the scale parameter after the adjustment;
Figure SMS_53
is an improvement factor of the point of interest;
Figure SMS_54
is the original scale parameter, i.e. the scale parameter before adjustment.
It should be noted that, the larger the improvement factor, the more the focus is the defective pixel point in the light transition region, and the smaller the scale parameter, the more the illumination influence can be effectively removed, so that the better the detail retention of the enhanced image is, so in order to ensure the detail of the defect, the larger the improvement factor, the smaller the adaptive scale parameter of the corresponding focus.
For non-interest points in the gray scale image, the original scale parameters are used for the non-interest points in the gray scale image because the non-interest points are not necessarily the pixel points of the defect and the light transition region
Figure SMS_55
And (5) enhancing.
For pixel points in different areas, the corresponding incident illumination components are also different, and the adaptive incident illumination components of the corresponding points are obtained according to the adaptive scale parameters of each attention point and the original scale parameters of each non-attention point in the gray level image: acquiring an incident illumination component of each attention point according to the self-adaptive scale parameter of each attention point, and enhancing each attention point in the gray level image by using a Retinex algorithm based on the incident illumination component; and acquiring an incident illumination component of each non-attention point according to the original scale parameter of each non-attention point, and enhancing each non-attention point in the gray image by using a Retinex algorithm based on the incident illumination component.
As one example, the calculation formula for the incident illumination component is:
Figure SMS_56
in the method, in the process of the invention,
Figure SMS_57
a Gaussian surrounding function with a scale parameter of c; s is an original image, namely a gray image;
Figure SMS_58
is the incident illumination component.
And obtaining an incident illumination component of each pixel point in the gray image by using a calculation formula of the incident illumination component, and enhancing the gray image by using a Retinex algorithm according to the obtained incident illumination component to obtain an enhanced gray image, wherein the Retinex algorithm is a known technology and is not described in detail herein.
The original scale parameters of the Gaussian surrounding function in the Retinex algorithm are adjusted according to the defect characteristics and the illumination transition region characteristics, so that the self-adaptive incident illumination component of each pixel point in the gray image is obtained, the defect region after the image enhancement processing of the gray image is not destroyed, the influence of uneven illumination on defect detection is reduced, and the accuracy of the follow-up defect detection on the surface of the automobile hub is improved. And then the edge detection algorithm is used for detecting the defects of the gray level image after the image enhancement, and the edge detection algorithm used here is a known technology and is not repeated here.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. 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 are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
The foregoing description of the preferred embodiments of the present invention is not intended to be limiting, but rather, any modifications, equivalents, improvements, etc. that fall within the principles of the present invention are intended to be included within the scope of the present invention.

Claims (7)

1. The automobile hub surface defect detection method based on machine vision is characterized by comprising the following steps of:
acquiring a gray image of an automobile hub area, and obtaining an original scale parameter of each pixel point in the gray image by setting the scale parameter of a Gaussian surrounding function in a Retinex algorithm;
acquiring a gradient value and a gradient direction of each pixel point in the gray level image; acquiring a focus point in the pixel point according to the difference of the gradient values; acquiring defect approximation degree of each attention point based on the gradient direction and the gray value of the pixel point;
three-dimensional reconstruction is carried out on the gray level images to obtain surface images under all view angles, and defect approximation degree of each concern point in each surface image is obtained;
obtaining improvement factors of corresponding attention points according to the difference of defect approximation degrees of each attention point in the gray level image and the surface image respectively; adjusting the original scale parameters by utilizing the improvement factors of each concern point to obtain the self-adaptive scale parameters of the corresponding concern points;
based on the self-adaptive scale parameter and the original scale parameter, carrying out image enhancement on the gray level image by using a Retinex algorithm, and carrying out automobile hub surface defect detection on the gray level image after image enhancement;
the method for acquiring the improvement factor comprises the following steps:
for any one attention point, calculating a defect approximation degree average value according to the defect approximation degree of the attention point in each affiliated surface image; calculating the defect approximation degree of the focus point in the gray level image and the difference absolute value of the defect approximation degree in any one of the affiliated surface images, calculating the average value of the difference absolute values according to the difference absolute values corresponding to all the affiliated surface images of the focus point, and marking the average value as a first result; normalizing the product of the defect approximation mean value and the first result, and taking the normalized result as a second result;
normalizing the defect approximation degree of the focus point in the gray level image, and taking the normalized result as a third result; normalizing the addition result of the second result and the third result, and taking the normalized result as an improvement factor of the attention point;
the method for acquiring the adaptive scale parameters comprises the following steps:
for any one point of interest, calculating the difference between the constant 1 and the improvement factor of the point of interest, and taking the product of the difference and the original scale parameter as the adaptive scale parameter of the point of interest.
2. The machine vision-based automobile hub surface defect detection method of claim 1, wherein the method for acquiring the attention point comprises the following steps:
obtaining a maximum gradient value and a minimum gradient value according to the gradient value of each pixel point in the gray level image, calculating the difference value of the maximum gradient value and the minimum gradient value, taking the difference value as a denominator, taking the difference value of the gradient value of any pixel point and the minimum gradient value as the ratio obtained by molecules, and marking the ratio as the characteristic value of the corresponding pixel point; and taking the pixel point with the characteristic value larger than the characteristic value threshold value as the attention point.
3. The method for detecting the surface defect of the automobile hub based on the machine vision according to claim 1, wherein the method for obtaining the defect approximation degree comprises the following steps:
taking any one of the attention points as a target point, acquiring gradient direction average values of all the neighborhood attention points in a preset neighborhood range of the target point, calculating a difference absolute value between the gradient direction of the target point and the gradient direction average value, and recording the difference absolute value as a first value; wherein, the numerical value of the gradient direction when participating in calculation refers to the included angle between the gradient direction and the horizontal direction;
acquiring a pixel point closest to the target point in the opposite direction of the gradient direction of the target point, and marking the pixel point as a first pixel point; acquiring a focus point closest to the target point in the gradient direction of the target point, marking the focus point as a first focus point, and acquiring a pixel point closest to the first focus point in the opposite direction of the gradient direction of the first focus point, marking the pixel point as a second pixel point;
calculating the absolute value of the difference value of the gray value between the first pixel point and the second pixel point, and recording the absolute value as a second value; and calculating the addition result of the constant 1 and the first value, and taking the reciprocal of the product of the addition result and the second value as the defect approximation degree of the target point.
4. The machine vision-based automobile hub surface defect detection method according to claim 1, wherein the method for image enhancement of a gray image using a Retinex algorithm based on the adaptive scale parameter and the original scale parameter comprises:
acquiring an incident illumination component of each attention point according to the self-adaptive scale parameter of each attention point, and enhancing each attention point in the gray level image by using a Retinex algorithm based on the incident illumination component;
and acquiring an incident illumination component of each non-attention point according to the original scale parameter of each non-attention point, and enhancing each non-attention point in the gray image by using a Retinex algorithm based on the incident illumination component.
5. The machine vision-based automobile hub surface defect detection method of claim 1, wherein the gray scale image is reconstructed in three dimensions by using a NeRF neural radiation field model.
6. The machine vision-based automobile hub surface defect detection method according to claim 1, wherein the original scale parameter of each pixel point in the gray level image is a scale parameter of a gaussian surround function in a set Retinex algorithm.
7. The machine vision-based automobile hub surface defect detection method as claimed in claim 1, wherein the method for three-dimensionally reconstructing a gray image to obtain surface images under all viewing angles comprises the steps of:
and (3) three-dimensional reconstruction is carried out to obtain a three-dimensional automobile hub, the three-dimensional automobile hub is rotated along a space rectangular coordinate system O-xyz at a preset rotation angle, and surface images of the automobile hub under different visual angles are obtained.
CN202310153944.1A 2023-02-23 2023-02-23 Automobile hub surface defect detection method based on machine vision Active CN115830033B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310153944.1A CN115830033B (en) 2023-02-23 2023-02-23 Automobile hub surface defect detection method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310153944.1A CN115830033B (en) 2023-02-23 2023-02-23 Automobile hub surface defect detection method based on machine vision

Publications (2)

Publication Number Publication Date
CN115830033A CN115830033A (en) 2023-03-21
CN115830033B true CN115830033B (en) 2023-04-28

Family

ID=85522183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310153944.1A Active CN115830033B (en) 2023-02-23 2023-02-23 Automobile hub surface defect detection method based on machine vision

Country Status (1)

Country Link
CN (1) CN115830033B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116468728B (en) * 2023-06-20 2023-08-29 深圳市锦红兴科技有限公司 Production quality detection method for hardware stamping part die
CN116563799B (en) * 2023-07-11 2023-09-22 山东昆仲信息科技有限公司 Dust online monitoring method based on video monitoring
CN116612111B (en) * 2023-07-14 2023-09-22 城资泰诺(山东)新材料科技有限公司 High-strength composite material processing quality detection method
CN116630308B8 (en) * 2023-07-20 2023-10-27 山东华太新能源电池有限公司 Data enhancement system for battery welding anomaly detection
CN116777918B (en) * 2023-08-25 2023-10-31 苏州科尔珀恩机械科技有限公司 Visual auxiliary kiln surface defect rapid detection method
CN116912248B (en) * 2023-09-13 2024-01-05 惠州市耀盈精密技术有限公司 Irregular hardware surface defect detection method based on computer vision
CN117095008B (en) * 2023-10-20 2024-02-06 深圳市高进实业有限公司 Intelligent detection method for defects of steel bar pipe of clock
CN117455916B (en) * 2023-12-25 2024-03-15 山东太阳耐磨件有限公司 Visual detection method for surface defects of steel plate

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114841937A (en) * 2022-04-21 2022-08-02 燕山大学 Detection method for detecting surface defects of automobile hub
CN114972325A (en) * 2022-07-11 2022-08-30 爱普车辆股份有限公司 Automobile hub defect detection method based on image processing

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9299130B2 (en) * 2013-03-15 2016-03-29 Trustees Of Tufts College Methods and apparatus for image processing and analysis
CN109859132A (en) * 2019-01-30 2019-06-07 孙洁 A kind of product quality online test method based on enhancing image recognition technology
CN111476784A (en) * 2020-04-14 2020-07-31 孙洁 Product surface defect online detection method based on image enhancement recognition technology
CN114937006A (en) * 2022-04-29 2022-08-23 南通同欧智能装备科技有限公司 Hammerhead refinement defect detection method based on image enhancement

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114841937A (en) * 2022-04-21 2022-08-02 燕山大学 Detection method for detecting surface defects of automobile hub
CN114972325A (en) * 2022-07-11 2022-08-30 爱普车辆股份有限公司 Automobile hub defect detection method based on image processing

Also Published As

Publication number Publication date
CN115830033A (en) 2023-03-21

Similar Documents

Publication Publication Date Title
CN115830033B (en) Automobile hub surface defect detection method based on machine vision
CN109816652B (en) Complex casting defect identification method based on gray level significance
CN116168026B (en) Water quality detection method and system based on computer vision
CN114723681B (en) Concrete crack defect detection method based on machine vision
CN113436168B (en) Crack defect detection method for industrial welding line X-ray diagram
CN102156996B (en) Image edge detection method
CN109632808B (en) Edge defect detection method and device, electronic equipment and storage medium
CN113963042B (en) Metal part defect degree evaluation method based on image processing
CN116664559B (en) Machine vision-based memory bank damage rapid detection method
CN115690105B (en) Milling cutter scratch detection method based on computer vision
CN114399522A (en) High-low threshold-based Canny operator edge detection method
CN114881915A (en) Symmetry-based mobile phone glass cover plate window area defect detection method
CN115984148B (en) Denoising enhancement method for high-throughput gene sequencing data
CN116740061B (en) Visual detection method for production quality of explosive beads
CN116228768B (en) Method for detecting scratches on surface of electronic component
CN115272303A (en) Textile fabric defect degree evaluation method, device and system based on Gaussian blur
Kozamernik et al. Visual inspection system for anomaly detection on KTL coatings using variational autoencoders
CN115393216A (en) Image defogging method and device based on polarization characteristics and atmospheric transmission model
CN116993966B (en) Casting polishing vision intelligent positioning method and system
CN112330667B (en) Morphology-based laser stripe center line extraction method
CN115797314B (en) Method, system, equipment and storage medium for detecting surface defects of parts
CN116883987A (en) Pointer instrument reading identification method for unmanned inspection of transformer substation
CN115100510B (en) Tire wear degree identification method
CN111353324A (en) Method for reading two-dimensional code of dot matrix in glass
CN116205903A (en) Method for detecting defects of vehicle body finish paint

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A Method for Detecting Surface Defects of Automotive Wheel Hubs Based on Machine Vision

Effective date of registration: 20230721

Granted publication date: 20230428

Pledgee: Weihai City Commercial Bank Limited by Share Ltd. high tech branch

Pledgor: WEIHAI RUIXINFENG METAL TECHNOLOGY Co.,Ltd.

Registration number: Y2023980049314