Curve burr visual detection method based on subject contour reconstruction and residual analysis
By using a method based on main contour reconstruction and residual analysis, the problems of contour-noise confusion, feature-semantic loss, and detection-quantization in burr detection on curves are solved, achieving high-precision burr recognition and quantization, and improving the reliability and applicability of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HUICUI INTELLIGENT TECH CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies for burr detection on curves suffer from challenges such as contour-noise confusion, feature-semantic loss, data-generalization dependence, and detection-quantization disconnect. They cannot effectively distinguish between burrs and noise, and it is difficult to achieve high-precision burr recognition and quantization.
By using a method based on main body contour reconstruction and residual analysis, a smooth main body contour model is first constructed to eliminate the influence of burrs. Then, through iterative reconstruction and multi-scale residual feature analysis, the burrs are identified and quantified.
It achieves reliable identification and quantification of burrs under noise and texture interference, reduces false alarm rate, and improves the applicability and accuracy of detection.
Smart Images

Figure CN121904058B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision inspection technology, specifically to a visual inspection method for curve burrs based on subject contour reconstruction and residual analysis. Background Technology
[0002] In many manufacturing fields such as precision machining, stamping, injection molding, and 3D printing, burrs on the edges or curved contours of workpieces are a common and harmful defect. Burrs typically appear as tiny, sharp, or curled protrusions attached to theoretically smooth edges. They not only affect the appearance and assembly accuracy of products, but may also detach during use, causing serious consequences such as jamming of moving parts, electrical short circuits, and contamination of hydraulic systems. Therefore, automated and high-precision detection of burrs on critical contour curves is an indispensable part of quality control.
[0003] Traditional burr detection relies primarily on manual touch (touching) or visual inspection with a magnifying glass, which is inefficient, inconsistent in standards, and prone to missed detections. Machine vision technology, as a non-contact, high-speed detection method, has naturally become a research direction for solving this problem. Existing machine vision-based burr detection schemes mainly focus on the extraction and analysis of edge information in images. The most similar implementation schemes include methods based on traditional edge detection and geometric analysis, methods based on local region grayscale statistics, and methods based on pre-trained deep learning models for image classification or segmentation.
[0004] (1) The method based on edge extraction and contour deviation analysis. This is the most intuitive and widely used traditional approach. The technical route is as follows: First, a high-quality image of the workpiece is obtained through high-contrast lighting (such as backlighting or low-angle lighting) to make the edges clear. Then, the entire edge contour of the workpiece is extracted using classic edge detection operators (such as Canny and Sobel) to obtain a set of contour sequences composed of pixels. In theory, a burr-free contour should be smooth and may be composed of geometric elements such as straight lines, arcs, and spline curves. Therefore, this scheme attempts to perform geometric fitting on the extracted contour. For example, for a contour expected to be a straight line, the least squares method is used to fit an ideal straight line. Then, calculate each contour point. The distance to the fitted line (i.e., the deviation). .
[0005] If multiple consecutive points in a local area Exceeding the preset threshold If the deviations are consistent (both on the same side of the straight line), then the area is considered to have burrs. For curves, piecewise fitting or calculation of curvature changes is used. The advantage of this method is its simplicity and effectiveness for large, obvious burrs. However, its disadvantages are significant: First, its performance is highly dependent on the accuracy of edge extraction. Image noise, uneven lighting, and workpiece surface texture can all cause edge point position drift or produce false edges. These noise points can be misjudged as burrs, leading to a high false alarm rate. Second, the preset geometric model (straight line, arc) often cannot accurately describe complex actual contours (such as free curves), and the fitting error itself will produce a large error. Furthermore, it interferes with judgment. Finally, it cannot effectively distinguish between burrs and minor process features allowed on the contour (such as chamfers and fillets), and lacks semantic understanding capabilities.
[0006] (2) A method based on local grayscale / texture statistical analysis. This method does not rely directly on precise edge localization, but focuses on the image features of the edge region. The basic idea is to define a series of "scan lines" perpendicular to the edge on both sides of the extracted approximate edge line. The grayscale profile is analyzed along each scan line. In an ideal edge without burrs, the grayscale profile will show a relatively steep and regular transition. However, when burrs are present, abnormal fluctuations, protrusions, or secondary peaks and valleys will be generated on the grayscale profile due to the stereo occlusion or self-imaging of the burrs. By calculating the statistical features of the grayscale sequence of the scan lines, such as local variance, gradient amplitude distribution, energy of specific frequency bands, etc., and comparing them with the features of normal samples obtained from training, it is determined whether burrs exist. Another variant is to analyze the texture features of the local edge region, such as using the gray-level co-occurrence matrix (GLCM) to calculate contrast, entropy, etc., assuming that burr regions will destroy the consistency of the original background or material texture. This scheme has a certain tolerance for edge localization errors. However, its drawbacks are that feature design is highly empirical, requiring extensive adjustments for different workpiece materials, surface treatments, and lighting conditions. For weak burrs (those with low contrast in the image) or burrs similar to the background texture, feature differences are not obvious, making them easy to miss. Furthermore, this method also struggles to quantify the geometric dimensions of burrs (such as height and width).
[0007] (3) Deep learning-based semantic segmentation or object detection methods. With the rise of artificial intelligence, the direct use of deep learning models has become a trend. A common approach is to collect a large number of workpiece images containing and without burrs, perform pixel-level annotation (semantic segmentation) or bounding box annotation (object detection), and then train a convolutional neural network (CNN), such as U-Net or YOLO series. The trained model can directly input images and output the pixel-level location or bounding box of the burrs. This method avoids complex manual feature design to a certain extent and can learn more abstract burr patterns. However, it has specific bottlenecks when applied to burr detection on curves: First, the data annotation cost is extremely high. Pixel-level annotation of small, thin burrs is extremely time-consuming and laborious. Second, the model is sensitive to the distribution of training data. If the types, sizes, and locations of burrs in the training set are not diverse enough, the model's generalization ability is poor, and it may fail for burrs of new shapes or burrs appearing in new locations (such as inflection points of complex curves). Third, existing general segmentation / detection networks are not designed for the specific geometric relationship of "curve attachments". They may misidentify the contour itself, background noise, or surface defects unrelated to burrs as burrs, lacking explicit modeling of the topological relationship between the "main contour" and "attachment anomalies," leading to inaccurate logical judgments.
[0008] Based on the above analysis, the shortcomings of existing technologies in solving the specific problem of burr detection on curves can be summarized as follows: "Contour-noise" confusion problem: Traditional methods are severely limited by the quality of underlying image processing (edge extraction, grayscale analysis), and cannot effectively distinguish between real contour geometric information, imaging noise / texture and real burr signals, resulting in the coexistence of false alarms and false negatives.
[0009] The "feature-semantic" gap problem: Statistical feature-based methods and simple geometric analysis lack an understanding of the high-level semantics that "burrs are local protrusions attached to the smooth body contour," and cannot intelligently distinguish burrs from permissible process features (such as rounded corners and lettering).
[0010] The "data-generalization" dependency problem: Although deep learning methods can learn semantics, they rely heavily on a large amount of diverse labeled data, and the decision-making process inside the model is not transparent. For industrial inspection with high reliability and high accuracy requirements, its stability and interpretability are questionable.
[0011] The problem of the disconnect between "detection and quantification": Most methods can only determine the "presence" of burrs, making it difficult to accurately measure the physical dimensions of burrs (such as height and volume), which is crucial for process feedback and severity classification.
[0012] The "global-local" imbalance problem: Existing methods either focus too much on local pixel changes (which are susceptible to noise interference) or rely on global fitting (which cannot detect subtle local anomalies), lacking an effective mechanism that organically combines global contour prior knowledge with local anomaly detection. Summary of the Invention
[0013] This invention addresses the characteristics of burrs on curved contours, such as small scale, irregular shape, and susceptibility to confusion with noise and process textures. It proposes a detection approach based on reconstructing a baseline contour and analyzing deviation residuals. Unlike traditional methods that directly search for anomalies on the original image or original edge points, this invention first constructs a smooth main contour model unaffected by burrs and uses this model as a unified reference benchmark. Then, it systematically analyzes the differences between the actual observation results and this benchmark. Within this framework, burrs are no longer considered isolated local pixel anomalies but are explicitly modeled as local geometric and grayscale deviations attached to the main contour, thus giving subsequent detection and quantization clear geometric and physical meaning.
[0014] Based on the above concept, in a first aspect, the present invention provides a visual detection method for curve burrs based on main body contour reconstruction and residual analysis, comprising the following steps: S1, acquiring a workpiece image containing the curve contour to be detected, and performing region of interest extraction and preprocessing on the workpiece image; S2, based on the preprocessed image, iteratively reconstructing the curve contour using a robust fitting method to obtain a smooth main body contour free from the influence of burrs; S3, comparing the smooth main body contour with the original image, calculating multi-scale residual features characterizing local anomalies of the curve, and generating a residual feature map; S4, extracting candidate anomaly regions based on the residual feature map, and identifying and quantizing the candidate anomaly regions to achieve the detection and parameter output of burrs on the curve.
[0015] As an example, in step S1, after extracting the region of interest from the workpiece image, the region of interest image is sequentially processed by grayscale conversion, contrast enhancement, and noise reduction.
[0016] As an example, in step S2, an initial edge point set of the curve is extracted based on the preprocessed image, and the initial edge point set of the curve is fitted to the curve through an iterative weighted fitting method, so that the weight of abnormal points that deviate greatly from the main body contour is reduced during the fitting process, thereby obtaining a smooth main body contour that is not sensitive to burrs.
[0017] As an example, in step S2, when iteratively weighting the initial set of edge points of the curve, the weight of the edge point is not only related to the geometric distance from the edge point to the current fitted curve, but also to the consistency between the image gradient direction at the edge point and the normal direction of the current fitted curve at the corresponding position. Specifically, a joint weight function is constructed based on the distance from the edge point to the current fitted curve and the angle between the image gradient direction at the edge point and the normal direction of the fitted curve, and the edge points are weighted and fitted. The joint weight function is used to assign different weights to edge points with different angles between the gradient direction and the normal direction of the fitted curve.
[0018] As an example, in step S2, the iterative fitting process for the main body contour includes: dividing the curve parameter domain into several overlapping sub-segments; performing weighted curve fitting on the curve edge points falling into each sub-segment to obtain the corresponding local fitting curves; and introducing global consistency constraints on the basis of the local fitting curves to jointly optimize each local fitting curve so that each local fitting curve satisfies the continuity and smoothness constraints at adjacent sub-segments, thus forming the final smooth main body contour.
[0019] As an example, in step S3, by calculating the normal geometric deviation of pixels or sampling points in the image relative to the main contour and the gray-scale distribution anomaly along the main contour direction, multi-scale residual features characterizing local anomalies of the curve are generated, and a residual feature map is formed.
[0020] As an example, in step S4, abnormal candidate regions are extracted based on the residual feature map, and burrs are identified according to the residual amplitude, geometric scale and positional relationship of the candidate regions with the main body contour, and the corresponding size parameters and positional information are output.
[0021] A second aspect of the invention also provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device performs the method as described in any of the preceding claims.
[0022] A third aspect of the invention also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the method as described in any of the preceding claims.
[0023] A fourth aspect of the present invention also provides a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to implement the method as described in any of the preceding claims.
[0024] This invention achieves reliable identification and quantification of curve burrs by robustly reconstructing the main contour of the curve and combining the joint analysis of geometric residuals and grayscale residuals, without relying on precise templates and complex training models. It can stably distinguish between the main contour and burr areas in the presence of noise, texture interference and local anomalies, reduce the impact of burrs on contour reconstruction and detection results, and improve the applicability and engineering feasibility of burr detection for curved workpieces. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating a visual detection method for curve burrs based on main body contour reconstruction and residual analysis disclosed in an embodiment of the present invention.
[0026] Figure 2 This is a visualization example of intermediate results of the algorithm disclosed in an embodiment of the present invention; wherein, Figure 2 (a) is the original ROI diagram. Figure 2 (b) is the reconstructed main outline. Overlay image, Figure 2 (c) is the normal distance residual plot. , Figure 2 (d) is the fusion residual map .
[0027] Figure 3 This is the final result image of burr detection and annotation. Detailed Implementation
[0028] 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.
[0029] To address the systemic shortcomings mentioned in the background art, the present invention aims to provide an intelligent detection and quantification method for burrs on curves based on subject contour reconstruction and residual analysis. Specifically, this invention abandons the traditional approach of directly finding anomalies in noisy images or purely data-driven black-box prediction, instead employing an analytical generative model approach: First, from actual images that may contain burrs, a theoretically burr-free smooth subject contour is robustly reconstructed; then, the actual observation is compared with the reconstructed theoretical contour, and the difference (residual) is mainly attributed to anomalies such as burrs; finally, these residuals are intelligently analyzed to achieve burr localization, classification, and quantification. Specific objectives include: achieving highly robust subject contour reconstruction, insensitive to image noise and minute burrs; designing precise residual calculation and feature extraction methods to effectively highlight burr signals; establishing a lightweight intelligent discrimination model based on residual features to achieve high-precision, low-false-alarm detection; and developing a high-precision estimation algorithm for burr geometric parameters.
[0030] It should be noted that, to implement the solution of this invention, an industrial vision inspection system is pre-built. The hardware configuration includes, for example, a CMOS industrial camera, a low-angle ring light source, a polarizing light accessory, and a high-precision stabilizing fixture. The workpiece to be inspected (which can be a stamped part, injection molded part, or 3D printed part) is fixed using the stabilizing fixture to ensure that the workpiece's positional deviation during imaging does not exceed 0.01mm. The light source parameters are adjusted so that the light source is incident at a low angle to the workpiece surface, causing burrs to produce obvious shadows or bright edges, enhancing the contrast with the background and the main body contour. For workpieces made of highly reflective materials, the polarizing light accessory is used to suppress specular reflection, avoiding edge blurring caused by reflection. The camera exposure time is controlled to 8ms, and the gain coefficient is set to 1.2 to capture an original workpiece image containing the curve contour to be inspected. .
[0031] Please see Figure 1 , Figure 2 , Figure 3 This invention provides a visual detection method for curve burrs based on main body contour reconstruction and residual analysis, including the following steps: S1, acquiring a workpiece image containing the curve contour to be detected, and extracting and preprocessing the region of interest (ROI) of the workpiece image; in this step, firstly, the region of interest (ROI) where the curve contour to be detected is located is determined based on the known CAD model of the workpiece or through a rough positioning.
[0032] As an example, in step S1, after extracting the region of interest from the workpiece image, the region of interest image is sequentially processed by grayscale conversion, contrast enhancement, and noise reduction.
[0033] To improve the discernibility of the curve contour and its burr features in the image, the color ROI image is... The following steps are performed sequentially: grayscale conversion, contrast enhancement, and noise reduction.
[0034] Grayscale processing: First, the color ROI image is processed... Grayscale conversion is performed to eliminate the influence of color information on subsequent edge and contour analysis. The grayscale conversion process uses a weighted average method, summing the red, green, and blue channels of the original color image according to human visual sensitivity. The conversion formula is as follows: .in, , , These represent the red, green, and blue channel pixel values of the corresponding pixel in the original color image, respectively. This represents the pixel value after grayscale conversion. Through the above grayscale processing, a single-channel grayscale image is obtained. Understandably, this weighted grayscale method can reduce the interference of color changes on subsequent processing steps while preserving the brightness information of the main outline and burr structure.
[0035] Contrast enhancement processing: In obtaining grayscale images Subsequently, to further enhance the grayscale difference between the curve contour, burr area, and background, the grayscale image undergoes contrast enhancement processing. In this embodiment, a contrast-limited adaptive histogram equalization (CLAHE) algorithm is employed. Specifically, the grayscale image is divided into 10×10 local blocks, and histogram equalization is performed within each local block. Simultaneously, a contrast limit parameter of 2.5 is set to suppress noise amplification caused by over-enhancement. Through the above CLAHE processing, the local contrast between the burr area, the subject contour edge, and the background is effectively enhanced while maintaining overall brightness stability. After contrast enhancement processing, the enhanced image is obtained. .
[0036] Noise Reduction: Due to the unavoidable random noise, surface micro-textures, and uneven illumination in industrial imaging environments, noise reduction is necessary to avoid adverse effects on subsequent contour reconstruction and residual calculation. Noise reduction processing is performed.
[0037] This embodiment employs a non-local means (NLM) algorithm for image denoising, setting the filter window size to 9×9 and the similarity weight parameter to h=12. This algorithm searches the entire image for regions with similar structures to the current pixel's neighborhood and updates the pixel value using a weighted average of these regions, thus fully utilizing redundant information in the image to achieve denoising. It is understood that non-local means filtering effectively smooths random noise and weak textures while preserving sharp edges and local protrusions corresponding to burrs, avoiding weakening or loss of burr information during denoising.
[0038] After noise reduction, the preprocessed image is obtained. It is more suitable for stable edge point extraction in terms of grayscale distribution and noise level, and can be used as the input image for subsequent robust reconstruction of the main body contour and residual analysis.
[0039] S2. Based on the preprocessed image, a robust fitting method is used to iteratively reconstruct the curve contour to obtain a smooth main body contour that eliminates the influence of burrs. As an example, in step S2, the initial edge point set of the curve is extracted based on the preprocessed image, and the initial edge point set of the curve is fitted to the curve through an iterative weighted fitting method, so that the weight of the outliers that deviate from the main body contour is reduced during the fitting process, thereby obtaining a smooth main body contour that is not sensitive to burrs.
[0040] The goal of this step is to improve the preprocessed image. The smooth body contour after removing the burr effect is estimated. Specifically, as follows: in the preprocessed image Above, an edge detection method that is insensitive to noise and can maintain edge continuity (such as a phase-consistency-based edge detection method) is used to extract the initial set of edge points of the curve, denoted as . This method is more robust to changes in illumination and contrast compared to the traditional Canny operator.
[0041] Iterative reweighted least squares (IRLS) is used to fit B-spline curves to the initial edge point set. Let the B-spline curve be represented as... .in, As basis functions, These are the coordinates of the corresponding control points.
[0042] Initially, utilize all edge points Perform ordinary least squares fitting to obtain the initial curve. Then the iterative process begins. In the... In each iteration, for each edge point Calculate its distance to the current curve Euclidean distance ,in, For point In the curve The parameters corresponding to the nearest point.
[0043] According to distance Calculate weights The weighting function is a Gaussian weighting function; the greater the distance to a point (which may correspond to a spike or noise point), the smaller its weight. This is a scale parameter used to control the degree of suppression of outliers.
[0044] Under the aforementioned weights, the objective function is minimized using the weighted least squares method: Among them, the regularization term Used to ensure the smoothness of the curve. This represents the regularization coefficient. By solving this objective function and updating the control points, a new curve is obtained. .
[0045] Repeat the above iterative steps until the change in the curve control points is less than a preset threshold or the maximum number of iterations is reached. The final convergence curve is denoted as... Because the burr points are gradually assigned smaller weights during the iteration process, the resulting main outline... It is not sensitive to burrs and can approximate the ideal contour in the burr-free state quite well.
[0046] Under weight constraints, construct a weighted least squares objective function: The regularization term is used to constrain the second derivative of the curve, suppressing high-frequency oscillations caused by local outliers, so that the reconstructed curve maintains a smooth and continuous morphological feature as a whole.
[0047] By continuously iterating and updating control points The iteration terminates when the results of two consecutive iterations meet the preset convergence condition, ultimately obtaining a smooth main body contour that is insensitive to burrs. Preset convergence conditions include, for example, changes in the curve control points being less than a threshold or reaching the maximum number of iterations.
[0048] Understandably, because the distance between spur points is much greater than that of noise, their weights will decay sharply during iteration, thus affecting the fitted values. It is not sensitive to burrs and can approximate the ideal burr-free profile quite well.
[0049] S3. Compare the smooth main body contour with the original image, calculate the multi-scale residual features that characterize the local anomalies of the curve, and generate a residual feature map. As an example, in step S3, by calculating the normal geometric deviation of pixels or sampling points in the image relative to the main body contour and the gray-level distribution anomalies along the direction of the main body contour, multi-scale residual features that characterize the local anomalies of the curve are generated, and a residual feature map is formed.
[0050] In this step, the main outline is obtained. Then, it is compared with the original image information to generate a residual image representing local anomalies. This step is the second key innovation of this invention, specifically including the generation of two complementary residual images.
[0051] (1) Normal distance residual diagram For each pixel within the ROI Calculate its outline to the main body. The signed normal distance. First, find the pixel. In the curve The nearest point on And calculate the unit normal vector at that point. , where the normal vector The positive direction pointing outside the contour is defined. Then the signed distance is defined as... .
[0052] exist Generate a normal distance residual image within a strip-shaped neighborhood (e.g., ±10 pixels). Its pixel value Pixels outside the neighborhood are set to zero. In an ideal, glitch-free environment... The contour should have continuous positive and negative areas on both sides, and the middle area should have a certain width; while burrs are manifested as "protrusions" or "depressions" that significantly deviate from zero values in local areas within this band-shaped region.
[0053] (2) Tangent gray-scale gradient residual map Considering that burrs not only cause positional shifts in images but also alter local grayscale distributions (producing shadows or bright spots), we further define grayscale residual features along the normal direction.
[0054] for Each sampling point on Extract a grayscale profile along its normal direction. The grayscale variation on this cross-section is analyzed. For a smooth edge without burrs, the grayscale cross-section typically exhibits monotonic or near-monotonic variation. A reference cross-section is obtained by fitting the ideal cross-section with a smooth edge model (such as an error function ERF convolution). .
[0055] Gray residual is defined as Each sampling point The corresponding grayscale residual values are mapped onto the image coordinate system to form a grayscale residual image. The presence of burrs disrupts the smoothness of the grayscale profile, thus leading to... A significant increase was observed in the corresponding region.
[0056] Subsequently, and Normalization and linear fusion are performed to obtain multi-scale geometric residual feature maps: ,in, , These are the weighting coefficients. The residual plot after fusion. It combines information from both geometric position deviation and texture appearance anomalies.
[0057] S4. Based on the residual feature map, candidate abnormal regions are extracted, and the candidate abnormal regions are identified and quantified to realize the detection of burrs on the curve and parameter output.
[0058] As an example, in step S4, abnormal candidate regions are extracted based on the residual feature map, and burrs are identified according to the residual amplitude, geometric scale and positional relationship of the candidate regions with the main body contour, and the corresponding size parameters and positional information are output.
[0059] In this step, the fusion residual map is... The analysis is performed to identify and quantify burrs.
[0060] First of all, Adaptive thresholding methods (such as the Otsu method) or simple magnitude thresholding are applied to extract connected candidate regions. Each candidate region corresponds to a potential anomalous region.
[0061] Subsequently, for each candidate region Extracting feature vectors Including: Geometric features: from For example, the average signed distance within the region Maximum absolute distance Area, perimeter, and elongation (aspect ratio); grayscale characteristics: from Examples include the average grayscale residual intensity and the maximum grayscale residual intensity within the region; contextual features: region In the main outline The projection length and the centroid of the region are on the projection length. The distance between regions, and the relationship between the region and its neighboring regions.
[0062] The aforementioned features are input into a lightweight classifier (such as a Support Vector Machine (SVM) or Gradient Boosting Decision Tree (GBDT) for classification. This classifier is trained using historical labeled data and only needs to label whether burrs exist in the image and their approximate areas, without requiring precise pixel-level labeling.
[0063] For areas classified as burrs, further quantitative measurements are performed, including: size: the area within... The thickness in the image can approximately reflect the protrusion height of the burr in the normal direction; the projection length of the region along the main contour direction reflects the width of the burr; location: the region is within the main contour parameters. The position on the top is used to give the precise location of the burr along the contour; the severity rating: combined with parameters such as protrusion height and width, the severity of the burr is graded as slight, moderate or severe.
[0064] Finally, the system outputs an inspection report with burr location markers, classification results, and quantification parameters, and can trigger alarms or execute subsequent sorting actions as needed.
[0065] As an example, in step S2, when iteratively weighting the initial set of edge points of the curve, the weight of the edge point is not only related to the geometric distance from the edge point to the current fitted curve, but also to the consistency between the image gradient direction at the edge point and the normal direction of the current fitted curve at the corresponding position. Specifically, a joint weight function is constructed based on the distance from the edge point to the current fitted curve and the angle between the image gradient direction at the edge point and the normal direction of the fitted curve, and the edge points are weighted and fitted. The joint weight function is used to assign different weights to edge points with different angles between the gradient direction and the normal direction of the fitted curve.
[0066] In this implementation, during step S2, when iteratively weighting the initial set of edge points of the curve, a weight constraint mechanism based on directional consistency is introduced to assign differentiated weights to different edge points during the fitting process.
[0067] Specifically, the initial edge point set of the curve is extracted based on the preprocessed image. ,in Indicates the first The edge point. In the iterative fitting... In the next iteration, let the current fitted curve be... Then the edge points can be calculated. Normal geometric distance to the current fitted curve .
[0068] At the same time, at the edge point At this point, the image gradient vector is calculated based on the preprocessed grayscale image. And based on this, determine the gradient direction at the edge point. For the current fitted curve At the edge point At the corresponding location, calculate the unit normal direction of the curve. And from this, the normal direction angle of the fitted curve is obtained. Then, the angle between the image gradient direction and the curve normal direction is calculated. .
[0069] Based on this, a joint weight function is constructed. .in, The weighting function is based on geometric distance. This is a weighting function based on directional consistency.
[0070] It is understandable that the main contour of the curve has continuity in both spatial location and directional characteristics, while local anomalies such as burrs usually exhibit characteristics inconsistent with the main contour in terms of directional distribution. By introducing both distance and direction terms into the weighting construction, the weights of edge points participating in the fitting process are affected not only by the degree of spatial deviation but also by local directional characteristics, thereby enabling the fitting process to have a more refined discriminative ability at the weighting level.
[0071] Subsequently, based on the joint weight function, weighted curve fitting is performed on the initial edge point set of the curve, the curve parameters are updated, and the above process is repeated until the preset iteration termination condition is met, thus completing the iterative reconstruction of the main contour.
[0072] In the above manner, during the iterative fitting process in step S2, the spatial positional relationship and orientation information of the edge points are used to participate in the weight calculation, thereby completing the reconstruction of the main body contour.
[0073] As another example, in step S2, the iterative fitting process for the main body contour includes: dividing the curve parameter domain into several overlapping sub-segments, performing weighted curve fitting on the curve edge points falling into each sub-segment to obtain the corresponding local fitting curves; and introducing global consistency constraints on the basis of the local fitting curves to jointly optimize each local fitting curve so that each local fitting curve satisfies the continuity and smoothness constraints at adjacent sub-segments, thus forming the final smooth main body contour.
[0074] In another example of this implementation, in step S2, the iterative fitting process of the main body contour adopts a two-layer fitting mechanism with joint constraints of segmented consistency and global smoothness.
[0075] Specifically, firstly in the curve parameter domain The parameter domain is divided into several overlapping sub-segments by performing interval partitioning. ,in, Each sub-segment corresponds to a continuous parameter range of the curve, used to limit the scope of local fitting.
[0076] In each sub-segment Within this sub-segment, select the set of initial edge points of the curve whose parameter values fall within that sub-segment. Then, using the weighted fitting method of step S2, the corresponding local fitting curves are obtained respectively. .
[0077] After completing the local fitting within each sub-segment, a global consistency constraint is introduced to jointly optimize all locally fitted curves. The global consistency constraint uses the consistency of curves within the overlapping areas of adjacent sub-segments as the constraint condition, and its constraint form can be expressed as: ,in, This represents the local fitting error term within each sub-segment. This represents the continuity and smoothness constraints of the fitted curves of adjacent sub-segments within the overlapping region. These are the weighting coefficients used to balance local and global terms.
[0078] It is understandable that the main contour of the curve has a continuous and smooth structural characteristic as a whole, but there may be curvature variations or uneven distribution of edge points in local areas. By modeling independently in local sub-segments and applying consistency constraints at the global level, both local expressiveness and overall continuity requirements can be considered at the parametric modeling level.
[0079] After completing the joint optimization, the local fitting curves in each sub-segment are integrated to form a smooth main outline covering the entire parameter domain, which is the final output of step S2.
[0080] This invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device performs the method as described in any of the preceding claims.
[0081] This invention also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the method as described in any of the preceding claims.
[0082] This invention also provides a computer program product or computer program, the computer program product or computer program including computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the method as described in any of the preceding claims.
[0083] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A curve burr visual detection method based on subject contour reconstruction and residual error analysis, characterized in that, The methods and steps include the following: S1. Obtain a workpiece image containing the contour of the curve to be detected, and perform region of interest extraction and preprocessing on the workpiece image; S2. Based on the preprocessed image, a robust fitting method is used to iteratively reconstruct the curve contour to obtain a smooth main body contour that eliminates the influence of burrs. S3. Compare the smooth main body contour with the original image, calculate the multi-scale residual features that characterize the local anomalies of the curve, and generate a residual feature map; S4. Based on the residual feature map, candidate abnormal regions are extracted, and the candidate abnormal regions are identified and quantified to realize the detection of burrs on the curve and parameter output. In step S2, an initial edge point set of the curve is extracted based on the preprocessed image, and the initial edge point set of the curve is fitted by an iterative weighted fitting method, so that the weight of abnormal points that deviate from the main contour is reduced during the fitting process, thereby obtaining a smooth main contour that is not sensitive to burrs. In step S2, when iteratively weighting the initial set of edge points of the curve, the weight of each edge point is related not only to the geometric distance from the edge point to the current fitted curve, but also to the consistency between the image gradient direction at the edge point and the normal direction of the current fitted curve at the corresponding position. Specifically: Based on the distance from the edge point to the current fitted curve and the angle between the gradient direction of the image at the edge point and the normal direction of the fitted curve, a joint weight function is constructed to perform weighted fitting on the edge points. The joint weight function assigns different weights to edge points with different angles between their gradient directions and the normal direction of the fitted curve. Its expression is as follows: ,in, The weighting function is based on geometric distance. This is a weighting function based on directional consistency; This represents the number of iterations. For edge points The normal geometric distance to the currently fitted curve; The angle between the image gradient direction and the curve normal direction; The edge point number; In step S2, the iterative fitting process for the main body contour includes: The curve parameter domain is divided into several overlapping sub-segments. Within each sub-segment, weighted curve fitting is performed on the curve edge points falling into that sub-segment to obtain the corresponding local fitting curves. Based on the local fitting curves, global consistency constraints are introduced to jointly optimize each local fitting curve, so that each local fitting curve satisfies the continuity and smoothness constraints at adjacent sub-segments, forming the final smooth main outline. The global consistency constraint uses the curve consistency within the overlapping area of adjacent sub-segments as the constraint condition, and its constraint form can be expressed as: ,in, This represents the local fitting error term within each sub-segment. This represents the continuity and smoothness constraints of the fitted curves of adjacent sub-segments within the overlapping region. These are the weighting coefficients used to balance local and global terms; , The first , The local fitting curves corresponding to each sub-segment.
2. The method for visual detection of curve burrs based on subject contour reconstruction and residual analysis according to claim 1, characterized in that: In step S1, after extracting the region of interest from the workpiece image, the region of interest image is sequentially processed by grayscale conversion, contrast enhancement, and noise reduction.
3. The method for visual detection of curve burrs based on subject contour reconstruction and residual analysis according to claim 1, characterized in that: In step S3, by calculating the normal geometric deviation of pixels or sampling points in the image relative to the main contour and the gray-level distribution anomaly along the main contour direction, multi-scale residual features characterizing local anomalies of the curve are generated, and a residual feature map is formed.
4. The curve burr visual detection method based on body contour reconstruction and residual error analysis according to claim 1, characterized in that: In step S4, abnormal candidate regions are extracted based on the residual feature map, and burrs are identified according to the residual amplitude, geometric scale and positional relationship of the candidate regions with the main body contour, and the corresponding size parameters and positional information are output.
5. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that: When the processor executes the computer program, it causes the electronic device to implement the method as described in any one of claims 1-4.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the method as described in any one of claims 1 to 4.
7. A computer program product, characterised in that, The computer program product comprises computer instructions stored in a computer readable storage medium; a processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to implement the method according to any one of claims 1 to 4.