Glass fiber reinforced plastic cutout profile image fitting method based on edge gradient calculation
By using a method combining edge gradient calculation and image geometry as the joint objective function, the problems of texture confusion and artifact interference in the contour extraction of the cut end face image of FRP pipe are solved, and high-precision inner and outer circle fitting and missing region quantization are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 连云港森伟玻璃钢制品有限公司
- Filing Date
- 2026-07-07
- Publication Date
- 2026-08-04
AI Technical Summary
Existing image contour extraction and fitting methods are prone to confusing real physical edges with texture pixels when processing the cut end face of fiberglass pipes. They are also affected by specular reflection from fiber ends and resin gloss artifacts, resulting in misalignment of the calculated inner and outer center points and loss of accuracy in geometric measurement.
By using an edge gradient calculation method, the original grayscale image of the pipe cut end face is obtained, polar coordinate transformation and one-dimensional low-pass filtering are performed, discrete edge pixel set is extracted, inner and outer circle equations and double circle center deviation penalty term image geometry joint objective function are constructed, iterative solution is performed, inner and outer circle fitting model is output, and the double contour topological mapping spacing and morphological missing region of the cut end face are quantified.
It achieves stable output of edge feature sets with high purity and accurate positioning in complex image environments, improves the fitting stability and quantization accuracy of the missing area when the contour is missing, and avoids measurement benchmark drift.
Smart Images

Figure CN122510291A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, specifically to a method for fitting fiberglass cut contour images based on edge gradient calculation. Background Technology
[0002] In the fiberglass pipe manufacturing industry, computer vision-based image processing technology is widely used in product quality inspection. In particular, for the morphological analysis of the cut end face area of fiberglass pipes, accurately extracting the inner and outer contour image features of the cut end face is a prerequisite for quantitatively calculating the uniformity of physical wall thickness and the area of morphologically missing regions.
[0003] Existing image contour extraction and fitting methods typically employ traditional omnidirectional pixel gradient search and independent mathematical model fitting. However, these methods face technical bottlenecks in real-world image analysis scenarios: First, cut surfaces often exhibit periodic textures such as fiber weaving, making it easy for traditional smoothing algorithms to confuse real physical edges with textured pixels when processing image matrices. Second, the cut surfaces of fiberglass pipes expose truncated fiber ends, which, under ring light illumination, produce point-like specular reflections due to abrupt changes in cross-sectional refractive index. Simultaneously, the residual cured resin on the cut surface has a specular sheen, generating positively polar bright spots and false edges, severely interfering with the extraction of effective edge pixels. When geometric breakpoints caused by cutting exist in the original image, traditional independent fitting algorithms, lacking spatial topological constraints between contours, are easily skewed by outliers, leading to severe misalignment of the calculated inner and outer center points and loss of accuracy in geometric measurements.
[0004] Therefore, when faced with complex original grayscale images containing periodic texture interference from fiber weaving, fiber end highlights and resin gloss artifacts, as well as irregular breakpoints and gaps, how to achieve highly robust discrete edge pixel purification extraction and quantization output is a core problem that urgently needs to be solved.
[0005] To address this, a method for fitting fiberglass cut contour images based on edge gradient calculation is proposed. Summary of the Invention
[0006] The purpose of this invention is to provide a method for fitting fiberglass cut contour images based on edge gradient calculation, which quantifies the double contour topological mapping spacing and the area of morphologically missing regions through an inner and outer circle fitting model.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A method for fitting fiberglass cut contour images based on edge gradient calculation includes: Obtain the original grayscale image of the pipe cut end face from above, extract the center pixel coordinates of the image based on grayscale features, and crop the annular image region containing the periodic texture of fiber weaving. The polar coordinates of the annular image region are transformed into a rectangular image matrix, and a one-dimensional low-pass filter is applied along the polar angle direction. In the filtered matrix, based on the median trajectory of the grayscale pixel band, a bipolar pixel gradient search is performed along the polar radius direction to simultaneously extract the discrete edge pixel sets on the inner and outer sides. The discrete edge pixel sets are then inversely transformed back to the original image two-dimensional coordinate system. Outlier noise removal is performed on the discrete edge pixel set after coordinate restoration to obtain the effective point set; Construct an image-geometric joint objective function that includes the equations of the inner and outer circles and a penalty term for deviation of the two circle centers. Iterate the objective function using the effective point set and output the fitting model of the inner and outer circles. Pixel space mapping is performed based on the inner and outer circle fitting model to quantize the double contour topological mapping spacing of the cut end face; the ideal contour data generated based on the inner and outer circle fitting model is used to perform Boolean difference operation with the binarized image matrix of the original grayscale image, and the area of the morphological missing region is calculated by combining the pixel equivalent.
[0008] Preferably, the process of obtaining the annular image region includes: Background noise in the original grayscale image is eliminated by using a large-scale smoothing filter operator. An adaptive threshold segmentation algorithm is used to extract the largest bright connected component that represents the overall contour of the cut end face. The geometric moments of the largest bright connected component are calculated, and the geometric centroid is extracted as the coordinates of the center pixel of the image. Using the image center pixel coordinates as the reference pole, and combining the pre-set maximum outer diameter pixel threshold and minimum inner diameter pixel threshold of the pipe, a concentric ring boundary that can completely cover the cutting end face and the periodic texture of the fiber weave is constructed outward; the pixels within the concentric ring boundary are extracted as a ring image region.
[0009] Preferably, the process of applying a one-dimensional low-pass filter includes: Establish a polar coordinate system with the image center pixel coordinates as the origin, and set the polar angle sampling step size and the polar radius sampling step size; For each discrete pixel in the rectangular image matrix, the corresponding floating-point pixel coordinates in the original image's two-dimensional coordinate system are calculated in reverse. The target grayscale value is then obtained using a bicubic spline interpolation algorithm, generating a rectangular image matrix that forcibly stretches the periodic texture of the fiber weave into horizontal stripes. The texture direction characteristics of the rectangular image matrix are analyzed, and a one-dimensional Gaussian low-pass filter that only operates in the horizontal direction of the polar angle is constructed. The horizontal sliding window size of the one-dimensional Gaussian low-pass filter is strictly larger than the average pixel span of a single fiber weave periodic texture. A convolution sliding window operation is performed on the rectangular image matrix using the one-dimensional Gaussian low-pass filter to smoothly fuse horizontal grayscale jumps while preserving high-frequency pixel gradient features in the vertical direction of the polar radius.
[0010] Preferably, the process of performing a bipolar pixel gradient search includes: Perform gray-level integration on the filtered rectangular image matrix, find the midpoint of the integration along the polar radius, smoothly connect the midpoints of the integration at each angle, and generate a continuous median trajectory that runs through the gray-level pixel band, i.e., the gray-level pixel band median trajectory. On the median trajectory of the grayscale pixel band, base points are selected at equal intervals and the polar radius normal vector is calculated. The first-order spatial derivative is calculated pixel by pixel along the normal. The maximum negative polar gradient points where the grayscale value drops sharply are extracted to form the inner discrete edge pixel set. Similarly, another set of maximum negative polar gradient points are extracted along the normal to form the outer discrete edge pixel set. The gradient magnitudes of pixels before and after the point of maximum negative polarity gradient are extracted and parabolic interpolation is performed to obtain sub-pixel gradient coordinates; all sub-pixel gradient coordinates are then converted back to coordinate data in the original image's two-dimensional coordinate system.
[0011] Preferably, the process of removing outliers from the discrete edge pixel set after coordinate reconstruction includes: For the restored inner discrete edge pixel set and outer discrete edge pixel set, calculate the Euclidean space distance and gradient direction deflection angle between adjacent pixels respectively; When the Euclidean space distance between adjacent pixels exceeds the preset safe pixel span, or the gradient direction deviation angle exceeds the preset angle threshold, it is determined that there is a geometric breakpoint, and the overall contour is divided into continuous healthy pixel arc segments with the geometric breakpoint as the boundary. All the segmented healthy pixel arcs are input into the random sampling consensus algorithm module. In each iteration, the minimum number of pixels are randomly selected to calculate the candidate circle equation and evaluate the algebraic distance from the remaining pixels to the candidate circle. Pixels with a distance less than the tolerance threshold are determined as inliers. After multiple iterations, the candidate circle equation with the most interior points is selected as the optimal model. Pixels with a distance greater than the tolerance threshold in the optimal model are classified as outliers and discarded, and the effective point set is output.
[0012] Preferably, the process of iteratively solving the objective function using the effective point set and outputting the inner and outer circle fitting model includes: The parameters of the inner circle fitting model to be determined include the inner circle center pixel coordinates and the inner circle pixel radius, and the parameters of the outer circle fitting model include the outer circle center pixel coordinates and the outer circle pixel radius. A joint objective function for image geometry is constructed, which superimposes the sum of squared distances from the inner effective point set to the inner circumference and the sum of squared distances from the outer effective point set to the outer circumference, and introduces a double-center deviation penalty term; the double-center deviation penalty term is defined as the square of the Euclidean distance between the inner and outer centers multiplied by a preset dynamic weight coefficient. Substitute the coordinates of the effective point sets on the inner and outer sides into the objective function for global iteration, continuously adjust the parameter space until the objective function converges to a minimum value, and output the inner circle fitting model and the outer circle fitting model, i.e., the inner and outer circle fitting models.
[0013] Preferably, the process of quantizing the topological mapping spacing of the dual contours of the cut end face includes: Extract the center coordinates of the inner and outer circle fitting models, and establish a new polar coordinate mapping system with the midpoint of the line connecting the two center points as the pole; generate discrete pixel rays outward with a fixed angle as the step size in the full angular space; calculate the coordinates of the two theoretical spatial intersection points of each ray with the trajectory of the inner circle fitting model and the trajectory of the outer circle fitting model. The absolute pixel spatial distance between two theoretical spatial intersection points under the same polar angle section is solved by using the Euclidean distance formula. The absolute pixel spatial distance is a characterization of the double contour topological mapping distance. All the acquired spacing data are unfolded into a topological plane in angular order, and a two-dimensional undulation characteristic curve is plotted with the polar angle as the abscissa and the spacing value as the ordinate. The extreme values of the two-dimensional undulation characteristic curve are extracted to complete the quantization of the mapping spacing.
[0014] Preferably, the process of calculating the area of the morphologically missing region includes: Based on the inner and outer circle fitting model, a two-dimensional ideal ring pixel connected region, which is enclosed by the ideal inner circle closed boundary and the outer circle closed boundary, is generated in the blank image matrix with the same scale as the two-dimensional coordinate system of the original image, as the ideal contour data. Retrieve the binarized image matrix representing the physical distribution characteristics of the cut end face entity generated by threshold segmentation during the original grayscale image cropping stage, and use it as the two-dimensional real incomplete pixel connected component; Under a unified image coordinate system, the ideal contour data and the two-dimensional real incomplete pixel connected domains are compared using image space Boolean difference set operation to extract the morphological difference connected domains that exist in the ideal contour data but are missing in the two-dimensional real incomplete pixel connected domains; the total number of pixels contained in the morphological difference connected domains is counted, and the total number of pixels is multiplied by the single pixel area equivalent coefficient to output the quantized morphological missing region area.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention unfolds a ring-shaped image region containing periodic features into a rectangular image matrix, and constructs a customized one-dimensional Gaussian low-pass filter by combining Fourier dominant frequency analysis. This neutralizes high-frequency texture fluctuations in the horizontal direction while preserving the true edge step features in the vertical direction without loss. Based on the gray-scale integral median trajectory as a safety benchmark, a bipolar pixel gradient search is performed along the normal direction to limit the extraction of the maximum point of the negative polarity gradient, thus shielding the positive polarity false bright spots generated by the high-light reflection of the fiber end of the cut surface and the resin gloss. Combined with sub-pixel level interpolation operations, it can stably output a set of edge features with high purity and accurate positioning in complex image interference environments, providing data assurance for subsequent geometric fitting.
[0016] 2. In constructing the joint objective function of image geometry, this invention introduces a double-center deviation penalty term and combines it with an exponential dynamic weight allocation strategy based on the macroscopic physical contour incompleteness rate. When the target contour data is healthy, a small amount of weight is allowed to intervene to retain the objectively existing slight eccentricity. However, when the image encounters severe data loss, causing the incompleteness rate to exceed the safety warning line, the penalty weight increases with the increase of the macroscopic physical contour incompleteness rate according to a preset exponential function relationship. When the incompleteness is more severe, the coaxial constraint of the inner and outer centers is strengthened, so that the residual inner and outer point sets can still converge under the concentric topological prior, which improves the fitting stability in the case of missing contour parts and ensures the reliability of the fitted trajectory.
[0017] 3. This invention accurately solves for the theoretical intersection distance using high-density discrete pixel rays, intuitively transforming the local topological spacing of the double contour into a two-dimensional undulating feature curve, thus avoiding measurement reference drift caused by field-of-view translation. For quantifying the area of morphologically missing regions, a flawless two-dimensional ideal annular pixel connected region is generated inversely in the blank matrix using a fitting model. This region is then compared with a binarized connected region containing real physical missing boundaries, and Boolean difference operations are performed in the same coordinate system to output accurate missing area data. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the fiberglass cut contour image fitting method based on edge gradient calculation according to the present invention. Figure 2 This is a schematic diagram illustrating the process of obtaining the inner and outer circle fitting model of the present invention; Figure 3 This is a schematic diagram of the quantization output process of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Example 1: This invention proposes a method for fitting fiberglass cut contour images based on edge gradient calculation. The process of the method is as follows: Figure 1 As shown, it includes: Obtain the original grayscale image of the pipe end face from above, extract the center pixel coordinates of the image based on the grayscale features, and crop the annular image region containing the periodic texture of fiber weaving. The polar coordinates of the annular image region are transformed into a rectangular image matrix, and a one-dimensional low-pass filter is applied along the polar angle direction. In the filtered matrix, based on the median trajectory of the grayscale pixel band, a bipolar pixel gradient search is performed along the polar radius direction to simultaneously extract the discrete edge pixel sets on the inner and outer sides. The discrete edge pixel sets are then inversely transformed back to the original image two-dimensional coordinate system. Outlier noise removal is performed on the discrete edge pixel set after coordinate restoration to obtain the effective point set; Construct an image-geometric joint objective function that includes the equations of the inner and outer circles and a penalty term for deviation of the two circle centers. Iterate the objective function using the effective point set and output the fitting model of the inner and outer circles. Pixel space mapping is performed based on the inner and outer circle fitting model to quantize the double contour topological mapping spacing of the cut end face; the ideal contour data generated based on the inner and outer circle fitting model is used to perform Boolean difference operation with the binarized image matrix of the original grayscale image, and the area of the morphological missing region is calculated by combining the pixel equivalent.
[0021] Preferably, the process of obtaining the annular image region includes: Background noise in the original grayscale image is eliminated by using a large-scale smoothing filter operator. An adaptive threshold segmentation algorithm is used to extract the largest bright connected component that represents the overall contour of the cut end face. The geometric moments of the largest bright connected component are calculated, and the geometric centroid is extracted as the coordinates of the center pixel of the image. Using the image center pixel coordinates as the reference pole, and combining the pre-set maximum outer diameter pixel threshold and minimum inner diameter pixel threshold of the pipe, a concentric ring boundary that can completely cover the cutting end face and the periodic texture of the fiber weave is constructed outward; the pixels within the concentric ring boundary are extracted as a ring image region.
[0022] In real industrial production line inspection environments, the raw grayscale images captured by cameras often contain high-frequency stray signals such as diffuse reflection from airborne dust, fine textures of conveyor belts, and fine fiber burrs on pipe ends. Therefore, a large-scale smoothing filter operator is used to eliminate background noise in the raw grayscale image. A large two-dimensional matrix sliding window is employed; specifically, a two-dimensional mean filter or Gaussian smoothing filter operator with a spatial size greater than 5×5 pixels is used, preferably within the range of 7×7 to 15×15 pixels, with the specific window size adaptively selected based on image resolution and noise intensity. This operator slides through the entire grayscale image matrix pixel by pixel, recalculating the grayscale value of the pixel at the center of the window and replacing it with a weighted average of the grayscale values of its surrounding neighboring pixels. Due to the use of a large-scale window, this spatial domain convolution operation can extremely effectively dissolve and neutralize isolated, small-area random noise points into the surrounding background grayscale data. This makes the overall brightness transition of the image smoother, preventing subsequent thresholding algorithms from mistaking these small, messy noise points for the physical edges of the cut end face.
[0023] Subsequently, an adaptive threshold segmentation technique is used to binarize the image. This algorithm automatically finds an optimal gray-level segmentation threshold based on the overall gray-level histogram distribution of the image, separating the bright fiberglass pipe wall from the dark background or inner hole, and extracting the set of white pixels with the largest area, i.e. the largest bright connected region.
[0024] Specifically, after obtaining the smoothed grayscale image, the grayscale histogram distribution of all pixels in the entire image is first statistically analyzed. Using the principle of maximum inter-class variance, the optimal grayscale threshold that best distinguishes the foreground fiberglass entity from the dark background is automatically calculated and used as the dynamic segmentation threshold. Then, the image matrix is traversed row by row, assigning pixels with grayscale values higher than the dynamic threshold as the highest brightness state and pixels with grayscale values lower than the dynamic threshold as the lowest brightness state, thereby generating a binarized image matrix. Next, the eight-neighbor connected component labeling scanning logic is activated, merging and labeling spatially adjacent pixels that are all in the highest brightness state into independent blocks. When a real fiberglass pipe end face is illuminated by a ring light source viewed from above, it will produce an extremely strong and continuous bright band of optical reflection. The total area of the pixels formed by this band is much larger than the sporadic reflective patches produced by the conveyor belt metal clamps. By calculating the absolute number of pixels contained in all independent blocks of the entire image and extracting the block with the highest area value, the maximum bright connected region is obtained. This accurately locks the macroscopic physical location of the cut end face in terms of topological morphology.
[0025] Next, by traversing all pixel coordinates within the connected region, its zeroth-order and first-order geometric moments are calculated. Using the mathematical principle of dividing the first-order geometric moment by the zeroth-order geometric moment, the geometric centroid coordinates of the connected region are obtained, which is used as the approximate physical center of the entire cut end face. Finally, using this center as the center, the system's preset minimum inner diameter pixel limit and maximum outer diameter pixel limit are read, and two concentric circles are drawn to form a ring boundary. All pixels in the original image located outside this boundary are assigned a value of zero, retaining only the pixels within the boundary, thereby extracting the ring-shaped image region.
[0026] Specifically, based on the dimensions of the standard engineering drawings of the fiberglass pipe to be tested, and combined with the physical equivalent coefficient calibrated by the industrial camera lens, the millimeter units on the drawings are accurately converted into pixel units in the digital matrix to obtain the standard outer diameter pixel value. A tolerance pixel span is added to the standard outer diameter pixel value to form the maximum outer diameter pixel threshold. At the same time, a tolerance pixel span is subtracted from the standard inner diameter pixel value to form the minimum inner diameter pixel threshold. The tolerance pixel span is set based on the dimensions of the standard engineering drawings, preferably 10%–30% of the standard outer diameter pixel value, and the specific value is determined by the allowable error requirements of the testing equipment.
[0027] This invention achieves precise coarse localization of target regions against complex backgrounds through image segmentation and geometric moment calculation. Adaptive threshold segmentation can resist fluctuations in the brightness of light sources in industrial environments, ensuring that the solid areas of the pipe wall are completely extracted. By using the geometric centroid combined with prior size boundaries to truncate the annular image region, a large amount of invalid background data and complex refraction shadows deep inside the pipe are eliminated, greatly reducing the pixel matrix computation in subsequent processing steps and meeting the real-time requirements of high-speed inspection in production lines. On the other hand, the precise coarse localization provides a reliable origin reference for subsequent polar coordinate unfolding, avoiding coordinate unfolding distortion caused by pole deviation, and significantly improving the anti-interference capability and operating efficiency of the entire vision inspection system.
[0028] Preferably, the process of applying a one-dimensional low-pass filter includes: Establish a polar coordinate system with the image center pixel coordinates as the origin, and set the polar angle sampling step size and the polar radius sampling step size; For each discrete pixel in the rectangular image matrix, the corresponding floating-point pixel coordinates in the original image's two-dimensional coordinate system are calculated in reverse. The target grayscale value is then obtained using a bicubic spline interpolation algorithm, generating a rectangular image matrix that forcibly stretches the periodic texture of the fiber weave into horizontal stripes. The texture direction characteristics of the rectangular image matrix are analyzed, and a one-dimensional Gaussian low-pass filter that only operates in the horizontal direction of the polar angle is constructed. The horizontal sliding window size of the one-dimensional Gaussian low-pass filter is strictly larger than the average pixel span of a single fiber weave periodic texture. A convolution sliding window operation is performed on the rectangular image matrix using the one-dimensional Gaussian low-pass filter to smoothly fuse horizontal grayscale jumps while preserving high-frequency pixel gradient features in the vertical direction of the polar radius.
[0029] Using the center pixel coordinates of the image as the origin of the polar coordinate system, the angle sampling precision and radius sampling precision are set. To prevent pixel holes after image transformation, a reverse calculation logic is adopted, that is, for each coordinate point in the target rectangular image matrix, its floating-point coordinates in the original image's two-dimensional coordinate system are calculated backward using trigonometric functions. Since floating-point coordinates cannot correspond to a single physical pixel, a bicubic spline interpolation algorithm is used, utilizing the gray values of the sixteen known pixels surrounding the floating-point coordinates, and calculating the target gray value through cubic polynomial weighted smoothing. After this transformation, the originally circular periodic texture is forcibly stretched into horizontally distributed light and dark stripes in the rectangular matrix.
[0030] Subsequently, a one-dimensional Gaussian low-pass filter was designed. Its core principle is that low-pass filtering smooths out high-frequency transitions in the signal. Considering that the woven texture appears as horizontal stripes in the image, the vertical window size of the filter was set to a minimum, while the horizontal sliding window size was set to a value greater than the average pixel span of a single woven texture strip. When the filter is horizontally convolved and slid across the matrix, the alternation of light and dark areas in the horizontal direction is smoothly blended.
[0031] Furthermore, the process of setting the polar angle sampling step size and the polar radius sampling step size includes: Extract the pre-set maximum outer diameter pixel threshold of the pipe, and calculate the total number of pixels contained in the maximum effective physical circumference corresponding to the maximum outer diameter using the product relationship of pi; divide the fully closed 360-degree central angle of the polar coordinate system into several discrete parts corresponding to the total number of pixels, and use the angle corresponding to each part as the dynamic polar angle sampling step size; at the same time, in the annular image area of the original grayscale image, scan along the vertical direction to extract the local grayscale distribution curve, and quantify the average physical pixel width of a single periodic texture; according to the Nyquist space sampling theorem, set half of the average physical pixel width of a single periodic texture as the dynamic polar radius sampling step size of the polar coordinate space transformation.
[0032] Specifically, input the maximum outer diameter pixel threshold of the pipe output from the previous step, multiply the outer diameter value by the constant of pi, and calculate the absolute number of pixels occupied by the circumferential trajectory of the pipe when the pipe end face is at the maximum boundary.
[0033] The 360-degree angle is divided into a number of parts corresponding to the number of pixels. Theoretically, it can be divided into fractions equal to the number of pixels. To balance computational load and accuracy, it can be divided into one-tenth of the number of pixels (which can be dynamically adjusted according to computational load and accuracy). The output is a dynamic polar angle sampling step size that adapts to the physical size of the current cut end face. This operation ensures that when the polar coordinates are mapped to the rectangular image matrix, each column of the rectangular matrix corresponds exactly to a single pixel (or every ten pixels) on the circumference of the original image in physical space, avoiding pixel loss or redundant overlap during the interpolation process.
[0034] A lateral scan is performed along the polar radius direction to statistically analyze the periodic span of the alternation of light and dark areas in the fiber weave texture, and to calculate the average pixel width occupied by a single fiber weave texture. Subsequently, based on the Nyquist sampling theorem, half of this width is used as the final dynamic polar radius sampling step size to guide the bicubic spline interpolation algorithm in completing the point-by-point pixel reconstruction mapping.
[0035] By dynamically binding the polar angle sampling step size to the pixel perimeter of the maximum physical boundary of the cut end face, a physical mapping in the horizontal direction is achieved within the rectangular matrix expanded in polar coordinates, ensuring accurate lateral resolution during subsequent edge extraction. Simultaneously, the Nyquist space sampling theorem is introduced to set the polar diameter sampling step size for fiber braided textures, balancing the preservation of high-frequency texture features with the removal of redundant sampling data in the underlying data link. This adaptive discretization resampling mechanism is compatible with various sizes of FRP pipes, from large to small diameters, broadening the process applicability and lifespan of the testing equipment.
[0036] This invention utilizes coordinate system dimensionality reduction and directional frequency domain filtering to unfold the annular fiber weave texture features into rectangular horizontal stripes, transforming complex two-dimensional spatial interference into a one-dimensional periodic signal. A custom-sized one-dimensional Gaussian low-pass filter operates only in the horizontal direction, dissolving pseudo-edge gradients of the horizontal texture while preserving the sharp abrupt changes in the true edges of the physical cut surfaces perpendicular to the horizontal axis. This avoids the drawback of traditional omnidirectional Gaussian blurring, which can dull true edges and reduce measurement accuracy, providing a clean and high-contrast image base for subsequent sub-pixel feature extraction.
[0037] The process of constructing a one-dimensional Gaussian low-pass filter includes: One-dimensional discrete spatial Fourier transform is performed on the extracted multiple vertical pixel grayscale sequences to obtain a rough main frequency range. Then, in the spatial domain, the local autocorrelation function of the original grayscale sequence is calculated for the pixel span corresponding to the rough main frequency range. The position of the first extreme point of the autocorrelation function is extracted and used as the precise spatial pixel period span of the periodic texture in the rectangular image matrix. The physical size of the horizontal sliding window of the one-dimensional Gaussian low-pass filter is strictly set to an integer multiple of the precise spatial pixel period.
[0038] Within the rectangular image matrix after polar coordinate expansion, multiple random horizontal coordinate indices are generated. A whole column of pixel grayscale values is extracted from top to bottom along these indices, outputting multiple vertical pixel grayscale sequences. These sequences contain the original one-dimensional fluctuation data of the brightness and darkness undulations of the fiber weave texture. The one-dimensional discrete space Fourier transform operator is invoked, and through complex matrix multiplication, the pixel spatial signal, originally representing the relationship between position and brightness, is deconstructed into frequency domain spectral data representing the relationship between frequency and energy.
[0039] Extreme value retrieval is performed in the spectrum array to lock the dominant frequency signal component with the highest amplitude corresponding to the energy peak, thereby obtaining a coarse dominant frequency range of the fiber weave texture structure fluctuation. Due to the physical defect of insufficient frequency resolution in the Fourier transform of extremely short pixel sequences, the algorithm then returns to the pixel spatial domain. For the pixel span range corresponding to the coarse dominant frequency range, the local autocorrelation function of the original vertical pixel grayscale sequence is calculated. By finding and extracting the coordinate position of the first extreme point after the local autocorrelation function deviates from the origin, the precise spatial pixel period span of the texture structure at the current image resolution is accurately locked and output.
[0040] Based on the precise spatial pixel period span, a one-dimensional Gaussian low-pass filter kernel matrix structure is dynamically generated, and its horizontal sliding window width is forced to be an integer multiple of two or three times the period span. Finally, the generated Gaussian filter kernel is subjected to sliding convolution with a rectangular image matrix to achieve effective neutralization of periodic high-frequency bands.
[0041] The fiber spacing of fiberglass pipes in industrial settings varies greatly, and even slight changes in image capture distance can cause drastic changes in the pixel span of the fiber weave texture in the image matrix. Using a manually fixed filter window size easily leads to under-filtering that fails to eliminate interference, or filtered waves that blur the true edges. This design employs a pre-processed one-dimensional discrete-space Fourier transform to precisely lock the dominant frequency and deduce the physical pixel period, achieving dynamic anchoring between the filter window and the true texture span. This ensures that each convolutional sliding window can encompass and suppress the peak and trough energy of the texture, outputting a clean, fitted basemap.
[0042] Preferably, the process of performing a bipolar pixel gradient search includes: Perform gray-level integration on the filtered rectangular image matrix, find the midpoint of the integration along the polar radius, smoothly connect the midpoints of the integration at each angle, and generate a continuous median trajectory that runs through the gray-level pixel band, i.e., the gray-level pixel band median trajectory. On the median trajectory of the grayscale pixel band, base points are selected at equal intervals and the polar radius normal vector is calculated. The first-order spatial derivative is calculated pixel by pixel along the normal. The maximum negative polar gradient points where the grayscale value drops sharply are extracted to form the inner discrete edge pixel set. Similarly, another set of maximum negative polar gradient points are extracted along the normal to form the outer discrete edge pixel set. The gradient magnitudes of pixels before and after the point of maximum negative polarity gradient are extracted and parabolic interpolation is performed to obtain sub-pixel gradient coordinates; all sub-pixel gradient coordinates are then converted back to coordinate data in the original image's two-dimensional coordinate system.
[0043] In a rectangular image matrix, the gray values of each pixel are accumulated along the vertical columns representing the epipolar radius, and a one-dimensional integral is performed to find the coordinates of the center pixel that makes the accumulated gray value reach half of the total energy. The center coordinates found in each column are then connected by a smooth curve to generate a median trajectory of gray-level pixels that runs through the interior of the high-brightness entity.
[0044] Subsequently, sampling base points are evenly spaced along the trajectory, and the polar radius normal vector at each base point is obtained by curve differentiation. Since the physical characteristics of the actual fiberglass pipe end face transition from a bright pipe wall to a dark background, its first spatial derivative is negative. A sub-pixel step length (e.g., 0.5 pixels) is set in the normal direction. For each step forward in the normal direction, a virtual grayscale value at the floating-point coordinate is calculated using bilinear interpolation. Then, the first spatial derivative is calculated based on the generated virtual grayscale value sequence. Pixel differences are calculated incrementally inward along the normal, recording only the points with the maximum negative gradient caused by sharp grayscale drops, which are used as the inner edges. Similarly, the maximum negative gradient points are searched outward as the outer edges. After finding the integer pixel extrema, the computer extracts the absolute gradient values of the extremum point and its adjacent pixels. Using these three values as dependent variables and the coordinates as independent variables, a univariate quadratic parabola equation is constructed. By calculating the x-coordinate of the vertex of this parabola, the sub-pixel extremum position with accuracy far exceeding that of the physical pixel grid is obtained. Finally, using the conversion formula from polar coordinates to rectangular coordinates, the data are restored to their original spatial positions in the image.
[0045] This invention constructs a highly reliable anti-spoofing edge extraction mechanism. By establishing a median trajectory of grayscale pixel bands, a safe starting benchmark is found inside the fiberglass pipe wall. A bidirectional independent search is performed from this benchmark, back-to-back, inward and outward, strictly limiting the extraction to only negative polarity gradient peaks, thus shielding against interference from numerous positive polarity bright spot pseudo-edges generated by high-gloss reflections from the fiber ends of the cut surface and resin gloss. Simultaneously, a sub-pixel calculation technique based on parabolic interpolation is introduced to meet the requirements of high-precision detection.
[0046] Preferably, the process of removing outliers from the discrete edge pixel set after coordinate reconstruction includes: For the restored inner discrete edge pixel set and outer discrete edge pixel set, calculate the Euclidean space distance and gradient direction deflection angle between adjacent pixels respectively; When the Euclidean space distance between adjacent pixels exceeds the preset safe pixel span, or the gradient direction deviation angle exceeds the preset angle threshold, it is determined that there is a geometric breakpoint, and the overall contour is divided into continuous healthy pixel arc segments with the geometric breakpoint as the boundary, that is, continuous edge segments where the distance between adjacent pixels and the gradient direction change are both within the safe threshold. All the segmented healthy pixel arcs are input into the random sampling consensus algorithm module. In each iteration, the minimum number of pixels are randomly selected to calculate the candidate circle equation and evaluate the algebraic distance from the remaining pixels to the candidate circle. Pixels with a distance less than the tolerance threshold are determined as inliers. After multiple iterations, the candidate circle equation with the most interior points is selected as the optimal model. Pixels with a distance greater than the tolerance threshold in the optimal model are classified as outliers and discarded, and the effective point set is output.
[0047] After obtaining the sub-pixel edge coordinates, the entire discrete edge pixel set is traversed, calculating the physical Euclidean distance between two adjacent pixels and the angular change in the gradient direction. On a normal arc, the point spacing is compact and the angular change is gradual. If an abnormally large gap is found between two points, or a sudden jump in angle occurs, it is determined that a geometric breakpoint formed by a fiberglass chip or severe dirt has appeared at that point. Using this breakpoint as the cutting position, the potentially incomplete contour is divided into multiple continuous healthy pixel arc segments. Next, the random sampling consistency core logic is invoked to randomly select three pixels from all healthy pixel arc segments, and a hypothetical candidate circle equation is calculated using these three points. Specifically, the average spacing and average skew angle of continuous healthy edge pixels in the standard flawless cut end face sample image are pre-statistically analyzed, and multiplied by a preset tolerance magnification factor to obtain the safe pixel span and angle threshold.
[0048] Subsequently, all remaining edge pixels are substituted into the equation to calculate the absolute distance from each point to the candidate circle. A very small tolerance threshold is preset; pixels with a distance less than this threshold are considered interior points supporting the candidate circle. The random sampling and voting evaluation process is iterated repeatedly. Finally, the number of interior points of all candidate circles is compared, and the candidate circle equation with the most support and the largest number of interior points is locked as the optimal model. Finally, using this optimal model as a benchmark, pixels in the set that are more than the tolerance threshold away from the optimal model's circle are strictly classified as outliers located at geometric breakpoint edges or in noisy regions, and these are removed from the data memory, outputting only the valid set of points that best matches the true circular trajectory.
[0049] This invention endows the visual inspection system with strong shape tolerance and resistance to notch damage. By pre-segmenting with geometric breakpoints, it isolates severely damaged areas from the initial interference of the algorithm. The deep fusion random sampling consensus algorithm abandons the weakness of the traditional least squares method, which is easily skewed by local extreme anomalies. Through the law of large numbers and majority voting mechanism, it automatically identifies and extracts most of the high-quality data that represent the true healthy geometric shape of the cut end face. At the same time, it accurately identifies and isolates severe deviations caused by notches, depressions or water droplet reflections as noise. This allows the algorithm to stably extract high-quality model data even when there is large-area damage or severe adhesion on the cut end face.
[0050] The process for obtaining the inner and outer circle fitting model is as follows: Figure 2 As shown, the process of iteratively solving the objective function using the effective point set and outputting the inner and outer circle fitting model includes: The parameters of the inner circle fitting model to be determined include the inner circle center pixel coordinates and the inner circle pixel radius, and the parameters of the outer circle fitting model include the outer circle center pixel coordinates and the outer circle pixel radius. A joint objective function for image geometry is constructed, which superimposes the sum of squared distances from the inner effective point set to the inner circumference and the sum of squared distances from the outer effective point set to the outer circumference, and introduces a double-center deviation penalty term. The coordinates of the inner and outer effective point sets are substituted into the objective function for global iteration, and the parameter space is continuously adjusted until the objective function converges to a minimum value. The inner circle fitting model and the outer circle fitting model are then output, i.e., the inner and outer circle fitting models.
[0051] First, initialize the model parameters to be solved in the computer memory, including the pixel coordinates of the center of the inner circle and the radius of the inner circle, as well as the pixel coordinates of the center of the outer circle and the radius of the outer circle, for a total of six unknown variables.
[0052] Subsequently, an image-geometric joint objective function is constructed to evaluate the fitting quality. The first two parts of this function are the sum of the squares of the distances from each pixel in the inner valid point set to the inner circumference, and the sum of the squares of the distances from each pixel in the outer valid point set to the outer circumference, respectively. These two terms represent the basic residuals of the data fitting. Most importantly, a double-center deviation penalty term is added at the end of the function. Its mathematical expression is the square of the Euclidean distance between the coordinates of the inner and outer centers, multiplied by a pre-defined dynamic weighting coefficient.
[0053] After construction, a nonlinear optimization mathematical tool is used to find the global minimum of the function. During the iteration process, the computer continuously fine-tunes the values of the six unknown variables. When the parameters cause a significant deviation between the inner and outer circle centers, the penalty term will be amplified exponentially, causing the total value of the objective function to rise sharply. In order to force the objective function value to decrease, the optimization solver will be forced to bring the inner and outer circle centers closer together in subsequent iterations. After several consecutive variable updates and gradient descents, convergence is declared when the objective function value no longer changes substantially. At this point, the current six parameter values are fixed, and a highly realistic inner and outer circle fitting model is output.
[0054] In the cutting process of fiberglass pipes, the inner hole and outer wall of the cut end face should maintain coaxiality macroscopically. If the inner and outer circles are fitted independently using traditional methods, the calculated inner and outer centers are easily misaligned due to small deviations in local images. The double-center deviation penalty term introduced in this invention applies an algebraic constraint that tends towards coaxiality during iterative solution. This constraint not only prevents the algorithm from diverging due to malicious inducement by residual noise, but also allows the small physical eccentricities that actually exist in the uneven thickness defective products to be preserved through the setting of dynamic weight coefficients, thereby outputting a geometric fitting model that closely fits the objective physical facts and is extremely stable.
[0055] The process of quantization output in this invention is as follows: Figure 3 As shown, this includes the double-contour topological mapping spacing and the area of the morphologically missing region; Preferably, the process of quantizing the topological mapping spacing of the dual contours of the cut end face includes: Extract the center coordinates of the inner and outer circle fitting models, and establish a new polar coordinate mapping system with the midpoint of the line connecting the two center points as the pole; generate discrete pixel rays outward with a fixed angle as the step size in the full angular space; calculate the coordinates of the two theoretical spatial intersection points of each ray with the trajectory of the inner circle fitting model and the trajectory of the outer circle fitting model. The absolute pixel spatial distance between two theoretical spatial intersection points under the same polar angle section is solved by using the Euclidean distance formula. The absolute pixel spatial distance is a characterization of the double contour topological mapping distance. All the acquired spacing data are unfolded into a topological plane in angular order, and a two-dimensional undulation characteristic curve is plotted with the polar angle as the abscissa and the spacing value as the ordinate. The extreme values of the two-dimensional undulation characteristic curve are extracted to complete the quantization of the mapping spacing.
[0056] The coordinates of the inner and outer center points are extracted, and the absolute physical midpoint coordinates of the line connecting the two points in two-dimensional space are calculated. This midpoint is then used as the new pole of the polar coordinate system. A computer algorithm controls a virtual ray generator to continuously generate discrete pixel rays from this pole in a closed angular space ranging from 0 to 360 degrees, with an incremental step size of a very small fixed angle, such as 0.1 degrees. Since both the inner and outer circle fitting models are known continuous geometric equations, the computer rigorously calculates the coordinates of the theoretical internal intersection point where each ray intersects the inner circle trajectory, and the coordinates of the theoretical external intersection point where it intersects the outer circle trajectory, by simultaneously solving the equations of the straight line and the circle.
[0057] Next, the Euclidean distance calculation formula is used to calculate the absolute pixel distance between the two theoretical intersection points on the same ray. This distance value physically represents the local wall thickness of the pipe cut end face at that specific cross-sectional angle. These spacing data are arranged sequentially according to the ray emission angle, and a topological expansion is performed in a plane coordinate system. The horizontal axis is set as the ray polar angle, and the vertical axis is set as the spacing value, to draw a two-dimensional fluctuation characteristic curve that intuitively reflects the wall thickness change. Finally, the curve is scanned, and the highest peak value and lowest trough value of the curve are extracted to quantify and evaluate the overall mapping spacing.
[0058] This invention avoids the measurement reference drift problem caused by the translation or slight tilt of the cut end face in the image field of view by establishing the midpoint of the line connecting the two centers as the absolute reference pole and using high-density ray intersection distance measurement. The generated two-dimensional fluctuation characteristic curve can not only directly output the maximum and minimum wall thickness values to intercept fatal defects due to uneven thickness, but also its fluctuation variance and shape trend can provide valuable reverse guidance data for the tool angle correction and feed rate optimization of the front-end cutting machine, improving the intelligent closed-loop control level of the production line.
[0059] Preferably, the process of calculating the area of the morphologically missing region includes: Based on the inner and outer circle fitting model, a two-dimensional ideal ring pixel connected region, which is enclosed by the ideal inner circle closed boundary and the outer circle closed boundary, is generated in the blank image matrix with the same scale as the two-dimensional coordinate system of the original image, as the ideal contour data. Retrieve the binarized image matrix representing the physical distribution characteristics of the cut end face entity generated by threshold segmentation during the original grayscale image cropping stage, and use it as the two-dimensional real incomplete pixel connected component; Under a unified image coordinate system, the ideal contour data and the two-dimensional real incomplete pixel connected domains are compared using image space Boolean difference set operation to extract the morphological difference connected domains that exist in the ideal contour data but are missing in the two-dimensional real incomplete pixel connected domains; the total number of pixels contained in the morphological difference connected domains is counted, and the total number of pixels is multiplied by the single pixel area equivalent coefficient to output the quantized morphological missing region area.
[0060] To accurately quantify the size of chips and defects caused by the cutting process, a blank, all-zero pixel matrix with the same resolution as the original image's two-dimensional coordinate system is created in the background memory. Within this blank matrix, the ideal inner circle fitting equation and the ideal outer circle fitting equation derived through previous iterative optimization are read. All pixels within the area bounded by these two theoretical equations are assigned a value of 255, reconstructing a flawless two-dimensional ideal annular pixel connected region, representing the theoretical physical boundary of the fiberglass pipe when it is intact.
[0061] Next, the system retrieves the actual target image matrix generated during the image cropping stage using adaptive thresholding. This matrix contains the actual physical morphology distribution of the pipe end face. If the cut end face is damaged, the corresponding connected component edges will inevitably have concave geometric breaks. Finally, under the constraint of an absolutely unified image coordinate system, the computer's underlying image space Boolean difference operator is invoked. This operator compares the pixel states of the two matrices row by row and column by column, extracting pixels that are white in the ideal connected component but black in the real connected component, generating a new morphologically different connected component. This different connected component visually corresponds to the shape of the missing fiberglass fragment. The total number of absolute pixels contained in this different connected component is accurately counted using an accumulator, and the single-pixel physical area equivalent coefficient calibrated during the device's factory calibration is read. The number of pixels is multiplied by this equivalent coefficient to directly calculate and output the area of the missing region in square millimeters.
[0062] This invention utilizes image region difference reconstruction technology from computer graphics to achieve high-precision numerical measurement of irregular physical shape defects. Since directly calculating the area on discrete edge pixels violates the principles of mathematical spatial dimensions, this solution uses two-dimensional planar template data generated by the inverse fitting model to subtract the objectively binary connected components containing the actual damage boundaries, thus establishing the underlying data logic from one-dimensional line equations to two-dimensional physical area measurement. This method, purely based on pixel matrix topological comparison, is not limited by irregular defect shapes, extremely distorted boundaries, or extremely large breakpoint spans, providing objective and accurate quantitative data support for subsequent production line implementation of strict defect level classification or quality interception.
[0063] The process of calculating the area of morphologically missing regions using pixel equivalents includes: Under normal cutting conditions, the cut end face of a fiberglass pipe is a plane perpendicular to the pipe axis. When the camera captures the image from above, the entire end face is within the same spatial plane. Therefore, a globally unified single-pixel area equivalent coefficient is used for conversion. During the calibration phase, using a standard calibration board with known physical dimensions, the pixel-physical area equivalent coefficient of the industrial camera at the current installation height and lens parameters is calculated, which represents the physical area corresponding to a single pixel. After extracting the morphological difference connected components, the total number of pixels contained within the difference connected components is counted. The total number of pixels is multiplied by the global pixel area equivalent coefficient to directly output the quantified morphological missing region area. If there is a slight tilt in the actual cutting operation, a cosine correction factor can be applied to the equivalent coefficient based on the spatial deflection angle of the image plane normal vector for optional accuracy expansion compensation.
[0064] Traditional area conversion often uses a globally unique fixed pixel equivalent. This method can lead to an underestimation of the area when detecting notches on curved surfaces with beveled edges due to perspective distortion. The cut ends of FRP (fiberglass reinforced plastic) pipes are typically vertical planes, free from such perspective distortion. Therefore, a globally uniform equivalent coefficient can be used to obtain high-precision area output without the need for complex nonlinear mapping tables. Even with slight cut tilts, the cosine compensation factor can achieve accuracy correction with minimal computational cost, effectively meeting the quality acceptance requirements for pipe installation sealing and pressure resistance.
[0065] Example 2: This invention proposes a method for fitting fiberglass cut contour images based on edge gradient calculation, comprising: Obtain the original grayscale image of the pipe cut end face from above, extract the center pixel coordinates of the image based on grayscale features, and crop the annular image region containing the periodic texture of fiber weaving. The polar coordinates of the annular image region are transformed into a rectangular image matrix, and a one-dimensional low-pass filter is applied along the polar angle direction. In the filtered matrix, based on the median trajectory of the grayscale pixel band, a bipolar pixel gradient search is performed along the polar radius direction to simultaneously extract the discrete edge pixel sets on the inner and outer sides. The discrete edge pixel sets are then inversely transformed back to the original image two-dimensional coordinate system. Outlier noise removal is performed on the discrete edge pixel set after coordinate restoration to obtain the effective point set; Construct an image-geometric joint objective function that includes the equations of the inner and outer circles and a penalty term for deviation of the two circle centers. Iterate the objective function using the effective point set and output the fitting model of the inner and outer circles. Pixel space mapping is performed based on the inner and outer circle fitting model to quantize the double contour topological mapping spacing of the cut end face; the ideal contour data generated based on the inner and outer circle fitting model is used to perform Boolean difference operation with the binarized image matrix of the original grayscale image, and the area of the morphological missing region is calculated by combining the pixel equivalent.
[0066] Preferably, the process of removing outliers from the discrete edge pixel set after coordinate reconstruction includes: For the restored inner discrete edge pixel set and outer discrete edge pixel set, calculate the Euclidean space distance and gradient direction deflection angle between adjacent pixels respectively; When the Euclidean space distance between adjacent pixels exceeds the preset safe pixel span, or the gradient direction deviation angle exceeds the preset angle threshold, it is determined that there is a geometric breakpoint, and the overall contour is divided into continuous healthy pixel arc segments with the geometric breakpoint as the boundary. All the segmented healthy pixel arcs are input into the random sampling consensus algorithm module. In each iteration, the minimum number of pixels are randomly selected to calculate the candidate circle equation and evaluate the algebraic distance from the remaining pixels to the candidate circle. Pixels with a distance less than the tolerance threshold are determined as inliers. After multiple iterations, the candidate circle equation with the most interior points is selected as the optimal model. Pixels with a distance greater than the tolerance threshold in the optimal model are classified as outliers and discarded, and the effective point set is output.
[0067] Furthermore, the process of setting the tolerance threshold includes: after geometric breakpoint segmentation, extracting the radial deviation mean square error of all adjacent pixels within each healthy pixel arc segment to the local micro-fitting baseline; using the radial deviation mean square error as a dynamic benchmark index characterizing the local physical edge roughness level of the current cut end face; establishing a positive nonlinear mapping relationship equation between the tolerance threshold and the radial deviation mean square error; for healthy pixel arc segments with smooth surfaces and small radial deviation mean square errors, the system assigns an extremely small lower limit pixel tolerance threshold; for healthy pixel arc segments with large radial deviation mean square errors due to the manufacturing frosting process, the system adaptively assigns an expanded dynamic tolerance threshold; finally, pixels with a distance less than the corresponding dynamic tolerance threshold are determined as valid interior points supporting the candidate circle equation.
[0068] The specific process of constructing the positive nonlinear mapping relationship equation is as follows: using the system's preset lower limit pixel tolerance value as the basic constant term, substituting the radial deviation mean square error as the independent variable into the logarithmic function to calculate the nonlinear gain variable, and finally adding the basic constant term to the nonlinear gain variable to output the dynamic tolerance threshold that expands nonlinearly and gradually with the increase of local edge roughness.
[0069] Preferably, the process of iteratively solving the objective function using the effective point set and outputting the inner and outer circle fitting model includes: The parameters of the inner circle fitting model to be determined include the inner circle center pixel coordinates and the inner circle pixel radius, and the parameters of the outer circle fitting model include the outer circle center pixel coordinates and the outer circle pixel radius. A joint objective function for image geometry is constructed, which superimposes the sum of squared distances from the inner effective point set to the inner circumference and the sum of squared distances from the outer effective point set to the outer circumference, and introduces a double-center deviation penalty term; the double-center deviation penalty term is defined as the square of the Euclidean distance between the inner and outer centers multiplied by a preset dynamic weight coefficient. Substitute the coordinates of the effective point sets on the inner and outer sides into the objective function for global iteration, continuously adjust the parameter space until the objective function converges to a minimum value, and output the inner circle fitting model and the outer circle fitting model, i.e., the inner and outer circle fitting models.
[0070] Furthermore, the process of setting dynamic weighting coefficients includes: Retrieve the geometric breakpoint location data output from the outlier removal step, and calculate the sum of the absolute central angles spanned by all geometric breakpoints in the image center coordinate system; divide the sum of absolute central angles by 360 degrees to obtain the macroscopic physical contour incompleteness rate; pre-set a safety warning value and a basic weight coefficient; compare the macroscopic physical contour incompleteness rate with the safety warning value; when the macroscopic physical contour incompleteness rate is less than or equal to the safety warning value, directly output the basic weight coefficient as the final dynamic weight coefficient; when the macroscopic physical contour incompleteness rate is greater than the safety warning value, calculate the difference between the macroscopic physical contour incompleteness rate and the safety warning value, multiply the difference by a preset amplification gain constant to obtain an exponent, calculate the exponent gain result using the natural constant as the base, multiply the exponent gain result by the basic weight coefficient, and output the final dynamic weight coefficient.
[0071] Input the two-dimensional pixel coordinates of the detected geometric breakpoints, call the arctangent trigonometric function to calculate the polar angle of each geometric breakpoint relative to the image center, output the intermediate data as the starting angle and ending angle of each missing arc, calculate the sum of absolute central angles; divide the sum of absolute central angles by the constant 360, and output the macroscopic physical contour incompleteness rate between 0 and 1.
[0072] The operation performed by calling the macroscopic physical contour incompleteness rate, as well as the system's preset safety warning value (e.g., set to 0.15) and basic weight coefficient (e.g., set to 0.01), is a branch judgment based on numerical size comparison.
[0073] If the macroscopic physical contour incompleteness rate of the input data is less than or equal to 0.15, it means that the edge data of the cut end face is healthy. The operation performed is direct assignment, and the final output data is 0.01 as a dynamic weight coefficient.
[0074] If the macroscopic physical contour incompleteness rate of the input data is greater than 0.15 (e.g., reaching 0.35), the operation performed is mathematical multiplication and exponential operation: First, subtract 0.15 from 0.35 to obtain a difference of 0.2. Multiply this difference of 0.2 by a preset amplification gain constant (e.g., set to 10) to obtain the exponent 2. Then, calculate the exponential gain result to the power of 10. Finally, multiply this exponential gain result by the basic weight coefficient 0.01, and output the final data as the amplified dynamic weight coefficient. At this time, the formula for the dynamic weight coefficient is: ; Where W is the dynamic weighting coefficient; W0 is the basic weighting coefficient; R is the macroscopic physical contour incompleteness rate; R safe The value is the safety warning value; K is the amplification gain constant.
[0075] When the data is healthy (the incompleteness rate is below the safety threshold of 0.15), the output has a very small constant basic weight coefficient, allowing the optimization solver to fully respect the original positions of the inner and outer valid point sets, thereby truly restoring and quantifying the microscopic thickness unevenness caused by the cutting tool offset. However, when the data encounters severe missing data (the incompleteness rate exceeds the safety threshold), the exponential gain operation based on the natural constant is activated, and the penalty weight will increase exponentially with the expansion of the damaged area, forcibly binding the isolated residual inner circle data with the outer circle data together, forcing the two to be output in a perfectly concentric state. This nonlinear two-stage hard-core mathematical constraint enables the algorithm to achieve industrial-grade high standards of fault tolerance and self-healing reliability.
[0076] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for fitting fiberglass cut contour images based on edge gradient calculation, characterized in that, include: Obtain the original grayscale image of the pipe cut end face from above, extract the center pixel coordinates of the image based on grayscale features, and crop the annular image region containing the periodic texture of fiber weaving. The polar coordinates of the annular image region are transformed into a rectangular image matrix, and a one-dimensional low-pass filter is applied along the polar angle direction; In the filtered matrix, based on the median trajectory of the grayscale pixel band, a bipolar pixel gradient search is performed along the polar radius direction to simultaneously extract the discrete edge pixel sets on the inner and outer sides; the discrete edge pixel sets are then inversely transformed back to the original image's two-dimensional coordinate system. Outlier noise removal is performed on the discrete edge pixel set after coordinate restoration to obtain the effective point set; Construct an image-geometric joint objective function that includes the equations of the inner and outer circles and a penalty term for deviation of the two circle centers. Iterate the objective function using the effective point set and output the fitting model of the inner and outer circles. Pixel space mapping is performed based on inner and outer circle fitting models to quantize the double contour topology mapping spacing of the cut end face; Ideal contour data generated based on inner and outer circle fitting models are compared with the binarized image matrix of the original grayscale image using Boolean difference operations, and the area of morphologically missing regions is calculated by combining pixel equivalents.
2. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of obtaining the ring-shaped image region includes: Background noise in the original grayscale image is eliminated by using a large-scale smoothing filter operator. An adaptive threshold segmentation algorithm is used to extract the largest bright connected component that represents the overall contour of the cut end face. The geometric moments of the largest bright connected component are calculated, and the geometric centroid is extracted as the coordinates of the center pixel of the image. Using the image center pixel coordinates as the reference pole, and combining the pre-set maximum outer diameter pixel threshold and minimum inner diameter pixel threshold of the pipe, a concentric ring boundary that can completely cover the cutting end face and the periodic texture of the fiber weave is constructed outward; the pixels within the concentric ring boundary are extracted as a ring image region.
3. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of applying a one-dimensional low-pass filter includes: Establish a polar coordinate system with the image center pixel coordinates as the origin, and set the polar angle sampling step size and the polar radius sampling step size; For each discrete pixel in the rectangular image matrix, the corresponding floating-point pixel coordinates in the original image's two-dimensional coordinate system are calculated in reverse. The target grayscale value is then obtained using a bicubic spline interpolation algorithm, generating a rectangular image matrix that stretches the periodic texture of the fiber weave into horizontal stripes. The texture direction characteristics of the rectangular image matrix are analyzed, and a one-dimensional Gaussian low-pass filter that only operates in the horizontal direction of the polar angle is constructed. The horizontal sliding window size of the one-dimensional Gaussian low-pass filter is strictly larger than the average pixel span of a single fiber weave periodic texture. A convolution sliding window operation is performed on the rectangular image matrix using the one-dimensional Gaussian low-pass filter to smoothly fuse horizontal grayscale jumps while preserving high-frequency pixel gradient features in the vertical direction of the polar radius.
4. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of performing a bipolar pixel gradient search includes: Perform gray-level integration on the filtered rectangular image matrix, find the midpoint of the integration along the polar radius, smoothly connect the midpoints of the integration at each angle, and generate a continuous median trajectory that runs through the gray-level pixel band, i.e., the gray-level pixel band median trajectory. On the median trajectory of the grayscale pixel band, base points are selected at equal intervals and the polar radius normal vector is calculated. The first-order spatial derivative is calculated pixel by pixel along the normal. The maximum negative polar gradient points of the grayscale value decrease are extracted to form the inner discrete edge pixel set. Similarly, another set of maximum negative polar gradient points are extracted along the normal to form the outer discrete edge pixel set. The gradient magnitudes of pixels before and after the point of maximum negative polarity gradient are extracted and parabolic interpolation is performed to obtain sub-pixel gradient coordinates; all sub-pixel gradient coordinates are then converted back to coordinate data in the original image's two-dimensional coordinate system.
5. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of removing outliers from the discrete edge pixel set after coordinate reconstruction includes: For the restored inner discrete edge pixel set and outer discrete edge pixel set, calculate the Euclidean space distance and gradient direction deflection angle between adjacent pixels respectively; When the Euclidean space distance between adjacent pixels exceeds the preset safe pixel span, or the gradient direction deviation angle exceeds the preset angle threshold, it is determined that there is a geometric breakpoint, and the overall contour is divided into continuous healthy pixel arc segments with the geometric breakpoint as the boundary. All the segmented healthy pixel arcs are input into the random sampling consensus algorithm module. In each iteration, the minimum number of pixels are randomly selected to calculate the candidate circle equation and evaluate the algebraic distance from the remaining pixels to the candidate circle. Pixels with a distance less than the tolerance threshold are determined as inliers. After multiple iterations, the candidate circle equation with the most interior points is selected as the optimal model. Pixels with a distance greater than the tolerance threshold in the optimal model are classified as outliers and discarded, and the effective point set is output.
6. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of iteratively solving the objective function using a set of effective points and outputting the inner and outer circle fitting model includes: The parameters of the inner circle fitting model to be determined include the inner circle center pixel coordinates and the inner circle pixel radius, and the parameters of the outer circle fitting model include the outer circle center pixel coordinates and the outer circle pixel radius. A joint objective function for image geometry is constructed, which superimposes the sum of squared distances from the inner effective point set to the inner circumference and the sum of squared distances from the outer effective point set to the outer circumference, and introduces a double-center deviation penalty term; the double-center deviation penalty term is defined as the square of the Euclidean distance between the inner and outer centers multiplied by a preset dynamic weight coefficient. Substitute the coordinates of the effective point sets on the inner and outer sides into the objective function for global iteration, continuously adjust the parameter space until the objective function converges to a minimum value, and output the inner circle fitting model and the outer circle fitting model, i.e., the inner and outer circle fitting models.
7. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of quantizing the topological mapping spacing of the dual contours of the cut end face includes: Extract the center coordinates of the inner and outer circle fitting models, and establish a new polar coordinate mapping system with the midpoint of the line connecting the two center points as the pole; generate discrete pixel rays outward with a fixed angle as the step size in the full angular space; calculate the coordinates of the two theoretical spatial intersection points of each ray with the trajectory of the inner circle fitting model and the trajectory of the outer circle fitting model. The absolute pixel spatial distance between two theoretical spatial intersection points under the same polar angle section is solved by using the Euclidean distance formula. The absolute pixel spatial distance is a characterization of the double contour topological mapping distance. All the acquired spacing data are unfolded into a topological plane in angular order, and a two-dimensional undulation characteristic curve is plotted with the polar angle as the abscissa and the spacing value as the ordinate. The extreme values of the two-dimensional undulation characteristic curve are extracted to complete the quantization of the mapping spacing.
8. The method for fitting fiberglass cut contour images based on edge gradient calculation according to claim 1, characterized in that, The process of calculating the area of morphologically missing regions includes: Based on the inner and outer circle fitting model, a two-dimensional ideal ring pixel connected region, which is enclosed by the ideal inner circle closed boundary and the outer circle closed boundary, is generated in the blank image matrix with the same scale as the two-dimensional coordinate system of the original image, as the ideal contour data. Retrieve the binarized image matrix representing the physical distribution characteristics of the cut end face entity generated by threshold segmentation during the original grayscale image cropping stage, and use it as the two-dimensional real incomplete pixel connected component; Under a unified image coordinate system, the ideal contour data and the two-dimensional real incomplete pixel connected domains are compared using image space Boolean difference set operation to extract the morphological difference connected domains that exist in the ideal contour data but are missing in the two-dimensional real incomplete pixel connected domains; the total number of pixels contained in the morphological difference connected domains is counted, and the total number of pixels is multiplied by the single pixel area equivalent coefficient to output the quantized morphological missing region area.