Coal mine ventilation well wall crack extraction method based on image processing
Through image processing technology, including weighted average grayscale, histogram equalization, segmented linear transformation and median filtering denoising, combined with Canny edge detection, the image noise interference problem in the detection of cracks in coal mine ventilation shaft walls is solved, significantly improving the The accuracy and robustness of the detection are achieved.
Patent Information
- Application Number
- CN202411251211.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-07
- Publication Date
- 2024-12-20
AI Technical Summary
In the detection of cracks in coal mine ventilation shaft walls, the prior art is difficult to effectively deal with the uneven grayscale distribution of images caused by complex backgrounds and noise interference, which affects the accuracy and completeness of crack images.
Using image processing-based methods, including weighted average grayscale, histogram equalization, image grayscale segmented linear transformation and median filtering denoising processing on the original image, combined with Canny edge detection operator, improve the visible cracks. and accuracy of detection.
The detection accuracy and robustness of cracks in coal mine ventilation shaft walls is significantly improved, ensuring the integrity and clarity of crack extraction.
Smart Images

Figure CN119168979A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for extracting cracks from a ventilation shaft wall of a coal mine based on image processing, which is suitable for safety detection and monitoring of ventilation shaft walls of coal mines. Background Art
[0002] In the process of collecting crack images, due to the limitations of the inspection system structure and the shooting angle of the camera, it is difficult to obtain the integrity of large-size defect images. In the actual collection process, crack images are faced with complex backgrounds and multiple interference factors, which will reduce the accuracy of image processing. Crack images may generate systematic random noise during the collection, transmission and storage process due to differences in the stability of camera photosensitive elements and inconsistent sensor responses. At the same time, external noise brought by the collection environment, such as dim imaging conditions in the shaft, shadows and stains, will also cause uneven grayscale distribution of the image. In order to improve the quality of the original image and provide a more reliable image basis for subsequent processing, the present invention will analyze and optimize various processing algorithms in the image preprocessing stage. These algorithms are designed to optimize image quality and reduce noise interference, thereby improving the accuracy and efficiency of crack detection. Summary of the invention
[0003] In view of the defects existing in the prior art, the purpose of the present invention is to achieve the above purpose. The technical solution adopted by the present invention is to provide a method for extracting cracks from the ventilation shaft wall of a coal mine based on image processing. The method grays the original image with a weighted average value, and converts the color image into a gray image by selecting an appropriate weight coefficient to highlight the characteristics of the cracks. The image after the weighted average value gray is processed by histogram equalization, and the contrast of the image is enhanced by adjusting the gray distribution of the image, thereby improving the visibility of the cracks. The crack image after the image histogram equalization is processed by the image grayscale piecewise linear transformation method, and the grayscale contrast of the crack area is improved by the piecewise linear transformation of the grayscale value, further highlighting the crack details. The grayscale image data is subjected to median filtering denoising, and the median filtering algorithm is used to remove image noise, retain the edge information of the crack, and enhance the clarity of the image. The crack edge is detected by the Canny edge detection operator, and the Canny algorithm is used to accurately detect the crack edge in the image to ensure the accuracy and integrity of the crack extraction.
[0004] In order to solve the above technical problems, the present invention is implemented by the following technical solutions:
[0005] A method for extracting cracks from a coal mine ventilation shaft wall based on image processing, further comprising the following steps:
[0006] Step 1: Obtain the original image data of cracks on the coal mine ventilation shaft wall.
[0007] Step 2: Grayscale the original image using the weighted average.
[0008] Step 3: Perform histogram equalization on the image after weighted average grayscale.
[0009] Step 4: Process the crack image after image histogram equalization using the image grayscale piecewise linear transformation method.
[0010] Step 5: Perform median filtering and denoising on the grayscale image data.
[0011] Step 6: Detect the crack edge using the Canny edge detection operator.
[0012] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, graying the weighted average value of the original image in step 2 includes the following sub-steps:
[0013] Step 2.1: Select appropriate weight coefficients according to the importance of each channel in the image.
[0014] Step 2.2: Use the selected weight coefficient to calculate the weighted average of each pixel in the original image.
[0015] Step 2.3: Replace the pixel value at the corresponding position of the original image with the grayscale value of each pixel to generate a grayscale image.
[0016] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, selecting an appropriate weight coefficient in step 2.1 includes the following sub-steps:
[0017] Step 2.1.1: For RGB images, select the red channel weight coefficient as 0.3, the green channel weight coefficient as 0.59, and the blue channel weight coefficient as 0.11.
[0018] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, in step 2.2, the weighted average value calculation of each pixel in the original image includes the following sub-steps:
[0019] Step 2.2.1: The specific formula is: ,in , , Respectively represent the original image at position The pixel values of the red, green, and blue channels.
[0020] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, in step 3, the histogram equalization processing of the image after the weighted average grayscale is performed includes the following sub-steps:
[0021] Step 3.1: Count the number of pixels at each gray level in the grayscale image to form a grayscale histogram.
[0022] Step 3.2: Calculate the cumulative distribution function (CDF) based on the grayscale histogram.
[0023] Step 3.3: Normalize the cumulative distribution function so that its range is between [0, 255] to obtain a new grayscale mapping table.
[0024] Step 3.4: Use the new grayscale mapping table to replace the grayscale values in the original image to generate an equalized image.
[0025] Step 3.5: Replace the pixel value at the corresponding position of the original image with the new grayscale value to generate a histogram equalized image.
[0026] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, in step 4, the image grayscale piecewise linear transformation method is used to process the crack image after the image histogram equalization, including the following sub-steps:
[0027] Step 4.1: According to the grayscale histogram of the image, determine the grayscale range of the crack image and select appropriate segmentation points according to the crack characteristics.
[0028] Step 4.2: Define a linear transformation function for each grayscale segment that maps the original grayscale value to a new grayscale value.
[0029] Step 4.3: For the grayscale value of each pixel in the image, apply the corresponding linear transformation function to calculate the new grayscale value according to the interval in which it is located.
[0030] Step 4.4: Replace the grayscale value at the corresponding position of the original image with the grayscale value after the piecewise linear transformation to generate an image processed by the piecewise linear transformation.
[0031] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, in step 4.3, a corresponding linear transformation function is applied to calculate a new gray value; and the following sub-steps are included:
[0032] Step 4.2.1: The general formula for a piecewise linear function is:
[0033]
[0034] in, is the output grayscale, is the input grayscale. , , are the slopes of the three broken lines. ( , )and( , ) are the coordinates of the two inflection points of the polyline.
[0035] Step 4.2.2: Image grayscale Range (0, ),( , ),( ,255) correspond to the slopes of different broken line segments as needed (0, ),( , ),( ,255) to stretch or shrink.
[0036] Step 4.2.3: Calculate , , , The values are 20, 220, 100, and 245 respectively.
[0037] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, in step 5, the median filtering and denoising process of the grayscale image data includes the following sub-steps:
[0038] Step 5.1: Determine a filter window of size 7×7 and traverse every pixel in the image.
[0039] Step 5.2: Move the window to each pixel of the image, sort all pixel values within the window, and find the median.
[0040] Step 5.3: Sort the pixel values in the neighborhood pixel set and take the median value as the new grayscale value of the current pixel.
[0041] Step 5.4: Replace the original grayscale value of the current pixel with the median value to generate an image processed by median filtering.
[0042] The above-mentioned method for extracting cracks from the coal mine ventilation shaft wall based on image processing, further, in step 6, detecting the crack edge by using the Canny edge detection operator includes the following sub-steps:
[0043] Step 6.1: Perform Gaussian filtering on the grayscale image.
[0044] Step 6.2: Use the Canny operator to calculate the gradient of the image in the horizontal and vertical directions.
[0045] Step 6.3: Perform non-maximum suppression on the gradient magnitude image, retain the pixels with local maximum values in the gradient direction, and suppress other non-edge points.
[0046] Step 6.4: Set the high threshold and the low threshold to perform double threshold processing on the gradient magnitude image.
[0047] Step 6.5: Connect the strong edge points through the weak edge points to ensure the continuity of the edge and generate the final edge detection result.
[0048] On the basis of the above technical solution, compared with the prior art, the technical solution of the present invention has achieved the following beneficial technical effects:
[0049] The present invention utilizes an improved image processing method to efficiently and accurately extract and identify cracks in the ventilation shaft wall of a coal mine. The original image data of the cracks in the ventilation shaft wall of a coal mine is obtained; the original image is grayed by weighted average value to obtain gray image data containing pixel gray values; the image is subjected to histogram equalization processing; the crack image after image histogram equalization is subjected to image grayscale transformation processing, and a piecewise linear function is set. , , , The value of is obtained to obtain the well wall crack image after the grayscale piecewise linear transformation method; the grayscale image data is subjected to image denoising; the crack edge detection algorithm is used to detect the crack edge. The method of the present invention improves the image processing flow, and through the combined application of multi-step image processing technology, the accuracy and robustness of crack detection are significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 A flowchart of a method for extracting cracks from a coal mine ventilation shaft wall based on image processing according to the present invention;
[0052] Figure 2 This is a grayscale comparison diagram of an image in an embodiment of the present invention;
[0053] Figure 3 This is a grayscale histogram equalization effect diagram in an embodiment of the present invention;
[0054] Figure 4 The piecewise linear grayscale transformation function and result diagram in the embodiment of the present invention;
[0055] Figure 5 This is a diagram showing the result of median filtering processing in an embodiment of the present invention;
[0056] Figure 6 This is a Canny recognition effect diagram in an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
[0058] like Figure 1 As shown, a method for extracting cracks from the coal mine ventilation shaft wall based on image processing includes the following steps:
[0059] Step 1: Obtain the original image data of cracks on the coal mine ventilation shaft wall.
[0060] Step 2: Grayscale the original image using the weighted average.
[0061] Step 2.1: The image captured by the camera is composed of three primary colors: red (R), green (G), and blue (B). Each pixel has 16777216 (256×256×256) colors. The three colors are mixed in different proportions at the pixel level to show the color changes between colors. In order to improve the computational efficiency, the color information is usually converted into a 256-level grayscale image during image processing. This process is called image graying, which is to convert the three components in the RGB image into a grayscale image by taking the average value. Image graying methods include maximum method, average method, and weighted average method. According to the importance of each channel in the image, select the appropriate weight coefficient.
[0062] Step 2.1.1: The human eye has different perceptions of color. It is most sensitive to green, followed by red, and least sensitive to blue. Therefore, it is more reasonable to add the three primary colors according to a certain weight to obtain a grayscale value. By using the mutual conversion relationship between YUV space and RGB space, the conversion of RGB images to grayscale images can be achieved. In the YUV color space, Y represents the brightness of the image, and the relevant information of the grayscale image is contained in the Y component. The conversion relationship can be expressed by formula (2):
[0063]
[0064] For RGB images, select a red channel weight factor of 0.3, a green channel weight factor of 0.59, and a blue channel weight factor of 0.11.
[0065] Step 2.2: Use the selected weight coefficient to calculate the weighted average value of each pixel in the original image.
[0066] Step 2.2.1: The specific formula is: ,in , , Respectively represent the original image at position The pixel values of the red, green, and blue channels.
[0067] Step 2.3: Replace the pixel value at the corresponding position of the original image with the gray value of each pixel point to generate a grayscale image. The present invention is based on MATLAB software and uses the above method to grayscale the image. The effect is as follows: Figure 2 shown.
[0068] Step 3.1: Count the number of pixels at each gray level in the grayscale image to form a grayscale histogram.
[0069] Step 3.2: Calculate the cumulative distribution function (CDF) based on the grayscale histogram.
[0070] Step 3.3: Normalize the cumulative distribution function so that its range is between [0, 255] to obtain a new grayscale mapping table.
[0071] Step 3.4: Use the new grayscale mapping table to replace the grayscale values in the original image to generate an equalized image.
[0072] Step 3.5: Replace the pixel value at the corresponding position of the original image with the new gray value to generate the image after histogram equalization, such as Figure 3 shown.
[0073] Step 4.1: According to the grayscale histogram of the image, determine the grayscale range of the crack image and select appropriate segmentation points according to the crack characteristics.
[0074] Step 4.2: Define a linear transformation function for each grayscale segment that maps the original grayscale value to a new grayscale value.
[0075] Step 4.2.1: The general formula of piecewise linear function is as shown in formula (3):
[0076]
[0077] in, is the output grayscale, is the input grayscale. , , are the slopes of the three broken lines. ( , )and( , ) are the coordinates of the two inflection points of the polyline.
[0078] Step 4.2.2: Image grayscale Range (0, ),( , ),( ,255) correspond to the slopes of different broken line segments as needed (0, ),( , ),( ,255) to stretch or shrink.
[0079] Step 4.2.3: Calculate , , , The values are 20, 220, 100, and 245 respectively.
[0080] Step 4.3: For the grayscale value of each pixel in the image, apply the corresponding linear transformation function to calculate the new grayscale value according to the interval in which it is located.
[0081] Step 4.4: Replace the grayscale value of the corresponding position of the original image with the grayscale value after the piecewise linear transformation to generate an image processed by the piecewise linear transformation, such as Figure 4 shown.
[0082] Step 5.1: Determine a filter window of size 7×7 and traverse every pixel in the image.
[0083] Step 5.2: Move the window to each pixel of the image, sort all pixel values in the window, and find the median. The calculation formula is shown in formula (4):
[0084]
[0085] In the formula, is the window of the median filter, A two-dimensional array sequence.
[0086] Step 5.3: Sort the pixel values in the neighborhood pixel set and take the median value as the new grayscale value of the current pixel.
[0087] Step 5.4: Replace the original grayscale value of the current pixel with the median value to generate an image processed by median filtering, such as Figure 5 shown.
[0088] Step 6.1: Original image Using a two-dimensional Gaussian filter template Perform convolution operation to obtain the processed smooth image ,in
[0089]
[0090]
[0091] Formula (6) is expressed as the Gaussian filter template With the original image The convolution operation.
[0092] Step 6.2: Use the derivative operator to calculate the horizontal derivative of the smoothed image The derivative with respect to the vertical direction , and solve for the gradient amplitude With the gradient direction .
[0093] Where: Gradient amplitude = , gradient direction .
[0094] Step 6.3: Perform non-maximum suppression on the gradient magnitude image, retain the pixels with local maximum values in the gradient direction, and suppress other non-edge points.
[0095] Step 6.4: Set the high threshold and the low threshold to perform double threshold processing on the gradient magnitude image.
[0096] Step 6.5: Using the lagging dual threshold detection method, the high and low thresholds are calculated based on the cumulative histogram, and then the two thresholds are used to detect and connect the image edges. Pixels greater than the high threshold are considered to be edges, and pixels less than the low threshold are considered not to be edges. When the grayscale value of a pixel is between the two thresholds, whether the pixel belongs to an edge is determined based on whether there are edge pixels above the high threshold in the neighboring pixels around the pixel. If so, the pixel is judged to be an edge, otherwise it is not an edge. The above operations are implemented on the MATLAB platform. The edge recognition effect of the preprocessed crack image and the Canny edge detection algorithm is shown in the figure. Figure 6 shown.
[0097] The above is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of rights of the present invention. Therefore, for ordinary technicians in this technical field, several improvements and changes can be made without departing from the principle of the present invention, and these improvements and changes are also regarded as the protection scope of the present invention.
Claims
1. A method for extracting cracks from coal mine ventilation shaft walls based on image processing, characterized in that: The steps include: Step 1: Obtain original image data of cracks on the coal mine ventilation shaft wall; Step 2: Grayscale the original image using the weighted average value; Step 3: Perform histogram equalization on the image after weighted average grayscale; Step 4: Process the crack image after image histogram equalization using the image grayscale piecewise linear transformation method; Step 5: Perform median filtering and denoising on the grayscale image data; Step 6: Detect the crack edge using the Canny edge detection operator.
2. A method for extracting cracks from a coal mine ventilation shaft wall based on image processing as claimed in claim 1, characterized in that: The grayscale conversion of the weighted average of the original image in step 2 includes the following sub-steps: Step 2.1: Select appropriate weight coefficients according to the importance of each channel in the image; Step 2.2: Using the selected weight coefficient, calculate the weighted average value of each pixel in the original image; Step 2.3: Replace the pixel value at the corresponding position of the original image with the grayscale value of each pixel to generate a grayscale image.
3. A method for extracting cracks from a coal mine ventilation shaft wall based on image processing as claimed in claim 2, characterized in that: Selecting an appropriate weight coefficient in step 2.1 includes the following sub-steps: Step 2.1.1: For RGB images, select the red channel weight coefficient as 0.3, the green channel weight coefficient as 0.59, and the blue channel weight coefficient as 0.
11.
4. A method for extracting cracks from a coal mine ventilation shaft wall based on image processing as claimed in claim 2, characterized in that: The weighted average calculation of each pixel in the original image in step 2.2 includes the following sub-steps: Step 2.2.1: The specific formula is: ,in , , Respectively represent the original image at position The pixel values of the red, green, and blue channels.
5. The method for extracting cracks from the coal mine ventilation shaft wall based on image processing according to claim 1, characterized in that: In step 3, the histogram equalization processing of the image after weighted average grayscale includes the following sub-steps: Step 3.1: Count the number of pixels at each gray level in the grayscale image to form a grayscale histogram; Step 3.2: Calculate the cumulative distribution function (CDF) based on the grayscale histogram; Step 3.3: Normalize the cumulative distribution function so that its range is between [0, 255] to obtain a new grayscale mapping table; Step 3.4: Use the new grayscale mapping table to replace the grayscale values in the original image to generate a balanced image; Step 3.5: Replace the pixel value at the corresponding position of the original image with the new grayscale value to generate a histogram equalized image.
6. The method for extracting cracks from the coal mine ventilation shaft wall based on image processing according to claim 1, characterized in that: In step 4, the image grayscale piecewise linear transformation method is used to process the crack image after the image histogram equalization, which includes the following sub-steps: Step 4.1: Determine the grayscale range of the crack image based on the grayscale histogram of the image, and select appropriate segmentation points based on the crack characteristics; Step 4.2: Define a linear transformation function for each grayscale segment, which maps the original grayscale value to the new grayscale value; Step 4.3: For the grayscale value of each pixel in the image, apply the corresponding linear transformation function to calculate the new grayscale value according to the interval in which it is located; Step 4.4: Replace the grayscale value at the corresponding position of the original image with the grayscale value after the piecewise linear transformation to generate an image processed by the piecewise linear transformation.
7. A method for extracting cracks from a coal mine ventilation shaft wall based on image processing as claimed in claim 6, characterized in that: In step 4.2, the corresponding linear transformation function is applied to calculate the new grayscale value; the following sub-steps are included: Step 4.2.1: The general formula for a piecewise linear function is:
8. Among them, is the output grayscale, is the input grayscale. , , are the slopes of the three broken lines. ( , )and( , ) are the coordinates of the two inflection points of the polyline; Step 4.2.2: Image grayscale Range (0, ),( , ),( ,255) correspond to the slopes of different broken line segments as needed (0, ),( , ),( ,255) to stretch or shrink; Step 4.2.3: Calculate , , , The values are 20, 220, 100, and 245 respectively.
9. The method for extracting cracks from the coal mine ventilation shaft wall based on image processing according to claim 1, characterized in that: The median filtering and denoising process of the grayscale image data in step 5 includes the following sub-steps: Step 5.1: Determine a filter window of size 7×7 and traverse every pixel in the image; Step 5.2: Move the window to each pixel of the image, sort all pixel values in the window, and find the median; Step 5.3: Sort the pixel values in the neighborhood pixel set and take the middle value as the new grayscale value of the current pixel; Step 5.4: Replace the original grayscale value of the current pixel with the median value to generate an image processed by median filtering.
10. The method for extracting cracks from the coal mine ventilation shaft wall based on image processing according to claim 1, characterized in that: In step 6, the crack edge detection is performed using the Canny edge detection operator, which includes the following sub-steps: Step 6.1: Perform Gaussian filtering on the grayscale image; Step 6.2: Use the Canny operator to calculate the gradient of the image in the horizontal and vertical directions; Step 6.3: Perform non-maximum suppression on the gradient magnitude image, retain the pixels with local maximum values in the gradient direction, and suppress other non-edge points; Step 6.4: Set the high threshold and the low threshold to perform double threshold processing on the gradient amplitude image; Step 6.5: Connect the strong edge points through the weak edge points to ensure the continuity of the edge and generate the final edge detection result.
Citation Information
Cited By
Image enhancement method for sealing element detection
CN120580183A
Image processing-based pinniform induction seam identification method
CN120876522A
Crack sub-pixel precision edge detection method and system based on improved Canny operator
CN121504967A
