Prism processing defect detection method and system based on contour feature matching

By using a detection method based on contour feature matching, the problem of inaccurate contour feature extraction in prism processing defect detection is solved, and accurate identification and efficient positioning of edge length and corner angle are achieved, thus improving the accuracy and reliability of detection.

CN122289272APending Publication Date: 2026-06-26SUZHOU PRECISION OPTOELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-28
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing prism processing defect detection technologies suffer from inaccurate contour feature extraction, low efficiency in identifying edge and corner defects, and insufficient defect positioning accuracy, making it difficult to meet the requirements of high-precision detection.

Method used

A detection method based on contour feature matching is adopted, including grayscale and binarization segmentation, multi-layer Gaussian filtering, curvature characterization value analysis, parallel feature descriptor splicing and difference comparison, to generate defect distribution maps of areas with abnormal edge length and abnormal edge angle.

Benefits of technology

It significantly improves the completeness and accuracy of contour feature extraction, quickly generates stable prism contour feature vectors, realizes efficient localization and accurate discrimination of prism processing defects, and improves detection accuracy and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289272A_ABST
    Figure CN122289272A_ABST
Patent Text Reader

Abstract

This invention relates to the field of optical component inspection technology, specifically disclosing a method and system for detecting prism manufacturing defects based on contour feature matching. The method includes: acquiring a surface image of the target prism, sequentially performing grayscale and binarization segmentation to obtain a binarized prism image; extracting the original contour point set through contour tracking; applying multi-level Gaussian filtering to the point set to calculate curvature characterization values, thereby segmenting the original contour point set into a straight line segment contour subset and a corner point contour subset; establishing straight line feature descriptors and corner point feature descriptors in parallel, and concatenating the features to obtain a contour feature vector; simultaneously acquiring the theoretical contour feature vector, comparing the differences between the two item by item to identify abnormal edge length regions and abnormal edge angle regions; finally, integrating the spatial locations of these two types of abnormal regions to generate a manufacturing defect distribution map, thereby marking the defect location and defect type of the target prism; this invention can improve the accuracy of prism manufacturing defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical component inspection technology, and in particular to a method and system for detecting defects in prism manufacturing based on contour feature matching. Background Technology

[0002] Currently, most prism processing defect detection methods use traditional image contour extraction and simple feature matching. In the precise detection of edges and corners, there are common problems such as insufficient feature extraction, inaccurate contour segmentation, and low defect judgment efficiency, which make it difficult to meet the actual requirements of high-precision detection of optical prisms.

[0003] For example, conventional contour processing does not extract straight edges and corners separately. Using only a single scale filter can easily blur the key information of corner points. When compared with standard contours, edge length deviation, corner angle deviation, and misjudgment often occur. Moreover, feature calculation is performed sequentially, resulting in slow detection speed and insufficient positioning accuracy.

[0004] Therefore, existing detection technologies generally suffer from inaccurate contour feature representation, poor defect identification stability, and low efficiency and accuracy of automated detection, which cannot meet the needs of efficient and high-precision prism processing and inspection. Summary of the Invention

[0005] This invention provides a method and system for detecting defects in prism processing based on contour feature matching, in order to solve the problems mentioned in the background art, such as inaccurate extraction of prism contour features, low efficiency in distinguishing edge and corner defects, and insufficient defect positioning accuracy.

[0006] To achieve the above objectives, the present invention provides a prism processing defect detection method based on contour feature matching, comprising: S1: Acquire the surface image of the target prism, perform grayscale and binarization segmentation on the surface image to obtain the binarized prism image of the target prism; S2: Perform contour tracking on the binarized prism image to obtain the original contour point set of the target prism; S3: Perform multi-level Gaussian filtering on the original contour point set, obtain the curvature characterization value of the pixel in the filtering result, and divide the original contour point set into a straight line segment contour subset and a corner point contour subset through the curvature characterization value. S4: Construct the line feature descriptor of the line segment contour subset and the corner feature descriptor of the corner point contour subset in parallel, and perform feature concatenation on the line feature descriptor and the corner feature descriptor to obtain the contour feature vector of the target prism. S5: Obtain the theoretical contour feature vector of the standard prism, and compare the contour feature vector with the theoretical contour feature vector by item-by-item difference to obtain the abnormal edge length region and abnormal edge angle region of the target prism. S6: Spatial location integration of the abnormal edge length region and the abnormal edge angle region to generate a processing defect distribution map of the target prism, so as to mark the defect location and defect type of the target prism.

[0007] In a preferred embodiment, acquiring a surface image of the target prism and performing grayscale and binarization segmentation on the surface image to obtain a binarized prism image of the target prism includes: Acquire a surface image of the target prism, and decompose the surface image into a red channel image, a green channel image, and a blue channel image; By using preset grayscale weighting coefficients, the red channel image, the green channel image, and the blue channel image are weighted and summed pixel by pixel to generate the grayscale prism image of the target prism; The gray-level histogram of the gray-level prism image is statistically analyzed, the valley regions in the gray-level histogram are identified, and the gray level corresponding to the minimum gray-level frequency value in the valley region is used as the segmentation threshold. In the grayscale prism image, pixels with grayscale values ​​not greater than the segmentation threshold are set as first grayscale values, and pixels with grayscale values ​​less than the segmentation threshold are set as second grayscale values, thus obtaining the binarized prism image.

[0008] In a preferred embodiment, the step of contour tracing the binarized prism image to obtain the original contour point set of the target prism includes: The binarized prism image is scanned line by line, and unmarked foreground pixels in the binarized prism image are detected as starting boundary points; Using the starting boundary point as the current tracking point, search for adjacent boundary pixels in the binarized prism image in a clockwise direction through eight neighborhoods; Using the boundary pixel as the new current tracking point, continue searching for the next adjacent boundary pixel in a clockwise direction according to the eight neighborhoods until returning to the starting boundary point, thus obtaining the closed contour path of the binarized prism image. All recorded boundary pixels on the closed contour path are arranged in the tracking order to form the original contour point set of the target prism.

[0009] In a preferred embodiment, performing multi-level Gaussian filtering on the original contour point set includes: Obtain the two-dimensional coordinate sequence of all pixels in the original contour point set; Set the first Gaussian filter scale parameter, the second Gaussian filter scale parameter, and the third Gaussian filter scale parameter respectively, wherein the values ​​of the three scale parameters increase sequentially; By applying the first Gaussian filter scale parameter, the two-dimensional coordinate sequence is Gaussian smoothed once to generate the first filtered point set of the original contour point set; Based on the second Gaussian filter scale parameter, the first filter point set is subjected to secondary Gaussian smoothing to obtain the second filter point set of the original contour point set. Based on the third Gaussian filter scale parameter, the second filter point set is subjected to three Gaussian smoothings to obtain the third filter point set of the original contour point set.

[0010] In a preferred embodiment, obtaining the curvature representation value of the pixels in the filtering result, and segmenting the original contour point set into a straight line segment contour subset and a corner point contour subset using the curvature representation value, includes: The change in orientation angle between each pixel in the third filter point set and its neighboring pixels is obtained, and the change in orientation angle is used as the curvature characterization value of the pixel. By traversing the curvature representation values ​​of the pixels along the contour order of the third filter point set, the local maxima of the third filter point set are determined. The local maxima points are marked as corner candidate points, and the index positions of the corner candidate points in the original contour point set are recorded; Using the index position as the dividing boundary, the sequence of consecutive pixels between every two adjacent corner candidate points in the original contour point set is extracted into a straight line segment contour subset; The corner candidate points and a predetermined number of surrounding pixels are extracted into a corner contour subset, resulting in a straight line segment contour subset and a corner contour subset of the original contour point set.

[0011] In a preferred embodiment, the step of simultaneously establishing the line feature descriptors of the line segment contour subset and the corner feature descriptors of the corner point contour subset, and then concatenating the line feature descriptors and the corner feature descriptors to obtain the contour feature vector of the target prism, includes: Extract the length of the line segment in the line segment contour subset and the direction angle of the line connecting the two corner points of the line segment, and combine the length and the direction angle of the line to form the line feature descriptor of the line segment contour subset; Extract the included angle between two adjacent line segments corresponding to a corner point in the corner point contour subset, and the arc distance between the corner point and its adjacent corner points, and combine the included angle and the arc distance into a corner point feature descriptor for the corner point contour subset; Based on the original contour order of the target prism, the line segment feature descriptors and the corner point feature descriptors are alternately arranged to obtain the initial feature sequence of the target prism; The initial feature sequence is normalized, and the normalized vectors are connected in sequence to form the contour feature vector of the target prism.

[0012] In a preferred embodiment, the step of obtaining the theoretical contour feature vector of the standard prism and comparing the contour feature vector with the theoretical contour feature vector through item-by-item difference to obtain the abnormal edge length region and abnormal edge angle region of the target prism includes: Extract the contour edge image of a standard prism, and perform line segment detection and corner point detection on the contour edge image to obtain the theoretical contour feature vector of the standard prism. The theoretical contour feature vector includes the theoretical line segment length value and the theoretical corner point angle value. The length values ​​of the line segments in the line feature descriptors of the contour feature vector are compared with the theoretical length values ​​of the line segments. If the difference between the length value of the straight line segment and the theoretical length value of the straight line segment is greater than a preset length difference threshold, then the spatial region corresponding to the straight line feature descriptor on the target prism is marked as an abnormal edge length region. The preset length difference threshold is set according to the statistical distribution of edge length errors corresponding to multiple qualified prism samples. The corner angle value of the corner feature descriptor in the contour feature vector is compared with the theoretical corner angle value. If the difference between the included angle value of the corner point and the included angle value of the theoretical corner point is greater than the preset angle difference threshold, then the spatial region corresponding to the corner point feature descriptor on the target prism is marked as an abnormal corner angle region. The preset angle difference threshold is set according to the statistical distribution of the angle errors corresponding to the multiple qualified prism samples.

[0013] In a preferred embodiment, the step of spatially integrating the abnormal edge length region and the abnormal edge angle region to generate a processing defect distribution map of the target prism, thereby marking the defect location and defect type of the target prism, includes: The pixel coordinates on the abnormal straight line segments in the abnormal edge length region are mapped to the coordinate system of the surface image to obtain the first coordinate set of the abnormal edge length region. Map the pixel coordinates of the abnormal corner points in the abnormal corner angle region to the coordinate system to obtain the second coordinate set of the abnormal corner angle region; Create a blank layer with the same size as the surface image; On the blank layer, the pixels in the first coordinate set are marked with a first color, and the pixels in the second coordinate set are marked with a second color to obtain the color layer of the target prism, wherein the first color and the second color are different. The color layer and the surface image are fused at the pixel level to output a processing defect distribution map of the target prism; Based on the processing defect distribution map of the target prism, the defect location and defect type of the target prism are marked, wherein the first color is used to indicate the location of edge length defects, and the second color is used to indicate the location of edge angle defects.

[0014] To address the above problems, the present invention also provides a prism processing defect detection system based on contour feature matching, the system comprising: The data processing module is used to acquire the surface image of the target prism, perform grayscale and binarization segmentation on the surface image, and obtain the binarized prism image of the target prism. The contour tracking module is used to perform contour tracking on the binarized prism image to obtain the original contour point set of the target prism; The feature segmentation module is used to perform multi-level Gaussian filtering on the original contour point set, obtain the curvature representation value of the pixel in the filtering result, and segment the original contour point set into a straight line segment contour subset and a corner point contour subset through the curvature representation value. The parallel stitching module is used to establish the straight line feature descriptors of the straight line segment contour subset and the corner feature descriptors of the corner point contour subset in parallel, and to stitch the straight line feature descriptors and the corner point feature descriptors together to obtain the contour feature vector of the target prism. The anomaly detection module is used to obtain the theoretical contour feature vector of the standard prism, and compare the contour feature vector with the theoretical contour feature vector item by item to obtain the abnormal edge length and abnormal edge angle regions of the target prism. The defect location module is used to integrate the spatial locations of the abnormal edge length area and the abnormal edge angle area to generate a processing defect distribution map of the target prism, so as to mark the defect location and defect type of the target prism.

[0015] Compared with the prior art, the present invention has the following beneficial effects: This invention performs multi-layer Gaussian filtering and curvature characterization analysis on the prism contour point set, which can accurately segment the straight line contour and corner contour, significantly improving the completeness and accuracy of contour feature extraction. By constructing and splicing two types of feature descriptors in parallel, a stable and unified prism contour feature vector can be quickly generated, effectively improving the detection calculation efficiency.

[0016] This invention accurately identifies areas with abnormal edge lengths and angles by comparing the measured contour feature vectors with the standard theoretical vectors item by item. After spatial location integration, a defect distribution map is generated, which can intuitively mark the location and type of defects, achieving efficient positioning and accurate identification of defects in prism processing, and improving the overall accuracy and reliability of defect detection. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating a prism processing defect detection method based on contour feature matching according to an embodiment of the present invention. Figure 2 A functional block diagram of a prism processing defect detection system based on contour feature matching provided in an embodiment of the present invention; Figure 3 The threshold segmentation grayscale histogram of a prism processing defect detection method based on contour feature matching provided in an embodiment of the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0018] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0019] This application provides a method for detecting defects in prism manufacturing based on contour feature matching. The execution entity of this method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the method for detecting defects in prism manufacturing based on contour feature matching can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0020] Reference Figure 1The diagram shown is a flowchart illustrating a prism manufacturing defect detection method based on contour feature matching according to an embodiment of the present invention. In this embodiment, the prism manufacturing defect detection method based on contour feature matching includes: S1: Acquire the surface image of the target prism, perform grayscale and binarization segmentation on the surface image to obtain the binarized prism image of the target prism; In this embodiment of the invention, acquiring a surface image of the target prism and performing grayscale and binarization segmentation on the surface image to obtain a binarized prism image of the target prism includes: Acquire a surface image of the target prism, and decompose the surface image into a red channel image, a green channel image, and a blue channel image; By using preset grayscale weighting coefficients, the red channel image, the green channel image, and the blue channel image are weighted and summed pixel by pixel to generate the grayscale prism image of the target prism; The gray-level histogram of the gray-level prism image is statistically analyzed, the valley regions in the gray-level histogram are identified, and the gray level corresponding to the minimum gray-level frequency value in the valley region is used as the segmentation threshold. In the grayscale prism image, pixels with grayscale values ​​not greater than the segmentation threshold are set as first grayscale values, and pixels with grayscale values ​​less than the segmentation threshold are set as second grayscale values, thus obtaining the binarized prism image.

[0021] It should be noted that the surface image of the target prism is acquired, and the surface image of the target prism is obtained. The color channel is split into red, green and blue channel images from the overall image. Each single channel image fully inherits the pixel distribution, contour structure and image details of the corresponding position in the original surface image.

[0022] Based on the pre-set grayscale weighting rules, each pixel in the red, green, and blue channel images is weighted and integrated one by one. The pixel information corresponding to the three color channels is fused and superimposed, removing the color dimension information of the image and uniformly transforming it into image information with a single grayscale dimension. Finally, a grayscale prism image that retains only the brightness and darkness grayscale features is generated.

[0023] Specifically, the grayscale weighting coefficients adopt the standard luminance conversion coefficients: the weight of the red channel is 0.299, the weight of the green channel is 0.587, and the weight of the blue channel is 0.114. For example, for a certain pixel, if its RGB values ​​are (120, 80, 200), then the grayscale value = 0.299×120 + 0.587×80 + 0.114×200 = 35.88 + 46.96 + 22.8 = 105.64, which is rounded to 106.

[0024] Furthermore, the grayscale weighting rule specifically includes: The grayscale distribution of all pixels in the grayscale prism image is comprehensively analyzed. Based on the frequency of pixel occurrence corresponding to different grayscale levels, a complete grayscale histogram is constructed. Based on the overall distribution pattern of the grayscale histogram, the valley regions where the frequency value drops are screened out. The grayscale level corresponding to the minimum frequency value in the valley region is extracted and used as the segmentation threshold for image segmentation.

[0025] Traverse all pixels in the grayscale prism image, compare the grayscale value of each pixel with the preset segmentation threshold, assign the first grayscale value to all pixels whose grayscale value is not greater than the segmentation threshold, and assign the second grayscale value to all pixels whose grayscale value is greater than the segmentation threshold. After completing the binarization assignment of all pixels in the image, a binarized prism image with accurate foreground and background segmentation is obtained.

[0026] As a practical data example, for a right-angle prism with dimensions of 30mm×30mm×30mm, its surface image (resolution 1280×1024 pixels) was acquired. The grayscale histogram after the above grayscale processing is shown below. Figure 3 As shown. Statistical analysis shows that within the grayscale range of 0-255, the foreground pixels of the prism are concentrated between grayscale levels 30-70, the background pixels are concentrated between grayscale levels 140-200, the trough region is located between grayscale levels 80-90, and the minimum frequency occurs at grayscale level 85, with a frequency value of 127. Therefore, a segmentation threshold T=85 is selected. Pixels with grayscale ≤85 are set to 255 (white, foreground), and pixels with grayscale >85 are set to 0 (black, background), resulting in a clear binarized prism image, providing high-quality input for subsequent contour tracking.

[0027] This application can stably generate a grayscale prism image with clear brightness and darkness by performing channel decomposition and weighted summation with fixed grayscale weights on the surface image, thus avoiding contour distortion caused by color interference.

[0028] By combining the valleys of the grayscale histogram to determine the segmentation threshold, the foreground and background can be adaptively distinguished, improving the accuracy of binarization segmentation. The entire process requires no manual intervention and has strong segmentation consistency, providing a reliable image foundation for subsequent contour tracking, feature extraction and defect detection, effectively improving the overall detection accuracy and stability.

[0029] S2: Perform contour tracking on the binarized prism image to obtain the original contour point set of the target prism; In this embodiment of the invention, the step of performing contour tracking on the binarized prism image to obtain the original contour point set of the target prism includes: The binarized prism image is scanned line by line, and unmarked foreground pixels in the binarized prism image are detected as starting boundary points; Using the starting boundary point as the current tracking point, search for adjacent boundary pixels in the binarized prism image in a clockwise direction through eight neighborhoods; Using the boundary pixel as the new current tracking point, continue searching for the next adjacent boundary pixel in a clockwise direction according to the eight neighborhoods until returning to the starting boundary point, thus obtaining the closed contour path of the binarized prism image. All recorded boundary pixels on the closed contour path are arranged in the tracking order to form the original contour point set of the target prism.

[0030] It is important to note that the entire binary prism image is scanned pixel by pixel in a top-down and left-to-right order. The attribute status of each pixel in the binary prism image is identified one by one. Pixels that have not been marked and belong to the foreground attribute are selected and directly determined as the starting boundary points required for contour tracking.

[0031] Using the selected starting boundary point as the reference point for contour trajectory tracking, the entire neighborhood range is defined around the eight adjacent directions of the reference point. Pixel points are checked one by one in the defined neighborhood range in a strict clockwise fixed turning order. Pixel points that are adjacent to the reference point and have boundary attributes are continuously screened from the binarized prism image.

[0032] Each round of search and identification of boundary pixels is replaced with a new contour trajectory follow-up reference point. The search rule of continuously maintaining a clockwise fixed direction of eight adjacent directions is continuously carried out to search for adjacent boundary pixels. The tracking is continuously extended along the edge of the binary prism image until the tracking path returns to the initially set starting boundary point position, completely enclosing and forming a closed contour path of the binary prism image without breaks or gaps. The coordinate offsets of the eight directions of the eight neighbors are as follows: (0,1), (-1,1), (-1,0), (-1,-1), (0,-1), (1,-1), (1,0), (1,1).

[0033] According to the sequence of contour tracing, all boundary pixels along the closed contour path that are recorded one by one are arranged in an orderly manner. All boundary pixels are completely collected and integrated according to the actual tracing sequence to form the original contour point set of the target prism that completely covers the edge shape of the target prism.

[0034] This application is approved. It uses line-by-line scanning to locate unmarked foreground pixels as starting boundary points, and continuously tracks boundary pixels in a clockwise direction using eight neighboring regions. This can generate a complete closed contour path without breaks or omissions, ensuring the integrity and continuity of contour extraction.

[0035] Arranging boundary pixels in the tracking order to form the original contour point set can accurately restore the true edge shape of the prism, providing a reliable point basis for subsequent multi-layer Gaussian filtering, curvature calculation and feature segmentation, and improving the stability of contour feature extraction and the accuracy of defect detection.

[0036] S3: Perform multi-level Gaussian filtering on the original contour point set, obtain the curvature characterization value of the pixel in the filtering result, and divide the original contour point set into a straight line segment contour subset and a corner point contour subset through the curvature characterization value. In this embodiment of the invention, performing multi-layer Gaussian filtering on the original contour point set includes: Obtain the two-dimensional coordinate sequence of all pixels in the original contour point set; Set the first Gaussian filter scale parameter, the second Gaussian filter scale parameter, and the third Gaussian filter scale parameter respectively, wherein the values ​​of the three scale parameters increase sequentially; By applying the first Gaussian filter scale parameter, the two-dimensional coordinate sequence is Gaussian smoothed once to generate the first filtered point set of the original contour point set; Based on the second Gaussian filter scale parameter, the first filter point set is subjected to secondary Gaussian smoothing to obtain the second filter point set of the original contour point set. Based on the third Gaussian filter scale parameter, the second filter point set is subjected to three Gaussian smoothings to obtain the third filter point set of the original contour point set.

[0037] The step of obtaining the curvature representation value of the pixels in the filtering result, and using the curvature representation value to segment the original contour point set into a straight line segment contour subset and a corner point contour subset, includes: The change in orientation angle between each pixel in the third filter point set and its neighboring pixels is obtained, and the change in orientation angle is used as the curvature characterization value of the pixel. By traversing the curvature representation values ​​of the pixels along the contour order of the third filter point set, the local maxima of the third filter point set are determined. The local maxima points are marked as corner candidate points, and the index positions of the corner candidate points in the original contour point set are recorded; Using the index position as the dividing boundary, the sequence of consecutive pixels between every two adjacent corner candidate points in the original contour point set is extracted into a straight line segment contour subset; The corner candidate points and a predetermined number of surrounding pixels are extracted into a corner contour subset, resulting in a straight line segment contour subset and a corner contour subset of the original contour point set.

[0038] It should be noted that the planar position information corresponding to all pixels within the original contour point set is extracted, and the planar position information of all pixels is organized and recorded in the order of the contour point arrangement to form a complete and coherent two-dimensional coordinate sequence.

[0039] Three independent and clearly defined smoothing control standards are defined, and the first, second and third Gaussian filter scale parameters are set sequentially. The three smoothing control standards are arranged in a fixed manner to gradually increase the adaptation range, so as to keep the overall arrangement gradient of the three smoothing control standards uniform and the level boundary clear.

[0040] Specifically, the first Gaussian filter scale parameter The value ranges from 0.5 to 1.0 pixels, representing the second Gaussian filter scale parameter. The value ranges from 1.5 to 2.5 pixels, representing the third Gaussian filter scale parameter. The value ranges from 3.0 to 5.0 pixels; Furthermore, the scale parameter is adaptively set based on the surface image resolution of the target prism and the minimum edge width of the prism, specifically as follows: , , ,in, The pixel value represents the length of the diagonal of the prism's circumscribed rectangle in the surface image.

[0041] Based on the smoothing range corresponding to the first Gaussian filter scale parameter, a global point regularization and modification operation is carried out on the two-dimensional coordinate sequence. According to the adjacent relationship of the contour points, the neighborhood position fusion and modification of each contour point in the two-dimensional coordinate sequence is performed to eliminate the subtle contour undulations inside the two-dimensional coordinate sequence. After the modification is completed, the first filter point set of the original contour point set is generated.

[0042] By applying the smoothing range corresponding to the second Gaussian filter scale parameter, neighborhood association trimming is performed again on all contour points within the first filter point set. The range of surrounding association modification is expanded to smoothly integrate the small contour offsets remaining in the first filter point set. After trimming, the second filter point set of the original contour point set is obtained.

[0043] Based on the smoothing range corresponding to the third Gaussian filter scale parameter, a larger-scale overall contour regularization process is carried out on the second filter point set. The positional correlation features of distant contour points within the second filter point set are fully integrated, and the smoothing calibration process of the overall contour trend is completed to obtain the third filter point set of the original contour point set.

[0044] It is important to note that all pixels in the third filter point set are selected sequentially, and the contour offset between each individual pixel and its front and rear adjacent pixels is compared. The directional deflection amplitude formed by the pixel and its front and rear neighboring pixels is quantized, and the quantized directional deflection amplitude is directly defined as the curvature representation value of the corresponding pixel.

[0045] For example, if the current pixel is P, the previous neighbor (the 5th point in front) is A, and the next neighbor (the 5th point behind) is B, calculate the direction angle θ1 of vector AP = 45° and the direction angle θ2 of vector PB = 47°. Then the change in direction angle is |47°-45°| = 2°. At the same time, calculate 360°-2° = 358°, and take the smaller value of 2° as the curvature representation value of the pixel.

[0046] All pixels are arranged sequentially according to the inherent contour layout of the third filter point set. The curvature representation value of each pixel is checked one by one along the contour extension direction. The curvature representation value of a single pixel is compared with that of its neighboring pixels. Pixels with curvature representation values ​​higher than all neighboring pixels are selected to accurately locate all local maxima within the third filter point set.

[0047] Specifically, the preceding and following neighboring pixels refer to a fixed number of pixels from the third to the seventh pixel in front of the current pixel along the contour sequence direction, and the same number of pixels behind it.

[0048] Furthermore, the specific calculation method for the change in orientation angle is as follows: calculate the orientation angle of the vector from the previous neighboring point to the current pixel, calculate the orientation angle of the vector from the current pixel to the next neighboring point, obtain two orientation angle values, calculate the absolute value of the difference between these two orientation angles, and subtract the absolute value from 360°, take the smaller value of the two, and use the smaller value as the curvature representation value of the current pixel.

[0049] The selected local maxima points are uniformly assigned attribute identifiers as corner candidate points. The ranking order of the corner candidate points in the overall point arrangement sequence of the original contour point set is determined, and the ranking order information is retained as a unique positioning identifier to complete the entire process of record keeping.

[0050] Based on the ranking order of the filing records, the boundary position of the contour segmentation is determined. Within the original contour point set, between two adjacent corner candidate points, all continuous and uninterrupted pixels are completely extracted to form a sequence structure, which is then separately split and organized to form a straight line segment contour subset.

[0051] Lock the pixel position of the corner candidate point, expand a fixed range around the corner candidate point to select a corresponding number of surrounding pixels, integrate the corner candidate point and the surrounding selected pixels into an independent sequence structure, split and sort to form a corner outline subset, and completely split and divide the original outline point set into the line segment outline subset and the corner outline subset.

[0052] Specifically, the predetermined quantity The number of pixels is between 5 and 11, and the number is related to the third Gaussian filter scale parameter. They are positively correlated, and the specific calculation formula is as follows: ,in, This represents the rounding function.

[0053] This application is approved. It employs a three-layer Gaussian smoothing process with progressively increasing scales, which can filter out noise jitter and minor burrs in the original contour point set while preserving the key structure of the prism contour. By sequentially generating the first, second, and third filter point sets, it achieves layered smoothing from fine to overall, avoiding corner blunting and contour distortion. This provides accurate and smooth point data for curvature characterization calculation, line segment and corner point segmentation, significantly improving the accuracy of subsequent feature extraction and defect judgment.

[0054] Using the change in pixel orientation angle of the third filter point set as the curvature characterization value, the degree of contour curvature can be accurately quantified. Local maxima are determined by traversing along the contour in sequence, which can stably locate corner candidate points. By segmenting the contour by index position, straight line segments and corner regions can be accurately separated, forming straight line segment contour subsets and corner contour subsets, realizing the structured decomposition of the contour. This provides accurate partitioning for subsequent parallel construction of feature descriptors, improving the accuracy of contour feature expression and the reliability of defect detection.

[0055] S4: Construct the line feature descriptor of the line segment contour subset and the corner feature descriptor of the corner point contour subset in parallel, and perform feature concatenation on the line feature descriptor and the corner feature descriptor to obtain the contour feature vector of the target prism. In this embodiment of the invention, the step of simultaneously establishing the line feature descriptors of the line segment contour subset and the corner feature descriptors of the corner point contour subset, and performing feature concatenation on the line feature descriptors and the corner feature descriptors to obtain the contour feature vector of the target prism, includes: Extract the length of the line segment in the line segment contour subset and the direction angle of the line connecting the two corner points of the line segment, and combine the length and the direction angle of the line to form the line feature descriptor of the line segment contour subset; Extract the included angle between two adjacent line segments corresponding to a corner point in the corner point contour subset, and the arc distance between the corner point and its adjacent corner points, and combine the included angle and the arc distance into a corner point feature descriptor for the corner point contour subset; Based on the original contour order of the target prism, the line segment feature descriptors and the corner point feature descriptors are alternately arranged to obtain the initial feature sequence of the target prism; The initial feature sequence is normalized, and the normalized vectors are connected in sequence to form the contour feature vector of the target prism.

[0056] It should be noted that the actual length of the overall extension span of the straight segments within the straight segment outline subset is measured, the positions of the two corner points of the straight segment outline subset are determined and the line connecting the two points is drawn, the directional information corresponding to the spatial extension direction of the connecting line is determined, and the measured length and directional information are integrated and collected into a fixed combination form to form the straight feature descriptor of the straight segment outline subset.

[0057] The extension direction of the two straight line segments connecting a single corner point within the corner point contour subset is determined. The opening deflection amplitude formed by the convergence of the two straight line segments is determined. The actual extension path of the contour curve path between a single corner point and its surrounding adjacent corner points is calculated along the actual direction of the contour edge. The determined opening deflection amplitude and the calculated contour curve path extension path are integrated and collected into a fixed combination form, and the corner point feature descriptor of the corner point contour subset is regularized.

[0058] According to the natural arrangement of points formed by the overall contour of the target prism, the straight line feature descriptors and corner feature descriptors are arranged in an orderly manner according to the arrangement pattern of alternating appearance of the contour structure. All feature descriptors are completely connected to form a continuous and regular arrangement sequence, which forms the initial feature sequence of the target prism.

[0059] The representation scale and range of all feature information within the initial feature sequence are standardized to eliminate the difference boundaries between different feature dimensions. After the scale standardization is completed, the feature information is arranged sequentially from beginning to end according to the original arrangement order. The whole is spliced ​​and combined to form the contour feature vector of the target prism with a fixed dimension structure and complete representation of the contour attributes.

[0060] It should be noted that the specific implementation of the parallel establishment is as follows: the straight line segment contour subset and the corner point contour subset are respectively assigned to two independent computing threads; the first thread is responsible for extracting the length of each straight line segment in the straight line segment contour subset and the direction angle of the line connecting the two corner points, generating a straight line feature descriptor; the second thread is responsible for extracting the included angle between the two adjacent straight line segments corresponding to each corner point in the corner point contour subset, as well as the arc distance between the corner point and the adjacent corner point, generating a corner point feature descriptor; the two threads are executed simultaneously, and after both threads are completed, the generated straight line feature descriptors and corner point feature descriptors are merged into the same memory space.

[0061] This application is approved. It establishes line feature descriptors and corner feature descriptors in parallel, which can simultaneously extract core features such as length, direction angle, included angle, and arc distance, thereby improving the efficiency of feature construction. By alternating and normalizing the original contours, a unified and dimensionally stable contour feature vector can be formed, which fully preserves the prism contour structure information, effectively improving the accuracy and speed of subsequent comparison with standard contour vectors, and enhancing the stability and reliability of defect identification.

[0062] S5: Obtain the theoretical contour feature vector of the standard prism, and compare the contour feature vector with the theoretical contour feature vector by item-by-item difference to obtain the abnormal edge length region and abnormal edge angle region of the target prism. In this embodiment of the invention, obtaining the theoretical contour feature vector of the standard prism, and comparing the contour feature vector with the theoretical contour feature vector item by item to obtain the abnormal edge length region and abnormal edge angle region of the target prism, includes: Extract the contour edge image of a standard prism, and perform line segment detection and corner point detection on the contour edge image to obtain the theoretical contour feature vector of the standard prism. The theoretical contour feature vector includes the theoretical line segment length value and the theoretical corner point angle value. The length values ​​of the line segments in the line feature descriptors of the contour feature vector are compared with the theoretical length values ​​of the line segments. If the difference between the length value of the straight line segment and the theoretical length value of the straight line segment is greater than a preset length difference threshold, then the spatial region corresponding to the straight line feature descriptor on the target prism is marked as an abnormal edge length region. The preset length difference threshold is set according to the statistical distribution of edge length errors corresponding to multiple qualified prism samples. The corner angle value of the corner feature descriptor in the contour feature vector is compared with the theoretical corner angle value. If the difference between the included angle value of the corner point and the included angle value of the theoretical corner point is greater than the preset angle difference threshold, then the spatial region corresponding to the corner point feature descriptor on the target prism is marked as an abnormal corner angle region. The preset angle difference threshold is set according to the statistical distribution of the angle errors corresponding to the multiple qualified prism samples.

[0063] It should be noted that the process involves fully acquiring the imaging content of the outer contour edge of a standard prism, obtaining the contour edge image corresponding to the standard prism, performing full-domain straight line structure recognition and contour inflection point recognition on the contour edge image, accurately identifying all effective straight line structures and corner structures inside the contour edge image, and constructing the theoretical contour feature vector of the standard prism based on the standard contour structure information. The theoretical contour feature vector fully includes two types of standard feature information: the length value of the theoretical straight line segment and the angle value of the theoretical corner point.

[0064] Furthermore, the standard prism refers to a defect-free physical prism that meets the tolerance requirements of the design drawings, or a standard contour edge image generated directly from the prism's design drawings. If a physical standard prism is used, the actual contour dimensions of the standard prism need to be pre-calibrated using high-precision measuring equipment, and the calibrated value is used as the theoretical value. If design drawings are used, a contour vector image is exported using computer-aided design software, and the vector image is converted into a binary image with the same resolution as the surface image. Then, line segment detection and corner point detection are performed on the binary image to extract the theoretical line segment length value and the theoretical corner point angle value. The theoretical contour feature vectors obtained in both methods need to be pre-stored in the system as a benchmark for subsequent item-by-item difference comparison.

[0065] The line feature descriptors contained in the contour feature vector of the target prism are retrieved. All line segment length values ​​recorded by the line feature descriptors are extracted one by one. All line segment length values ​​are matched to the theoretical line segment length values ​​stored in the theoretical contour feature vector to carry out a one-to-one numerical comparison and identification.

[0066] The numerical deviation between the length value of the straight line segment and the corresponding theoretical length value is determined. When the numerical deviation exceeds the preset length difference threshold, the physical spatial position of the straight line feature descriptor in the target prism entity structure is locked, and the anomaly identification processing is completed for the corresponding physical spatial position to form the abnormal edge length area of ​​the target prism.

[0067] Collect edge length detection data of a large number of qualified prism samples, statistically analyze the normal error fluctuation range generated during the edge length detection of qualified prism samples, and complete the calibration of a fixed numerical range based on the overall distribution law of error fluctuation. The calibrated fixed numerical range is directly used as the preset length difference threshold for anomaly judgment.

[0068] The corner feature descriptors contained in the contour feature vector of the target prism are retrieved. All corner angle values ​​recorded by the corner feature descriptors are extracted one by one. All corner angle values ​​are matched to the theoretical corner angle values ​​stored in the theoretical contour feature vector. A one-to-one numerical comparison and identification process is carried out.

[0069] The numerical deviation between the included angle value of the corner point and the corresponding theoretical included angle value is determined. When the numerical deviation exceeds the preset angle difference threshold, the physical spatial position of the corner feature descriptor in the target prism entity structure is locked, and the anomaly identification processing is completed for the corresponding physical spatial position to form the abnormal corner angle area of ​​the target prism.

[0070] Collect a large number of qualified prism samples and their angle detection data. Statistically analyze the normal error fluctuation range generated during the angle detection of qualified prism samples. Combine the overall distribution law of error fluctuation to complete the calibration of a fixed numerical range. The calibrated fixed numerical range is directly used as the preset angle difference threshold for anomaly judgment.

[0071] It should be noted that the number of qualified prism samples shall not be less than thirty. The specific method is as follows: measure the difference between the length of each edge of each qualified prism sample and the theoretical design length to obtain an edge length error sample set; calculate the arithmetic mean and standard deviation of the error sample set, and then add three times the standard deviation to the arithmetic mean. The resulting value is used as the length difference threshold. Similarly, for the angle, measure the difference between the angle of each edge of each qualified prism sample and the theoretical design angle to obtain an angle error sample set; calculate the arithmetic mean and standard deviation of the error sample set, and then add three times the standard deviation to the arithmetic mean. The resulting value is used as the angle difference threshold. If the length error of a certain edge of the target prism exceeds the length difference threshold, or the angle error of a certain edge exceeds the angle difference threshold, the corresponding spatial region is determined to be an abnormal region.

[0072] This application is approved. By constructing the theoretical contour feature vector of a standard prism and establishing a unified detection benchmark, the measured contour feature vector is compared with the theoretical vector item by item. This allows for the accurate identification of deviations in edge length and angle. By setting thresholds based on the statistical distribution of qualified samples, it is possible to effectively distinguish between normal errors and real defects, avoid misjudgments and omissions, and quickly locate abnormal areas in edge length and angle, thereby improving the objectivity, stability and detection accuracy of defect judgment.

[0073] S6: Spatial location integration of the abnormal edge length region and the abnormal edge angle region to generate a processing defect distribution map of the target prism, so as to mark the defect location and defect type of the target prism.

[0074] In this embodiment of the invention, the step of spatially integrating the abnormal edge length region and the abnormal edge angle region to generate a processing defect distribution map of the target prism, thereby marking the defect location and defect type of the target prism, includes: The pixel coordinates on the abnormal straight line segments in the abnormal edge length region are mapped to the coordinate system of the surface image to obtain the first coordinate set of the abnormal edge length region. Map the pixel coordinates of the abnormal corner points in the abnormal corner angle region to the coordinate system to obtain the second coordinate set of the abnormal corner angle region; Create a blank layer with the same size as the surface image; On the blank layer, the pixels in the first coordinate set are marked with a first color, and the pixels in the second coordinate set are marked with a second color to obtain the color layer of the target prism, wherein the first color and the second color are different. The color layer and the surface image are fused at the pixel level to output a processing defect distribution map of the target prism; Based on the processing defect distribution map of the target prism, the defect location and defect type of the target prism are marked, wherein the first color is used to indicate the location of edge length defects, and the second color is used to indicate the location of edge angle defects.

[0075] It should be noted that the position information of all pixels belonging to the abnormal straight line segment within the abnormal edge length region is extracted, and the pixel position information is transformed according to the image coordinate mapping rules. The arrangement relationship of the points in the contour image is converted into the coordinate arrangement relationship of the surface image, and the first coordinate set of the abnormal edge length region is generated completely.

[0076] Extract the position information of the pixels corresponding to the abnormal corner points within the abnormal corner area, and use a unified image coordinate mapping matching rule to complete the conversion and adaptation of the pixel position information. Adapt the arrangement of corner points to the preset coordinate system of the surface image to generate the second coordinate set of the abnormal corner area.

[0077] A blank image layer is created by referring to the overall size and pixel layout of the surface image. The number of horizontal pixels, the number of vertical pixels, and the size of the image boundary of the blank layer are completely consistent with the surface image. A dedicated blank layer is created to carry the layered annotation of the defect location.

[0078] Within the entire pixel range of the blank layer, match all pixels contained in the first coordinate set one by one, and fill all matched pixels with a fixed first display color. Simultaneously, within the pixel range of the blank layer, match all pixels contained in the second coordinate set one by one, and fill all matched pixels with a fixed second display color. The two display colors are set to independent visual color systems that are not identical to each other. After the color annotation is completed, the color layer of the target prism is formed. For example, the first display color is red (RGB 255,0,0), and the second display color is blue (RGB 0,0,255).

[0079] The color layer and the surface image are fully covered and merged by overlapping and superimposing pixels one by one. While preserving the original real-world details of the surface image, the color annotation information of the color layer is completely retained. After the pixel-level superposition and integration is completed, the processing defect distribution map of the shaped target prism is directly output.

[0080] Based on the color-coded locations of the processing defect distribution map of the target prism, defect information is marked. The first display color corresponds to a fixed physical location of the defect corresponding to the edge length, while the second display color corresponds to a fixed physical location of the defect corresponding to the edge angle. By relying on the visual distinguishing attributes of different colors, the exact location of all defects in the target prism and the category of the defect are marked and distinguished.

[0081] This application, once approved, transforms two types of abnormal regions into a coordinate set under a unified coordinate system through coordinate mapping. Combined with differentiated color markings on a blank layer of the same size, it enables the visual differentiation of defect locations. Pixel-level fusion of the color-annotated layer and the surface image generates an intuitive and clear distribution map of processing defects, accurately marking defect locations and types, simplifying the process of reading inspection results, and improving defect location efficiency and on-site practicality.

[0082] like Figure 2 The diagram shown is a functional block diagram of a prism processing defect detection system based on contour feature matching provided in an embodiment of the present invention.

[0083] The prism machining defect detection system based on contour feature matching described in this invention can be installed in an electronic device. Depending on the functions implemented, the prism machining defect detection system based on contour feature matching may include a data processing module, a contour tracking module, a feature segmentation module, a parallel stitching module, an anomaly detection module, and a defect localization module. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and is stored in the memory of the electronic device.

[0084] In this embodiment, the functions of each module / unit are as follows: The data processing module is used to acquire the surface image of the target prism, perform grayscale and binarization segmentation on the surface image, and obtain the binarized prism image of the target prism. The contour tracking module is used to perform contour tracking on the binarized prism image to obtain the original contour point set of the target prism. The feature segmentation module is used to perform multi-level Gaussian filtering on the original contour point set, obtain the curvature representation value of the pixel in the filtering result, and segment the original contour point set into a straight line segment contour subset and a corner point contour subset through the curvature representation value. The parallel stitching module is used to establish the straight line feature descriptor of the straight line segment contour subset and the corner feature descriptor of the corner point contour subset in parallel, and to perform feature stitching on the straight line feature descriptor and the corner point feature descriptor to obtain the contour feature vector of the target prism. The anomaly determination module is used to obtain the theoretical contour feature vector of the standard prism, and compare the contour feature vector with the theoretical contour feature vector item by item to obtain the abnormal edge length region and the abnormal edge angle region of the target prism. The defect location module is used to integrate the spatial locations of the abnormal edge length region and the abnormal edge angle region to generate a processing defect distribution map of the target prism, so as to mark the defect location and defect type of the target prism.

[0085] In the several embodiments provided by this invention, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0086] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0087] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0088] like Figure 3The figure shows a threshold segmentation grayscale histogram of a prism processing defect detection method based on contour feature matching according to an embodiment of the present invention. The horizontal axis represents grayscale level (0-255), and the vertical axis represents pixel frequency (number of occurrences). The threshold segmentation grayscale histogram is statistically obtained based on an actual acquired image of a prism surface. The figure shows a clear bimodal characteristic: the left peak is located between grayscale levels 30 and 70, corresponding to the prism entity area (foreground); the right peak is located between grayscale levels 140 and 200, corresponding to the background area. There is a trough area between the two peaks, and the lowest point of the trough is located at grayscale level 85. The frequency corresponding to this point is the smallest, so grayscale level 85 is selected as the optimal segmentation threshold. Using this threshold, the foreground and background of the prism can be accurately separated, providing a high-quality binarized image for subsequent contour tracking. It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention.

[0089] This application embodiment can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for detecting defects in prism manufacturing based on contour feature matching, characterized in that, The method includes: S1: Acquire the surface image of the target prism, perform grayscale and binarization segmentation on the surface image to obtain the binarized prism image of the target prism; S2: Perform contour tracking on the binarized prism image to obtain the original contour point set of the target prism; S3: Perform multi-level Gaussian filtering on the original contour point set, obtain the curvature characterization value of the pixel in the filtering result, and divide the original contour point set into a straight line segment contour subset and a corner point contour subset through the curvature characterization value. S4: Construct the line feature descriptor of the line segment contour subset and the corner feature descriptor of the corner point contour subset in parallel, and perform feature concatenation on the line feature descriptor and the corner feature descriptor to obtain the contour feature vector of the target prism. S5: Obtain the theoretical contour feature vector of the standard prism, and compare the contour feature vector with the theoretical contour feature vector by item-by-item difference to obtain the abnormal edge length region and abnormal edge angle region of the target prism. S6: Spatial location integration of the abnormal edge length region and the abnormal edge angle region to generate a processing defect distribution map of the target prism, so as to mark the defect location and defect type of the target prism.

2. The prism machining defect detection method based on contour feature matching as described in claim 1, characterized in that, The process of acquiring a surface image of the target prism and performing grayscale and binarization segmentation on the surface image to obtain a binarized prism image of the target prism includes: Acquire a surface image of the target prism, and decompose the surface image into a red channel image, a green channel image, and a blue channel image; By using preset grayscale weighting coefficients, the red channel image, the green channel image, and the blue channel image are weighted and summed pixel by pixel to generate the grayscale prism image of the target prism; The gray-level histogram of the gray-level prism image is statistically analyzed, the valley regions in the gray-level histogram are identified, and the gray level corresponding to the minimum gray-level frequency value in the valley region is used as the segmentation threshold. In the grayscale prism image, pixels with grayscale values ​​not greater than the segmentation threshold are set as first grayscale values, and pixels with grayscale values ​​less than the segmentation threshold are set as second grayscale values, thus obtaining the binarized prism image.

3. The prism machining defect detection method based on contour feature matching as described in claim 1, characterized in that, The step of performing contour tracking on the binarized prism image to obtain the original contour point set of the target prism includes: The binarized prism image is scanned line by line, and unmarked foreground pixels in the binarized prism image are detected as starting boundary points; Using the starting boundary point as the current tracking point, search for adjacent boundary pixels in the binarized prism image in a clockwise direction through eight neighborhoods; Using the boundary pixel as the new current tracking point, continue searching for the next adjacent boundary pixel in a clockwise direction according to the eight neighborhoods until returning to the starting boundary point, thus obtaining the closed contour path of the binarized prism image. All recorded boundary pixels on the closed contour path are arranged in the tracking order to form the original contour point set of the target prism.

4. The prism machining defect detection method based on contour feature matching as described in claim 1, characterized in that, The step of performing multi-level Gaussian filtering on the original contour point set includes: Obtain the two-dimensional coordinate sequence of all pixels in the original contour point set; Set the first Gaussian filter scale parameter, the second Gaussian filter scale parameter, and the third Gaussian filter scale parameter respectively, wherein the values ​​of the three scale parameters increase sequentially; By applying the first Gaussian filter scale parameter, the two-dimensional coordinate sequence is Gaussian smoothed once to generate the first filtered point set of the original contour point set; Based on the second Gaussian filter scale parameter, the first filter point set is subjected to secondary Gaussian smoothing to obtain the second filter point set of the original contour point set. Based on the third Gaussian filter scale parameter, the second filter point set is subjected to three Gaussian smoothings to obtain the third filter point set of the original contour point set.

5. The prism machining defect detection method based on contour feature matching as described in claim 4, characterized in that, The step of obtaining the curvature representation value of the pixels in the filtering result, and using the curvature representation value to segment the original contour point set into a straight line segment contour subset and a corner point contour subset, includes: The change in orientation angle between each pixel in the third filter point set and its neighboring pixels is obtained, and the change in orientation angle is used as the curvature characterization value of the pixel. By traversing the curvature representation values ​​of the pixels along the contour order of the third filter point set, the local maxima of the third filter point set are determined. The local maxima points are marked as corner candidate points, and the index positions of the corner candidate points in the original contour point set are recorded; Using the index position as the dividing boundary, the sequence of consecutive pixels between every two adjacent corner candidate points in the original contour point set is extracted into a straight line segment contour subset; The corner candidate points and a predetermined number of surrounding pixels are extracted into a corner contour subset, resulting in a straight line segment contour subset and a corner contour subset of the original contour point set.

6. The prism machining defect detection method based on contour feature matching as described in claim 1, characterized in that, The process involves concurrently establishing straight line feature descriptors for the straight line segment contour subset and corner feature descriptors for the corner point contour subset, and then concatenating the straight line feature descriptors and the corner feature descriptors to obtain the contour feature vector of the target prism, including: Extract the length of the line segment in the line segment contour subset and the direction angle of the line connecting the two corner points of the line segment, and combine the length and the direction angle of the line to form the line feature descriptor of the line segment contour subset; Extract the included angle between two adjacent line segments corresponding to a corner point in the corner point contour subset, and the arc distance between the corner point and its adjacent corner points, and combine the included angle and the arc distance into a corner point feature descriptor for the corner point contour subset; Based on the original contour order of the target prism, the line segment feature descriptors and the corner point feature descriptors are alternately arranged to obtain the initial feature sequence of the target prism; The initial feature sequence is normalized, and the normalized vectors are connected in sequence to form the contour feature vector of the target prism.

7. The prism machining defect detection method based on contour feature matching as described in claim 1, characterized in that, The process of obtaining the theoretical contour feature vector of the standard prism involves comparing the contour feature vector with the theoretical contour feature vector item by item to obtain the abnormal edge length regions and abnormal edge angle regions of the target prism, including: Extract the contour edge image of a standard prism, and perform line segment detection and corner point detection on the contour edge image to obtain the theoretical contour feature vector of the standard prism. The theoretical contour feature vector includes the theoretical line segment length value and the theoretical corner point angle value. The length values ​​of the line segments in the line feature descriptors of the contour feature vector are compared with the theoretical length values ​​of the line segments. If the difference between the length value of the straight line segment and the theoretical length value of the straight line segment is greater than a preset length difference threshold, then the spatial region corresponding to the straight line feature descriptor on the target prism is marked as an abnormal edge length region. The preset length difference threshold is set according to the statistical distribution of edge length errors corresponding to multiple qualified prism samples. The corner angle value of the corner feature descriptor in the contour feature vector is compared with the theoretical corner angle value. If the difference between the included angle value of the corner point and the included angle value of the theoretical corner point is greater than the preset angle difference threshold, then the spatial region corresponding to the corner point feature descriptor on the target prism is marked as an abnormal corner angle region. The preset angle difference threshold is set according to the statistical distribution of the angle errors corresponding to the multiple qualified prism samples.

8. The prism machining defect detection method based on contour feature matching as described in claim 1, characterized in that, The step of spatially integrating the abnormal edge length regions and the abnormal edge angle regions to generate a processing defect distribution map of the target prism, thereby marking the defect location and defect type of the target prism, includes: The pixel coordinates on the abnormal straight line segments in the abnormal edge length region are mapped to the coordinate system of the surface image to obtain the first coordinate set of the abnormal edge length region. Map the pixel coordinates of the abnormal corner points in the abnormal corner angle region to the coordinate system to obtain the second coordinate set of the abnormal corner angle region; Create a blank layer with the same size as the surface image; On the blank layer, the pixels in the first coordinate set are marked with a first color, and the pixels in the second coordinate set are marked with a second color to obtain the color layer of the target prism, wherein the first color and the second color are different. The color layer and the surface image are fused at the pixel level to output a processing defect distribution map of the target prism; Based on the processing defect distribution map of the target prism, the defect location and defect type of the target prism are marked, wherein the first color is used to indicate the location of edge length defects, and the second color is used to indicate the location of edge angle defects.

9. A prism machining defect detection system based on contour feature matching, characterized in that, The system for implementing the prism machining defect detection method based on contour feature matching as described in claim 1 includes: The data processing module is used to acquire the surface image of the target prism, perform grayscale and binarization segmentation on the surface image, and obtain the binarized prism image of the target prism. The contour tracking module is used to perform contour tracking on the binarized prism image to obtain the original contour point set of the target prism; The feature segmentation module is used to perform multi-level Gaussian filtering on the original contour point set, obtain the curvature representation value of the pixel in the filtering result, and segment the original contour point set into a straight line segment contour subset and a corner point contour subset through the curvature representation value. The parallel stitching module is used to establish the straight line feature descriptors of the straight line segment contour subset and the corner feature descriptors of the corner point contour subset in parallel, and to stitch the straight line feature descriptors and the corner point feature descriptors together to obtain the contour feature vector of the target prism. The anomaly detection module is used to obtain the theoretical contour feature vector of the standard prism, and compare the contour feature vector with the theoretical contour feature vector item by item to obtain the abnormal edge length and abnormal edge angle regions of the target prism. The defect location module is used to integrate the spatial locations of the abnormal edge length area and the abnormal edge angle area to generate a processing defect distribution map of the target prism, so as to mark the defect location and defect type of the target prism.