An accurate surface crack detection technology based on digital image processing
The digital image processing method addresses the challenge of accurately detecting surface cracks by employing CCD sensors and morphological operations, enabling precise crack measurement and real-time monitoring across multiple domains.
Patent Information
- Application Number
- CN202211280474.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-19
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-10-19
AI Technical Summary
The existing technology is difficult to efficiently and accurately monitor surface cracks such as roads, buildings and insulators in real time, affecting safety and load-bearing capacity.
The method based on digital image processing is adopted, including crack image acquisition, image preprocessing, threshold segmentation, image morphology processing, curve fitting and actual value conversion. The crack image is collected using CCD image sensor, and the length and width of the crack are accurately measured through histogram equalization, image filtering, threshold segmentation, morphological operations and curve fitting.
It realizes accurate detection of surface cracks, has non-destructive testing, good reproducibility, high processing accuracy, fast speed and low cost, and is suitable for transportation, electricity, construction and cultural relics protection fields.
Smart Images

Figure CN115601379B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital image processing, and particularly relates to a precise surface crack detection technology based on digital image processing. Background Art
[0002] In traffic construction, the flatness and integrity rate of highway pavements are very important indicators for driving safety. Pavement damage and cracks will have a serious impact on the load-bearing capacity of the highway and traffic safety. In the construction industry, the outer surface of buildings often develops surface cracks due to exposure to sunlight and rain erosion. The extension of cracks will affect the stress condition of the building itself, and the safety of the building will be greatly reduced. In industry, insulators are exposed to the atmosphere and work in harsh environments such as strong electric fields, strong mechanical stresses, and sudden temperature changes for a long time, which easily leads to insulator fracture. In short, real-time monitoring of cracks has become an urgent need in various fields, and digital image processing technology has stood out from numerous solutions and become an effective crack detection technology. This invention proposes a precise surface crack detection technology based on digital image processing. Summary of the Invention
[0003] In view of the above deficiencies in the prior art, the present invention provides a precise surface crack detection method based on digital image processing, which is reasonably designed, has accurate effects, and is suitable for promotion.
[0004] A precise surface crack detection method based on digital image processing includes crack image acquisition, image preprocessing, threshold segmentation, image morphological processing, curve fitting, and actual value conversion; the steps are as follows:
[0005] S1. Crack image acquisition: Use a CCD image sensor to capture marble cracks.
[0006] S2. Image preprocessing: First perform histogram equalization on the crack image, and then use image smoothing technology to process the image.
[0007] S21: Histogram equalization:
[0008] The histogram of an image represents the number of pixels with each gray level in the image. It is a two-dimensional graph, where the abscissa is the gray level of the pixel points, and the ordinate is the frequency of each gray level, reflecting the statistical relationship between the two; its histogram is defined as a discrete function, that is:
[0009] h(r k ) = n k (1)
[0010] where r k is the k-th level brightness in the image gray level interval [0, G], and nk is a pixel in an image with a gray level of r k ; usually, the normalized histogram, that is, all elements h(r k ) are divided by the total number of pixels n in the image:
[0011]
[0012] Use the histogram equalization method to process the discrete gray levels of the image. Let p r (r j ), j = 1, 2,..., L represent the probabilities of the image taking each gray level; for discrete gray levels, the summation method is adopted, and the equalization transformation is:
[0013]
[0014] In the formula, k = 1, 2,..., L, and s k is the gray value in the image after equalization processing, which corresponds to the gray value r k in the input image;
[0015] S22: Select the region of interest:
[0016] Use the Matlab rectangular cropping function imcrop to crop the crack image to obtain the crack region;
[0017] S23: Image filtering:
[0018] Select the Gauss template of the mean filter to filter the crack image;
[0019] S3. Threshold segmentation:
[0020] Adopt the one-dimensional maximum entropy threshold segmentation method, and the definition of information entropy is as follows:
[0021]
[0022] Where X i is a point in the discrete set {X1, X2,..., X n}, and P(X i ) represents the probability of each X i appearing; X i represents the image gray level, and p i represents the probability corresponding to the gray level; then the condition is satisfied:
[0023] p i ≥0, i = 1, 2,..., n (5)
[0024]
[0025] Select m as the threshold, then the original region is divided into two parts: the target region A and the background region B; the probability distributions of the target region A and the background region B are:
[0026]
[0027] where p m is:
[0028]
[0029] So the final entropy function consists of two parts: the target region entropy function and the background region entropy function, that is:
[0030]
[0031] When H(m) reaches the maximum value, the corresponding gray level M is the required optimal threshold, that is:
[0032]
[0033] S4. Image morphological processing:
[0034] Image morphological transformation includes image dilation, erosion, opening operation and closing operation; image A is dilated by the structuring element B, denoted as is defined as:
[0035]
[0036] Image A is eroded by the structuring element, denoted as AΘB, and is defined as:
[0037]
[0038] The morphological opening operation of A by B can be denoted as The morphological closing operation of A by B is denoted as A·B;
[0039] For the surface crack image after threshold segmentation, first take its negative, and then use the image morphological processing method. First, perform the morphological opening operation on it, select a suitable structuring element to filter out the interference blocks with gray values similar to the cracks around the cracks, and then use the morphological closing operation to process it;
[0040] S5. Length measurement:
[0041] S51. Image thinning:
[0042] The marble surface crack image processed by morphological opening and closing operations is a binary image; based on this, the number of crack length pixels is counted. First, the crack image is thinned; the layer-by-layer peeling thinning method is adopted to divide all pixel points in the image into skeleton points and edge points, and the 8-neighborhood pixel conditions of these two types of points are counted; then the entire image is traversed, and the edge points of the marble surface crack are removed one by one, and finally the crack becomes a skeleton with only one pixel point width.
[0043] S52. Curve fitting:
[0044] After the image thinning process, the crack has a width of a single pixel, and the points on the crack have a certain directionality and are a vector; therefore, the crack can be described by a linear equation, and the curve fitting method is used to calculate the crack length pixels.
[0045] Use the curve fitting tool in MATLAB to perform curve fitting on the thinned crack, divide the crack into several sub-cracks, and then perform curve fitting operations on each segment of the crack respectively, so that the simulated regularized curve can be as close as possible to the original crack segment. Then, according to the fitting curve equation, the length pixels of each segment of the crack are obtained, and finally the summation calculation is performed; through the curve fitting method, the curve equation that best matches the sub-crack is obtained, and the length of each sub-crack is calculated by curve integration, and finally the summation operation is performed to obtain the length pixels of the entire crack.
[0046] S6. Width measurement:
[0047] S61. Image rotation:
[0048] Establish a two-dimensional coordinate system XOY on the crack image after morphological processing, and find the starting coordinate (x0, y0) and ending coordinate (x1, y1) of the crack in the image; use the starting point of the crack as the origin of the coordinate system, connect the origin of the crack and the ending coordinate to get the straight line l, and calculate the angle between l and the coordinate axis X:
[0049]
[0050] When the slope of the straight line l is positive, rotate the crack image clockwise by θ angle, otherwise rotate it counterclockwise by θ angle.
[0051] S62. Count width pixels:
[0052] Next, perform a column-by-column scan on the rotated crack image, and count the number of pixels w with a gray value of 1 in each column i , i = 1, 2,... n, where n is the number of columns in the crack image. Finally, the average value of the width pixels of n columns is obtained to get the crack width pixels to be measured; the specific calculation process is as follows:
[0053]
[0054] S6, True value conversion:
[0055] During the shooting process, a standard reference object is added, and the ratio of the true value to a single pixel is obtained to get the actual length and width values of the cracks on the marble surface.
[0056] Preferably, the marble surface crack image collected in step S1 is an RGB image, which is converted into a corresponding grayscale image.
[0057] Preferably, the standard reference object in step S6 is a coin.
[0058] The beneficial effects of the present invention are:
[0059] The present invention proposes a general surface crack detection scheme for the cracks on the marble block surface. Through this scheme, the characteristics such as the position, length, and width of the cracks can be detected more accurately. Using this scheme to monitor the surface cracks in real time can play a role in many fields such as transportation, electric power, construction, and cultural relics protection. Compared with other crack detection technologies, this scheme uses digital image processing technology, which can not only perform non-destructive detection on the surface cracks, but also has the characteristics of good reproducibility, high processing accuracy, fast detection speed, and low cost, showing a great promotion advantage. Brief Description of the Drawings
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0061] Figure 1 It is the flow chart of the solution for the precise detection technology of the surface cracks of the present invention;
[0062] Figure 2 are the cracks on the marble surface;
[0063] Figure 3 is the grayscale image of the marble crack;
[0064] Figure 4 is the grayscale image of the crack after histogram equalization;
[0065] Figure 5 is the grayscale histogram of the original crack image;
[0066] Figure 6 is the grayscale histogram of the crack image after histogram equalization;
[0067] Figure 7 is the extracted crack region of interest;
[0068] Figure 8 is the crack image after mean filtering;
[0069] Figure 9 is the surface crack image after threshold segmentation;
[0070] Figure 10 is the negative of the surface crack image after threshold segmentation;
[0071] Figure 11 is the crack image after morphological opening operation;
[0072] Figure 12 is the crack image further processed by morphological closing operation;
[0073] Figure 13 is the thinned crack image;
[0074] Figure 14 is the three - segment crack curve fitting;
[0075] Figure 15 is the rotated binary crack image. Detailed implementation manners
[0076] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Usually, the components of the embodiments of the present invention described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.
[0077] An accurate surface crack detection method based on digital image processing aims to extract features such as the length and width of surface cracks. Since the length and width of cracks have different focuses, in order to accurately count their values, different strategic solutions need to be adopted according to the characteristics of crack length and width; including crack image acquisition, image preprocessing, threshold segmentation, image morphology processing, curve fitting, and actual value conversion. Among them, the crack image acquisition module is the camera's acquisition of marble surface cracks, and the available image sensors include CMOS image sensors and CCD image sensors. The image preprocessing step completes tasks such as image enhancement and noise reduction. The threshold segmentation module is the key to the entire detection algorithm, and the processing scheme of this step will have an important impact on the accuracy of the crack detection algorithm. The role of the image morphology module is mainly to eliminate some isolated noise interference points or interference blocks that may appear around the cracks and connect the broken crack segments. Curve fitting provides an accurate and effective solution for measuring the length of surface cracks. The actual value conversion module converts the measured length and width pixels into real measurement values. The specific steps are as follows:
[0078] S1. Crack image acquisition:
[0079] Since the CCD image sensor has higher sensitivity and lower noise compared to the CMOS image sensor, the CCD image sensor is used to photograph the marble cracks during this detection process. The acquired crack images are as shown in the appendix Figure 2 as follows;
[0080] Since the acquired marble surface crack images are RGB images, they are converted into corresponding grayscale images for subsequent processing. The converted grayscale images are as shown in the appendix Figure 3 as follows;
[0081] S2. Image preprocessing:
[0082] Image preprocessing is some operations such as image enhancement and restoration carried out according to the defects of the acquired images themselves and specific research purposes. Since the light source of the camera, the light intensity and the scattering direction are not easy to adjust, and the equipment may vibrate during the shooting process, the captured images will be distorted to a certain extent. In this scheme, the preprocessing means is to first perform histogram equalization on the crack images, and then use image smoothing technology to process the images.
[0083] S21: Histogram equalization:
[0084] The histogram of an image represents the number of pixels with each gray level in the image. It is a two-dimensional graph. The abscissa is the gray level of the pixel points, and the ordinate is the frequency of each gray level, reflecting the statistical relationship between the two; its histogram definition as a discrete function is:
[0085] h(rk ) = n k (1)
[0086] Among them, r k is the k-th level brightness within the image gray level range [0, G], and n k is the pixel in the image with gray level r k ; Usually, the histogram is normalized, that is, all elements h(r k ) are divided by the total number of pixels n in the image:
[0087]
[0088] The histogram equalization method is used to process the discrete gray levels of the image. Let p r (r j ), j = 1, 2,..., L represent the probabilities of the image taking each gray level; for discrete gray levels, the summation method is adopted, and the equalization transformation is:
[0089]
[0090] In the formula, k = 1, 2,..., L, and s k is the gray value in the image after equalization processing, which corresponds to the gray value r k in the input image;
[0091] The gray image of the marble surface crack after histogram equalization is as shown in the appendix Figure 4 .
[0092] Figure 5 , Figure 6 are the gray histograms of the crack images before and after equalization processing respectively. Obviously, the crack image processed by the histogram equalization method will have the maximum amount of image gray information and is more suitable for human eye recognition and discrimination.
[0093] S22: Select the region of interest:
[0094] Since our ultimate goal is to extract the characteristics of the marble surface cracks, some irrelevant interference factors can be excluded first, that is, the region of interest for the detection algorithm is extracted from the crack image. Here, the Matlab rectangular cropping function imcrop is used to crop the crack image to obtain the crack region (350×600) shown in the appendix Figure 7 .
[0095] S23: Image filtering:
[0096] Image filtering in image preprocessing is mainly divided into three filtering methods: mean filtering, median filtering, and Wiener filtering.
[0097] The basic principle of mean filtering is to use a filtering template to calculate the average gray value of a selected area in the processed image, and then replace the gray values of all pixel points in the selected area with this gray value.
[0098] Median filtering is a non-linear filtering and also a typical low-pass filter. Its basic principle is to sort the pixels in the neighborhood of the center point of the filtering template according to the gray level and select the median value to replace the gray value of this pixel point.
[0099] Wiener filtering is a filtering method that can be automatically adjusted. It performs less smoothing on the areas where the image has large variations and more smoothing on the areas where the image has small variations.
[0100] Considering the simplicity of the algorithm and the real-time requirement of crack detection, the surface crack detection algorithm proposed in the present invention selects the Gauss template of the mean filter to filter the crack image, and the effect after processing is as shown in the appendix Figure 8 As shown, obviously the crack area becomes clearer.
[0101] S3. Threshold segmentation:
[0102] After preprocessing the crack image, we hope to further distinguish the cracks from the marble background, that is, to segment the surface cracks from the image.
[0103] The so-called image segmentation is to decompose the image into several regions with different characteristics and extract meaningful target regions or features from them. Each sub-region after segmentation is a connected set of pixels, and these pixels have the same properties in a certain sense. Generally, there are two ways to achieve image segmentation, namely clustering (region method) and boundary method, etc. The boundary method is selected in the present invention, and threshold segmentation is one of the more commonly used boundary methods. Obviously, how to select the most appropriate threshold is the core of the threshold segmentation algorithm.
[0104] The threshold segmentation method based on the gray histogram needs to directly observe on the gray histogram of the image. If the histogram shows an obvious bimodal shape, then select the gray value at the bottom of the valley as the segmentation threshold. The maximum inter-class variance threshold segmentation method is also called the Otsu method. Its idea is to select an appropriate threshold to make the variance between the target and the background reach the maximum value after segmentation. The iterative threshold segmentation method is to first select a certain threshold as the initial value and continuously iterate through a certain strategy until the given criterion is met. The maximum entropy threshold segmentation method aims to maximize the entropy of the image gray value to keep the information content of the target and the background after image segmentation as much as possible. The definition of information entropy is as follows:
[0105]
[0106] where X iFor a certain point in the discrete set {X1, X2,..., X n}, P(X i ) represents the probability of each X i occurring; corresponding to this detection algorithm, X i represents the image grayscale, and p i represents the probability corresponding to the grayscale; then it satisfies the condition:
[0107] p i ≥0, i = 1, 2,..., n (5)
[0108]
[0109] Select m as the threshold, then the original region is divided into two parts: the target region A and the background region B; then the probability distributions of the target region A and the background region B are:
[0110]
[0111] Among them, p m is:
[0112]
[0113] So the final entropy function consists of two parts: the target region entropy function and the background region entropy function, that is:
[0114]
[0115] When H(m) reaches the maximum value, the corresponding grayscale M is the required optimal threshold, that is:
[0116]
[0117] Returning to the marble surface crack image, since the grayscale histogram does not show a bimodal shape, we first exclude the threshold segmentation method based on the grayscale histogram. By comparing the latter three threshold segmentation methods, we adopt the one-dimensional maximum entropy threshold segmentation method. The effect of the marble surface crack image after threshold segmentation is shown in the appendix Figure 9 as follows:
[0118] S4. Image morphological processing:
[0119] After the threshold segmentation process, it is very rare for the crack image to form the ideal state of a completely closed and connected crack edge required for crack detection, and there may be some isolated noise interference points or interference blocks around the crack. This requires using morphological methods to process the image.
[0120] Image morphology is a mathematical method that uses algebraic geometry to quantitatively describe geometric shapes and structures. Image morphological transformations mainly include dilation, erosion, opening operation, and closing operation of images, etc.
[0121] Dilation is an operation to "lengthen" or "thicken" in a binary image. This special way and the degree of thickening are controlled by a set called the structuring element. For example, image A is dilated by structuring element B, denoted as Defined as:
[0122]
[0123] The erosion operation can "shrink" or "thin" the objects in a binary image. Just like in dilation, the way and degree of shrinking are also controlled by a structuring element. Image A is eroded by structuring element B, denoted as A Θ B, and defined as:
[0124]
[0125] In the actual application of images, we more often use dilation and erosion in various combinations, that is, opening operation and closing operation. The morphological opening operation of A by B can be denoted as This operation is the result of eroding A by B and then dilating the eroded result by B. The morphological closing operation of A by B is denoted as A · B, which is exactly the result of dilating first and then eroding;
[0126] The morphological opening operation completely deletes the object regions that cannot contain the structuring element, smooths the contours of the objects, disconnects the narrow connections, and removes the small protrusions. For the morphological closing operation, it smooths the contours of the objects like the opening operation. However, different from the opening operation, the closing operation generally connects the narrow gaps to form slender bends and fills the holes smaller than the structuring element.
[0127] For the surface crack image after threshold segmentation, first take its negative film, as shown in the appendix Figure 10 shown, and then use the image morphological processing method. First, perform a morphological opening operation on it, select an appropriate structuring element to filter out the interference blocks around the crack with gray values similar to the crack. The processing effect is as shown in Figure 11 shown. Observe the crack image after the opening operation and find that the crack is not continuous and the crack is not completely filled. At this time, we then use the morphological closing operation to process it. The final image morphological processing effect diagram is as shown in Figure 12 shown;
[0128] S5. Length measurement:
[0129] S51. Image thinning:
[0130] The marble surface crack image processed by morphological opening and closing operations is a binary image. On this basis, the statistics of the crack length in pixels are carried out. First, the crack image is thinned. The layer-by-layer peeling thinning method is adopted to divide all pixel points in the image into skeleton points and edge points, and the 8-neighborhood pixel conditions of these two types of points are counted. Then, the whole image is traversed, and the edge points of the marble surface crack are removed one by one. Finally, the crack becomes a skeleton with only one pixel width.
[0131] Image thinning is an important operation in image analysis and pattern recognition. After thinning, the image features are more obvious and the connectivity of the small parts of the image is maintained, providing a compact and effective representation form for subsequent image processing and analysis, and reducing the time and space required for subsequent processing.
[0132] Back to crack detection, the marble surface crack image processed by morphological opening and closing operations is a binary image. If the statistics of the crack length in pixels are to be carried out on this basis, we need to first thin the crack image. The layer-by-layer peeling thinning method is adopted to divide all pixel points in the image into skeleton points and edge points, and the 8-neighborhood pixel conditions of these two types of points are counted in advance. Then, the whole image is traversed, and the edge points of the marble surface crack are removed one by one. Finally, the crack becomes a skeleton with only one pixel width, and the specific effect is as Figure 13 shown.
[0133] S52. Curve fitting:
[0134] After image thinning, the crack has a single pixel width, and the points on the crack have a certain directionality, which is a vector. Therefore, the crack can be described by a linear equation, and the means of curve fitting can be used to calculate the crack length in pixels.
[0135] Curve fitting is a method of approximately simulating the shape of the target in the image with a continuous curve and establishing an information approximate representation of its functional relationship. There are many methods for solving the fitting curve. For a linear model, the parameters are determined by establishing and solving a system of equations to obtain the fitting curve. For a non-linear model, it is necessary to solve a non-linear system of equations or use a parameter optimization method to obtain the equation parameters of the fitting curve, and the most commonly used fitting method for non-linear targets is the least squares fitting method.
[0136] Use the curve fitting tool in MATLAB to perform curve fitting on the thinned crack. In order to improve the accuracy of curve fitting, the crack is divided into several sub-cracks (this crack measurement is divided into three segments), and then the curve fitting operation is performed on each segment of the crack respectively, so that the simulated regularized curve can be as close as possible to the original crack segment. Then, the crack length in pixels of each segment is obtained according to the fitting curve equation, and finally the summation calculation is carried out; the final curve fitting effect is asFigure 14 As shown in Figure 14 , Table 1 lists the equations of the three-segment fitting curves.
[0137] Table 1. Fitting Curve Equations
[0138]
[0139] By means of curve fitting, the curve equation that best matches the sub-cracks is obtained, and the lengths of each sub-crack are calculated by curve integration. Finally, a summation operation is performed to obtain the pixel length of the full crack.
[0140] S6. Width Measurement:
[0141] Measuring the crack width is different from measuring the length, which requires cumbersome processing operations such as image thinning and curve fitting. It only performs the statistical work of crack pixels on the threshold-segmented image after morphological processing. However, since the cracks in the image do not extend horizontally, to accurately measure the crack width, we need to rotate the crack image first.
[0142] S61. Image Rotation:
[0143] Establish a two-dimensional coordinate system XOY on the crack image after morphological processing, and find the starting coordinate (x0, y0) and ending coordinate (x1, y1) of the crack in the image; use the starting point of the crack as the origin of the coordinate system, connect the origin and the ending coordinate of the crack to get the straight line l, and calculate the angle between l and the coordinate axis X:
[0144]
[0145] When the slope of the straight line l is positive, rotate the crack image clockwise by θ degrees, otherwise rotate it counterclockwise by θ degrees.
[0146] S62. Statistical Width Pixels:
[0147] Next, perform a column-by-column scan on the rotated crack image, and count the number of pixels w with a gray value of 1 in each column i , i = 1, 2,... n, where n is the number of columns in the crack image. Finally, the average value of the width pixels of the n columns is obtained to get the crack width pixels to be measured; the specific calculation process is as follows:
[0148]
[0149] S6. True Value Conversion:
[0150] Since the images captured by the CCD image sensor have a fixed resolution, and digital image processing technology can well preserve the reproduction of the original image. Therefore, based on this, a standard reference object (such as a coin) can be added during the shooting process, and the ratio of the true value (mm) to a single pixel can be obtained. In this measurement, the calibrated result of the proportionality coefficient is 0.24, and the actual length and width values of the cracks on the marble surface are shown in Table 2.
[0151] Table 2. Parameter values
[0152]
[0153] Summary:
[0154] Digital image processing technology has incomparable advantages over other crack detection technologies. It can not only perform non-destructive detection on surface cracks, but also has the following characteristics:
[0155] (1) Good reproducibility. Digital image processing will not cause image degradation due to transformation operations such as storage, transmission, or copying of image data.
[0156] (2) High processing accuracy and large amount of processed information.
[0157] (3) Fast detection speed and easy to achieve real-time automatic detection. Due to the rapid development of processors, the time consumed by digital image processing algorithms is getting shorter and shorter, so it is very easy to achieve real-time detection.
[0158] (4) Low cost. With the popularization of home computers and cameras in daily life, it only takes a small cost to build a high-performance digital image processing system.
[0159] The present invention proposes a general surface crack detection scheme for the surface cracks of marble blocks. Through this scheme, the characteristics of the crack such as position, length, and width can be detected more accurately. Using this scheme to monitor the surface cracks in real time can play a role in many fields such as transportation, electric power, construction, and cultural relics protection. Compared with other crack detection technologies, this scheme adopts digital image processing technology, which can not only perform non-destructive detection on surface cracks, but also has the characteristics of good reproducibility, high processing accuracy, fast detection speed, and low cost, showing great promotion advantages.
[0160] The above description is only an embodiment of the present invention and does not constitute any limitation to the present invention. Obviously, for professionals in this field, after understanding the content and principle of the present invention, various corrections and changes in form and details may be made without departing from the principle of the present invention, but these corrections and changes based on the idea of the present invention are still within the protection scope of the claims of the present invention.
Claims
1. An accurate surface crack detection method based on digital image processing, characterized in that: It includes crack image acquisition, image preprocessing, threshold segmentation, image morphological processing, curve fitting, and actual value conversion. The steps are as follows: S1. Crack image acquisition: Use a CCD image sensor to capture marble cracks. S2. Image preprocessing: First perform histogram equalization on the crack image, and then use image smoothing technology to process the image. S21: Histogram equalization: The histogram of an image represents the number of pixels at each gray level in the image. It is a two-dimensional graph, where the abscissa is the gray level of the pixel points and the ordinate is the frequency of each gray level, reflecting the statistical relationship between the two. Its histogram is defined as a discrete function: h(r k ) = n k (1) where r k is the k-th brightness level within the image gray level range [0, G], and n k is the pixel in the image with gray level r k ; the normalized histogram, which divides all elements h(r k ) by the total number of pixels n in the image: Use the histogram equalization method to process the discrete gray levels of the image, and let p r (r j ), where j = 1, 2,..., L represents the probability that the image takes each gray level; for discrete gray levels, the summation method is adopted, and the equalization transformation is as follows: where k = 1, 2,..., L, and s k is the gray value in the equalized image, which corresponds to the gray value r k ; S22: Select the region of interest: Use the Matlab rectangular cropping function imcrop to crop the crack image to obtain the crack region. S23: Image filtering: Select the Gauss template of the mean filter to filter the crack image. S3. Threshold segmentation: Adopt the one-dimensional maximum entropy threshold segmentation method, where the definition of information entropy is as follows: Where X i is a point in the discrete set {X1, X2,..., X n}, and P(X i ) represents the probability of each X i occurring; X i represents the image gray level, and p i represents the probability corresponding to the gray level; then the condition is satisfied: p i ≥ 0, i = 1, 2, ..., n (5) Select m as the threshold, then the original region is divided into two parts: the target region A and the background region B. The probability distributions of the target region A and the background region B are: where p m is So the final entropy function consists of two parts: the target region entropy function and the background region entropy function, that is: When H(m) reaches the maximum value, the corresponding gray level M is the required optimal threshold, that is: S4. Image morphological processing: Morphological image transformation includes dilation, erosion, opening operation, and closing operation of images; image A is dilated by structuring element B, denoted as defined as: Image A is eroded by the structuring element B, denoted as AΘB, and is defined as: The morphological opening operation of A by B can be denoted as The morphological closing operation of A by B is denoted as A·B; For the surface crack image after threshold segmentation, first take its negative, and then use the image morphological processing method. First perform morphological opening operation on it, select a suitable structuring element to filter out the interference blocks with gray values similar to the cracks around the cracks, and then use morphological closing operation to process it. S5. Length measurement: S51. Image thinning: The marble surface crack image processed by morphological opening and closing operations is a binary image. On this basis, the statistics of the crack length pixels are carried out. First, perform a thinning operation on the crack image. Adopt the layer-by-layer peeling thinning method to divide all pixel points in the image into skeleton points and edge points, and count the situations of all 8-neighborhood pixels of these two types of points. Then traverse the whole image, gradually remove the edge points of the marble surface cracks, and finally turn the cracks into a skeleton with a width of only one pixel. S52. Curve fitting: After the image thinning process, the crack has a width of a single pixel, and the points on the crack have a certain directionality and are a vector. Therefore, the crack can be described by a linear equation, and the means of curve fitting is used to calculate the crack length pixels. Use the curve fitting tool in MATLAB to fit the refined crack, divide the crack into several sub-cracks, and then perform curve fitting operations on each segment of the crack respectively, so that the simulated regularized curve can be as close as possible to the original crack segment. Then, obtain the length pixels of each segment of the crack according to the fitted curve equation, and finally perform a summation calculation; through the curve fitting method, find the curve equation that best matches the sub-crack, calculate the length contained in each sub-crack by curve integral, and finally perform a summation operation to obtain the length pixels of the entire crack. S6. Width measurement: S61. Image rotation: Establish a two-dimensional coordinate system XOY on the crack image after morphological processing, and find the starting coordinate (x0, y0) and ending coordinate (x1, y1) of the crack in the image; take the starting point of the crack as the origin of the coordinate system, connect the origin and the ending coordinate of the crack to get a straight line l, and calculate the angle between l and the coordinate axis X: When the slope of the straight line l is positive, rotate the crack image clockwise by θ angle, otherwise rotate it counterclockwise by θ angle. S62. Statistical width pixels: Next, perform a column-by-column scan on the rotated crack image, and count the number of pixels w with a gray value of 1 in each column i , where i = 1, 2,... n, and n is the number of columns in the crack image. Finally, obtain the crack width pixels to be measured by calculating the average value of the width pixels in n columns. The specific calculation process is as follows: S6. True value conversion: Add a standard reference object during the shooting process, and find the ratio of the true value to a single pixel to obtain the actual length and width values of the crack on the marble surface.
2. The precise surface crack detection method based on digital image processing according to claim 1, characterized in that: The marble surface crack image collected in step S1 is an RGB image, which is converted into the corresponding grayscale image.
3. The precise surface crack detection method based on digital image processing according to claim 1, wherein: The standard reference object in step S6 is a coin.
Citation Information
Patent Citations
Soil crack feature information extraction method
CN110264459A
Bridge crack detection method
CN110378879A