A machine vision-based method for detecting the thickness uniformity of potato chips
Patent Information
- Application Number
- CN202611233023.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2046-08-14
AI Technical Summary
[0003]薯片本身具有形状不规则、边缘易破碎、表面存在鼓起和凹陷的特点,人工抽检或单点测厚只能获得少量位置的厚度结果,难以反映整片薯片的全域厚度分布;普通二维图像检测主要依据颜色、轮廓或表面纹理判断外观状态,无法准确获得薯片上表面的空间高度值,也难以区分表面起伏与真实厚度不均之间的差异;单一顶部结构光测量虽然能够获取上表面高度信息,但通常默认薯片底面与输送带基准平面贴合,未考虑薯片翘边、卷边和局部悬空导致的底面漂移,容易造成厚度计算偏差;此外,现有方法对不规则外轮廓薯片缺乏自适应测量网格,厚度异常点难以稳定合并为具有空间范围的厚度异常区域,导致厚度均匀性评价结果不够准确,难以满足产线分拣、复检和剔除的稳定应用需求
[0086] This invention simultaneously acquires top structured light stripe images, top texture images, and lateral edge contour images of the potato chip to be tested, forming a unified composite visual data source for the height of the upper surface, the shape of the outer contour, and the actual thickness of the edge of the potato chip. This overcomes the problem that manual sampling, single-point thickness measurement, or ordinary two-dimensional image detection cannot express the thickness distribution of the entire potato chip, and improves the data integrity and non-contact measurement stability of potato chip thickness detection.
Smart Images

Figure CN122774994B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of optical measurement technology, and in particular to a method for detecting the thickness uniformity of potato chips based on machine vision. Background Technology
[0002] With the increasing demand for automated inspection in food processing production lines, non-contact inspection technologies for detecting thickness uniformity, edge warping, and localized thickness unevenness in sheet-shaped foods such as potato chips have received widespread attention. Current methods for detecting potato chip thickness mainly rely on manual sampling, single-point contact thickness measurement, or ordinary two-dimensional image visual inspection. However, these methods commonly suffer from the following problems in practical applications:
[0003] Potato chips are characterized by irregular shapes, easily broken edges, and bulges and depressions on the surface. Manual sampling or single-point thickness measurement can only obtain thickness results for a small number of locations, making it difficult to reflect the overall thickness distribution of the entire chip. Ordinary two-dimensional image detection mainly judges the appearance based on color, contour, or surface texture, which cannot accurately obtain the spatial height value of the chip's upper surface, nor can it distinguish the difference between surface undulations and actual thickness unevenness. Although single top structured light measurement can obtain upper surface height information, it usually assumes that the bottom surface of the chip is in contact with the reference plane of the conveyor belt, without considering bottom surface drift caused by chip curling, rolling, and local suspension, which can easily lead to thickness calculation errors. In addition, existing methods lack adaptive measurement grids for irregularly contoured potato chips, making it difficult to stably merge thickness anomalies into thickness anomaly regions with spatial range, resulting in inaccurate thickness uniformity evaluation results and failing to meet the stable application requirements of production line sorting, re-inspection, and rejection.
[0004] Therefore, how to provide a machine vision-based method for detecting the thickness uniformity of potato chips is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] One objective of this invention is to propose a machine vision-based method for detecting the uniformity of potato chip thickness. This invention constructs a composite visual dataset of potato chips, and generates an upper surface height field through principal fitting plane solution, pose orthogonalization processing, and contour adaptive polar coordinate measurement grid establishment. Then, combined with boundary thickness conditions, a bottom surface drift field inversion model is constructed to obtain the global thickness function and identify thickness anomaly regions. Finally, the potato chip thickness uniformity detection result is output, thereby improving the accuracy, stability, and production line applicability of irregular potato chip thickness measurement.
[0006] A method for detecting the thickness uniformity of potato chips based on machine vision according to an embodiment of the present invention includes the following steps:
[0007] Step 1: Collect the top structured light stripe image, top texture image, and side edge contour image of the potato chip to be detected, and generate a composite visual dataset of potato chips;
[0008] Step 2: Generate an initial point cloud set for the upper surface of the potato chip based on the potato chip composite visual dataset, and perform principal fitting plane solution and pose orthogonalization processing on the initial point cloud set for the upper surface of the potato chip to generate a standardized potato chip height map.
[0009] Step 3: Extract the outer contour of the potato chip from the top texture image, and establish an adaptive polar coordinate measurement grid based on the outer contour of the potato chip and the standardized potato chip height map;
[0010] Step 4: Extract spatial height values from the standardized potato chip height map and map the spatial height values to the contour adaptive polar coordinate measurement grid to generate the upper surface height field;
[0011] Step 5: Extract the true edge thickness from the lateral edge contour image, and map the true edge thickness to the contour adaptive polar coordinate measurement grid by combining the outer contour line of the potato chip, thereby generating boundary thickness conditions;
[0012] Step 6: Construct a bottom surface drift field inversion model based on the upper surface height field and boundary thickness conditions, and iteratively solve the bottom surface drift field inversion model to generate the bottom surface drift field;
[0013] Step 7: Generate a global thickness function based on the upper surface height field and the bottom surface drift field, and identify areas of thickness anomaly based on the global thickness function;
[0014] Step 8: Generate thickness uniformity evaluation values based on the global thickness function and thickness anomaly regions, and output the potato chip thickness uniformity detection results based on the thickness uniformity evaluation values.
[0015] Optionally, step one specifically includes:
[0016] When the potato chips to be inspected enter the inspection station, the top structured light projector is triggered to project coded stripes onto the upper surface of the potato chips to be inspected, and the top camera captures the top structured light stripe image formed by the coded stripes on the upper surface of the potato chips to be inspected.
[0017] The top structured light projector is turned off and the top supplementary light source is turned on. The top texture image of the potato chip to be detected is acquired by the top camera. The top texture image and the top structured light stripe image have the same image coordinate reference.
[0018] A lateral edge contour image of the edge region of the potato chip to be detected is acquired by a lateral camera set to the side of the potato chip to be detected. The lateral edge contour image includes the upper contour and the lower contour of the edge of the potato chip to be detected.
[0019] The same detection number, the same trigger time marker, and the corresponding viewpoint marker are configured for the top structured light stripe image, the top texture image, and the side edge contour image, respectively;
[0020] A composite visual dataset of potato chips is generated based on the top structured light stripe image, top texture image, and side edge contour image configured with the same detection number, the same trigger time marker, and the corresponding viewpoint marker.
[0021] Optionally, step two specifically includes:
[0022] Read the top structured light stripe image and the top texture image from the potato chip composite visual dataset, and determine the imaging area of the potato chip to be detected based on the top texture image;
[0023] Extract the stripe center line from the top structured light stripe image within the imaging area, and subtract the position of the stripe center line from the preset reference stripe position to obtain the stripe offset.
[0024] Multiply the stripe offset by a preset height conversion coefficient to obtain the spatial height value of each sampling position on the surface of the potato chip to be detected, and generate an initial point cloud set on the surface of the potato chip based on the horizontal coordinate, vertical coordinate and spatial height value of each sampling position.
[0025] The initial point cloud set on the upper surface of the potato chip is solved by the principal fitting plane to obtain the potato chip principal fitting plane, and the attitude offset is generated according to the normal deviation between the potato chip principal fitting plane and the conveyor belt reference plane.
[0026] An attitude rotation matrix is constructed based on the attitude offset. The attitude rotation matrix is used to orthogonalize the lateral coordinates, longitudinal coordinates, and spatial height values of each point in the initial point cloud set on the upper surface of the potato chip, thereby generating an orthogonal point cloud set.
[0027] The orthogonalized point cloud set is projected according to the image coordinate reference of the top texture image, and the spatial height value corresponding to each coordinate position after projection is written into the pixel position of the height map to generate a standardized potato chip height map.
[0028] Optionally, step three specifically includes:
[0029] The top texture image is grayscaled and edge-enhanced to generate a texture boundary-enhanced image;
[0030] Closed boundary tracking is performed on the texture boundary enhancement image to extract the closed boundary line between the potato chip to be detected and the background, and the outer contour line of the potato chip is generated.
[0031] Based on the horizontal and vertical coordinates of each contour point in the outer contour of the potato chip, the horizontal coordinates of all contour points are summed and divided by the number of contour points to obtain the horizontal coordinates of the centroid. The vertical coordinates of all contour points are summed and divided by the number of contour points to obtain the vertical coordinates of the centroid. The centroid of the potato chip is generated from the horizontal and vertical coordinates of the centroid.
[0032] Using the centroid of the potato chip as the pole, multiple radial measurement lines are generated from the centroid of the potato chip to the outer contour line of the potato chip at preset angle intervals, and the intersection point of each radial measurement line with the outer contour line of the potato chip is recorded.
[0033] The distance from the centroid of the potato chip to the corresponding intersection point in each radial measurement line is taken as the contour radius of the radial measurement line, and the contour radius is divided by the preset number of radial segments to obtain the radial step size;
[0034] On each radial measurement line, multiple radial sampling points are generated sequentially from the centroid of the potato chip according to the radial step size, and each radial sampling point is mapped to the height map pixel position in the standardized potato chip height map.
[0035] An adaptive polar coordinate measurement grid for the profile is established based on the angular position of each radial measurement line, the radial position of each radial sampling point, and the corresponding height map pixel position of each radial sampling point.
[0036] Optionally, step four specifically includes:
[0037] Read the height map pixel position corresponding to each radial sampling point from the contour adaptive polar coordinate measurement grid;
[0038] Based on the height map pixel position corresponding to each radial sampling point, the corresponding spatial height value is extracted from the standardized potato chip height map;
[0039] Establish circumferential numbers according to the angular position of each radial measurement line, and establish radial numbers according to the radial position of each radial sampling point;
[0040] The extracted spatial height values are written into the contour adaptive polar coordinate measurement grid according to the corresponding circumferential and radial indices to generate a spatial height value array.
[0041] In the spatial height value array, the spatial height values corresponding to adjacent radial numbers under the same circumferential number are connected sequentially in the direction from the centroid of the potato chip to the outer contour line of the potato chip to generate a radial height sequence;
[0042] In the spatial height value array, the spatial height values corresponding to the same radial index under adjacent circumferential indexes are connected sequentially in the direction of increasing angular position to generate a circumferential height sequence;
[0043] The upper surface height field is generated based on the spatial height value array, the radial height sequence, and the circumferential height sequence.
[0044] Optionally, step five specifically includes:
[0045] Extract the upper and lower edge contours of the potato chip to be detected from the lateral edge contour image;
[0046] Multiple edge thickness measurement lines are generated along the normal direction of the lower edge contour, and the intersection points of each edge thickness measurement line with the upper edge contour and with the lower edge contour are recorded.
[0047] The true edge thickness is obtained by multiplying the pixel distance between the intersection point of the upper edge contour and the intersection point of the lower edge contour in the same edge thickness measurement line by a preset lateral pixel length conversion factor.
[0048] Based on the viewpoint markers of the lateral edge contour image, determine the corresponding contour points of each edge thickness measurement line on the outer contour line of the potato chip, and write the actual edge thickness into the corresponding contour points.
[0049] According to the angular position of the corresponding contour point, the true edge thickness is associated with the outermost radial sampling point at the same angular position in the contour adaptive polar coordinate measurement grid;
[0050] The boundary thickness condition is generated based on the actual edge thickness associated with the outermost radial sampling point.
[0051] Optionally, step six specifically includes:
[0052] Read the spatial height value array, radial height sequence and circumferential height sequence from the upper surface height field, and read the true edge thickness corresponding to the outermost radial sampling point from the boundary thickness condition;
[0053] In the contour adaptive polar coordinate measurement grid, each radial sampling point is configured as a variable position, and a bottom surface height offset to be determined is set for each variable configuration position.
[0054] Subtract the corresponding actual edge thickness from the spatial height value corresponding to the outermost radial sampling point to obtain the boundary bottom surface drift reference value of the outermost radial sampling point;
[0055] Calculate the squared difference between the required bottom surface height offset and the corresponding boundary bottom surface drift reference value for each outermost radial sampling point, and sum all the squared differences to generate boundary constraint terms;
[0056] In each radial height sequence, the squared difference between the bottom surface height offsets corresponding to adjacent radial sampling points is calculated, and the squared differences in all radial height sequences are summed to generate a radial continuity constraint term.
[0057] In each circumferential height sequence, the squared difference between the bottom surface height offsets corresponding to adjacent circumferential sampling points is calculated, and the squared differences in all circumferential height sequences are summed to generate circumferential continuous constraint terms.
[0058] Under each circumferential sequence number, three consecutive radial sampling points are selected in sequence. The square of the second-order difference between the bottom surface height offsets corresponding to the three consecutive radial sampling points is calculated. All squares of the second-order difference are summed to generate the radial curvature constraint term.
[0059] Under each radial index, three consecutive circumferential sampling points are selected in sequence. The square of the second-order difference between the bottom surface height offsets corresponding to the three consecutive circumferential sampling points is calculated. All squares of the second-order difference are summed to generate the circumferential curvature constraint term.
[0060] The curvature suppression constraint term is generated by summing the radial curvature constraint term and the circumferential curvature constraint term.
[0061] The boundary constraint terms, radial continuity constraint terms, circumferential continuity constraint terms, and curvature suppression constraint terms are weighted and summed to construct the bottom surface drift field inversion model;
[0062] The bottom surface drift field inversion model is iteratively solved to minimize the weighted summation result, thereby obtaining the bottom surface height offset corresponding to each radial sampling point.
[0063] The bottom surface height offset is arranged according to the circumferential and radial serial numbers of each radial sampling point to generate the bottom surface drift field.
[0064] Optionally, the step of generating a global thickness function based on the upper surface height field and the bottom surface drift field specifically involves:
[0065] Read the spatial height value corresponding to each radial sampling point from the height field of the upper surface;
[0066] Read the bottom height offset corresponding to each radial sampling point from the bottom drift field;
[0067] Subtract the corresponding bottom surface height offset from the spatial height value corresponding to the same radial sampling point to obtain the thickness value of the radial sampling point.
[0068] The thickness values are arranged according to the circumferential and radial indices of each radial sampling point to generate a thickness value array;
[0069] Based on the thickness value array, a global thickness function is established with circumferential and radial indices as independent variables and thickness values as dependent variables.
[0070] Optionally, the step of identifying thickness anomaly regions based on the global thickness function specifically involves:
[0071] Read the thickness value corresponding to each radial sampling point from the global thickness function;
[0072] Calculate the average thickness value corresponding to all radial sampling points to generate the average thickness value;
[0073] Subtract the average thickness value from the thickness value corresponding to each radial sampling point and take the absolute value to generate the thickness deviation value;
[0074] Radial sampling points whose thickness deviation values are greater than a preset thickness deviation threshold are marked as abnormal sampling points;
[0075] Based on the circumferential and radial indices corresponding to the abnormal sampling points, adjacent abnormal sampling points are connected and merged to generate a thickness anomaly region.
[0076] Optionally, step eight specifically includes:
[0077] Calculate the standard deviation of the thickness values corresponding to all radial sampling points based on the global thickness function, and divide the standard deviation by the average thickness value to generate the thickness dispersion ratio.
[0078] The percentage of abnormal area is generated based on the ratio of the number of abnormal sampling points in the total thickness abnormal area to the total number of radial sampling points.
[0079] Based on the difference between the maximum and minimum thickness values in the global thickness function, a thickness range value is generated, and the thickness range value is divided by the average thickness value to generate a thickness range ratio value.
[0080] The thickness uniformity evaluation value is generated by adding the thickness dispersion ratio, the abnormal area ratio and the thickness range ratio and then dividing by three.
[0081] When the thickness uniformity evaluation value is less than or equal to a preset first evaluation threshold, a thickness uniformity qualified mark is generated;
[0082] When the thickness uniformity evaluation value is greater than a preset first evaluation threshold and less than or equal to a preset second evaluation threshold, a slight thickness unevenness mark is generated.
[0083] When the thickness uniformity evaluation value is greater than the preset second evaluation threshold, a severe thickness non-uniformity mark is generated.
[0084] Based on the thickness uniformity evaluation value and the corresponding thickness uniformity qualified mark, slight thickness unevenness mark, or severe thickness unevenness mark, the potato chip thickness uniformity test result is output.
[0085] The beneficial effects of this invention are:
[0086] This invention simultaneously acquires top structured light stripe images, top texture images, and lateral edge contour images of the potato chip to be tested, forming a unified composite visual data source for the height of the upper surface, the shape of the outer contour, and the actual thickness of the edge of the potato chip. This overcomes the problem that manual sampling, single-point thickness measurement, or ordinary two-dimensional image detection cannot express the thickness distribution of the entire potato chip, and improves the data integrity and non-contact measurement stability of potato chip thickness detection.
[0087] This invention generates a standardized potato chip height map by solving the principal fitting plane and orthogonalizing the orientation. It also establishes an adaptive polar coordinate measurement grid based on the outer contour of the potato chip, so that the spatial height values of irregular potato chips can be stably arranged according to the circumferential and radial indices. This reduces the influence of potato chip orientation tilt, edge gaps and outer contour irregularities on the thickness sampling position, and improves the continuity and spatial correspondence accuracy of the upper surface height field expression.
[0088] This invention uses the actual edge thickness extracted from the lateral edge contour image as the boundary thickness condition, introduces the bottom surface drift field inversion model to iteratively solve the bottom surface offset of the potato chip, and combines the upper surface height field to generate a global thickness function, thus avoiding the thickness calculation error caused by only using the conveyor belt reference plane as the bottom surface of the potato chip. Furthermore, by outputting the detection results through thickness anomaly areas and thickness uniformity evaluation values, the detection results can distinguish between qualified, slightly uneven thickness, and severely uneven thickness states, improving the reliability of the sorting, re-inspection, and rejection processes on the production line. Attached Figure Description
[0089] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0090] Figure 1 This is an overall flowchart of a machine vision-based method for detecting the thickness uniformity of potato chips proposed in this invention.
[0091] Figure 2 This is a simulation diagram of the initial point cloud and orthogonalized attitude of the upper surface of a potato chip, which is a potato chip thickness uniformity detection method based on machine vision proposed in this invention.
[0092] Figure 3 This is a schematic diagram of the contour adaptive polar coordinate measurement grid for a machine vision-based potato chip thickness uniformity detection method proposed in this invention.
[0093] Figure 4 This is a simulation diagram of the boundary thickness condition mapping for a machine vision-based potato chip thickness uniformity detection method proposed in this invention. Detailed Implementation
[0094] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0095] refer to Figures 1-4 A machine vision-based method for detecting the thickness uniformity of potato chips includes the following steps:
[0096] Step 1: Collect the top structured light stripe image, top texture image, and side edge contour image of the potato chip to be detected, and generate a composite visual dataset of potato chips;
[0097] Step 2: Generate an initial point cloud set on the upper surface of the potato chip based on the potato chip composite visual dataset. Perform principal fitting plane solution and pose orthogonalization processing on the initial point cloud set on the upper surface of the potato chip to generate a standardized potato chip height map.
[0098] Step 3: Extract the outer contour of the potato chip from the top texture image, and establish an adaptive polar coordinate measurement grid based on the outer contour of the potato chip and the standardized potato chip height map;
[0099] Step 4: Extract spatial height values from the standardized potato chip height map and map the spatial height values to the contour adaptive polar coordinate measurement grid to generate the upper surface height field;
[0100] Step 5: Extract the true edge thickness from the lateral edge contour image, and map the true edge thickness to the contour adaptive polar coordinate measurement grid by combining the outer contour line of the potato chip, thus generating the boundary thickness condition;
[0101] Step 6: Construct a bottom surface drift field inversion model based on the upper surface height field and boundary thickness conditions, and iteratively solve the bottom surface drift field inversion model to generate the bottom surface drift field;
[0102] Step 7: Generate a global thickness function based on the upper surface height field and the bottom surface drift field, and identify areas of thickness anomaly based on the global thickness function;
[0103] Step 8: Generate thickness uniformity evaluation values based on the global thickness function and thickness anomaly regions, and output the potato chip thickness uniformity detection results based on the thickness uniformity evaluation values.
[0104] In this embodiment, step one specifically includes:
[0105] When the potato chips to be inspected enter the inspection station, the top structured light projector is triggered to project coded stripes onto the upper surface of the potato chips to be inspected, and the top camera captures the top structured light stripe image formed by the coded stripes on the upper surface of the potato chips to be inspected.
[0106] Turn off the top structured light projector and turn on the top supplementary light source. Use the top camera to capture the top texture image of the potato chip to be detected. The top texture image and the top structured light stripe image have the same image coordinate reference.
[0107] A lateral edge contour image of the edge region of the potato chip to be detected is acquired by a lateral camera set to the side of the potato chip to be detected. The lateral edge contour image includes the upper contour and lower contour of the edge of the potato chip to be detected.
[0108] The same detection number, the same trigger time marker, and the corresponding viewpoint marker are configured for the top structured light stripe image, the top texture image, and the side edge contour image, respectively;
[0109] Based on the top structured light stripe image, top texture image, and side edge contour image configured with the same detection number, the same trigger time marker, and the corresponding viewpoint marker, a potato chip composite visual dataset is generated.
[0110] In the specific implementation process, the detection station is set with an independent imaging area of 120mm width. The imaging resolution of the top camera is set to 2448×2048 pixels, the lens focal length is set to 25mm, the stripe spacing of the top structured light projector is set to 0.6mm, the coding stripes are black and white alternating phase-shifted stripes, and the angle between the stripe projection direction and the conveyor belt movement direction is set to 90°, so that the local bulges, depressions and bends on the surface of the potato chip can form a stable offset in the stripe image. The top supplementary light source is a ring diffuse light source with an illuminance of 8000lx and an exposure time of 1.2ms, so that the potato chip boundary, oil spot texture and broken edge in the top texture image can maintain a clear correspondence with the structured light stripe image. The angle between the optical axis of the side camera and the conveyor belt plane is set to 5°, and the height of the side imaging area is set to 12mm, which is used to cover the thickness variation range between the upper and lower contours of the potato chip edge. All three types of images use the same photoelectric trigger signal as the acquisition starting point, and the trigger time error is controlled within 1ms. The above settings can reduce positional mismatch during high-speed potato chip transport, ensure the spatial correspondence between the top structured light stripe image, the top texture image, and the lateral edge contour image on the same potato chip to be detected, and provide a consistent data foundation for the generation of the initial point cloud set on the upper surface of the potato chip and the extraction of the true edge thickness.
[0111] In this embodiment, step two specifically involves:
[0112] Read the top structured light stripe image and top texture image from the potato chip composite visual dataset, and determine the imaging region of the potato chip to be detected based on the top texture image;
[0113] Extract the stripe center line from the top structured light stripe image within the imaging area, and subtract the position of the stripe center line from the preset reference stripe position to obtain the stripe offset.
[0114] Multiply the stripe offset by the preset height conversion coefficient to obtain the spatial height value of each sampling position on the surface of the potato chip to be detected, and generate an initial point cloud set on the surface of the potato chip based on the horizontal coordinate, vertical coordinate and spatial height value of each sampling position.
[0115] The principal fitting plane is solved for the initial point cloud set on the upper surface of the potato chip to obtain the principal fitting plane of the potato chip, and the attitude offset is generated based on the normal deviation between the principal fitting plane of the potato chip and the reference plane of the conveyor belt.
[0116] An attitude rotation matrix is constructed based on the attitude offset. The attitude rotation matrix is used to orthogonalize the lateral coordinates, longitudinal coordinates, and spatial height values of each point in the initial point cloud set on the upper surface of the potato chip, thereby generating an orthogonal point cloud set.
[0117] The orthogonalized point cloud set is projected according to the image coordinate reference of the top texture image, and the spatial height value corresponding to each coordinate position after projection is written into the pixel position of the height map to generate a standardized potato chip height map.
[0118] In the specific implementation process, the imaging area of the potato chip to be inspected is defined by the potato chip boundary mask in the top texture image. The stripe center line is only extracted within this imaging area to avoid the background stripes of the conveyor belt from participating in the calculation. The preset reference stripe position is obtained through no-load calibration. That is, when no potato chips are placed at the inspection station, the top structured light projector is controlled to project coded stripes onto the reference plane of the conveyor belt. The top camera acquires the no-load reference stripe image, extracts the center line position of each coded stripe in the no-load reference stripe image, and records the horizontal coordinate of the reference stripe center in the same image coordinate row as the preset reference stripe position. The preset height conversion coefficient is obtained through standard thickness calibration pieces. That is, standard calibration pieces with thicknesses of 1.00mm, 1.50mm, and 2.00mm are placed sequentially at the inspection station, and the corresponding structured light stripe images are acquired respectively. The average stripe offset of each standard calibration piece relative to the preset reference stripe position is calculated, and the average value of the standard calibration piece thickness divided by the corresponding average stripe offset is taken to obtain the preset height conversion coefficient. For any sampling position, the horizontal position of the pixel of the actual stripe center line in the top structured light stripe image is subtracted from the preset reference stripe position to obtain the stripe offset. Then, the stripe offset is multiplied by the preset height conversion coefficient to obtain the spatial height value of the sampling position. The horizontal coordinates, vertical coordinates and spatial height values of each sampling position form the initial point cloud set of the potato chip's upper surface.
[0119] When solving for the principal fitting plane, the points in the initial point cloud set on the upper surface of the potato chip are substituted into the plane expression, and the principal fitting plane of the potato chip is determined by the minimum sum of squared residuals:
[0120] ;
[0121] in, To find the minimum value function, This represents the total number of sampling locations. Indicates the sampling position number. For the first The horizontal coordinates of each sampling location, For the first The vertical coordinates of each sampling location, For the first Spatial height value of each sampling location, , and Let the normal parameters of the principal fitting plane of the potato chip be such that they satisfy... , Let (a, b, c) be the normal vector of the principal fitting plane of the potato chip model, and (0, 0, 1) be the normal vector of the reference plane of the conveyor belt model. First, normalize the normal vector of the principal fitting plane of the potato chip model to obtain a unit normal vector. Then, perform a cross product between this unit normal vector and the normal vector of the reference plane of the conveyor belt model to obtain the rotation axis vector. Perform a dot product between this unit normal vector and the normal vector of the reference plane of the conveyor belt model to obtain the cosine of the attitude angle. The rotation axis vector and the attitude angle together constitute the attitude offset. When constructing the attitude rotation matrix, first convert the rotation axis vector into an antisymmetric matrix. Then, using the identity matrix as the initial matrix, multiply the antisymmetric matrix by the sine of the attitude angle to obtain the first rotation correction matrix. Multiply the antisymmetric matrix by itself and then multiply the result by 1 minus the cosine of the attitude angle to obtain the second rotation correction matrix. Add the identity matrix, the first rotation correction matrix, and the second rotation correction matrix to obtain the attitude rotation matrix. During the pose orthogonalization process, the horizontal coordinates, vertical coordinates, and spatial height values of each point in the initial point cloud set on the upper surface of the potato chip are multiplied by the pose rotation matrix to obtain the orthogonalized point cloud set. Then, using the image coordinate reference of the top texture image as the projection plane, the horizontal and vertical coordinates of each point in the orthogonalized point cloud set are mapped to the pixel position of the height map, and the corresponding spatial height value is written to the pixel position of the height map. For pixel positions not directly covered by the point cloud, bilinear completion is performed using the spatial height values of four adjacent pixel positions already written to the height map, thereby generating a continuous standardized potato chip height map.
[0122] In this embodiment, step three specifically includes:
[0123] The top texture image is grayscaled and edge-enhanced to generate a texture boundary-enhanced image;
[0124] Closed boundary tracking is performed on the texture boundary enhancement image to extract the closed boundary line between the potato chip to be detected and the background, and the outer contour line of the potato chip is generated.
[0125] Based on the horizontal and vertical coordinates of each contour point in the outer contour of the potato chip, the horizontal coordinates of all contour points are summed and divided by the number of contour points to obtain the horizontal coordinates of the centroid. The vertical coordinates of all contour points are summed and divided by the number of contour points to obtain the vertical coordinates of the centroid. The centroid of the potato chip is generated from the horizontal and vertical coordinates of the centroid.
[0126] Using the center of the potato chip as the pole, multiple radial measurement lines are generated from the center of the potato chip to the outer contour line of the potato chip at preset angle intervals, and the intersection point of each radial measurement line and the outer contour line of the potato chip is recorded.
[0127] The distance from the centroid of the potato chip to the corresponding intersection point in each radial measurement line is taken as the contour radius of the radial measurement line, and the contour radius is divided by the preset number of radial segments to obtain the radial step length.
[0128] On each radial measurement line, multiple radial sampling points are generated sequentially from the centroid of the potato chip according to the radial step size, and each radial sampling point is mapped to the height map pixel position in the standardized potato chip height map.
[0129] Based on the angular position of each radial measurement line, the radial position of each radial sampling point, and the height map pixel position corresponding to each radial sampling point, an adaptive polar coordinate measurement grid for the contour is established.
[0130] In the specific implementation process, the top texture image is first converted into a grayscale image using a weighted method for the red, green, and blue channels. The weight of the red channel is set to 0.299, the weight of the green channel is set to 0.587, and the weight of the blue channel is set to 0.114 to reduce the impact of color difference on the potato chip surface on boundary recognition. The grayscale image is smoothed using a 3×3 Gaussian filter kernel with a filter standard deviation of 1.0. Then, the Sobel operator is used to extract the horizontal and vertical grayscale gradients respectively. The square root of the sum of the squared values of the horizontal and vertical grayscale gradients is obtained to obtain the edge gradient magnitude map. Pixels with edge gradient magnitudes greater than 45 are marked as candidate edge pixels. Then, a 3×3 closing operation is performed to connect the broken edges to generate a texture boundary enhancement image. During closed boundary tracking, the largest connected edge region in the texture boundary enhancement image is used as the candidate boundary region for the potato chip. Starting from the leftmost edge pixel, adjacent edge pixels are searched point by point in a clockwise direction, with an 8-neighborhood set. When the tracking point returns to the starting point and the number of boundary points is greater than 300, a closed boundary line is determined. For burrs in the closed boundary line, the average coordinates of 5 consecutive contour points are used for smoothing correction to obtain the outer contour line of the potato chip. Preferably, the preset angle interval is set to 5°, thus generating 72 radial measurement lines around the centroid of the potato chip; the preset radial segment number is set to 20, so that each radial measurement line forms 20 radial sampling points. Through the above processing, the outer contour line can be kept continuous and stable even when there are local gaps, curled edges, or color variations at the edge of the potato chip, and the contour adaptive polar coordinate measurement grid is kept consistent with the irregular potato chip boundary, providing a stable sampling position for the upper surface height field mapping.
[0131] In this embodiment, step four specifically includes:
[0132] Read the height map pixel position corresponding to each radial sampling point from the contour adaptive polar coordinate measurement grid;
[0133] Based on the height map pixel position corresponding to each radial sampling point, extract the corresponding spatial height value from the standardized potato chip height map;
[0134] Establish circumferential numbers according to the angular position of each radial measurement line, and establish radial numbers according to the radial position of each radial sampling point;
[0135] The extracted spatial height values are written into the contour adaptive polar coordinate measurement grid according to the corresponding circumferential and radial indices to generate a spatial height value array.
[0136] In the spatial height value array, the spatial height values corresponding to adjacent radial numbers under the same circumferential number are connected sequentially in the direction from the centroid of the potato chip to the outer contour line of the potato chip to generate a radial height sequence.
[0137] In the spatial height value array, the spatial height values corresponding to the same radial index under adjacent circumferential indexes are connected sequentially in the direction of increasing angular position to generate a circumferential height sequence;
[0138] Generate the upper surface height field based on the spatial height value array, radial height sequence, and circumferential height sequence;
[0139] In the specific implementation process, the height map pixel positions of the standardized potato chip height map are consistent with the image coordinate reference of the top texture image. Each radial sampling point in the contour adaptive polar coordinate measurement grid corresponds to a height map pixel position. When extracting spatial height values, the horizontal and vertical pixel coordinates of the height map pixel position are used as indices to directly read the spatial height value written at that position, avoiding recalculation of structured light stripes. The circumferential sequence number is set to increment from 0° according to the angle position, with a preset angle interval of 5°, forming a total of 72 circumferential sequence numbers. The radial sequence number is set to increment from the potato chip centroid to the outer contour line of the potato chip, with a preset radial segment number of 20, and each radial measurement line forms 20 radial sequence numbers. The spatial height value array adopts a 72-row, 20-column two-dimensional array structure, where the row number corresponds to the circumferential sequence number and the column number corresponds to the radial sequence number. The radial height sequence is used to express the continuous change in height from the center to the edge of the potato chip in the same angular direction, and the circumferential height sequence is used to express the continuous change in height along the circumferential direction of the outer contour at the same radial position. By simultaneously preserving the spatial height value array, radial height sequence, and circumferential height sequence, the upper surface height field can possess both two-dimensional gridded representation capabilities and retain the continuous relationship of radial undulation and circumferential warping of the potato chip surface. This reduces height sampling misalignment caused by irregular boundaries and improves the stability of boundary thickness constraints and global thickness function calculations.
[0140] In this embodiment, step five specifically includes:
[0141] Extract the upper and lower edge contours of the potato chip to be detected from the lateral edge contour image;
[0142] Multiple edge thickness measurement lines are generated along the normal direction of the lower edge contour, and the intersection points of each edge thickness measurement line with the upper edge contour and with the lower edge contour are recorded.
[0143] The true edge thickness is obtained by multiplying the pixel distance between the intersection point of the upper edge contour and the intersection point of the lower edge contour in the same edge thickness measurement line by a preset lateral pixel length conversion factor.
[0144] Based on the viewpoint markers of the lateral edge contour image, determine the corresponding contour points of each edge thickness measurement line on the outer contour line of the potato chip, and write the actual thickness of the corresponding edge into the corresponding contour point.
[0145] According to the angular position of the corresponding contour point, the true edge thickness is associated with the outermost radial sampling point at the same angular position in the contour adaptive polar coordinate measurement grid;
[0146] Generate boundary thickness conditions based on the actual edge thickness associated with the outermost radial sampling point;
[0147] In the specific implementation, the imaging height range of the lateral edge contour image is set to 12mm, the preset lateral pixel length conversion factor is set to 0.01mm / pixel, and the interval of the edge thickness measurement lines is set to 2 pixels to ensure that the thickness difference between the upper and lower contours of the potato chip edge can be stably acquired. The boundary thickness condition refers to the set of true edge thicknesses associated with the outermost radial sampling points of the contour adaptive polar coordinate measurement grid. Each true edge thickness corresponds to an edge thickness measurement line, a corresponding contour point on the outer contour line of the potato chip, and an outermost radial sampling point, and the position is bound by the angle position of the corresponding contour point. The pixel distance between the upper and lower contours reflects the actual thickness change of the potato chip edge from the lateral viewpoint. Compared with the spatial height value obtained solely from the top structured light, it can supplement the true thickness reference of the bottom surface of the potato chip at the edge. By fixing the true edge thickness as a boundary thickness condition to the outermost radial sampling point of the contour adaptive polar coordinate measurement grid, an outer contour boundary constraint can be provided for the bottom surface drift field inversion model. This makes the bottom surface drift field limited by the true thickness at the edge position, thereby reducing the error caused by potato chip curling, edge warping and bottom tilting in thickness calculation, and improving the reliability of global thickness function calculation and thickness anomaly region identification.
[0148] In this embodiment, step six specifically includes:
[0149] Read the spatial height value array, radial height sequence and circumferential height sequence from the upper surface height field, and read the true edge thickness corresponding to the outermost radial sampling point from the boundary thickness condition;
[0150] In the contour adaptive polar coordinate measurement grid, each radial sampling point is configured as a variable position, and a bottom surface height offset to be determined is set for each variable configuration position.
[0151] Subtract the corresponding actual edge thickness from the spatial height value corresponding to the outermost radial sampling point to obtain the boundary bottom surface drift reference value of the outermost radial sampling point;
[0152] Calculate the squared difference between the required bottom surface height offset and the corresponding boundary bottom surface drift reference value for each outermost radial sampling point, and sum all the squared differences to generate boundary constraint terms;
[0153] In each radial height sequence, the squared difference between the bottom surface height offsets corresponding to adjacent radial sampling points is calculated, and the squared differences in all radial height sequences are summed to generate a radial continuity constraint term.
[0154] In each circumferential height sequence, the squared difference between the bottom surface height offsets corresponding to adjacent circumferential sampling points is calculated, and the squared differences in all circumferential height sequences are summed to generate circumferential continuous constraint terms.
[0155] Under each circumferential sequence number, three consecutive radial sampling points are selected in sequence. The square of the second-order difference between the bottom surface height offsets corresponding to the three consecutive radial sampling points is calculated. All squares of the second-order difference are summed to generate the radial curvature constraint term.
[0156] Under each radial index, three consecutive circumferential sampling points are selected in sequence. The square of the second-order difference between the bottom surface height offsets corresponding to the three consecutive circumferential sampling points is calculated. All squares of the second-order difference are summed to generate the circumferential curvature constraint term.
[0157] The curvature suppression constraint term is generated by summing the radial curvature constraint term and the circumferential curvature constraint term.
[0158] The boundary constraint terms, radial continuity constraint terms, circumferential continuity constraint terms, and curvature suppression constraint terms are weighted and summed to construct the bottom surface drift field inversion model;
[0159] The bottom surface drift field inversion model is iteratively solved to minimize the weighted summation result, and the bottom surface height offset corresponding to each radial sampling point is obtained.
[0160] The bottom surface height offset is arranged according to the circumferential and radial serial numbers of each radial sampling point to generate the bottom surface drift field;
[0161] In the specific implementation process, the bottom surface height offset is used to characterize the local deviation of the potato chip's bottom surface relative to the conveyor belt's reference plane, with the unit set to millimeters. The contour adaptive polar coordinate measurement grid uses 72 circumferential indices and 20 radial indices, with each radial sampling point configured with a bottom surface height offset to be determined. Therefore, a single potato chip corresponds to 1440 variables to be determined. The weights of the boundary constraint term are set to 1.00, the radial continuity constraint term to 0.35, the circumferential continuity constraint term to 0.35, and the curvature suppression constraint term to 0.20. Among them, the boundary constraint term is used to ensure that the bottom surface drift field meets the true edge thickness at the outer contour position, the radial and circumferential continuity constraints are used to limit abrupt changes in the bottom surface at adjacent positions, and the curvature suppression constraint term is used to limit excessive bending of the bottom surface height offset in local areas. Through the above weight configuration, while maintaining the priority of the true edge thickness constraint, the bottom surface drift field can be kept smooth and continuous in the direction from the center of the potato chip to the edge and in the circumferential unfolding direction, avoiding the bottom surface being incorrectly assumed to be flat due to relying solely on the upper surface height field.
[0162] In this invention, the bottom surface drift field inversion model is not used to recover the microscopic rough texture of the potato chip's bottom surface, but rather to estimate the low-frequency drift state of the potato chip's bottom surface relative to the conveyor belt reference plane. This low-frequency drift state mainly originates from edge curling, localized lifting, overall bending, and support surface offset caused by the bottom surface not fully adhering to the conveyor belt. For the small air bubbles, localized oil stains, and minute rough spots present on the surface of the fried potato chips, this invention does not treat them as the primary solution object for the bottom surface drift field, but rather expresses them through thickness deviation values and thickness anomaly regions in the global thickness function.
[0163] To avoid the bottom surface drift field being inferred unidirectionally from the boundary thickness condition in the central region, this invention simultaneously reads the radial and circumferential height sequences from the upper surface height field during the iterative solution process, and generates upper surface morphology change markers based on the spatial height differences between adjacent radial and circumferential sampling points. When the upper surface height change near a certain radial sampling point is less than 0.05 mm, the original weights of the radial continuity constraint, circumferential continuity constraint, and curvature suppression constraint are maintained. When the upper surface height change near a certain radial sampling point is greater than or equal to 0.05 mm and less than 0.15 mm, the weight of the curvature suppression constraint in the neighborhood of that location is reduced to 70% of its original weight. When the upper surface height change near a certain radial sampling point is greater than or equal to 0.15 mm, the weight of the curvature suppression constraint in the neighborhood of that location is reduced to 50% of its original weight, while retaining the radial and circumferential continuity constraints to prevent local abrupt changes from being completely smoothed out. In this way, the bottom drift field inversion model is constrained by the true edge thickness at the outer contour position and guided by the radial and circumferential morphological changes of the upper surface height field in the inner region. This avoids both unconstrained oscillations in the bottom drift field and excessive smoothing of the true local bulges or depressions.
[0164] After each iteration, the maximum change in bottom surface height offset between two adjacent iterations is calculated. When the maximum change is less than 0.005 mm and the current inversion error change is less than 0.01, the bottom surface drift field is considered converged. If, after reaching the maximum number of iterations, there are still three or more consecutive radial sampling points with bottom surface height offset changes greater than 0.030 mm, the corresponding area is marked as an unstable inversion region and output as a re-examination prompt in subsequent thickness anomaly region identification. By setting convergence criteria and inversion unstable region marking, this invention can provide a correction and prompt mechanism when the bottom surface morphology in the central region is not completely consistent with the smoothness assumption, thereby improving the reliability of the bottom surface drift field inversion results.
[0165] In the specific iterative solution, the initial value of all the bottom surface height offsets to be determined is set to 0mm, and the initial value of the outermost radial sampling point is replaced with the corresponding boundary bottom surface drift reference value. In each iteration, the boundary constraint term, radial continuity constraint term, circumferential continuity constraint term, and curvature suppression constraint term are recalculated, and the current inversion error value is obtained by summing them according to their corresponding weights. The iteration step size is set to 0.05, and the maximum number of iterations is set to 200. When the difference between the inversion error value of the previous round and the inversion error value of the next round is less than 0.01, or when the maximum number of iterations is reached, the iteration stops, and the bottom surface height offset corresponding to each radial sampling point obtained in the last round is used as the solution result. Through this iterative method, the bottom surface height offset can be gradually converged towards the direction that satisfies the boundary thickness condition and is smooth overall, reducing the influence of potato chip edge curling, rolling, and local overhang on the thickness inversion, thereby providing a stable bottom surface reference for the generation of the global thickness function.
[0166] The output of the bottom drift field inversion model is the estimated bottom drift field that minimizes the weighted sum of boundary constraints, radial continuity constraints, circumferential continuity constraints, and curvature suppression constraints. It is not intended to uniquely reconstruct the true microscopic geometry of the potato chip's bottom surface. For the same potato chip to be tested, when the spatial height value array, radial height sequence, circumferential height sequence, boundary thickness condition, weights of each constraint, initial values, iteration step size, and stopping condition are all determined, the bottom drift field inversion model outputs a determined set of bottom height offsets according to the same iterative process. The upper surface morphology change marker is not used to directly infer the true bottom morphology, nor does it indicate that an upper surface bulge necessarily corresponds to a bottom bulge. Instead, it is used to identify areas with significant spatial height value changes and to reduce the intensity of the curvature suppression constraint in these areas, preventing excessive smoothing of local thickness variation areas during the inversion process. Therefore, the bottom drift field inversion model ensures the thickness reference of the outer contour position through boundary true thickness constraints, limits the unconstrained oscillation of bottom height offset through radial and circumferential continuous constraint terms, limits local excessive bending through curvature suppression constraint terms, and locally adjusts the curvature suppression intensity through upper surface morphology change markers, so that the output result becomes a stable engineering estimate for global thickness function calculation.
[0167] In this invention, the final thickness value is obtained by subtracting the bottom surface height offset from the spatial height value corresponding to the same radial sampling point. Therefore, data link errors are mainly transmitted along the spatial height value generation path and the bottom surface height offset generation path. In the spatial height value generation path, the extraction error of the top structured light stripe center line, the preset reference stripe position error, and the preset height conversion coefficient error will jointly affect the spatial height value. In the bottom surface height offset generation path, the lateral edge contour extraction error, the preset lateral pixel length conversion coefficient error, the edge true thickness mapping error, and the bottom surface drift field iterative solution error will jointly affect the bottom surface height offset. Since this invention controls the above steps through the same photoelectric trigger signal, the same image coordinate reference, no-load calibration, standard thickness calibration plate conversion, lateral pixel length conversion, angle position binding, and iterative convergence determination, it can reduce the impact of the cumulative error of each step on the final thickness value and ensure that the global thickness function, thickness anomaly region, and thickness uniformity evaluation value have a stable data source.
[0168] In the specific implementation process, the following allowable ranges are set for data link errors: the extraction error of the center line of the top structured light stripe is no greater than 0.05 pixels; the repeated extraction error of the preset reference stripe position is no greater than 0.04 pixels; after the preset height conversion coefficient is calibrated by the standard thickness calibration sheet, the height conversion residual of the 1.00mm, 1.50mm and 2.00mm standard thickness calibration sheet is no greater than 0.012mm; the coordinate correspondence error between the top texture image and the top structured light stripe image is no greater than 0.5 pixels; the calibration error of the lateral pixel length conversion coefficient is no greater than 0.008mm; the repeated measurement deviation of the true edge thickness formed after the extraction of the upper and lower edge contours is no greater than 0.010mm; when the true edge thickness is associated with the outermost radial sampling point according to the angle position, the angle position deviation does not exceed one circumferential sequence number; after the bottom surface drift field iterative convergence, the maximum change value of the bottom surface height offset between two adjacent wheels is no greater than 0.005mm, and the change of the current inversion error value is less than 0.01. The height conversion residual, lateral pixel length conversion error, edge true thickness repeated measurement deviation, edge mapping error, and bottom surface drift field iteration residual are used as the main error components. These are then synthesized and estimated using a square root method, resulting in a single-point thickness synthesis standard error of no more than 0.023 mm. The 0.038 mm average thickness error is the average absolute error obtained during the verification process of this invention, based on 300 potato chips, 1440 radial sampling points per chip, and a total of 432,000 sets of corresponding thickness differences. It is not the upper limit of the absolute error for a single sampling point. This average thickness error also includes placement disturbances when the potato chips are transferred to the offline 3D scanning device, residual differences caused by resampling of the reference thickness point cloud, and residual differences caused by changes in the surface state of the local oil film. Therefore, the above error allocation and synthesis estimation can support the average thickness error of this invention being on the order of 0.038 mm.
[0169] In this embodiment, a global thickness function is generated based on the upper surface height field and the bottom surface drift field, specifically as follows:
[0170] Read the spatial height values corresponding to each radial sampling point from the height field of the upper surface;
[0171] Read the bottom height offset corresponding to each radial sampling point from the bottom drift field;
[0172] Subtract the corresponding bottom surface height offset from the spatial height value corresponding to the same radial sampling point to obtain the thickness value of the radial sampling point.
[0173] The thickness values are arranged according to the circumferential and radial indices of each radial sampling point to generate a thickness value array;
[0174] Establish a global thickness function based on the thickness value array, with circumferential and radial indices as independent variables and thickness values as dependent variables;
[0175] In the specific implementation, the thickness value array is set to 72 rows and 20 columns, corresponding to 72 circumferential indices and 20 radial indices, respectively, with the thickness value unit set to millimeters. The global thickness function no longer uses the thickness of a single cross-section or edge as the criterion, but instead incorporates the thicknesses of the central region, transition region, and outer contour region of the potato chip into a unified array expression, ensuring that any circumferential or radial indice corresponds to a unique thickness value. This method eliminates the influence of potato chip tilt, bottom surface overhang, and edge warping on thickness calculation, transforming the thickness distribution from discrete sampling results into a continuously indexable global thickness expression, providing a complete and stable data foundation for identifying thickness anomalies and evaluating thickness uniformity.
[0176] In this embodiment, the thickness anomaly region is identified based on the global thickness function, specifically as follows:
[0177] Read the thickness value corresponding to each radial sampling point from the global thickness function;
[0178] Calculate the average thickness value corresponding to all radial sampling points to generate the average thickness value;
[0179] The thickness deviation value is generated by subtracting the average thickness value from the thickness value corresponding to each radial sampling point and taking the absolute value.
[0180] Radial sampling points with thickness deviation values greater than the preset thickness deviation threshold are marked as abnormal sampling points;
[0181] Based on the circumferential and radial indices corresponding to the abnormal sampling points, adjacent abnormal sampling points are connected and merged to generate a thickness anomaly region;
[0182] In the specific implementation process, the preset thickness deviation threshold is set to 0.18mm. The connection and merging of abnormal sampling points is performed using a circumferential-radial adjacency method. That is, the sampling points corresponding to the previous circumferential number, the next circumferential number, the previous radial number, and the next radial number of each abnormal sampling point are used as adjacency judgment objects. When adjacent sampling points are also marked as abnormal sampling points, they are grouped into the same abnormal connected group. For the first and last positions of the circumferential number, the first and last positions are connected to determine adjacency, so that the first circumferential number and the 72nd circumferential number can be continuously merged in the circumferential direction, avoiding the breakage after the outer contour of the potato chip is unfolded. When each abnormal connected group includes at least 3 abnormal sampling points, it is determined as a valid thickness abnormal region. Connected groups with fewer than 3 abnormal sampling points are discarded as isolated measurement disturbances. Through the above connection and merging method, scattered abnormal sampling points can be transformed into thickness abnormal regions with spatial range, avoiding misjudgment caused by single-point noise, and accurately preserving the thin and thick uneven regions extending radially and the edge warping regions distributed circumferentially, providing a stable regional basis for thickness uniformity evaluation.
[0183] In this embodiment, step eight specifically includes:
[0184] The standard deviation of the thickness values corresponding to all radial sampling points is calculated based on the global thickness function, and the standard deviation is divided by the average thickness value to generate the thickness dispersion ratio.
[0185] The percentage of abnormal area is generated based on the ratio of the number of abnormal sampling points in the total thickness abnormal area to the total number of radial sampling points.
[0186] Based on the difference between the maximum and minimum thickness values in the global thickness function, a thickness range value is generated, and the thickness range value is divided by the average thickness value to generate a thickness range ratio value.
[0187] The thickness uniformity evaluation value is generated by adding the thickness dispersion ratio, the abnormal area ratio and the thickness range ratio and then dividing by three.
[0188] When the thickness uniformity evaluation value is less than or equal to the preset first evaluation threshold, a thickness uniformity qualified mark is generated;
[0189] When the thickness uniformity evaluation value is greater than the preset first evaluation threshold and less than or equal to the preset second evaluation threshold, a slight thickness unevenness mark is generated.
[0190] When the thickness uniformity evaluation value is greater than the preset second evaluation threshold, a severe thickness non-uniformity mark is generated.
[0191] Based on the thickness uniformity evaluation value and the corresponding thickness uniformity qualified mark, slight thickness non-uniformity mark or severe thickness non-uniformity mark, the potato chip thickness uniformity test result is output;
[0192] In the specific implementation process, the first evaluation threshold is preset to 0.08, and the second evaluation threshold is preset to 0.15. The thickness dispersion ratio, abnormal area ratio, and thickness range ratio are all dimensionless values, allowing the three indicators to participate in the thickness uniformity evaluation on the same numerical scale. The thickness dispersion ratio reflects the overall fluctuation of the thickness of the entire potato chip around the average thickness value, the abnormal area ratio reflects the coverage of the thickness abnormal area in all radial sampling points, and the thickness range ratio reflects the extreme difference between the maximum and minimum thickness values. By using the three indicators together to generate the thickness uniformity evaluation value, the biased influence of a single local anomaly or a single extreme value on the test results can be avoided. When the thickness uniformity evaluation value is in different threshold ranges, the test results can correspond to three states: thickness uniformity qualified, slight thickness non-uniformity, or severe thickness non-uniformity, respectively. This facilitates the sorting equipment to perform pass, re-inspection, or rejection operations based on the test results, thereby improving the stability and executability of the potato chip thickness uniformity test results.
[0193] Example 1: To verify the feasibility of this invention in practice, it was applied to a continuous frying and sorting production line of a potato chip manufacturing company. This line outputs approximately 420 potato chips per minute. After frying, seasoning, and cooling, the chips enter the visual inspection station. In actual production, issues such as curled edges, localized bulges, thinner central areas, and incomplete bottom adhesion to the conveyor belt exist. Traditional manual sampling can only measure thickness at regular intervals, making it difficult to detect thickness fluctuations in consecutive batches. While ordinary two-dimensional image detection can identify breakage, scorch marks, and obvious appearance defects, it cannot determine whether surface undulations correspond to actual thickness unevenness. Single top structured light detection can easily misinterpret curled edges as increased thickness, leading to unstable sorting results. This example effectively demonstrates the core problem this invention aims to solve: achieving stable detection of potato chip thickness uniformity under conditions of high-speed conveying, irregular outer contours, and bottom surface drift.
[0194] In this production line, a top structured light projector, a top camera, a top supplementary light source, and a side camera are installed at the same inspection station. After the potato chips to be inspected enter the inspection area, top structured light stripe images, top texture images, and side edge contour images are simultaneously acquired to generate a composite visual dataset of the potato chips. The top structured light stripe images are used to extract spatial height values, the top texture images are used to extract the outer contour lines of the potato chips and establish a contour-adaptive polar coordinate measurement grid, and the side edge contour images are used to obtain the true edge thickness. The inspection software performs principal fitting plane solving and attitude orthogonalization processing on the initial point cloud set on the upper surface of the potato chips to generate a standardized potato chip height map. The spatial height values are then mapped to the contour-adaptive polar coordinate measurement grid to form an upper surface height field. Subsequently, the true edge thickness is introduced as a boundary thickness condition into the bottom surface drift field inversion model. The bottom surface drift field is obtained through iterative solving, and a global thickness function is further generated. Finally, based on the global thickness function, areas with abnormal thickness are identified, thickness uniformity evaluation values are calculated, and inspection results are output as follows: thickness uniformity qualified marker, slight thickness non-uniformity marker, or severe thickness non-uniformity marker.
[0195] To verify the practical effect of this invention, a comparative test was conducted on the manual sampling thickness measurement method and the method of this invention at the same inspection station on a potato chip production line. The manual sampling thickness measurement method used a vernier thickness gauge to randomly select five locations on each potato chip to measure its thickness. The method of this invention simultaneously integrates the top structured light stripe image, the top texture image, and the lateral edge contour image, and introduces boundary thickness conditions and a bottom surface drift field inversion model. During the test, 300 potato chips were inspected using each method, and the offline high-precision 3D scanning results were used as reference values. The comparison results are shown in Table 1.
[0196] To ensure the reliability of the accuracy verification benchmark, this embodiment uses a metrologically calibrated offline 3D scanning device as the reference measurement device. Before testing, the offline 3D scanning device is calibrated using standard thickness blocks of 0.50mm, 1.00mm, 1.50mm, and 2.00mm. After calibration, the repeated measurement deviation in the height direction is no greater than 0.010mm, and the sampling interval in the planar direction is no greater than 0.020mm. The verification environment temperature is controlled between 20℃ and 25℃. The potato chips to be tested are cooled before entering the testing station to reduce the influence of temperature changes and surface oil film flow on the measurement results. For the same potato chip, the global thickness function is first generated by the method of this invention. Then, the potato chip is removed and placed on the offline 3D scanning device for global scanning to obtain a reference thickness point cloud. The reference thickness point cloud is registered according to the outer contour line of the potato chip and resampled to the same 72 circumferential indices and 20 radial indices as the contour adaptive polar coordinate measurement grid of this invention, so that each radial sampling point thickness value output by the method of this invention has a corresponding reference thickness value.
[0197] The average thickness error refers to the average absolute difference between the thickness value measured by the method of this invention and the offline reference thickness value among all tested potato chips and all corresponding radial sampling points; the maximum thickness error refers to the maximum value among all the above absolute differences. Specifically, for each potato chip, the thickness value of 1440 radial sampling points was recorded, resulting in 432,000 sets of corresponding thickness differences for 300 potato chips. The average thickness error and maximum thickness error were then statistically analyzed based on these values. To verify repeatability, 30 potato chips were randomly selected from the 300 samples for three repeated tests. The same imaging parameters and conveying speed were maintained throughout the three tests, and the standard deviation of the thickness values at the same sampling point was calculated. When the standard deviation of the repeated tests was greater than 0.020 mm, the sample was marked as an imaging anomaly and re-acquired. Through the above-mentioned reference equipment calibration, grid registration, full-domain corresponding sampling, and repeatability verification, it can be ensured that the average thickness error and maximum thickness error in Table 1 have clear metrological benchmarks and statistical sources.
[0198]
[0199] In Table 1, the average thickness error and maximum thickness error refer to the measurement error of the thickness value output by the detection method relative to the offline reference thickness value, and do not indicate that the method of this invention has changed the physical thickness of the potato chip itself. For the manual sampling thickness measurement method, five locations are randomly selected for contact thickness measurement on each potato chip, and the measured values at these five locations are compared with the thickness values at the corresponding spatial locations in the offline reference thickness value to obtain the measurement error of the manual sampling. For the method of this invention, the thickness value of each potato chip is output according to the contour adaptive polar coordinate measurement grid of 1440 radial sampling points, and this is compared with the corresponding points after resampling of the offline reference thickness value to obtain the measurement error of the method of this invention. Therefore, Table 1 reflects the degree of approximation of the true thickness distribution by different detection methods, rather than the degree to which the thickness of the potato chip is changed by the detection method.
[0200] The accuracy of thickness anomaly region identification is calculated based on the degree of overlap between the reference thickness anomaly region and the detected thickness anomaly region. In the offline reference thickness values, regions with a thickness deviation greater than 0.18 mm and at least 3 connected sampling points are marked as reference thickness anomaly regions. The method of this invention generates detected thickness anomaly regions according to the same threshold and the same connectivity rules. For manual sampling thickness detection, since only 5 discrete thickness points are obtained per potato chip, this embodiment first marks discrete points exceeding the thickness deviation threshold as anomalies, and then determines whether a hit is achieved based on the positional relationship between the local area where the anomaly point is located and the reference thickness anomaly region. When a manually sampled anomaly point falls into the reference thickness anomaly region, it is recorded as a correct identification; when the reference thickness anomaly region is not covered by any manually sampled anomaly point, it is recorded as a missed detection; when a manually sampled anomaly point does not fall into the reference thickness anomaly region, it is recorded as a false detection. The accuracy of thickness anomaly region identification is calculated as the proportion of correctly identified regions to the total number of reference thickness anomaly regions.
[0201] The same timing start and end standards are used for all testing times. For the manual sampling thickness measurement method, the timing start point is the moment the operator picks up a single potato chip and begins positioning the thickness measurement tool, and the timing end point is the moment the last thickness measurement point data for that potato chip is recorded. For the method of this invention, the timing start point is the moment the photoelectric trigger signal triggers image acquisition, and the timing end point is the moment the thickness uniformity detection result is output. The number of misjudgments refers to the number of samples whose thickness uniformity pass mark, slight thickness non-uniformity mark, or severe thickness non-uniformity mark is inconsistent with the offline reference thickness value. Based on the above indicator definitions, all data in Table 1 have clear statistical calibers and can objectively reflect the differences between the manual sampling thickness measurement method and the method of this invention in terms of measurement error, abnormal area identification, detection efficiency, and classification stability.
[0202] As shown in Table 1 above, under the condition of the same number of test samples (300 slices), the method of the present invention has a significant advantage over the manual sampling thickness detection method. The average thickness error of the manual sampling thickness detection method is 0.164 mm, and the maximum thickness error reaches 0.382 mm, indicating that it is greatly affected by the limited number of sampling locations, irregular edges of potato chips, and local warping, making it difficult to accurately reflect the true thickness distribution of the entire potato chip. The average thickness error of the method of the present invention is reduced to 0.038 mm, and the maximum thickness error is reduced to 0.091 mm, indicating that the global thickness function can more completely express the thickness changes in the central area, transition area, and edge area of the potato chip. At the same time, the accuracy rate of thickness anomaly area identification of the method of the present invention reaches 95.7%, which is significantly improved compared with 71.6% of the manual sampling thickness detection method, indicating that it can stably identify local thickness deviations as thickness anomaly areas, reducing missed detections and false detections. Furthermore, regarding detection efficiency, the manual sampling method for thickness inspection has an average inspection time of 1850ms per piece, which is insufficient to meet the inspection requirements of continuous production lines. In contrast, the method of this invention takes only 68ms, making it more suitable for high-speed sorting scenarios. Moreover, the number of false positives is reduced from 42 pieces to 8 pieces, further demonstrating that its detection results are more stable and reliable.
[0203] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for detecting the thickness uniformity of potato chips based on machine vision, characterized in that, Includes the following steps: Step 1: Collect the top structured light stripe image, top texture image, and side edge contour image of the potato chip to be detected, and generate a composite visual dataset of potato chips; Step 2: Generate an initial point cloud set for the upper surface of the potato chip based on the potato chip composite visual dataset, and perform principal fitting plane solution and pose orthogonalization processing on the initial point cloud set for the upper surface of the potato chip to generate a standardized potato chip height map. Step 3: Extract the outer contour of the potato chip from the top texture image, and establish an adaptive polar coordinate measurement grid based on the outer contour of the potato chip and the standardized potato chip height map; Step 4: Extract spatial height values from the standardized potato chip height map and map the spatial height values to the contour adaptive polar coordinate measurement grid to generate the upper surface height field; Step 5: Extract the true edge thickness from the lateral edge contour image, and map the true edge thickness to the contour adaptive polar coordinate measurement grid by combining the outer contour line of the potato chip, thereby generating boundary thickness conditions; Step 6: Construct a bottom surface drift field inversion model based on the upper surface height field and boundary thickness conditions, and iteratively solve the bottom surface drift field inversion model to generate the bottom surface drift field; Step 7: Generate a global thickness function based on the upper surface height field and the bottom surface drift field, and identify areas of thickness anomaly based on the global thickness function; Step 8: Generate thickness uniformity evaluation values based on the global thickness function and thickness anomaly regions, and output the potato chip thickness uniformity detection results based on the thickness uniformity evaluation values.
2. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step one specifically involves: When the potato chips to be inspected enter the inspection station, the top structured light projector is triggered to project coded stripes onto the upper surface of the potato chips to be inspected, and the top camera captures the top structured light stripe image formed by the coded stripes on the upper surface of the potato chips to be inspected. The top structured light projector is turned off and the top supplementary light source is turned on. The top texture image of the potato chip to be detected is acquired by the top camera. The top texture image and the top structured light stripe image have the same image coordinate reference. A lateral edge contour image of the edge region of the potato chip to be detected is acquired by a lateral camera set to the side of the potato chip to be detected. The lateral edge contour image includes the upper contour and the lower contour of the edge of the potato chip to be detected. The same detection number, the same trigger time marker, and the corresponding viewpoint marker are configured for the top structured light stripe image, the top texture image, and the side edge contour image, respectively; A composite visual dataset of potato chips is generated based on the top structured light stripe image, top texture image, and side edge contour image configured with the same detection number, the same trigger time marker, and the corresponding viewpoint marker.
3. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step two specifically involves: Read the top structured light stripe image and the top texture image from the potato chip composite visual dataset, and determine the imaging area of the potato chip to be detected based on the top texture image; Extract the stripe center line from the top structured light stripe image within the imaging area, and subtract the position of the stripe center line from the preset reference stripe position to obtain the stripe offset. Multiply the stripe offset by a preset height conversion coefficient to obtain the spatial height value of each sampling position on the surface of the potato chip to be detected, and generate an initial point cloud set on the surface of the potato chip based on the horizontal coordinate, vertical coordinate and spatial height value of each sampling position. The initial point cloud set on the upper surface of the potato chip is solved by the principal fitting plane to obtain the potato chip principal fitting plane, and the attitude offset is generated according to the normal deviation between the potato chip principal fitting plane and the conveyor belt reference plane. An attitude rotation matrix is constructed based on the attitude offset. The attitude rotation matrix is used to orthogonalize the lateral coordinates, longitudinal coordinates, and spatial height values of each point in the initial point cloud set on the upper surface of the potato chip, thereby generating an orthogonal point cloud set. The orthogonalized point cloud set is projected according to the image coordinate reference of the top texture image, and the spatial height value corresponding to each coordinate position after projection is written into the pixel position of the height map to generate a standardized potato chip height map.
4. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step three specifically involves: The top texture image is grayscaled and edge-enhanced to generate a texture boundary-enhanced image; Closed boundary tracking is performed on the texture boundary enhancement image to extract the closed boundary line between the potato chip to be detected and the background, and the outer contour line of the potato chip is generated. Based on the horizontal and vertical coordinates of each contour point in the outer contour of the potato chip, the horizontal coordinates of all contour points are summed and divided by the number of contour points to obtain the horizontal coordinates of the centroid. The vertical coordinates of all contour points are summed and divided by the number of contour points to obtain the vertical coordinates of the centroid. The centroid of the potato chip is generated from the horizontal and vertical coordinates of the centroid. Using the centroid of the potato chip as the pole, multiple radial measurement lines are generated from the centroid of the potato chip to the outer contour line of the potato chip at preset angle intervals, and the intersection point of each radial measurement line with the outer contour line of the potato chip is recorded. The distance from the centroid of the potato chip to the corresponding intersection point in each radial measurement line is taken as the contour radius of the radial measurement line, and the contour radius is divided by the preset number of radial segments to obtain the radial step size; On each radial measurement line, multiple radial sampling points are generated sequentially from the centroid of the potato chip according to the radial step size, and each radial sampling point is mapped to the height map pixel position in the standardized potato chip height map. An adaptive polar coordinate measurement grid for the profile is established based on the angular position of each radial measurement line, the radial position of each radial sampling point, and the corresponding height map pixel position of each radial sampling point.
5. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step four specifically involves: Read the height map pixel position corresponding to each radial sampling point from the contour adaptive polar coordinate measurement grid; Based on the height map pixel position corresponding to each radial sampling point, the corresponding spatial height value is extracted from the standardized potato chip height map; Establish circumferential numbers according to the angular position of each radial measurement line, and establish radial numbers according to the radial position of each radial sampling point; The extracted spatial height values are written into the contour adaptive polar coordinate measurement grid according to the corresponding circumferential and radial indices to generate a spatial height value array. In the spatial height value array, the spatial height values corresponding to adjacent radial numbers under the same circumferential number are connected sequentially in the direction from the centroid of the potato chip to the outer contour line of the potato chip to generate a radial height sequence; In the spatial height value array, the spatial height values corresponding to the same radial index under adjacent circumferential indexes are connected sequentially in the direction of increasing angular position to generate a circumferential height sequence; The upper surface height field is generated based on the spatial height value array, the radial height sequence, and the circumferential height sequence.
6. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step five specifically involves: Extract the upper and lower edge contours of the potato chip to be detected from the lateral edge contour image; Multiple edge thickness measurement lines are generated along the normal direction of the lower edge contour, and the intersection points of each edge thickness measurement line with the upper edge contour and with the lower edge contour are recorded. The true edge thickness is obtained by multiplying the pixel distance between the intersection point of the upper edge contour and the intersection point of the lower edge contour in the same edge thickness measurement line by a preset lateral pixel length conversion factor. Based on the viewpoint markers of the lateral edge contour image, determine the corresponding contour points of each edge thickness measurement line on the outer contour line of the potato chip, and write the actual edge thickness into the corresponding contour points. According to the angular position of the corresponding contour point, the true edge thickness is associated with the outermost radial sampling point at the same angular position in the contour adaptive polar coordinate measurement grid; The boundary thickness condition is generated based on the actual edge thickness associated with the outermost radial sampling point.
7. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step six specifically involves: Read the spatial height value array, radial height sequence and circumferential height sequence from the upper surface height field, and read the true edge thickness corresponding to the outermost radial sampling point from the boundary thickness condition; In the contour adaptive polar coordinate measurement grid, each radial sampling point is configured as a variable position, and a bottom surface height offset to be determined is set for each variable configuration position. Subtract the corresponding actual edge thickness from the spatial height value corresponding to the outermost radial sampling point to obtain the boundary bottom surface drift reference value of the outermost radial sampling point; Calculate the squared difference between the required bottom surface height offset and the corresponding boundary bottom surface drift reference value for each outermost radial sampling point, and sum all the squared differences to generate boundary constraint terms; In each radial height sequence, the squared difference between the bottom surface height offsets corresponding to adjacent radial sampling points is calculated, and the squared differences in all radial height sequences are summed to generate a radial continuity constraint term. In each circumferential height sequence, the squared difference between the bottom surface height offsets corresponding to adjacent circumferential sampling points is calculated, and the squared differences in all circumferential height sequences are summed to generate circumferential continuous constraint terms. Under each circumferential sequence number, three consecutive radial sampling points are selected in sequence. The square of the second-order difference between the bottom surface height offsets corresponding to the three consecutive radial sampling points is calculated. All squares of the second-order difference are summed to generate the radial curvature constraint term. Under each radial index, three consecutive circumferential sampling points are selected in sequence. The square of the second-order difference between the bottom surface height offsets corresponding to the three consecutive circumferential sampling points is calculated. All squares of the second-order difference are summed to generate the circumferential curvature constraint term. The curvature suppression constraint term is generated by summing the radial curvature constraint term and the circumferential curvature constraint term. The boundary constraint terms, radial continuity constraint terms, circumferential continuity constraint terms, and curvature suppression constraint terms are weighted and summed to construct the bottom surface drift field inversion model; The bottom surface drift field inversion model is iteratively solved to minimize the weighted summation result, thereby obtaining the bottom surface height offset corresponding to each radial sampling point. The bottom surface height offset is arranged according to the circumferential and radial serial numbers of each radial sampling point to generate the bottom surface drift field.
8. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, The process of generating a global thickness function based on the upper surface height field and the bottom surface drift field is as follows: Read the spatial height value corresponding to each radial sampling point from the height field of the upper surface; Read the bottom height offset corresponding to each radial sampling point from the bottom drift field; Subtract the corresponding bottom surface height offset from the spatial height value corresponding to the same radial sampling point to obtain the thickness value of the radial sampling point. The thickness values are arranged according to the circumferential and radial indices of each radial sampling point to generate a thickness value array; Based on the thickness value array, a global thickness function is established with circumferential and radial indices as independent variables and thickness values as dependent variables.
9. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, The method of identifying thickness anomaly regions based on the global thickness function specifically includes: Read the thickness value corresponding to each radial sampling point from the global thickness function; Calculate the average thickness value corresponding to all radial sampling points to generate the average thickness value; Subtract the average thickness value from the thickness value corresponding to each radial sampling point and take the absolute value to generate the thickness deviation value; Radial sampling points whose thickness deviation values are greater than a preset thickness deviation threshold are marked as abnormal sampling points; Based on the circumferential and radial indices corresponding to the abnormal sampling points, adjacent abnormal sampling points are connected and merged to generate a thickness anomaly region.
10. The method for detecting the thickness uniformity of potato chips based on machine vision according to claim 1, characterized in that, Step eight specifically involves: Calculate the standard deviation of the thickness values corresponding to all radial sampling points based on the global thickness function, and divide the standard deviation by the average thickness value to generate the thickness dispersion ratio. The percentage of abnormal area is generated based on the ratio of the number of abnormal sampling points in the total thickness abnormal area to the total number of radial sampling points. Based on the difference between the maximum and minimum thickness values in the global thickness function, a thickness range value is generated, and the thickness range value is divided by the average thickness value to generate a thickness range ratio value. The thickness uniformity evaluation value is generated by adding the thickness dispersion ratio, the abnormal area ratio and the thickness range ratio and then dividing by three. When the thickness uniformity evaluation value is less than or equal to a preset first evaluation threshold, a thickness uniformity qualified mark is generated; When the thickness uniformity evaluation value is greater than a preset first evaluation threshold and less than or equal to a preset second evaluation threshold, a slight thickness unevenness mark is generated. When the thickness uniformity evaluation value is greater than the preset second evaluation threshold, a severe thickness non-uniformity mark is generated. Based on the thickness uniformity evaluation value and the corresponding thickness uniformity qualified mark, slight thickness unevenness mark, or severe thickness unevenness mark, the potato chip thickness uniformity test result is output.
Citation Information
Patent Citations
Method and system for measuring thickness of optical thin film of quartz substrate
CN121898270A
Mobile phone middle frame CNC machining hole site precision detection method based on machine vision
CN122244159A