A machine vision-based defect detection method for bamboo chopsticks

By combining machine vision with image preprocessing and subpixel detection technology, this method solves the problems of existing methods relying on large amounts of data annotation and training required when changing materials. It achieves efficient and accurate bamboo chopstick defect detection and is suitable for automated detection of bamboo chopsticks of different specifications.

CN122156098APending Publication Date: 2026-06-05WUXI XINJIE ELECTRICAL

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUXI XINJIE ELECTRICAL
Filing Date
2026-02-11
Publication Date
2026-06-05

Smart Images

  • Figure CN122156098A_ABST
    Figure CN122156098A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of machine vision detection, and specifically relates to a kind of bamboo chopsticks defect detection method based on machine vision, comprising: image acquisition and pretreatment, extract the most obvious two channels of three-channel image and brighten to obtain single-channel image by addition;Gaussian filter denoising;Image gradient is calculated using operator;Sub-pixel level edge detection is realized by Hessian matrix and Taylor expansion;Complete path is formed by connecting edge points in normal direction positive and negative directions;Whether bamboo chopsticks is qualified is determined by the ratio of the area of the region surrounded by bamboo chopstick edge path and the minimum circumscribed circle area calculated from edge path, and the circularity of edge path.The present application does not need a large amount of data labeling and model training, and combines sub-pixel detection technology through traditional image algorithm, considers detection accuracy and efficiency, and has strong generalization and robustness, can adapt to different types of bamboo chopsticks detection, effectively reduces labor cost and false positive rate, and guarantees bamboo chopsticks delivery quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision inspection technology, and in particular to a method for detecting defects in bamboo chopsticks based on machine vision. Background Technology

[0002] Machine vision is a comprehensive technology encompassing multiple branches such as mechanics, control, optical imaging, sensors, analog and digital video technology, and image processing; it is a complete technological system. In light industrial production, machine vision technology is widely used in various projects such as anomaly detection, defect detection, part positioning, and item classification, providing crucial support for the automation and intelligentization of industrial production.

[0003] During the production of bamboo chopsticks, both ends (the larger and smaller ends) must be perfectly round, meeting factory requirements, and free from defects such as breaks or chips. The integrity of both ends is one of the core indicators for determining whether bamboo chopsticks meet the shipping standards. Currently, machine vision-based bamboo chopstick defect detection solutions are mainly divided into two categories: deep learning-based detection methods and machine learning methods based on data statistics.

[0004] The aforementioned existing technical solutions all achieve target defect detection through model training or statistical analysis, but they have significant technical drawbacks: First, they require a large amount of labeled data, resulting in high costs for data collection and labeling; second, the types of chopsticks produced during bamboo chopstick production are not fixed, leading to numerous defect types. In material change detection scenarios, existing methods require retraining and relearning data to achieve the expected detection results, which is cumbersome and inefficient; third, for unfamiliar defects that have not been trained on, existing methods have detection uncertainties and are prone to misjudgment, seriously affecting the quality of bamboo chopsticks shipped.

[0005] Further analysis reveals that supervised learning-based surface defect detection technology, relying on a large amount of defect-labeled data and the assumption of identical distribution, is ill-suited to the actual working conditions of random emergence of defect types and uneven sample distribution in bamboo chopstick production. While mainstream unsupervised learning-based anomaly detection methods do not require defect labeling and achieve defect identification by modeling the distribution of normal samples, they still have two key problems: First, traditional machine learning-based single anomaly detection algorithms have high false alarm rates and poor generalization, and it is difficult to balance detection accuracy and efficiency. Second, deep learning-based anomaly detection methods suffer from confusion in anomaly sample reconstruction and a lack of single-class training guidance.

[0006] Therefore, there is an urgent need for a method for detecting defects in bamboo chopsticks that does not rely on a large amount of data for training, has strong generalization ability, and balances detection accuracy and efficiency, in order to overcome the shortcomings of existing technologies. Summary of the Invention

[0007] The purpose of this invention is to overcome the problems of the prior art and provide a machine vision-based method for detecting defects in bamboo chopsticks. This method addresses the technical problems of existing bamboo chopstick defect detection methods, such as reliance on large amounts of labeled data, the need for retraining when changing materials, poor generalization, high false alarm rate, and difficulty in balancing detection accuracy and efficiency.

[0008] The above objectives are achieved through the following technical solutions: A machine vision-based method for detecting defects in bamboo chopsticks includes the following specific steps: Step (1) Image acquisition and preprocessing: Acquire three-channel original images of both ends of the bamboo chopsticks, extract the two most obvious channels of the original images and add them together to obtain a single-channel image, and perform exponential transformation on the single-channel image to brighten the image and increase the contrast between the ends of the bamboo chopsticks and the background. Step (2) Image Gaussian Filtering: The single-channel image obtained in step (1) is filtered and denoised using a Gaussian filter. The expression for the Gaussian filter is: ,in and These are the pixel coordinates of the distance from the center of the filter. The standard deviation of the Gaussian distribution; Step (3) Image gradient calculation: Convolve the image filtered in step (2) with a 3×3 Sobel operator to obtain approximate values ​​of the horizontal gradient. and the approximate value of the vertical gradient Then through the formula Calculate the gradient magnitude for each pixel. ; Step (4) Subpixel response value calculation: Introduce the Hessian matrix to adjust the gradient magnitude. The second-order partial derivative of the image is calculated to determine the normal direction of the pixel. The sub-pixel position is obtained by Taylor expansion along the normal direction, and the sub-pixel response value that meets the candidate requirements is selected. Step (5) Path connection: Traverse the sub-pixel response values ​​obtained in step (4), filter out edge point candidates, start from the edge point candidate with the largest response value, traverse along the normal in both directions and connect the edge points that meet the requirements to form a complete edge path; Step (6) Defect judgment: Calculate the area of ​​the maximum edge path and the area of ​​the minimum circumscribed circle obtained in step (5), the ratio of the area enclosed by the maximum edge path to the area of ​​the minimum circumscribed circle obtained by the maximum edge path, and the two thresholds of the roundness of the maximum edge path. If they meet the preset thresholds, the bamboo chopsticks are judged to be qualified; otherwise, they are judged to be defective.

[0009] Preferably, the parameters of the exponential transformation in step (1) are adjusted according to the brightness characteristics of the bamboo chopstick image so that the gray difference between the two ends of the bamboo chopstick and the background is not less than 30.

[0010] Preferably, the standard deviation of the Gaussian distribution in step (2) The value range is 0.8-1.2.

[0011] Preferably, the convolution operation of the Sobel operator in step (3) satisfies: the Sobel_x operator is The Sobel_y operator is A is the pixel matrix within the convolution kernel range. = Operator A, = Operator A.

[0012] Preferably, the expression for the Hessian matrix in step (4) is: ,in , , These are the second-order partial derivatives of the gradient image, and the normal direction is the eigenvector corresponding to the largest eigenvalue of the Hessian matrix. .

[0013] Preferably, the formula for calculating the sub-pixel position in step (4) is as follows: ,in , The candidate requirements are: (Based on the coordinates of the reference pixel point) .

[0014] Preferably, the selection criteria for the candidate edge points in step (5) is: the subpixel response value is greater than the preset response threshold, and the response threshold ranges from 50 to 80.

[0015] Preferably, the traversal range of the normal direction in step (5) is based on the feature vector. The three adjacent pixels centered are used to perform adjacent edge filtering.

[0016] Preferably, the ratio of the minimum circumscribed circle area and the preset threshold for roundness in step (6) are in the range of 0.85-0.95, and the preset threshold can be flexibly adjusted according to the production standards of bamboo chopsticks.

[0017] Preferably, the two ends of the bamboo chopsticks include a large end and a small end, and the defects include breaks, gaps, and imperfections that are not completely circular at both ends of the bamboo chopsticks.

[0018] The present invention provides a machine vision-based method for detecting defects in bamboo chopsticks, which reduces application costs by eliminating the need for extensive data annotation and model training. It combines traditional image algorithms with sub-pixel detection technology to balance detection accuracy and efficiency. It can flexibly adjust multiple parameters to adapt to the detection of bamboo chopsticks of different specifications, and use roundness features to determine and adapt to unfamiliar defect types. This method achieves automated, high-precision, and robust detection of defects at both ends of bamboo chopsticks, ensuring product quality and reducing manpower input. Attached Figure Description

[0019] Figure 1 This is the original input image of a bamboo chopstick with normal ends in a machine vision-based defect detection method for bamboo chopsticks as described in this invention. Figure 2 This is a preprocessed image of bamboo chopsticks with normal ends, as described in the machine vision-based bamboo chopstick defect detection method of the present invention. Figure 3 This is a schematic diagram of the outer contour path of bamboo chopsticks when both ends are normal in the machine vision-based bamboo chopstick defect detection method described in this invention. Figure 4 This is the original input image for when the ends of bamboo chopsticks are abnormal in the machine vision-based bamboo chopstick defect detection method described in this invention. Figure 5 This is a preprocessed image of bamboo chopsticks when both ends are abnormal, as described in the machine vision-based bamboo chopstick defect detection method of the present invention. Figure 6 This is a schematic diagram of the outer contour path when the two ends of the bamboo chopsticks are abnormal in the machine vision-based bamboo chopsticks defect detection method described in this invention. Figure 7 This is a flowchart of a machine vision-based method for detecting defects in bamboo chopsticks according to the present invention. Detailed Implementation

[0020] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. The described embodiments are merely some, not all, of the embodiments of the present invention. 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.

[0021] like Figure 7 As shown, this solution provides a machine vision-based defect detection method for bamboo chopsticks, mainly consisting of four core stages: image preprocessing, sub-pixel edge detection, path connection of adjacent edge points, and defect judgment based on path features. Image preprocessing reduces noise and enhances contrast, laying the foundation for subsequent detection; sub-pixel edge detection obtains high-precision edge points at both ends of the bamboo chopsticks; path connection forms complete edge paths from discrete edge points; finally, the circularity features of the path are used to determine whether there are defects at both ends of the bamboo chopsticks. The specific steps are as follows: Step (1): Image acquisition and preprocessing First, three-channel raw images of both ends (large and small ends) of the bamboo chopsticks are acquired using an industrial camera. During the acquisition process, the distance between the camera and both ends of the bamboo chopsticks is kept constant, and the imaging angle is perpendicular to the end face of the bamboo chopsticks to ensure the consistency and accuracy of the images.

[0022] After acquiring the original three-channel image, the image is preprocessed: the RGB three channels of the original image are analyzed, and the two channels with the most obvious brightness difference and the clearest outline of the bamboo chopsticks are extracted (for example, when the bamboo chopsticks are darker and the background is brighter, the R channel and G channel images are extracted). The pixel values ​​of the two channel images are added together to form a new single-channel image.

[0023] Subsequently, an image exponential transform is performed on the single-channel image. The expression for the exponential transform is: (in These are the transformed pixel values. These are the original pixel values. (where γ is a constant and γ is an exponential coefficient). By adjusting the value of γ (usually ranging from 0.6 to 0.8), the single-channel image is brightened, further increasing the contrast between the large and small ends of the bamboo chopsticks and the background, while reducing the noise impact caused by changes in ambient light, making the edges of the bamboo chopsticks easier to identify.

[0024] 0039. Step (2): Image Gaussian filtering To further reduce the interference of image noise on subsequent edge detection, the single-channel image obtained in step (1) is subjected to Gaussian filtering. The core principle of Gaussian filtering is to perform a weighted average of each pixel and its neighboring pixels in the image. The weights are determined by the Gaussian function, and the neighboring pixels that are closer to the pixel have a larger weight, thereby smoothing out noise while preserving the edge information of the image to the greatest extent.

[0025] The specific expression for the Gaussian filter is: , in, and This represents the pixel coordinates of the distance from the center of the filter. The standard deviation of the Gaussian distribution determines the width of the filter. The value range is 0.8-1.2, and in this embodiment, it is preferred. =1.0, which can be flexibly adjusted according to the noise intensity of the actual image.

[0026] Step (3): Calculate the image gradient To accurately identify the edges of bamboo chopsticks, it is necessary to calculate the gradient information of the image. The gradient reflects the rate of change of pixel grayscale values ​​in the image, and the gradient values ​​are larger in the edge regions. This invention uses a 3×3 gradient. The operator performs a convolution operation on the Gaussian-filtered image and calculates the approximate horizontal gradient values ​​of the image. and the approximate value of the vertical gradient .

[0027] The convolution operation of the operator is as follows: The matrix form of the operator is , The matrix form of the operator is Let A be the pixel matrix within the convolution kernel range, then: , , After obtaining approximate gradient values ​​in the horizontal and vertical directions, the gradient magnitude for each pixel value is calculated using the following formula. This comprehensively reflects the edge strength of the pixel. .

[0028] Step (4): Calculate subpixel response values To achieve high-precision edge detection, this invention introduces sub-pixel detection technology, improving edge positioning accuracy from the pixel level to the sub-pixel level. The specific process is as follows: First, construct the Hessian matrix and take its second-order partial derivative with respect to the image composed of gradients G (i.e., the pixel value at each pixel is the gradient value G). The expression for the Hessian matrix is: , in, For gradient images in Second-order partial derivatives in the direction, For gradient images in Second-order partial derivatives in the direction, For gradient images in Mixed second-order partial derivatives in the direction.

[0029] The eigenvector corresponding to the largest eigenvalue of the Hessian matrix corresponds to the normal direction of that pixel. Represented by this pixel. Using the reference point, sub-pixel coordinates are obtained through Taylor expansion. The calculation formula is: , in, The calculation formula is: , For gradient images in First-order partial derivative in the direction, For gradient images in The first-order partial derivative in the direction.

[0030] In this step, candidate sub-pixels need to be selected. If the following conditions are met... If the condition is met, the point is considered a valid candidate for a sub-pixel edge point, and its sub-pixel response value is calculated and saved. If the condition is not met, the point is determined to be invalid and is not retained.

[0031] Step (5): Path connection To form the complete outline of both ends of the bamboo chopsticks, it is necessary to connect the effective sub-pixel candidate points selected in step (4) using paths. The specific process is as follows: First, set a subpixel response threshold (ranging from 50 to 80, which can be adjusted according to actual detection needs). Iterate through the subpixel response value of each pixel. If the response value is greater than the threshold, the point is set as a candidate edge point; if it is less than the threshold, the point is determined not to be an edge point and is excluded. After the iteration is complete, a set of candidate edge points for the entire image is obtained.

[0032] Starting from the point with the largest response value in the candidate edge point set (this point is the most likely edge point), traverse the system according to the normal direction obtained in step (4). The traversal range is defined by the feature vector. For the three adjacent pixels of the center, perform adjacent edge filtering. If a point within this range is a candidate edge point, connect that point to the current point and continue traversing the next point along the normal direction until no edge point that meets the requirements can be found.

[0033] To ensure that the complete edges of the chopsticks are obtained, the above traversal process is carried out from both the positive and negative directions of the normal, and finally the discrete edge candidate points are connected into an ordered edge point array, that is, the complete edge path.

[0034] Step (6): The ratio of the area of ​​the smallest circumcircle and the roundness judgment of the largest edge path. The standard for acceptable bamboo chopsticks is that both ends should be perfectly round. Therefore, the presence of defects is determined by calculating the roundness of the edge path. The specific process is as follows: After obtaining the edge paths of the large and small ends of the bamboo chopsticks, calculate the area of ​​the region enclosed by the path (i.e., the path area) and the area of ​​the minimum circumscribed circle of the path. Calculate the circularity of the path by the ratio of the path area to the minimum circumscribed circle area. The formula for calculating circularity is: Circularity = Path Area / Minimum Circumscribed Circle Area.

[0035] Set a preset threshold for roundness (the value range is 0.85 - 0.95, which can be flexibly adjusted according to the production standards of bamboo chopsticks). If the calculated roundness meets the requirements of the preset threshold, it is determined that the shapes of both ends of the bamboo chopstick are complete and the inspection is qualified; if the roundness does not meet the preset threshold, it is judged that there are defects such as fractures and gaps in the bamboo chopstick, and it is a non-conforming product and does not pass the shipping inspection.

[0036] As Figures 1-3 shown, when the large and small ends of the bamboo chopstick are normal, Figure 1 is the original input image, Figure 2 is the image after preprocessing and Gaussian filtering, Figure 3 is a schematic diagram of the outer contour path composed of the edge points of the bamboo chopstick. This path presents a complete circle, and the roundness meets the preset threshold, so it is judged as qualified; as Figures 4-6 shown, when the large and small ends of the bamboo chopstick are abnormal, Figure 4 is the original input image, Figure 5 is the image after preprocessing and Gaussian filtering, Figure 6 is a schematic diagram of the outer contour path composed of the edge points of the bamboo chopstick. This path presents a non-complete circle due to the existence of a gap, and the roundness does not reach the preset threshold, so it is judged as unqualified.

[0037] Example 1 This example is applied to the pipeline inspection scenario of regular-sized bamboo chopsticks. The inspection object is the finished product in the production process of bamboo chopsticks. The core of the inspection is to judge whether there are defects such as fractures and gaps at both ends (the large end and the small end) of the bamboo chopstick that affect the integrity of the contour.

[0038] Step (1): Image acquisition and preprocessing Collect the RGB three-channel original images of both ends of the bamboo chopstick through an industrial camera. During the collection process, strictly control the distance between the camera and the end face of the bamboo chopstick and the imaging angle to ensure that there is no obvious distortion in the end face of the bamboo chopstick in the image. Through the statistical analysis of the gray distribution, it is determined that the contrast between the contour of the bamboo chopstick and the background in the R channel and the G channel is the strongest. Extract the images of the R channel and the G channel and add them pixel by pixel to obtain a single-channel image. Use the exponential transformation formula to brighten the single-channel image. By adjusting the value and the γ value, make the gray difference between both ends of the bamboo chopstick and the background reach the preset requirements, and ensure that the edge contour is clearly distinguishable.

[0039] Step (2): Image Gaussian filtering According to the noise situation of the current detection environment, select a suitable standard deviation of the Gaussian distribution, and use the corresponding Gaussian filter to filter the preprocessed single-channel image. While effectively filtering out the environmental light noise and the image sensor noise, completely retain the detailed features of the edge of the bamboo chopstick, and provide high-quality image data for subsequent gradient calculation.

[0040] Step (3): Calculate the image gradient Using 3×3 The operator performs a convolution operation on the filtered image and calculates the approximate values ​​of the horizontal gradient. and the approximate value of the vertical gradient Then, using the gradient magnitude formula Calculate the gradient magnitude for each pixel. This creates a gradient image, in which the edge region of the bamboo chopsticks exhibits high brightness.

[0041] Step (4): Calculate subpixel response values Constructing the Hessian matrix and calculating the second-order partial derivatives of the gradient image to determine the normal direction of each pixel, using high-gradient-value pixels in the gradient image as reference points, and calculating sub-pixel coordinates using the Taylor expansion formula to filter those that meet the criteria... Calculate and store the subpixel response value for each valid subpixel.

[0042] Step (5): Path connection Set an appropriate sub-pixel response threshold to filter out a set of candidate edge points. Starting from the point with the largest response value, the traversal range along the normal direction is defined by the feature vector. The three adjacent pixels centered are used to filter adjacent edges and form the complete edge paths at both ends of the bamboo chopstick. The path coordinate data is stored in an ordered array in sequence.

[0043] Step (6): The ratio of the area of ​​the smallest circumcircle and the roundness judgment of the largest edge path. Based on the production quality standards for this specification of bamboo chopsticks, a corresponding preset threshold for roundness is set. Using the coordinate array of the edge path, the path area is calculated using the polygon area formula, and the minimum circumscribed circle area is calculated using the minimum circumscribed circle algorithm, thus obtaining the roundness value. The calculated roundness is compared with the preset threshold. If the roundness meets the requirements, the bamboo chopsticks are deemed qualified and allowed to proceed to the next production stage; if the roundness does not meet the preset threshold, they are deemed unqualified and the sorting device is triggered to remove them.

[0044] Example 2 This embodiment is applied to the detection scenario of fine-sized bamboo chopsticks. Because these chopsticks have a smaller diameter and finer edge contours, the requirements for detection accuracy are higher.

[0045] Step (1): Image acquisition and preprocessing Raw RGB three-channel images of both ends of thin bamboo chopsticks were acquired using an industrial camera. During acquisition, camera parameters were optimized to improve image resolution and ensure clear imaging of the chopsticks' edge details. Grayscale analysis revealed that these chopsticks exhibited superior contour contrast in the G and B channels. The G and B channels were extracted and summed to obtain a single-channel image. An exponential transform was then applied to brighten the single-channel image, focusing on enhancing the grayscale difference between the chopsticks' edges and the background to prevent the edges from being submerged in the background due to the chopsticks' small diameter.

[0046] Step (2): Image Gaussian filtering Considering that the edges of thin bamboo chopsticks are more susceptible to noise interference, a suitable Gaussian distribution standard deviation is selected. While ensuring the filtering effect, we focus on protecting the edge details from being blurred, so that the edge features of the thin bamboo chopsticks can be accurately extracted.

[0047] Step (3): Calculate the image gradient Using the same 3×3 method as in Example 1 The operator performs a convolution operation to calculate approximate gradient values ​​in the horizontal and vertical directions, thereby obtaining the gradient magnitude. Gradient calculations are used to accurately locate the edge area of ​​thin bamboo chopsticks.

[0048] Step (4): Calculate subpixel response values The Hessian matrix is ​​constructed according to the method in Example 1, the normal direction and sub-pixel coordinates are solved, effective sub-pixel points are strictly screened and the response value is calculated. The detection difficulty caused by the fine edge of the thin bamboo chopstick is compensated by sub-pixel level positioning, and the edge positioning accuracy meets the detection requirements.

[0049] Step (5): Path connection Set a sub-pixel response threshold for detecting thin bamboo chopsticks, filter the candidate edge point set, and start from the point with the largest response value. The traversal range along the normal direction is based on the feature vector. For the three adjacent pixels centered on the chopstick, adjacent edge filtering is performed. Since the edge path of the thin bamboo chopstick is shorter, the traversal logic needs to be optimized to ensure that the path is closed and complete, and to accurately reflect the outline shape of the end face of the thin bamboo chopstick.

[0050] Step (6): The ratio of the area of ​​the smallest circumcircle and the roundness judgment of the largest edge path. Based on the production standards for thin bamboo chopsticks, a corresponding preset threshold for roundness is set. The path area of ​​the edge path and the area of ​​the minimum circumscribed circle are calculated to obtain the roundness value. If the roundness meets the preset threshold, the thin bamboo chopsticks are deemed qualified; if the roundness does not meet the standard due to a small chip or break in the thin bamboo chopsticks, they are deemed unqualified and the rejection mechanism is triggered.

[0051] As can be seen from the above embodiments, the detection method of the present invention can achieve accurate detection by adjusting relevant parameters according to the detection requirements of different specifications and types of bamboo chopsticks. It does not require changing the core algorithm or model training. It has high detection accuracy and strong adaptability, and can effectively solve the shortcomings of the prior art. It can be widely used in automated defect detection scenarios of various bamboo chopstick production lines.

[0052] The above description is merely illustrative of the embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting defects in bamboo chopsticks based on machine vision, characterized in that, Includes the following steps: Step (1) Image acquisition and preprocessing: Acquire three-channel original images of both ends of the bamboo chopsticks, extract the two most obvious channels of the original images and add them together to obtain a single-channel image, and perform exponential transformation on the single-channel image to brighten the image and increase the contrast between the ends of the bamboo chopsticks and the background. Step (2) Image Gaussian Filtering: The single-channel image obtained in step (1) is filtered and denoised using a Gaussian filter. The expression for the Gaussian filter is: ,in and These are the pixel coordinates from the center of the filter. Let $\mathbf{a}$ be the standard deviation of the Gaussian distribution. Step (3) Image gradient calculation: Convolve the image filtered in step (2) with a 3×3 Sobel operator to obtain approximate values ​​of the horizontal gradient. and the approximate value of the vertical gradient Then through the formula Calculate the gradient magnitude for each pixel. ; Step (4) Subpixel response value calculation: Introduce the Hessian matrix to adjust the gradient magnitude. The second-order partial derivative of the image is calculated to determine the normal direction of the pixel. The sub-pixel position is obtained by Taylor expansion along the normal direction, and the sub-pixel response value that meets the candidate requirements is selected. Step (5) Path connection: Traverse the sub-pixel response values ​​obtained in step (4), filter out edge point candidates, start from the edge point candidate with the largest response value, traverse along the normal in both directions and connect the edge points that meet the requirements to form a complete edge path; Step (6) Defect judgment: Calculate the area of ​​the maximum edge path and the area of ​​the minimum circumscribed circle obtained in step (5), the ratio of the area enclosed by the maximum edge path to the area of ​​the minimum circumscribed circle obtained by the maximum edge path, and the two thresholds of the roundness of the maximum edge path. If they meet the preset thresholds, the bamboo chopsticks are judged to be qualified; otherwise, they are judged to be defective.

2. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The parameters of the exponential transformation in step (1) are adjusted according to the brightness characteristics of the bamboo chopstick image so that the gray difference between the two ends of the bamboo chopstick and the background is not less than 30.

3. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The standard deviation of the Gaussian distribution mentioned in step (2) The value range is 0.8-1.

2.

4. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The convolution operation of the Sobel operator described in step (3) satisfies: the Sobel_x operator is The Sobel_y operator is A is the pixel matrix within the convolution kernel range. = Operator A, = Operator A.

5. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The expression for the Hessian matrix mentioned in step (4) is: ,in , , These are the second-order partial derivatives of the gradient image, and the normal direction is the eigenvector corresponding to the largest eigenvalue of the Hessian matrix. .

6. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The formula for calculating the sub-pixel position in step (4) is as follows: ,in , The candidate requirements are: (Based on the coordinates of the reference pixel point) .

7. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The selection criteria for edge point candidates in step (5) are: the subpixel response value is greater than the preset response threshold, and the response threshold ranges from 50 to 80.

8. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The traversal range of the normal direction mentioned in step (5) is based on the eigenvector. The three adjacent pixels centered are used to perform adjacent edge filtering.

9. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The ratio of the minimum circumscribed circle area and the preset threshold for roundness in step (6) are in the range of 0.85-0.

95. The preset threshold can be flexibly adjusted according to the production standards of bamboo chopsticks.

10. The method for detecting defects in bamboo chopsticks based on machine vision according to claim 1, characterized in that, The two ends of the bamboo chopsticks include the large end and the small end, and the defects include breaks, gaps, and imperfections that are not completely round at both ends.