An automatic adjustment method for polarizing mirrors used in defect detection of mechanical parts
By optimizing the polarizing mirror acquisition device through angle adjustment and image feature matching, the problem of light interference from pores on the surface of mechanical parts was solved, and high-quality defect detection was achieved.
Patent Information
- Application Number
- CN202511697120.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2045-11-19
AI Technical Summary
The varying distribution and morphology of pores on the surface of mechanical parts can interfere with light during imaging. A fixed imaging angle can affect polarization, reduce image quality, and impact the reliability and accuracy of defect detection.
By using an image acquisition device with adjustable angle, combined with an image feature matching algorithm and a polarizing filter, grayscale images at different acquisition angles are analyzed to determine the optimal acquisition angle, eliminate interfering light, and preserve detailed textures.
It improves the quality of grayscale images of mechanical parts, enhancing the reliability and accuracy of defect detection.
Smart Images

Figure CN121141530B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image enhancement technology, and more specifically to an automatic adjustment method for a polarizing filter used for defect detection of mechanical parts. Background Technology
[0002] During the production of mechanical parts, if the gas generated during the casting process fails to escape in time, it can cause holes to form on the surface of the mechanical parts, resulting in porosity defects. At this time, it is necessary to inspect the surface of the mechanical parts. However, the reflection of the surface of the mechanical parts and the reflection of the porosity area can affect the final defect detection results.
[0003] Compared to machine vision, polarization vision technology reveals surface features of targets more clearly and is more sensitive to the polarization information of scattered light, thus effectively identifying objects of different materials and surface conditions. Simultaneously, it reduces reflected light intensity, enhances features, and effectively improves the contrast between features and the background.
[0004] However, the distribution of pores on the surface of mechanical parts varies, resulting in differences in surface flatness. During the imaging process, the complexity of the pore area can generate interfering light. Fixing the imaging angle can affect the polarization effect, thereby reducing the quality of the obtained mechanical part surface image and affecting the reliability and accuracy of subsequent defect detection. Summary of the Invention
[0005] To address the technical problems in related technologies where the complexity of the pore region generates interfering light during the imaging process, and a fixed imaging angle affects the polarization effect, resulting in poor detail and texture in the acquired images of mechanical parts, thus leading to low image quality and poor reliability and accuracy in defect detection, this invention provides an automatic polarization filter adjustment method for defect detection of mechanical parts. The specific technical solution adopted is as follows:
[0006] This invention proposes an automatic polarizing filter adjustment method for detecting defects in mechanical parts, including an image acquisition device capable of angle adjustment and equipped with a polarizing filter. The method uses the angle between the center direction of the image acquisition device's viewing angle and the horizontal direction as the acquisition angle. The method includes:
[0007] The image acquisition device acquires grayscale images of mechanical parts at different acquisition angles. Based on the grayscale value of each row of pixels in each frame of the grayscale image of the mechanical part, the degree of porosity defect of each pixel in the corresponding grayscale image of the mechanical part is determined.
[0008] The polarization factor of a pixel is determined based on the grayscale difference between any pixel in the same frame of grayscale image of a mechanical part and other pixels within a preset local range; pixels representing the same part position in grayscale images of mechanical parts from different frames are combined in order of acquisition angle to obtain a comparison pixel sequence; the polarization influence coefficient of a pixel is determined based on the difference in the polarization factor of the pixels in the comparison pixel sequence.
[0009] Based on the degree of porosity defects in the same row of pixels, the same row of pixels is divided into normal pixels and suspected abnormal pixels. Based on the polarization influence coefficient of the normal pixels and the polarization influence coefficient of the suspected abnormal pixels, the degree of row interference of the same row of pixels in the grayscale image of the corresponding mechanical part is determined.
[0010] Based on the degree of pore defects and the degree of row interference, the target defect degree of the pixel in the corresponding grayscale image of the mechanical part is determined; based on the target defect degree of all pixels in the grayscale image of the same mechanical part, the selection coefficient of different grayscale images of the mechanical part is determined; based on the selection coefficient, the optimal acquisition angle is selected, and the image acquisition device is adjusted to the optimal acquisition angle.
[0011] Further, the preset local range is an eight-neighbor range, and the step of determining the polarization factor of a pixel based on the grayscale difference between any pixel in the same frame of the grayscale image of the mechanical part and other pixels within the preset local range includes:
[0012] Calculate the mean of the absolute values of the grayscale differences between any pixel and other pixels in its eight-neighborhood range to obtain the neighborhood grayscale difference.
[0013] The polarization factor of the pixel is obtained by normalizing the grayscale difference in the neighborhood.
[0014] Furthermore, the method for obtaining pixels representing the same part position in grayscale images of mechanical parts from different frames includes:
[0015] Image feature matching algorithms are used to identify image features in grayscale images of mechanical parts in different frames. Based on the identification results, the pixels representing the same part position in all grayscale images of mechanical parts are determined.
[0016] Further, determining the polarization influence coefficient of a pixel based on the difference in polarization factors among pixels in the comparison pixel sequence includes:
[0017] Calculate the polarization factor of each pixel and the standard deviation of the polarization factors of all pixels in the comparison pixel sequence, and then normalize the result to obtain the polarization influence coefficient of the pixel.
[0018] Furthermore, the step of dividing pixels in the same row into normal pixels and suspected abnormal pixels based on the degree of porosity defects in the same row includes:
[0019] Pixels with a porosity defect degree greater than a preset defect degree threshold are identified as suspected abnormal pixels.
[0020] Pixels with a porosity defect level less than or equal to a preset defect level threshold are considered normal pixels.
[0021] Further, determining the degree of row interference of pixels in the same row in the grayscale image of the corresponding mechanical part based on the polarization influence coefficient of the normal pixels and the polarization influence coefficient of the suspected abnormal pixels includes:
[0022] The absolute value of the difference between the mean polarization influence coefficient of all normal pixels in the same row and the mean polarization influence coefficient of all suspected abnormal pixels is calculated and normalized to obtain the row interference level.
[0023] Further, determining the target defect degree of the pixel in the corresponding grayscale image of the mechanical part based on the degree of porosity defect and the degree of row interference includes:
[0024] The negative number of the line interference level is normalized and used as the polarization effect coefficient;
[0025] The target defect degree is obtained by calculating the product of the porosity defect degree of the pixel and the polarization effect coefficient of the pixels in the same row as the pixel, and then normalizing the product.
[0026] Further, determining the selection coefficient for different grayscale images of the same mechanical part based on the target defect degree of all pixels in the grayscale image includes:
[0027] Calculate the sum of the target defect severity of all pixels in the grayscale image of the mechanical part, and normalize the sum to obtain the selection coefficient of the grayscale image of the mechanical part.
[0028] Further, the step of selecting the optimal acquisition angle based on the selection coefficient includes:
[0029] The optimal acquisition angle is the acquisition angle of the grayscale image of the mechanical part when the selection coefficient is maximized.
[0030] Further, determining the degree of porosity defect of each pixel in the corresponding grayscale image of the mechanical part based on the grayscale value of each row of pixels in each frame of the grayscale image of the mechanical part includes:
[0031] Calculate the absolute value of the difference between the gray value of each row of pixels and the mean gray value of the pixels in the same row to obtain the mean gray value difference;
[0032] The degree of porosity defects of the pixel is obtained by normalizing the mean gray level difference.
[0033] The present invention has the following beneficial effects:
[0034] This invention determines the degree of porosity defects of each pixel in the corresponding grayscale image of a mechanical part based on the grayscale value of each row of pixels in each frame of the grayscale image. The degree of porosity defects characterizes grayscale anomalies; that is, the more abnormal the grayscale, the greater the degree of porosity defects. Then, by combining the grayscale differences of other pixels within a preset local range, the polarization factor of the pixel at the center position is determined. A comparison pixel sequence is determined by combining pixels representing the same part position in different frames of grayscale images of mechanical parts. Based on the differences in polarization factors of pixels at the same part position in different frames of grayscale images of mechanical parts, the polarization influence on the pixel itself is analyzed to determine the polarization influence coefficient of the pixel. Based on the polarization influence coefficients of normal pixels and suspected abnormal pixels, the row interference degree of pixels in the same row in the corresponding grayscale image of the mechanical part is determined. The row interference degree characterizes the influence of interfering light and polarization effects on a row of pixels. Finally, the degree of porosity defects and the row interference degree are combined... The degree of the target defect is determined. The greater the degree of the target defect, the clearer the texture details of the corresponding pixels are preserved under better polarization effect. This facilitates the subsequent determination of the selection coefficient based on the degree of the target defect of all pixels in the grayscale image of the same mechanical part. The optimal acquisition angle is selected based on the selection coefficient, and the image acquisition device is adjusted to the optimal acquisition angle. This invention performs feature analysis on grayscale images of mechanical parts under multiple frames at different acquisition angles, including grayscale features of the same row, grayscale features within a local area, and grayscale features of other pixels representing the same part position. This achieves accurate analysis of the impact of polarization effect, thereby determining the optimal acquisition angle based on the analysis results. This ensures that the influence of interfering light can be eliminated at the optimal acquisition angle while preserving the detailed texture of the grayscale image of the mechanical part. As a result, the grayscale image of the mechanical part at the optimal acquisition angle has high image quality and optimal polarization effect, improving the reliability and accuracy of subsequent defect detection of grayscale images of mechanical parts at the optimal acquisition angle. Attached Figure Description
[0035] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a flowchart of an automatic adjustment method for a polarizing mirror for detecting defects in mechanical parts, provided in one embodiment of the present invention.
[0037] Figure 2 This is a structural diagram of an image acquisition device for a polarizing mirror provided in one embodiment of the present invention. Detailed Implementation
[0038] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an automatic adjustment method for a polarizing mirror for detecting defects in mechanical parts according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0039] Unless otherwise defined, 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 pertains.
[0040] The following description, in conjunction with the accompanying drawings, details the specific scheme of the automatic adjustment method for a polarizing mirror for detecting defects in mechanical parts provided by the present invention.
[0041] Please see Figure 1 The diagram illustrates a flowchart of an automatic adjustment method for a polarizing mirror used for defect detection of mechanical parts, according to an embodiment of the present invention. The method includes:
[0042] S101: Acquire grayscale images of mechanical parts captured by the image acquisition device at different acquisition angles, and determine the degree of porosity defects of each pixel in the corresponding grayscale image of the mechanical part based on the grayscale value of each row of pixels in each frame of the grayscale image of the mechanical part.
[0043] The specific application scenario of this invention is an image acquisition device capable of angle adjustment and equipped with a polarizing filter, such as... Figure 2 As shown, Figure 2This invention provides a structural diagram of an image acquisition device for a polarizing filter, according to an embodiment of the present invention. The angle between the center of the viewing angle of the image acquisition device and the horizontal direction is used as the acquisition angle. It is understood that due to issues such as the incident angle of the light source and the tilt angle of the mechanical part itself, when using an image acquisition device to acquire images of a mechanical part, it is impossible to effectively guarantee that the image acquisition device can acquire a better grayscale image of the mechanical part, that is, an image that best eliminates the influence of reflections from the mechanical part. Therefore, the present invention, by setting up an image acquisition device with adjustable angle, achieves optimal image acquisition results by utilizing the texture features and grayscale distribution features of the grayscale image of the mechanical part under different acquisition angles.
[0044] In this embodiment of the invention, a fixed acquisition angle range can be set, for example, between 30 degrees and 150 degrees, and an original image of the mechanical part is acquired every 5 degrees. Then, image preprocessing is performed on all the original images to obtain a grayscale image of the mechanical part. Specifically, the image preprocessing can be, for example, image grayscale processing and background removal processing. Image grayscale processing can be, for example, mean grayscale processing. Background removal processing is performed by image annotation or part shape recognition to obtain an image containing only the part area as the grayscale image of the mechanical part. There are no restrictions on this.
[0045] In this embodiment of the invention, due to the curved shape inside the pores of the mechanical part itself, the pores can reflect light over a large angle range. The polarizing mirror can filter out light that is perpendicular to its polarization direction. Due to the requirement for the incident angle of light, when the plane angle between the light source and the mechanical part changes, the corresponding polarizing mirror cannot filter out the interfering light. Therefore, in the grayscale image of the mechanical part, pixels in different rows may represent different changes in the incident angle. Thus, this invention combines the grayscale features of pixels in different rows to achieve the analysis of pore defects.
[0046] Furthermore, in some embodiments of the present invention, the degree of porosity defect of each pixel in the corresponding grayscale image of the mechanical part is determined based on the grayscale value of each row of pixels in each frame of the grayscale image of the mechanical part, including: calculating the absolute value of the difference between the grayscale value of each row of pixels and the mean grayscale value of the pixels in the same row to obtain the mean grayscale difference; and normalizing the mean grayscale difference to obtain the degree of porosity defect of the pixel.
[0047] The degree of pore defects refers to the display of pores in the grayscale image of the mechanical part at the corresponding angle. Since the greater the grayscale difference of pixels in the same row, the stronger the display effect of the corresponding pores, in this embodiment of the invention, the absolute value of the difference between the grayscale value of each row of pixels and the mean grayscale value of pixels in the same row is calculated to obtain the mean grayscale difference. The greater the mean grayscale difference, the more likely the corresponding pixel is to be a pixel in the pore area, that is, the stronger the display effect of the pore area. The degree of pore defects of the pixel is obtained by normalizing the mean grayscale difference.
[0048] S102: Determine the polarization factor of a pixel based on the grayscale difference between any pixel in the same frame of grayscale image of a mechanical part and other pixels within a preset local range; combine pixels representing the same part position in grayscale images of mechanical parts from different frames according to the order of acquisition angle to obtain a comparison pixel sequence; determine the polarization influence coefficient of a pixel based on the difference in polarization factor of pixels in the comparison pixel sequence.
[0049] Since pore areas are usually clustered together, this embodiment of the invention analyzes the pore features by analyzing the local area where the pixel is located.
[0050] Furthermore, in some embodiments of the present invention, the preset local range is an eight-neighbor range. The polarization factor of a pixel is determined based on the grayscale difference between any pixel in the grayscale image of a mechanical part in the same frame and other pixels in the preset local range. This includes: calculating the mean of the absolute values of the grayscale differences between any pixel and other pixels in its eight-neighbor range to obtain the neighborhood grayscale difference; and normalizing the neighborhood grayscale difference to obtain the polarization factor of the pixel.
[0051] In this embodiment of the invention, the neighborhood grayscale difference is obtained by calculating the average of the absolute values of the grayscale differences between any pixel and other pixels within its eight neighboring regions. Taking a pixel as the center pixel and the other pixels within its eight neighboring regions as surrounding pixels, the absolute values of the grayscale differences between the center pixel and each of the surrounding pixels are calculated, resulting in eight calculation results. These eight results are then averaged to obtain the neighborhood grayscale difference, which represents the grayscale difference between the center pixel and all surrounding pixels. A larger neighborhood grayscale difference indicates that the center pixel is more likely to be located at the edge of a pore region or within a region with optimal polarization within the pore. Therefore, the neighborhood grayscale difference is normalized to obtain the pixel's polarization factor, which can effectively characterize the pore anomaly features of the pixel.
[0052] In one embodiment of the present invention, the normalization process can be specifically, for example, maximum and minimum value normalization. Furthermore, the normalization in subsequent steps can all adopt maximum and minimum value normalization. In other embodiments of the present invention, other normalization methods can be selected according to the specific range of the numerical values, which will not be elaborated further.
[0053] In this embodiment of the invention, when the image acquisition device captures multiple grayscale images of mechanical parts at different angles using a polarizing mirror, the polarizing mirror cannot filter out all reflected light due to the change in the polarizing mirror angle, resulting in different brightness levels between the grayscale images of mechanical parts captured at different angles. Therefore, the multiple images captured by the image acquisition device at different angles using a polarizing mirror are compared, and feature analysis is performed based on the pixels representing the same part position in the grayscale images of different frames.
[0054] Furthermore, in some embodiments of the present invention, the method for obtaining pixels representing the same part position in grayscale images of mechanical parts in different frames includes: using an image feature matching algorithm to perform image feature recognition on grayscale images of mechanical parts in different frames, and determining pixels representing the same part position in all grayscale images of mechanical parts based on the recognition results.
[0055] Since the incident angle changes in grayscale images of mechanical parts across different frames, the content represented by the same pixel also changes. For example, a pixel at a certain position in a grayscale image of a mechanical part at a 30-degree angle represents the edge of the mechanical part, while the same pixel at a 90-degree angle represents the center of the mechanical part. Therefore, this invention uses an image feature matching algorithm to identify image features in grayscale images of mechanical parts across different frames, and performs pixel matching based on the identification results, matching pixels representing the same part position together, which facilitates subsequent analysis of pixels at the same part position.
[0056] The image feature matching algorithm in the embodiments of the present invention may be, for example, a corner matching algorithm, a scale invariant feature transform (SIFT) matching algorithm, etc., which are well known prior art to those skilled in the art, and will not be further limited or described in detail.
[0057] In this embodiment of the invention, after determining the pixels representing the same part position, the pixels representing the same part position in grayscale images of mechanical parts in different frames are combined in order of the acquisition angle to obtain a comparison pixel sequence. For example, when the pixels representing the same part position in grayscale images of mechanical parts at 30 degrees, 60 degrees, and 90 degrees are a, b, and c respectively, the comparison pixel sequence is [a, b, c].
[0058] Furthermore, in some embodiments of the present invention, after obtaining the comparison pixel sequence, the polarization factor changes of the pixels in the sequence are analyzed, and the polarization influence coefficient of the pixel is determined based on the difference in the polarization factor of the pixels in the comparison pixel sequence. This includes: calculating the standard deviation of the polarization factor of each pixel and the polarization factor of all pixels in the comparison pixel sequence, and performing normalization processing to obtain the polarization influence coefficient of the pixel.
[0059] Understandably, at certain angles, due to the influence of a polarizing filter, the grayscale value of a pixel will exhibit a polarization effect, thus eliminating the influence of illumination. Therefore, this invention calculates the polarization factor of each pixel and the standard deviation of the polarization factors of all pixels in its comparison pixel sequence, and normalizes the result to obtain the polarization influence coefficient of the pixel. The larger the polarization influence coefficient, the more unstable the polarization influence on the corresponding pixel location, leading to more unstable local grayscale value changes at different acquisition angles. This unstable change is usually caused by angle-dependent interference light (such as specular reflection). Conversely, the smaller the polarization influence coefficient, the more stable the local grayscale value changes are across all acquisition angles, and the closer they are to the inherent, undisturbed surface texture.
[0060] S103: Based on the degree of porosity defects in the same row of pixels, the pixels in the same row are divided into normal pixels and suspected abnormal pixels. Based on the polarization influence coefficient of normal pixels and the polarization influence coefficient of suspected abnormal pixels, the degree of row interference of the pixels in the same row in the grayscale image of the corresponding mechanical part is determined.
[0061] Furthermore, in some embodiments of the present invention, the pixels in the same row are divided into normal pixels and suspected abnormal pixels according to the degree of pore defects in the same row, including: pixels with a degree of pore defects greater than a preset defect degree threshold are regarded as suspected abnormal pixels; pixels with a degree of pore defects less than or equal to the preset defect degree threshold are regarded as normal pixels.
[0062] The preset defect severity threshold is a threshold value for the degree of pore defects. In this embodiment of the invention, the preset defect severity threshold can be, for example, 0.8. That is, pixels with a pore defect severity greater than 0.8 are considered as suspected abnormal pixels, and pixels with a pore defect severity less than or equal to 0.8 are considered as normal pixels. Of course, in other embodiments of the invention, the preset defect severity threshold can also be adjusted according to actual detection needs, and there is no limitation on this.
[0063] It is understandable that the larger the value of the pore defect degree, the more abnormal the gray value of the pixel is in the same row. Since the pore reflects light, the pixel is more likely to be the pixel corresponding to the reflected light in the pore area. Since the illumination of a row of pixels is the same, that is, the pixels in the same row belonging to the pore area will reflect the corresponding light, this invention combines all the polarization influence coefficients of a row of pixels to conduct a specific analysis of a row of pixels.
[0064] Furthermore, in some embodiments of the present invention, determining the degree of row interference of pixels in the same row in the grayscale image of the corresponding mechanical part based on the polarization influence coefficient of normal pixels and the polarization influence coefficient of suspected abnormal pixels includes: calculating the absolute value of the difference between the mean of the polarization influence coefficients of all normal pixels in the same row and the mean of the polarization influence coefficients of all suspected abnormal pixels, and performing normalization processing to obtain the degree of row interference.
[0065] Since the polarizing mirror angles corresponding to a row of pixels are the same, that is to say, the polarization effect of a row of pixels is the same, in this embodiment of the invention, the mean value of the polarization influence coefficient of all suspected abnormal pixels in the same row and the mean value of the polarization influence coefficient of all normal pixels in the same row are calculated. The mean value of the polarization influence coefficient of all suspected abnormal pixels is taken as the first mean value, and the mean value of the polarization influence coefficient of all normal pixels is taken as the second mean value.
[0066] Understandably, the polarization effect coefficient characterizes the instability of local pixel contrast at different acquisition angles. This instability is mainly caused by angle-dependent interference light (such as specular reflection). When the polarization effect is poor (i.e., there is severe interference light): normal pixels (flat metal surfaces) will produce strong specular reflection, resulting in a very large polarization effect coefficient. Meanwhile, suspected abnormal pixels (such as pores) do not reflect light, their texture is stable, and their polarization effect coefficient is very small. In this case, the absolute value of the difference between their means will be relatively large. When the polarization effect is good (i.e., there is no interference light): normal pixels have stable textures and a very small polarization effect coefficient. Suspected abnormal pixels also have stable textures and a very small polarization effect coefficient. In this case, the absolute value of the difference between their means will be very small.
[0067] This invention calculates the absolute value of the difference between the mean polarization influence coefficient of all normal pixels and the mean polarization influence coefficient of all suspected abnormal pixels, and then normalizes the result to obtain the row interference level. A higher row interference level indicates a greater difference in instability between normal and abnormal pixels, suggesting that the row is severely affected by interfering light and has a worse polarization effect. Conversely, a lower row interference level indicates a better polarization effect.
[0068] S104: Determine the target defect degree of the pixel in the corresponding mechanical part grayscale image based on the degree of porosity defect and the degree of line interference; determine the selection coefficient of different mechanical part grayscale images based on the target defect degree of all pixels in the same mechanical part grayscale image; select the optimal acquisition angle based on the selection coefficient, and adjust the image acquisition device to the optimal acquisition angle.
[0069] Furthermore, in some embodiments of the present invention, determining the target defect degree of a pixel in the grayscale image of the corresponding mechanical part based on the degree of porosity defect and the degree of row interference includes: calculating the difference between 1 and the degree of row interference as a polarization effect coefficient; calculating the product of the degree of porosity defect of the pixel and the polarization effect coefficient of the pixels in the same row as the pixel, and normalizing the product to obtain the target defect degree.
[0070] In this embodiment of the invention, since the greater the degree of pore defects, the greater the impact of pores on the pixel, and the greater the degree of row interference of pixels in the same row, the more severe the influence of interference light on the corresponding pixel row, and the worse the polarization effect, in order to obtain an image with more obvious pores and better polarization effect, the degree of pore defects is positively correlated with the degree of target defects, while the degree of row interference is negatively correlated with the degree of target defects.
[0071] It should be noted that a positive correlation indicates that there is a unidirectional relationship between the independent and dependent variables, where the larger the independent variable is, the larger the dependent variable is; a negative correlation indicates that there is an inverse relationship between the independent and dependent variables, where the smaller the independent variable is, the larger the dependent variable is. The specific manifestation of positive and negative correlations is determined by practical applications, and this application does not impose any special restrictions.
[0072] This embodiment of the invention first performs a negative correlation mapping on the row interference level to ensure that rows with lower interference levels (better effect) receive higher scores. Since the row interference level has been normalized and limited to the [0,1] range, this embodiment calculates (1 - row interference level) to obtain the polarization effect coefficient. Thus, the larger the polarization effect coefficient (its value range is also [0,1]), the smaller the interference in the row where the pixel is located, i.e., the better the polarization effect.
[0073] Therefore, the product of the porosity defect degree and the polarization effect coefficient is calculated and normalized to obtain the target defect degree. The greater the target defect degree, the greater the porosity effect of the pixel in the same row, even when the polarization effect is better. In this case, the porosity defect in the region where the pixel is located is greater.
[0074] The degree of target defects can accurately characterize clearer pore textures and better polarization effects.
[0075] Furthermore, in some embodiments of the present invention, determining the selection coefficient of different grayscale images of mechanical parts based on the target defect degree of all pixels in the grayscale image of the same mechanical part includes: calculating the sum of the target defect degree of all pixels in the grayscale image of the mechanical part, and normalizing the sum to obtain the selection coefficient of the grayscale image of the mechanical part.
[0076] In this embodiment of the invention, the sum of the target defect severity values of all pixels in each frame of the grayscale image of the mechanical part is normalized and used as the selection coefficient for the grayscale image of the mechanical part. The larger the selection coefficient, the better it can characterize the polarization effect and the display effect of the pore area in the grayscale image of the corresponding mechanical part. Therefore, in this embodiment of the invention, the acquisition angle of the grayscale image of the mechanical part with the largest selection coefficient is taken as the optimal acquisition angle.
[0077] In this embodiment of the invention, the image acquisition device is adjusted to the optimal acquisition angle. The grayscale image of the mechanical part at the optimal acquisition angle is taken as the optimal grayscale image of the mechanical part. The optimal grayscale image of the mechanical part corresponds to the greatest polarization elimination effect, and the texture details of pixel grayscale anomalies are preserved more completely. This facilitates the subsequent detection of porosity defects and enhances the reliability and accuracy of the detection.
[0078] This invention determines the degree of porosity defect of each pixel in the corresponding grayscale image of a mechanical part based on the grayscale value of each row of pixels in each frame of the grayscale image. The degree of porosity defect characterizes the grayscale anomaly, i.e., the more abnormal the grayscale, the greater the degree of porosity defect. Then, by combining the grayscale differences of other pixels within a preset local range, the polarization factor of the pixel at the center position is determined. A comparison pixel sequence is determined by combining pixels representing the same part position in different frames of grayscale images of mechanical parts. Based on the difference in polarization factor of pixels at the same part position in different frames of grayscale images of mechanical parts, the polarization influence of the pixel itself is analyzed to determine the polarization influence coefficient of the pixel. Based on the polarization influence coefficient of normal pixels and the polarization influence coefficient of suspected abnormal pixels, the row interference degree of the same row of pixels in the corresponding grayscale image of the mechanical part is determined. The row interference degree characterizes the influence of interference light and polarization effect on a row of pixels. Finally, by combining the degree of porosity defect and the row interference degree, the degree of target defect is determined. The greater the degree of the target defect, the clearer the texture details of the corresponding pixels are preserved under better polarization effect. This facilitates the subsequent determination of the selection coefficient based on the degree of the target defect of all pixels in the grayscale image of the same mechanical part. The optimal acquisition angle is selected based on the selection coefficient, and the image acquisition device is adjusted to the optimal acquisition angle. This invention performs feature analysis on grayscale images of mechanical parts under multiple frames at different acquisition angles, including grayscale features of the same row, grayscale features within a local area, and grayscale features of other pixels representing the same part position. This achieves accurate analysis of the impact of polarization effect, thereby determining the optimal acquisition angle based on the analysis results. This ensures that the influence of interfering light can be eliminated at the optimal acquisition angle while preserving the detailed texture of the grayscale image of the mechanical part. This results in high image quality for the grayscale image of the mechanical part at the optimal acquisition angle, obtaining the optimal polarization effect of the grayscale image of the mechanical part at the optimal acquisition angle, and improving the reliability and accuracy of subsequent defect detection of the grayscale image of the mechanical part at the optimal acquisition angle.
[0079] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0080] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for automatically adjusting a polariscope for mechanical part defect detection, characterized by, The method comprises the following steps: An image acquisition device capable of angle adjustment and provided with a polarizer is included, and an angle between a center direction of a view angle of the image acquisition device and a horizontal direction is taken as an acquisition angle, the method comprising: Obtaining gray scale images of mechanical parts acquired by the image acquisition device at different acquisition angles, and determining a degree of a blowhole defect of each pixel point in each frame of the gray scale images of the mechanical parts according to a gray scale value of each row of pixel points in each frame of the gray scale images of the mechanical parts; Determining a polarization factor of each pixel point in the same frame of the gray scale images of the mechanical parts according to a gray scale difference between the pixel point and other pixel points in a preset local range, combining pixel points representing the same part position in different frames of the gray scale images of the mechanical parts to obtain a contrast pixel point sequence according to the acquisition angle, and determining a polarization influence coefficient of the pixel point according to a difference between the polarization factors of the pixel points in the contrast pixel point sequence; Dividing the same row of pixel points into normal pixel points and suspected abnormal pixel points according to the degree of the blowhole defect of the same row of pixel points, and determining a row interference degree of the same row of pixel points in the corresponding gray scale image of the mechanical parts according to the polarization influence coefficient of the normal pixel points and the polarization influence coefficient of the suspected abnormal pixel points; Determining a target defect degree of the pixel point in the corresponding gray scale image of the mechanical parts according to the degree of the blowhole defect and the row interference degree, determining a selection coefficient of the gray scale image of the mechanical parts according to the target defect degrees of all the pixel points in the same gray scale image of the mechanical parts, and adjusting the image acquisition device to an optimal acquisition angle according to the selection coefficient; A method for determining the polarization influence coefficient of the pixel point comprises: Calculating a standard deviation between the polarization factor of each pixel point and the polarization factors of all the pixel points in the contrast pixel point sequence, and performing normalization processing to obtain the polarization influence coefficient of the pixel point; A method for determining the row interference degree of the same row of pixel points in the corresponding gray scale image of the mechanical parts comprises: Calculating an absolute value of a difference between a mean value of the polarization influence coefficients of all the normal pixel points in the same row of pixel points and a mean value of the polarization influence coefficients of all the suspected abnormal pixel points, and performing normalization processing to obtain the row interference degree; A method for determining the target defect degree of the pixel point in the corresponding gray scale image of the mechanical parts comprises: Performing normalization processing on an inverse number of the row interference degree as a polarization effect coefficient; Calculating a product of the degree of the blowhole defect of the pixel point and the polarization effect coefficient of the same row of pixel points in which the pixel point is located, and performing normalization processing to obtain the target defect degree; A method for determining the selection coefficient of the gray scale image of the mechanical parts comprises: Calculating a sum value of the target defect degrees of all the pixel points in the gray scale image of the mechanical parts, and performing normalization processing on the sum value to obtain the selection coefficient of the gray scale image of the mechanical parts; A method for determining the optimal acquisition angle comprises: Taking an acquisition angle of the gray scale image of the mechanical parts when the selection coefficient is maximum as the optimal acquisition angle; A method for determining the degree of the blowhole defect of each pixel point in the corresponding gray scale image of the mechanical parts comprises: An absolute value of a difference between the gray value of each row of pixels and a mean value of gray values of the same row of pixels is calculated to obtain a mean gray difference; The mean gray difference is normalized to obtain a degree of a pore defect of the pixel.
2. The method of claim 1, wherein the method is characterized by: The preset local range is an eight-neighbor range, and the polarization factor of the pixel is determined according to a gray difference between any pixel in the same frame of the mechanical part gray image and other pixels in the preset local range, including: An average value of absolute values of gray value differences between any pixel and other pixels in an eight-neighbor range of the pixel is calculated to obtain a neighborhood gray difference; The neighborhood gray difference is normalized to obtain the polarization factor of the pixel.
3. The method of claim 1, wherein the method further comprises: determining the polarization state of the light beam; and adjusting the polarization state of the light beam to a desired polarization state. The method for obtaining the pixels representing the same part position in different frames of the mechanical part gray images, including: An image feature recognition is performed on different frames of the mechanical part gray images by using an image feature matching algorithm, and pixels representing the same part position in all the mechanical part gray images are determined according to a recognition result.
4. The method of claim 1, wherein the method is characterized by: The same row of pixels is divided into normal pixels and suspected abnormal pixels according to the degree of the pore defect in the same row of pixels, including: Pixels with the degree of the pore defect greater than a preset defect degree threshold value are regarded as suspected abnormal pixels; Pixels with the degree of the pore defect less than or equal to the preset defect degree threshold value are regarded as normal pixels.
Citation Information
Patent Citations
High-reflection plane metal part defect detection method and system based on composite polarized light source and medium
CN120801347A
Magnesia carbon brick automatic detection method based on laser sensor
CN120868926A