A pipe interface edge detection method based on mathematical morphology and regional connectivity
Through the combination of mathematical morphology and regional connectivity, image edge information is extracted, solving the shortcomings of traditional methods in noise suppression and edge clarity, and achieving edge detection of single pixel width, which is suitable for accurate recognition of visual measurements.
Patent Information
- Application Number
- CN202410297177.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-15
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-03-15
AI Technical Summary
Traditional image edge detection methods have shortcomings in suppressing noise and false edges, making it difficult to achieve edge detection results without texture interference, clear edges, and single pixel width.
The tube interface edge detection method based on mathematical morphology and regional connectivity is adopted, and edge information is extracted in combination with regional connectivity to achieve edge detection of single pixel width.
It effectively removes noise and texture interference, highlights the edge characteristics of the image, and realizes clear edges and no texture interference detection results, which are suitable for accurate identification and positioning during visual measurement.
Smart Images

Figure CN118196125B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of edge detection methods, and in particular to a pipe interface edge detection method based on mathematical morphology and regional connectivity. Background Art
[0002] The edge is the discontinuous part of the local grayscale change of the image. It contains the most important information of an image and is also the most sensitive part of the human eye. Image edge detection technology is widely used in various fields such as video processing, computer vision, biomedicine, pattern recognition, etc. For example, in industrial inspection, it is necessary to accurately identify the edge of the part and then measure it to determine the qualification of the produced and processed products.
[0003] Traditional image edge detection methods, such as Roberts operator, Sobel operator, Prewitt operator, Laplace operator, etc., mainly extract image edges through first-order or second-order differential operations. However, since both noise and edges in the image belong to high-frequency components, such differential operators will inevitably increase the noise in the image. The optimal operator method that emerged later mainly uses appropriate smoothing filtering before differential operations to reduce the influence of noise in high-frequency components, such as LoG (Laplacen of Gaussian) operator, Canny operator, sine operator, etc. Although some results have been achieved, they are still unsatisfactory in suppressing noise and false edges. In recent years, various new theoretical tools have been widely used in image edge detection technology, such as wavelet transform, mathematical morphology, fuzzy mathematics, fractal theory, etc. Mathematical morphology analyzes and processes images from a set perspective. Through the flexible combination of various morphological operators and structural elements, the original image information can be well preserved while effectively filtering out noise. At the same time, morphological operations are easy to process in parallel and are easy to implement in practical applications. Based on the above content, the present invention proposes a pipe interface edge detection method based on mathematical morphology and regional connectivity. Summary of the invention
[0004] The purpose of the present invention is to provide a pipe interface edge detection method based on mathematical morphology and regional connectivity to solve the technical problems raised in the background technology, to accept a grayscale image as input, and to output an edge detection result with no texture interference, clear edges, and a single pixel width, so as to solve the problem of accurate identification and positioning in the visual measurement process.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] A pipe interface edge detection method based on mathematical morphology and regional connectivity comprises the following steps:
[0007] S1. Place the pipe joint on the experimental table and use a CMOS camera to collect images of the pipe joint on the experimental table to prepare an image data set;
[0008] S2, moving the calibration plate, collecting images of the pipe joint at different observation angles and distances, detecting the projection points corresponding to the image features in the image, estimating the parameters of the CMOS camera, and performing image correction according to the obtained camera estimation parameters;
[0009] S3, based on the corrected image obtained in S2, extracting the ROI region of interest to reduce the amount of calculation;
[0010] S4, converting the color image into a grayscale image, performing median filtering on the image, and obtaining a filtered image; and then using a mathematical morphology method to expand the image with a disk-shaped structural element having a radius of 3, and obtaining an expanded image;
[0011] S5. Subtract the image obtained by dilation in S4 from the image filtered by a 3×3 window, and combine the obtained image features with the area size of regional connectivity to extract the edge information of interest.
[0012] Preferably, the median filtering in S4 specifically refers to: applying a 3×3 median filter to the grayscale image, sorting the pixel values in the window by size, and taking the median as output.
[0013] Preferably, the step of dilating and corroding the image using a mathematical morphology method in S4 specifically includes the following contents:
[0014] A1. Apply a 3×3 median filter to the grayscale image and then perform a disk-shaped structure element dilation operation with a radius of 3.
[0015] A2, using the image obtained by dilating the disk-shaped structure element with a radius of 3 and subtracting the image after filtering with a 3×3 window to obtain an edge with a multi-pixel width;
[0016] A3. Refine the edge with multi-pixel width by using the regional skeleton extraction algorithm to obtain the edge with single-pixel width;
[0017] A4. Sort the area information of multiple closed edges in the image to obtain a label matrix L, and determine the connected area composed of edge pixels to which the measured size belongs in the image;
[0018] A5. Check whether each connected region of the label matrix L is a connected region composed of edge pixels of the measured size in the image, and obtain a logical matrix M. The pixel position of the corresponding connected region is true (or 1), and the other positions are false (or 0);
[0019] A6. A logic matrix M is formed by combining the edge image of a single pixel width and the edge pixels of the measured size in the image to form a connected region position information. Through the logic operation in the matrix, the pixels of the connected region formed by the edge pixels of the measured size are set to 1, and the other pixels are set to false (or 0).
[0020] Compared with the prior art, the present invention provides a pipe interface edge detection method based on mathematical morphology and regional connectivity, which has the following beneficial effects:
[0021] The present invention is based on mathematical morphology and regional connectivity, and utilizes corrosion and expansion operations in mathematical morphology and mathematical operations to remove noise and texture interference and highlight image edge features. Adding a regional connectivity method enables the present invention to ignore other information and quickly select important information from complex scenes for further processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of a process of a pipe interface edge detection method based on mathematical morphology and regional connectivity proposed by the present invention;
[0023] Figure 2 This is a schematic diagram of the experimental bench setup mentioned in Example 1 of the present invention;
[0024] Figure 3 This is a schematic diagram of an image after expansion and corrosion mentioned in Example 1 of the present invention;
[0025] Figure 4 This is a schematic diagram of the effect after edge feature extraction mentioned in Example 1 of the present invention. DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0027] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0028] Embodiment 1:
[0029] See also Figure 1 The present invention proposes a pipe interface edge detection method based on mathematical morphology and regional connectivity, comprising:
[0030] Step 1:
[0031] See also Figure 2 , the pipe joint is placed on the experimental table, and the image of the pipe joint on the experimental table is collected by using a CMOS camera to prepare an image data set;
[0032] Step 2:
[0033] Move the calibration plate, collect images of the pipe joint at different observation angles and distances, detect the projection points corresponding to the image features in the image, estimate the parameters of the CMOS camera, and perform image correction based on the obtained camera estimation parameters;
[0034] Step 3:
[0035] Based on the corrected image obtained in S2, the ROI region of interest is extracted to reduce the amount of calculation;
[0036] Step 4:
[0037] The color image is converted into a grayscale image, and a median filter is performed on it to obtain a filtered image; then the image is expanded and eroded using the mathematical morphology method to obtain the expanded image and the eroded image (such as Figure 3 shown);
[0038] S5, respectively subtract the filtered image from the expanded image and the eroded image obtained in S4, and extract the edge information of interest (such as Figure 4 shown).
[0039] Embodiment 2:
[0040] See also Figure 1 The present invention proposes a pipe interface edge detection method based on mathematical morphology and regional connectivity, comprising:
[0041] Step 1:
[0042] See also Figure 2 , place the pipe joint on the experimental table or the moving belt conveyor, and use the CMOS camera to collect the image of the pipe joint on the experimental table to collect the image of the current environment;
[0043] Step 2:
[0044] Move the calibration plate, collect images of the pipe joint at different observation angles and distances, detect the projection points corresponding to the image features in the image, estimate the parameters of the CMOS camera, and perform image correction based on the obtained camera estimation parameters;
[0045] Step 3:
[0046] Based on the corrected image obtained in S2, the ROI region of interest is extracted, and the area around the part of about 1-5 cm is retained as the ROI region of interest to reduce the amount of calculation;
[0047] Step 4:
[0048] The color image is converted into a grayscale image, and a median filter is performed on it with a 3×3 window to obtain a filtered image; then the image is expanded with a disk-shaped structure element with a radius of 3 using the mathematical morphology method to obtain the expanded image (such as Figure 3 shown);
[0049] S5, subtract the filtered image from the expanded image obtained in S4, and extract the edge information of interest (such as Figure 4 shown).
[0050] The above are only preferred specific implementation modes of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and inventive concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A pipe interface edge detection method based on mathematical morphology and regional connectivity, characterized in that: The following steps are involved: S1. Place the pipe joint on the experimental table and use a CMOS camera to collect images of the pipe joint on the experimental table to prepare an image data set; S2, moving the calibration plate, collecting images of the pipe joint at different observation angles and distances, detecting the projection points corresponding to the image features in the image, estimating the parameters of the CMOS camera, and performing image correction according to the obtained camera estimation parameters; S3, based on the corrected image obtained in S2, extracting the ROI region of interest to reduce the amount of calculation; S4, converting the color image into a grayscale image, performing median filtering on the image, and obtaining a filtered image; and then using a mathematical morphology method to dilate and erode the image, respectively, to obtain a dilated image and an eroded image; The use of mathematical morphology to dilate and erode an image comprises the following specific contents: A1. Apply a 3×3 median filter to the grayscale image and then perform a disk-shaped structure element dilation operation with a radius of 3. A2, using the image obtained by dilating the disk-shaped structure element with a radius of 3 and subtracting the image after filtering with a 3×3 window to obtain an edge with a multi-pixel width; A3. Refine the edge with multi-pixel width by using the regional skeleton extraction algorithm to obtain the edge with single-pixel width; A4. Sort the area information of multiple closed edges in the image to obtain a label matrix L, and determine the connected area composed of edge pixels to which the measured size belongs in the image; A5. Check whether each connected region of the label matrix L is a connected region composed of edge pixels of the measured size in the image, and obtain a logical matrix M; the pixel position of the corresponding connected region is true, and the other positions are false; A6, a logic matrix M of the position information of the connected region composed of the edge image of a single pixel width and the edge pixels of the measured size in the image, and the pixel points of the connected region composed of the edge pixels of the measured size are set to 1 through the logic operation in the matrix, and the other pixel points are set to false; S5. Subtract the filtered image from the expanded image and the eroded image obtained in S4, respectively, and extract the edge information of interest by combining the obtained image features with the area size of regional connectivity.
2. The method for detecting pipe interface edges based on mathematical morphology and regional connectivity according to claim 1, characterized in that: The median filtering in S4 specifically refers to: applying a 3×3 median filter to the grayscale image, sorting the pixel values in the window by size, and taking the median as output.
Citation Information
Patent Citations
Mathematical morphology-based image edge detection method
CN101930597A
Welded pipe corrosion state detection method based on image processing
CN117152137A