Depth detection method of composite material defects based on image processing
Through image processing technology, the depth-related indicators of the pit area of the composite material are extracted and inputted into the prediction model, which solves the problems of large calculation volume and high cost during depth camera measurement, and achieves efficient and low-cost pit depth detection.
Patent Information
- Application Number
- CN202410852829.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-06-28
AI Technical Summary
In the prior art, when using a depth camera to measure the depth of a composite material, the calculation amount is large and costly, and high-precision measurement requires a high-cost depth camera.
By using an image-based processing method, by obtaining the target grayscale image of the composite surface, the depth-related indicators of the pit area such as target distance, target curvature, target area, shadow and clarity are extracted, and input to the trained pit. In the depth prediction model, the pit depth is predicted. This method uses line array lasers and industrial cameras, reducing the need for distance calculations per point and reducing costs.
It effectively reduces the calculation amount and cost of pit depth measurement of composite materials, improves the accuracy and efficiency of measurement, and improves the accuracy of depth measurement through targeted detection.
Smart Images

Figure CN118411361B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image data processing and a method for depth detection of composite material defects based on image processing. Background Art
[0002] The composite material may be a metal composite material. The performance of a metal composite material often depends on its internal structure. The depth of the pit defect of the metal composite material is closely related to the quality of the composite material, and the depth of the pit defect directly affects the strength of the material structure. In order to promptly discover problems in the production process and ensure the quality of the metal composite material, it is necessary to detect the depth of the pit defect of the metal composite material.
[0003] The patent document with the authorization announcement number CN106959075B discloses a method and system for accurate measurement using a depth camera. The method includes obtaining the depth information of an object using a depth camera. In the prior art, when it is necessary to measure the depth of a pit on the surface of a metal composite material, the depth of the pit area can also be measured by a depth camera, and the depth measurement of the pit area by a depth camera is a conventional measurement method. When a depth camera is used to measure the depth of the pit area, the depth camera calculates the distance between each point on the surface of the metal composite material and the lens, and then calculates the depth of the pit area. Generally, the surface area of the metal composite material is large. When a pit area on the surface of the metal composite material is depth detected, the depth camera needs to calculate the distance between each point on the surface of the metal composite material and the lens, resulting in a large amount of calculation. Moreover, the price of the depth camera is high, which leads to a high cost of using the depth camera. Furthermore, the depth of the pit area of the metal composite material may be small. In order to improve the accuracy of the measured depth, using a depth camera with higher accuracy will increase the cost.
[0004] Based on this, when measuring the depth of a pit area, it is particularly important to reduce the amount of calculation and reduce the cost. Summary of the invention
[0005] In order to solve the above-mentioned technical problems that the amount of calculation is large when using existing depth cameras to calculate the depth of the pit area and the cost of using depth cameras is high, the present invention proposes a depth detection method for composite material defects based on image processing.
[0006] In an embodiment of the present invention, a method for depth detection of composite material defects based on image processing is provided, comprising:
[0007] Acquire a target grayscale image of the surface of the composite material, process the target grayscale image, and obtain a pit area;
[0008] Taking any pit area as a target pit area, obtaining depth-related indicators of the target pit area, wherein the depth-related indicators include a target distance and a target curvature;
[0009] The depth-related index is input into the trained pit depth prediction model to obtain the depth value corresponding to the target pit area; wherein the process of obtaining the target distance and the target curvature includes:
[0010] Obtain a calibration image of the composite material surface irradiated by the linear array laser, wherein the angle between the light emitting direction of the linear array laser and the vertical direction of the composite material surface is a first preset angle, and the value range of the first preset angle is ; Processing the calibration image to obtain a laser contour line and a reference line, and using the laser contour line in the target pit area as the target contour line, wherein the reference line is a line connecting two intersection points of the laser contour line and the target pit area;
[0011] The distances between the pixel points in the target contour and the reference line are calculated, and the maximum value of all the distances is taken as the target distance; the target contour is fitted to obtain a fitting curve, and the target curvature is obtained.
[0012] Beneficial effect: The greater the target distance corresponding to the target pit area, the greater the probability that the pit is deeper. The greater the target curvature corresponding to the target pit area, the greater the probability that the pit is deeper. Based on this, the depth value can be determined according to the target distance and target curvature of the target pit area. Cameras and linear array lasers are used to measure the depth of the pit area, which is less expensive than using a depth camera to measure the depth of the pit. Moreover, the location of the pit area is determined first, and then the depth of the pit area is measured in a targeted manner. Compared with using a depth camera to measure the depth of the pit, the amount of calculation required to calculate the distance between each point on the surface of the metal composite material and the lens is small.
[0013] In one embodiment, the reference line passes through the center of the target pit area.
[0014] Beneficial effect: the obtained target distance and target curvature are more closely related to the depth of the target pit area, and thus the depth of the target pit area obtained by the target distance and target curvature is more accurate.
[0015] In one embodiment, the depth-related indicators also include target area, shadow degree and clarity; wherein: the area of the target pit area is taken as the target area; the variance of the grayscale values of the pixels in the target pit area is taken as the clarity of the target pit area.
[0016] Beneficial effect: The larger the target area, the greater the probability that the depth of the target pit area is larger; the greater the clarity, the greater the probability that the depth of the target pit area is smaller. Based on this, the target area and clarity of the target pit area are input into the pit depth prediction model to improve the accuracy of the obtained pit depth value.
[0017] In one embodiment, the shadow degree acquisition process includes:
[0018] The mean of the grayscale values of the pixels in the target pit area is taken as the defect mean;
[0019] The mean of the gray values of the pixels in the non-pit area of the target gray image is taken as the normal mean;
[0020] The absolute value of the difference between the defect mean and the normal mean is used as the shadow degree of the target pit area.
[0021] Beneficial effect: The greater the shadow degree, the greater the probability that the depth of the target pit area is greater. Based on this, the shadow degree of the target pit area is input into the pit depth prediction model to further improve the accuracy of the obtained pit depth value.
[0022] In one embodiment, the process of obtaining the normal mean value includes:
[0023] Determine the minimum bounding rectangle of the target pit area, and enlarge the length and width of the minimum bounding rectangle by a preset multiple with the center of the minimum bounding rectangle to obtain a first bounding rectangle, wherein the preset multiple is greater than 1, and the average of the grayscale values of the pixel points in the first bounding rectangle excluding the target pit area is taken as the normal average.
[0024] Beneficial effect: Since the first pixel point is around the target pit area, the difference between the normal mean and the defect mean can better reflect the shadow degree of the target pit area.
[0025] In one embodiment, obtaining a target grayscale image of a composite material surface includes:
[0026] Acquire an image of the composite material surface, the composite material surface is illuminated by a light source at a second preset angle, the second preset angle is the angle between the light source and the vertical direction of the composite material surface, and the value range of the second preset angle is ; Gray-scale the image of the surface of the composite material to obtain the target gray-scale image.
[0027] Beneficial effect: After the inclined light source illuminates the surface of the composite material, the shadow of the target pit area is made more obvious, so that the shadow degree can better reflect the depth of the target pit area.
[0028] In one embodiment, the process of obtaining the pit area includes:
[0029] Performing binary segmentation on the target grayscale image to obtain a binary image, and then obtaining a connected domain of the binary image;
[0030] The connected domain whose area is not less than the preset minimum pit threshold and whose area is not greater than the preset maximum pit threshold is taken as the pit area.
[0031] Beneficial effect: The area of the pit region is within a certain range, so the pit region can be obtained by presetting a minimum pit threshold and a maximum pit threshold, thereby making the obtained pit region more accurate.
[0032] In one embodiment, the pit depth prediction model is a back propagation neural network.
[0033] The beneficial effects of the present invention include:
[0034] The beneficial effects have been described above, and here is a brief description: Since this solution first determines the pit area and then conducts targeted detection of the depth of the pit area, the amount of calculation can be reduced compared to using a depth camera. The reason is that when measuring the depth of the pit area, the depth camera usually calculates the distance between each point on the surface of the metal composite material and the lens. In addition, the cost of using a depth camera is currently high, while the cost of the camera, linear array laser, etc. used in this solution is lower. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0036] Figure 1 is a flow chart schematically showing a method for depth detection of composite material defects based on image processing according to an embodiment of the present invention;
[0037] Figure 2 is a schematic diagram schematically showing the positional relationship among an industrial camera, a light source, a composite material surface and a pit area according to an embodiment of the present invention;
[0038] Figure 3 is a schematic diagram schematically illustrating scanning positioning lines and projection lines according to an embodiment of the present invention;
[0039] Figure 4 is a schematic diagram schematically illustrating a linear array laser and a laser profile according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0042] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0043] The implementation scenario of the present invention may be in a production process or a quality inspection process of a composite material.
[0044] Figure 1 FIG. 1 is a flow chart schematically showing a method for depth detection of composite material defects based on image processing according to an embodiment of the present invention. Figure 1 As shown, according to the present invention, a flow chart of a method for depth detection of composite material defects based on image processing is provided.
[0045] The specific instructions are as follows: Figure 1 As shown, steps S1 to S5 are included:
[0046] In step S1, a target grayscale image of the surface of the composite material is obtained. The specific description is as follows:
[0047] For the convenience of description, unless otherwise specified, the composite materials herein are metal composite materials.
[0048] Place the industrial camera directly above the composite material surface. The shooting direction of the industrial camera is vertically downward. Then, the image of the composite material surface can be obtained through the industrial camera, and the image is grayed to obtain the target gray image.
[0049] Preferably, in one embodiment: obtaining a target grayscale image of the surface of the composite material comprises:
[0050] Figure 2 Schematic diagram schematically showing the positional relationship among an industrial camera, a light source, a composite material surface and a pit area according to an embodiment of the present invention. Figure 2 As shown, 201 is an industrial camera, 202 is a light source, 203 is the surface of the composite material, and 204 is a pit area. Figure 2 The three-dimensional space coordinate system shown, wherein the xoy plane is the horizontal plane and the z axis is perpendicular to the horizontal plane.
[0051] The composite material is placed horizontally on the table. The shooting direction of the industrial camera is the opposite direction of the z-axis, that is, the vertical downward direction. The light source emits light in a direction that is inclined by a second preset angle compared to the opposite direction of the z-axis, and the light of the light source is irradiated on the surface of the composite material. That is, the direction of the second preset angle rotated around the coordinate origin in the opposite direction of the z-axis is the irradiation direction of the light source. In one embodiment, the direction of the second preset angle rotated around the y-axis in the opposite direction of the z-axis is the irradiation direction of the light source. The implementer can set the second preset angle according to the specific implementation scenario, wherein the second preset angle is greater than 0 degrees and less than 90 degrees, for example, the second preset angle can be an empirical value of 50 degrees.
[0052] In one embodiment, the light source may be a bar light source.
[0053] It should be noted that the depth of field of industrial cameras is relatively small, wherein the depth of field accuracy reaches the millimeter level. The height and position requirements of industrial cameras are as follows: industrial cameras at preset heights and preset positions can only capture the upper surface of the composite material, and the image of the portion below the upper surface will be blurred to a certain extent; wherein, the implementer can set the preset height and preset position according to the specific implementation scenario. For example, the pit area is lower than the upper surface, and the image of the pit area will be blurred to a certain extent. After selecting the second preset angle corresponding to the light source, the second preset angle remains fixed. In one embodiment, after selecting the direction of the emitted light of the light source, the direction of the emitted light remains fixed.
[0054] Normally, the image obtained by the industrial camera includes a background image. If the image includes a background image, the image can be segmented first to obtain an image of the composite material surface, which is called a target image, wherein the target image does not include the background image; the target image is then grayed to obtain a gray image of the composite material surface; the gray image is then median filtered to obtain a target gray image. The image segmentation algorithm can use semantic segmentation in the prior art. If the parameters of the industrial camera are set so that the image taken by the industrial camera does not include the background image, the image can be directly grayed to obtain a gray image; the gray image is then median filtered to obtain a target gray image.
[0055] In step S2, the target grayscale image is processed to obtain the pit area. The specific description is as follows:
[0056] Since there is a certain difference between the grayscale values of the pixels corresponding to the pit area and the grayscale values of the pixels corresponding to the non-pit area, and there is a certain difference between the grayscale values of the edge pixels of the pit area and the surrounding pixels, the target grayscale image can be processed to obtain the position and size of all pit areas in the target grayscale image.
[0057] In one embodiment, the position and size of the pit area may be obtained based on edge detection algorithms.
[0058] Preferably, in one embodiment: the target grayscale image is processed to obtain the pit area, including: the target grayscale image can be subjected to the Otsu threshold segmentation algorithm to obtain a binary image; the binary image is subjected to a connected domain analysis to obtain a connected area; the connected area whose area is greater than or equal to the preset minimum pit threshold and whose area is less than or equal to the preset maximum pit threshold is taken as the pit area, thereby obtaining the position and area of the pit area. The implementer can set the preset minimum pit threshold and the preset maximum pit threshold according to the specific implementation scenario. For example, the preset minimum pit threshold can be an empirical value of 20, and the preset maximum pit threshold can be 400.
[0059] In step S3, any pit area is taken as the target pit area, and the target contour line and the reference line of the target pit area are determined. Specifically, a calibration image of the composite material surface irradiated by the linear array laser is obtained, and the angle between the light emitting direction of the linear array laser and the vertical direction of the composite material surface is a first preset angle, and the value range of the first preset angle is ; Processing the calibration image to obtain a laser contour line and a reference line, and using the laser contour line in the target pit area as the target contour line, wherein the reference line is a line connecting two intersection points of the laser contour line and the target pit area.
[0060] Analysis of the target pit area:
[0061] In one embodiment, a baseline is calibrated on the surface of the composite material; a calibration image of the calibrated composite material surface is collected; the calibration image is processed to obtain a baseline in the calibration image, wherein the baseline is an image of a scan positioning line on a target pit area, and in the calibration image, the baseline passes through the center of the target pit area, and a target contour line corresponding to the baseline is obtained, wherein the target contour line is a projection line of the scan positioning line when the scan positioning line is in a first position, and both ends of the target contour line are on the edge of the target pit area, that is, the target contour line is a projection line of the scan positioning line on the target pit area when the scan positioning line is in the first position. The target contour line is determined based on a light source, and the direction of light emitted by the light source is a direction inclined at a second preset angle compared to the vertical downward direction. The specific description is as follows:
[0062] Figure 3 FIG. 2 is a schematic diagram schematically showing scanning positioning lines and projection lines according to an embodiment of the present invention. Figure 3 As shown, 301 is a scanning positioning line, 302 is a position of the scanning positioning line during movement, and 303 is a projection line.
[0063] Among them, the scanning positioning line can be a cotton thread or the like. The scanning positioning line can be moved by a movable track, and the scanning positioning line can be controlled to move. When it is necessary to obtain the baseline and target contour line of the target pit area, it is necessary to calibrate the baseline of the composite material surface, and the scanning positioning line can be controlled to move along the x-axis direction to the first position, wherein the scanning positioning line is parallel to the y-axis. When the scanning positioning line is in the first position, in the image of the composite material surface, the baseline corresponding to the scanning positioning line passes through the center of the target pit area. When the scanning positioning line is in the first position, the calibration of the baseline is completed, and the calibration image of the calibrated composite material surface can be collected.
[0064] It should be noted that the baseline is the image of the scanning positioning line in the target pit area when the scanning positioning line is in the first position; when the scanning positioning line is parallel to the y-axis, the irradiation direction of the light source cannot be the direction of the second preset angle rotated around the x-axis in the opposite direction of the z-axis, because the target contour line cannot be obtained at this time.
[0065] In one embodiment, the irradiation direction of the light source is a direction rotated around the y-axis by a second preset angle in the opposite direction of the z-axis; and the scanning positioning line is parallel to the y-axis.
[0066] After the irradiation direction of the light source is selected, the irradiation direction of the light source remains unchanged, the moving direction of the scanning positioning line remains unchanged, and the angle between the scanning positioning line and the y-axis remains unchanged.
[0067] Since the light source illuminates the composite material surface at an angle, the target pit area has a certain depth, the scanning positioning line is close to the composite material surface, and the scanning positioning line is in the first position, so the target pit area in the calibration image taken by the industrial camera will have a projection line of the scanning positioning line. In the calibration image, the projection line in the target pit area is called the target contour line, where the two ends of the target contour line are on the edges of the target pit area.
[0068] In the target pit area in the calibration image, since the target contour line has some characteristics, for example, the target contour line has an obvious edge, the target contour line is between the edge of the shadow in the target pit area and the edge of the target pit area, the grayscale difference between the pixels in the target contour line is small, and the grayscale difference between the pixel point in the target contour line and the second pixel point is large, wherein the second pixel point is a pixel point adjacent to the pixel point in the target contour line, and the second pixel point is not a pixel point in the target contour line, and the line connecting the two ends of the target contour line passes through the center of the target pit area, so the target contour line and its position can be determined by image processing techniques such as edge detection.
[0069] In the calibration image, the image of the scanned positioning line is a line segment with obvious features such as edges. Therefore, the image of the scanned positioning line and its position can be determined by image processing techniques such as edge detection, and then the baseline and its position can be determined.
[0070] In one embodiment, the color of the scanned positioning line is determined, which is significantly different from the color of the composite material surface, so that the image and position of the scanned positioning line can be determined based on a color threshold segmentation algorithm, and then the reference line and its position can be determined.
[0071] The implementer may determine the target contour line and its position and the image of the scanned positioning line and its position in the calibration image based on the features of the target contour line and the features of the image of the scanned positioning line according to other means in the prior art.
[0072] Preferably, in one embodiment: the process of acquiring the target contour line and the reference line by the linear array laser includes:
[0073] Figure 4 Schematic diagram schematically showing a linear array laser and a laser profile according to an embodiment of the present invention. Figure 4As shown, 401 is a linear array laser, and the laser emitted by the linear array laser appears as a line on the surface of the composite material. The linear array laser can be moved by a movable track, and the linear array laser can be controlled to move horizontally; the horizontal movement of the linear array laser can be controlled according to the position of the target pit area; 402 is a first contour line, 403 is a target contour line, 404 is a second contour line, and the first contour line, the target contour line, and the second contour line constitute the laser contour line, and 405 is a line connecting the two intersection points of the laser contour line and the edge of the target pit area. Among them, the direction of the laser emitted by the linear array laser is the direction of the first preset angle rotated around the coordinate origin in the opposite direction of the z-axis, wherein the first preset angle is greater than 0 degrees and less than 90 degrees. The implementer can set the first preset angle by himself according to the specific implementation scenario, and the first preset angle can take the empirical value of 45 degrees. After setting the first preset angle, the first preset angle is fixed.
[0074] In one embodiment, in the calibration image, a reference line passes through the center of the target pit area to facilitate calculation of the target distance and the target curvature.
[0075] In one embodiment, after the direction of emitting laser light of the linear array laser is selected, the direction of emitting laser light remains unchanged.
[0076] In one embodiment, the direction of emitting laser light from the linear array laser is a direction rotated around the y-axis by a first preset angle in the opposite direction of the z-axis.
[0077] When there are many pit areas on the surface of the composite material, it may be inconvenient to obtain the baseline and target contour lines of the target pit area by scanning the positioning line. In order to more conveniently obtain the baseline and target contour lines of the target pit area, the baseline and target contour lines can be obtained by linear array lasers and industrial cameras.
[0078] The laser contour in the image can be obtained based on the color threshold segmentation algorithm.
[0079] When it is necessary to obtain the baseline and target contour line of the target pit area, the linear array laser can be controlled to move along the x-axis direction to the second position. When the linear array laser is in the second position, in the image of the composite material surface, the line connecting the two intersection points of the laser contour line and the edge of the target pit area passes through the center of the target pit area. When the linear array laser is in the second position, the calibration of the baseline is completed, and the calibration image of the composite material surface under the irradiation of the linear array laser can be obtained through the industrial camera. In order to make the calibration image clearer, the calibration image of the composite material surface under the irradiation of the linear array laser and the light source 202 can be obtained through the industrial camera.
[0080] The calibration image can be subjected to median filtering to obtain a denoised calibration image. Then, the laser contour line in the calibration image can be obtained based on the color threshold segmentation algorithm. In the calibration image, the laser contour line in the target pit area is used as the target contour line, and the line connecting the two intersection points of the laser contour line and the edge of the target pit area is used as the reference line. Figure 4 As shown, in the calibration image, the image of curve 403 is the target contour line.
[0081] In step S4, based on the target contour line and the reference line, the depth-related index of the target pit area is determined, including the target distance and the target curvature. Specifically, in the calibration image, the distance between each pixel point in the target contour line and the reference line is calculated, and the maximum value of all the distances is taken as the target distance; the target contour line is fitted to obtain a fitting curve, and the curvature of the fitting curve is taken as the target curvature corresponding to the target pit area. The specific description is as follows:
[0082] The pixel corresponding to the maximum value of all distances is the pixel farthest from the baseline in the target contour. The larger the target distance, the greater the probability that the depth of the target pit area is larger.
[0083] The greater the depth of the target pit area, the greater the likelihood that the target distance is greater.
[0084] Usually, the target pit area is irregular, so the target contour is a curve close to an arc. Based on the least squares method, the target contour can be fitted to obtain a fitting curve, which is an arc. Because the target contour is composed of pixel points, the target contour can be fitted by the least squares method. The curvature of the fitting curve is used as the target curvature corresponding to the target pit.
[0085] The greater the depth of the target pit area, the greater the probability that the target curvature is greater.
[0086] At this point, the target distance and target curvature of the target pit area are obtained. All remaining pit areas in the composite material surface are traversed to obtain the target distance and target curvature of each remaining pit area.
[0087] In step S5, the depth-related index is input into the trained pit depth prediction model to obtain the depth value corresponding to the target pit area. The depth value is the predicted value. The specific description is as follows:
[0088] In one embodiment, the target distance and target curvature of the target pit area are input into the trained pit depth prediction model to obtain the depth value corresponding to the target pit area. All remaining pit areas on the surface of the composite material are traversed to obtain the depth value of each remaining pit area.
[0089] The training process of the pit depth prediction model is an existing technology. For ease of understanding, the training process is introduced as follows: sample data of the pit area is collected and the data is labeled. For any sample data, it includes the target distance and target curvature of the pit area, which are the input of the model. The sample data also includes the depth of the pit area, which is the output of the model.
[0090] The sample data is input into the back propagation neural network for model training.
[0091] During training, the difference between the predicted values and the true values is calculated using the mean squared error loss function.
[0092] The gradient descent method is used to adjust the model parameters to minimize the error between the predicted value and the true value, that is, to reduce the error between the predicted value and the true value.
[0093] In one embodiment, the parameters of the pit depth prediction model are adjusted iteratively. If the total number of iterations is greater than a preset number of iterations, the parameters of the model are stopped to obtain a trained pit depth prediction model. The implementer may set the preset number of iterations according to a specific implementation scenario. For example, the preset number of iterations may be an empirical value of 500 times.
[0094] In another embodiment, the parameters of the pit depth prediction model are adjusted iteratively, and if the performance index of the model is greater than a preset threshold, the adjustment of the parameters of the model is stopped, thereby obtaining a trained pit depth prediction model. The implementer can set the preset threshold according to the specific implementation scenario.
[0095] All remaining pit areas in the composite material surface are traversed to obtain a depth value of each remaining pit area.
[0096] It should be noted that the same reference numerals in different drawings of the present invention represent the same thing.
[0097] In one embodiment, the depth-related index further includes a target area, wherein the area of the target pit region is used as the target area. The total number of pixels in the target pit region can be counted, and the total number is used as the target area.
[0098] The larger the area of the target dimple region, the greater the probability that the depth of the target dimple region is greater.
[0099] In one embodiment, the depth-related index also includes a shadow degree, wherein the shadow degree of the target pit area can be determined according to the grayscale value of the pixel points in the target pit area and the grayscale value of the pixel points in the non-pit area in the target grayscale image. The specific description is as follows:
[0100] Since the target pit area has a certain depth, after the target pit area is illuminated by the light source, especially after being illuminated by the light source inclined at the second preset angle, a part of the target pit area will have a relatively obvious shadow. In the target grayscale image: the grayscale value of the pixel points in the shadow area is small; while the non-pit area has no shadow, and when the non-pit area is illuminated by uniform light, the difference between the grayscale values of the pixel points in the non-pit area is small, and the grayscale value of the pixel points in the non-pit area is large.
[0101] The greater the depth of the target pit region, the greater the probability that the shadow of the target pit region is more obvious, that is, the greater the probability that the shadow of the target pit region is darker.
[0102] Therefore, the shadow degree of the target pit area can be determined according to the grayscale value of the pixel points in the target pit area and the grayscale value of the pixel points in the non-pit area in the target grayscale image. The greater the shadow degree of the target pit area, the greater the probability that the depth of the target pit area is greater.
[0103] Preferably, in one embodiment, the process of obtaining the shadow degree includes: in the target grayscale image, taking the mean of the grayscale values of all pixels in the target pit area as the defect mean; taking the mean of the grayscale values of all pixels in the non-pit area in the target grayscale image as the normal mean; taking the absolute value of the difference between the defect mean and the normal mean as the shadow degree of the target pit area. The larger the absolute value of the difference between the defect mean and the normal mean, the greater the probability that the shadow of the target pit area is darker, and further the greater the probability that the depth of the target pit area is greater.
[0104] Preferably, in one embodiment: the process of obtaining the normal mean value corresponding to the target pit area includes:
[0105] The minimum circumscribed rectangle of the target pit area can be obtained by conventional methods in the prior art, and the product of the area of the minimum circumscribed rectangle and the preset multiple is used as the area of the first circumscribed rectangle, wherein the preset multiple is greater than 1, the center of the first circumscribed rectangle and the center of the minimum circumscribed rectangle are at the same position, and the length-to-width ratio of the first circumscribed rectangle is the same as the length-to-width ratio of the minimum circumscribed rectangle. The implementer can set the preset multiple by himself according to the specific implementation scenario, wherein the preset multiple can take the empirical value of 2.25.
[0106] The average of the grayscale values of all first pixels is taken as the normal average of the target pit area, wherein the first pixel is a pixel in the first circumscribed rectangle, but the first pixel is not a pixel in the target pit area.
[0107] In one embodiment, the depth-related index also includes clarity, wherein the variance of the grayscale values of all pixels in the target pit area is used as the clarity of the target pit area. The specific description is as follows:
[0108] The depth of field of the selected industrial camera is small, and the depth of field accuracy reaches the millimeter level. Before taking the image, the parameters of the industrial camera need to be debugged so that the non-pit area taken by the industrial camera is clearer in the image. Therefore, the non-pit area is clearer in the target grayscale image, and the target pit area is blurred in the target grayscale image.
[0109] A characteristic of a target grayscale image captured by an industrial camera is that the deeper the depth of the target pit area, the more blurred the target pit area is in the image.
[0110] In the target grayscale image, the more blurred the target pit area is, the greater the probability that the contrast of the grayscale values of the pixels in the target pit area is lower, which further indicates that the greater the probability that the variance of the grayscale values of all pixels in the target pit area is smaller.
[0111] Therefore, the variance of the grayscale values of all pixels in the target pit area can be used as the clarity of the target pit area. The greater the clarity of the target pit area in the image, the greater the probability that the depth of the target pit area is smaller. It should be noted that the greater the clarity of the target pit area in the image, the less blurred the target pit area in the image.
[0112] At this point, the target area, shadow and clarity of the target pit area are obtained. All remaining pit areas in the composite material surface are traversed to obtain the target area, shadow and clarity of each remaining pit area.
[0113] Preferably, in one embodiment, the target area, shadow degree and clarity, target distance and target curvature of the target pit area are input into the trained pit depth prediction model to obtain the depth value corresponding to the target pit area. All remaining pit areas in the surface of the composite material are traversed to obtain the depth value of each remaining pit area.
[0114] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0115] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A method for depth detection of composite material defects based on image processing, characterized in that: include: Acquire a target grayscale image of the surface of the composite material, process the target grayscale image, and obtain a pit area; Taking any pit area as a target pit area, obtaining depth-related indicators of the target pit area, wherein the depth-related indicators include a target distance and a target curvature; Inputting the depth-related index into the trained pit depth prediction model to obtain the depth value corresponding to the target pit area; The process of obtaining the target distance and target curvature includes: Obtain a calibration image of the composite material surface irradiated by the linear array laser, wherein the angle between the light emitting direction of the linear array laser and the vertical direction of the composite material surface is a first preset angle, and the value range of the first preset angle is ; Processing the calibration image to obtain a laser contour line and a reference line, and using the laser contour line in the target pit area as the target contour line, wherein the reference line is a line connecting two intersection points of the laser contour line and the target pit area; Calculate the distance between the pixel points in the target contour and the reference line, and take the maximum value of all the distances as the target distance; fit the target contour to obtain a fitting curve, and obtain the target curvature; Wherein, the pit depth prediction model is a back propagation neural network; Calibrate the reference line of the composite material surface; collect the calibration image of the composite material surface after calibration; process the calibration image to obtain the reference line in the calibration image, wherein the reference line is an image of the scanning positioning line on the target pit area, and the reference line passes through the center of the target pit area in the calibration image, and obtains the target contour line corresponding to the reference line; Wherein, the target contour line is a projection line of the scanning positioning line when the scanning positioning line is in the first position, and both ends of the target contour line are on the edges of the target pit area; The laser contour in the image is obtained based on the color threshold segmentation algorithm.
2. The method for depth detection of composite material defects based on image processing according to claim 1, characterized in that: In the calibration image, the reference line passes through the center of the target pit area.
3. The method for depth detection of composite material defects based on image processing according to claim 1, characterized in that: The depth-related indicators also include target area, shadow degree and clarity; Wherein: the area of the target pit region is taken as the target area; The variance of the grayscale values of the pixels in the target pit area is calculated, and the variance is used as the clarity of the target pit area.
4. The method for depth detection of composite material defects based on image processing according to claim 3, characterized in that: The process of obtaining the shadow degree includes: The mean of the grayscale values of the pixels in the target pit area is taken as the defect mean; The mean of the gray values of the pixels in the non-pit area of the target gray image is taken as the normal mean; The absolute value of the difference between the defect mean and the normal mean is used as the shadow degree of the target pit area.
5. The method for depth detection of composite material defects based on image processing according to claim 4, characterized in that: The mean of the grayscale values of the pixels in the non-pit area of the target grayscale image is taken as the normal mean, including: Determine the minimum bounding rectangle of the target pit area, and enlarge the length and width of the minimum bounding rectangle by a preset multiple with the center of the minimum bounding rectangle to obtain a first bounding rectangle, wherein the preset multiple is greater than 1, and the average of the grayscale values of the pixel points in the first bounding rectangle excluding the target pit area is taken as the normal average.
6. The method for depth detection of composite material defects based on image processing according to claim 1, characterized in that: Obtain target grayscale images of composite material surfaces, including: Acquire an image of the composite material surface, the composite material surface is illuminated by a light source at a second preset angle, the second preset angle is the angle between the light source and the vertical direction of the composite material surface, and the value range of the second preset angle is ; Gray-scale the image of the surface of the composite material to obtain the target gray-scale image.
7. The method for depth detection of composite material defects based on image processing according to claim 1, characterized in that: The process of obtaining the pit area includes: Performing binary segmentation on the target grayscale image to obtain a binary image, and then obtaining a connected domain of the binary image; The connected domain whose area is not less than the preset minimum pit threshold and whose area is not greater than the preset maximum pit threshold is taken as the pit area.
Citation Information
Patent Citations
Methods and systems for precise measurement using depth cameras
CN106959075B
Defect detection method and device based on semantic segmentation model, medium and equipment
CN111462120A
Wear surface damage depth estimation method and system based on multi-attention mechanism
CN114972882A
Method for predicting damage state of carbon fiber composite laminated plate under low-speed impact
CN116882232A
Defect detection and identification method and device based on image detection
CN118014933A
