A visual detection method for surface forming defects of moon cake appearance
Patent Information
- Application Number
- CN202611364713.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-04
- Publication Date
- 2026-10-30
AI Technical Summary
[0002]对于表面带有立体浮雕图案和周期性侧边裙齿结构的成型工件,通常通过光学成像获取其表面图像,并对微细裂纹、边棱破损、表面塌陷以及色泽异常等缺陷进行识别,以保证工业成品的出厂质量,常规工业视觉检测系统一般采用面阵相机采集二维灰度图像,再结合灰度阈值分割或模板特征匹配算法,对待测表面的各类成型缺陷进行识别和定位,例如,公开号为CN122343181A的中国发明专利申请公开了一种烘焙食品生产的质量检测方法及检测系统,通过三维相机采集外观图像并结合卷积神经网络与热成像提取几何、纹理与色彩特征以识别外观缺陷,然而,该方法依赖常规三维成像与端到端统计特征匹配,预设烘焙表面处于理想光学响应状态,未建立光照反射物理模型;当月饼表面附着强反射油膜亮斑并伴随色泽渐变时,其特征提取易将表层镜面高光误判为开裂缺陷,且无法在侧边裙齿局部破损时提供抗缺损的精准刚体旋转对齐基准,难以兼顾复杂光照干扰下的几何形貌提取精度与高速检测稳定性
[0020]1、在月饼外观表面成型缺陷的视觉检测中,利用多向光度图像对表面反射特性与几何形貌进行区分,并在计算过程中避开高光饱和和阴影区域对结果的干扰,可减少油膜反光对表面形貌判断的影响,同时,根据漫反射反照率的局部变化对表面单位法向量场进行平滑处理,在表面性质较均匀的区域抑制噪声,同时保留真实的几何边缘,从而降低油膜亮斑造成的裂纹误判,并保留微细裂纹等缺陷的边缘特征。
Smart Images

Figure CN123015519A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and digital image processing technology, and in particular relates to a visual detection method for surface molding defects of mooncakes. Background Technology
[0002] For molded workpieces with three-dimensional relief patterns and periodic side skirt tooth structures, surface images are typically acquired through optical imaging to identify defects such as micro-cracks, edge damage, surface collapse, and abnormal color, ensuring the quality of finished industrial products. Conventional industrial vision inspection systems generally use area array cameras to acquire two-dimensional grayscale images, combined with grayscale threshold segmentation or template feature matching algorithms, to identify and locate various molding defects on the surface under test. For example, Chinese invention patent application CN122343181A discloses a quality inspection method and inspection system for baked goods production. The method uses a 3D camera to acquire appearance images and combines convolutional neural networks and thermal imaging to extract geometric, texture, and color features to identify appearance defects. However, this method relies on conventional 3D imaging and end-to-end statistical feature matching, assumes that the baking surface is in an ideal optical response state, and does not establish a physical model of light reflection. When the mooncake surface is covered with a bright spot of highly reflective oil film and accompanied by color gradient, its feature extraction is prone to misjudging the surface specular highlights as crack defects. Furthermore, it cannot provide a precise rigid body rotation alignment reference to resist defects when the side skirt teeth are locally damaged. It is difficult to balance the geometric shape extraction accuracy under complex lighting interference with high-speed detection stability.
[0003] With the continuous increase in conveyor speed on industrial production lines, after processes such as coating with egg wash and high-temperature baking, the grease seeping from the surface of the workpiece under test easily forms an oil film with strong specular reflection. At the same time, the non-uniform Maillard reaction also causes the diffuse reflectance of the surface to vary gradually over a large range. When surface reflection, color changes, and three-dimensional undulations coexist, the ideal diffuse reflectance conditions and stable geometric benchmarks relied upon by conventional visual inspection are easily affected, mainly resulting in the following problems: 1. Conventional two-dimensional optical imaging reflects both surface geometric undulations and reflectivity in a two-dimensional grayscale image, making it difficult to distinguish between the two directly. Localized bright spots caused by the oil film are easily misjudged as physical cracks. 1. The color difference caused by baking may mask defects such as minor collapses and blurred patterns; 2. Conventional three-dimensional laser triangulation or structured light scanning requires spatial scanning sampling, which takes a long time to detect and is easily affected by the mechanical vibration of the conveyor belt. Under high-speed continuous conveying conditions, it is difficult to meet the cycle time requirements of online detection; 3. Traditional photometric stereo vision algorithms usually establish a solution model based on ideal diffuse reflection conditions. When the oil film produces strong specular reflection and causes image saturation, the calculation results of the surface normal vector are prone to distortion. In addition, when there are local physical defects in the side skirt teeth, the conventional contour fitting method is prone to deviation in the estimation of the rotation position, which leads to errors in template registration.
[0004] Therefore, under the combined influence of factors such as strong reflective oil film, baking color gradient, and high-speed continuous conveying, how to distinguish the changes in surface optical reflection from the three-dimensional geometric morphology of the substrate, and how to stably and quickly complete spatial pose alignment and defect classification when the side skirt teeth are locally damaged, has become the technical problem to be solved by this invention. Summary of the Invention
[0005] To address the problems in the background art, the technical solution of the present invention is as follows: A visual inspection method for surface molding defects of mooncakes, comprising the following steps:
[0006] Step S1: Obtain a multi-directional photometric image sequence of the mooncake under illumination from four or more known incident light sources, and construct the optical radiometric tensor of the corresponding surface pixel coordinates.
[0007] Step S2: Detect the grayscale response value of each pixel in the optical radiation tensor, remove invalid channels that reach the preset saturation upper limit or dark cutoff lower limit, construct the weighted least squares regression equation of the effective channels, solve the diffuse albedo scalar and the surface unit normal vector field, and generate the albedo map to be detected.
[0008] Step S3: Construct the first fundamental form of the differential metric tensor based on the orthogonal projection components of the surface unit normal vector field, and calculate the mean curvature and Gaussian curvature after correcting the second-order shape operator matrix to generate the surface differential curvature feature map.
[0009] Step S4: Extract the geometric center of the outer contour of the mooncake to be tested, transform the surface differential curvature feature map to polar coordinate space, extract the one-dimensional curvature sequence in the radial distribution range of the side skirt teeth, calculate the local periodic energy variance mask to isolate the damaged skirt tooth range, use discrete Fourier transform to extract the main frequency harmonic phase angle of the effective skirt tooth range, compare with the reference phase angle to obtain the rigid body rotation deviation angle, and apply rotation interpolation to the surface differential curvature feature map and the albedo map to be tested based on the deviation angle to generate an aligned test map.
[0010] Step S5: Align the image to be tested with the reference mold image through differential comparison, and output the geometric parameters of the connected domain deformation and the color difference parameters.
[0011] Preferably, step S2 includes the following sub-steps: Step S21, calculate the diagonal weight matrix in the weighted least squares regression equation based on the absolute discrete deviation of the grayscale response values of the pixel points in each effective channel relative to the intermediate grayscale reference value; Step S22, obtain the three-dimensional gradient coupling vector through weighted least squares regression; Step S23, calculate the L2 norm of the three-dimensional gradient coupling vector as the diffuse albedo scalar; Step S24, divide the three-dimensional gradient coupling vector by the diffuse albedo scalar to obtain the unit surface normal vector.
[0012] Preferably, after step S2 calculates the diffuse albedo scalar and the surface unit normal field, the following sub-steps are also included: step S25, calculating the spatial variance of the diffuse albedo scalar in the local neighborhood centered on the target pixel; step S26, in areas where the spatial variance is lower than a preset uniformity threshold, using bilateral filtering to smooth high-frequency noise in the surface unit normal field; at abrupt edges where the spatial variance is greater than or equal to the preset uniformity threshold, stopping the filtering smoothing across the edge to maintain the normal truncation steepness of the geometric edge.
[0013] Preferably, step S4, which extracts the one-dimensional curvature sequence, includes the following sub-steps: Step S41, obtaining the outer edge contour of the mooncake to be tested using the minimum circumcircle fitting algorithm; Step S42, calculating the geometric center of the outer contour based on the outer edge contour; Step S43, establishing a polar coordinate system with the geometric center of the outer contour as the origin, and mapping the rectangular coordinates in the surface differential curvature feature map to the polar radius and polar angle; Step S44, selecting an annular region with a polar radius between 92% and 99% of the nominal radius of the mooncake as the radial distribution interval of the side skirt teeth; Step S45, performing radial average integration on the average curvature value within the radial distribution interval of the side skirt teeth along the polar angle direction to generate a one-dimensional curvature sequence corresponding to the circumferential angle.
[0014] Preferably, step S4, which involves masking the damaged skirt tooth region, includes the following sub-steps: Step S46, dividing the one-dimensional curvature sequence into multiple local sliding windows covering the periodic angle of a single tooth; Step S47, calculating the local periodic energy variance of the curvature signal within each local sliding window; Step S48, when the local periodic energy variance within a certain local sliding window exceeds the upper limit of a preset benchmark variance interval, marking the circumferential angle interval corresponding to that local sliding window as the damaged skirt tooth region and applying a zero-weight mask; Step S49, during the discrete Fourier transform process, performing Fourier series decomposition only on the curvature signal of the effective skirt tooth region not covered by the zero-weight mask, and extracting the fundamental frequency phase angle corresponding to the main energy peak as the main frequency harmonic phase angle.
[0015] Preferably, the differential comparison in step S5 includes the following sub-steps: Step S51, perform absolute value difference between the aligned curvature map to be inspected and the standard mold reference curvature map to generate a geometric deformation saliency map; Step S52, perform absolute value difference between the aligned albedo map to be inspected and the standard baking albedo template to generate an optical color difference saliency map; construct a dual-channel parallel topology analysis process composed of the geometric deformation saliency map and the optical color difference saliency map.
[0016] Preferably, the dual-channel parallel topology analysis process in step S5 includes the following judgment criteria: when the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold, and the aspect ratio of the extracted connected domain skeleton is greater than 5:1, the connected domain is judged to be a surface physical crack defect; when the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold, and the connected domain shows planar aggregation accompanied by the decay of the average curvature integral, the connected domain is judged to be a pattern blur defect; when the Gaussian curvature in the geometric deformation saliency map shows a positive or negative extreme value abrupt change in the connected domain, the connected domain is judged to be a surface depression or blistering defect; when the difference value in the optical color difference saliency map is greater than the preset albedo anomaly threshold, accompanied by a step decrease in albedo and no anomaly in the geometric deformation saliency map, the connected domain is judged to be a leakage or scorching defect.
[0017] Preferably, in step S1, the light source is four monochromatic white narrow-band light-emitting diodes arranged in a ring. The optical axes of each light source converge symmetrically at the center of the test station surface. The pitch angle of each light source is fixed at 45°, and the spatial azimuth angle of each light source is orthogonally distributed at 90° intervals. When the mooncake to be tested passes through the test station at a uniform speed, the four light sources are lit in a time-division manner at the microsecond level, and the camera synchronously exposes to acquire a sequence of four multi-directional photometric images.
[0018] Preferably, after step S5, the following sub-steps are also included: Step S53, calculate the pixel physical area, geometric centroid physical coordinates and defect severity level of the defect connected region; Step S54, when the defect severity level exceeds the preset release threshold, generate a sorting rejection control signal and transmit the sorting rejection control signal to the downstream sorting mechanism to reject the defective mooncake.
[0019] Compared with existing technologies, the visual inspection method for surface molding defects of mooncakes of the present invention has the following advantages:
[0020] 1. In the visual inspection of surface forming defects of mooncakes, multi-directional photometric images are used to distinguish the surface reflectivity and geometric morphology. During the calculation process, the interference of high light saturation and shadow areas on the results is avoided, which can reduce the influence of oil film reflection on the judgment of surface morphology. At the same time, the surface unit normal vector field is smoothed according to the local variation of diffuse reflectance, which suppresses noise in areas with relatively uniform surface properties, while preserving the true geometric edges. This reduces the misjudgment of cracks caused by bright spots of oil film, and preserves the edge features of defects such as microcracks.
[0021] 2. The average curvature and Gaussian curvature are calculated based on the surface unit normal vector field, so that the judgment of geometric defects is based on the actual undulation of the surface. In this way, when the surface of the mooncake shows a large range of color gradation due to uneven baking, the geometric features can still maintain good stability, reduce the interference of color change on defect detection, and help identify surface forming defects such as physical cracks and local collapse.
[0022] 3. By utilizing the periodicity inherent in the side skirt teeth, when a local skirt tooth is damaged, the abnormal area is first eliminated, and then the rotation position of the mooncake is determined using the remaining intact skirt teeth. This avoids the direct impact of local defects on the overall pose judgment. This method improves the positioning stability under the condition of local tooth damage, reduces the possibility of deviation in the calculation of rotation position, and enables the image under inspection and the reference map to maintain relatively stable alignment even when there are local skirt tooth defects. Attached Figure Description
[0023] Figure 1 This is the overall flowchart of the decoupling and defect detection of mooncake surface morphology according to the present invention;
[0024] Figure 2 This is the dual-channel multidimensional defect classification and decision topology diagram of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0026] A visual inspection method for surface molding defects of mooncakes includes the following steps:
[0027] Step S1: Obtain a multi-directional photometric image sequence of the mooncake under illumination from four or more known incident light sources, and construct the optical radiometric tensor of the corresponding surface pixel coordinates.
[0028] Step S2: Detect the grayscale response value of each pixel in the optical radiation tensor, remove invalid channels that reach the preset saturation upper limit or dark cutoff lower limit, construct the weighted least squares regression equation of the effective channels, solve the diffuse albedo scalar and the surface unit normal vector field, and generate the albedo map to be detected.
[0029] Step S3: Construct the first fundamental form of the differential metric tensor based on the orthogonal projection components of the surface unit normal vector field, and calculate the mean curvature and Gaussian curvature after correcting the second-order shape operator matrix to generate the surface differential curvature feature map.
[0030] Step S4: Extract the geometric center of the outer contour of the mooncake to be tested, transform the surface differential curvature feature map to polar coordinate space, extract the one-dimensional curvature sequence in the radial distribution range of the side skirt teeth, calculate the local periodic energy variance mask to isolate the damaged skirt tooth range, use discrete Fourier transform to extract the main frequency harmonic phase angle of the effective skirt tooth range, compare with the reference phase angle to obtain the rigid body rotation deviation angle, and apply rotation interpolation to the surface differential curvature feature map and the albedo map to be tested based on the deviation angle to generate an aligned test map.
[0031] Step S5: Align the image to be tested with the reference mold image through differential comparison, and output the geometric parameters of the connected domain deformation and the color difference parameters.
[0032] Preferably, step S2 includes the following sub-steps: Step S21, calculate the diagonal weight matrix in the weighted least squares regression equation based on the absolute discrete deviation of the grayscale response values of the pixel points in each effective channel relative to the intermediate grayscale reference value; Step S22, obtain the three-dimensional gradient coupling vector through weighted least squares regression; Step S23, calculate the L2 norm of the three-dimensional gradient coupling vector as the diffuse albedo scalar; Step S24, divide the three-dimensional gradient coupling vector by the diffuse albedo scalar to obtain the unit surface normal vector.
[0033] Preferably, after step S2 calculates the diffuse albedo scalar and the surface unit normal field, the following sub-steps are also included: step S25, calculating the spatial variance of the diffuse albedo scalar in the local neighborhood centered on the target pixel; step S26, in areas where the spatial variance is lower than a preset uniformity threshold, using bilateral filtering to smooth high-frequency noise in the surface unit normal field; at abrupt edges where the spatial variance is greater than or equal to the preset uniformity threshold, stopping the filtering smoothing across the edge to maintain the normal truncation steepness of the geometric edge.
[0034] Preferably, step S4, which extracts the one-dimensional curvature sequence, includes the following sub-steps: Step S41, obtaining the outer edge contour of the mooncake to be tested using the minimum circumcircle fitting algorithm; Step S42, calculating the geometric center of the outer contour based on the outer edge contour; Step S43, establishing a polar coordinate system with the geometric center of the outer contour as the origin, and mapping the rectangular coordinates in the surface differential curvature feature map to the polar radius and polar angle; Step S44, selecting an annular region with a polar radius between 92% and 99% of the nominal radius of the mooncake as the radial distribution interval of the side skirt teeth; Step S45, performing radial average integration on the average curvature value within the radial distribution interval of the side skirt teeth along the polar angle direction to generate a one-dimensional curvature sequence corresponding to the circumferential angle.
[0035] Preferably, step S4, which involves masking the damaged skirt tooth region, includes the following sub-steps: Step S46, dividing the one-dimensional curvature sequence into multiple local sliding windows covering the periodic angle of a single tooth; Step S47, calculating the local periodic energy variance of the curvature signal within each local sliding window; Step S48, when the local periodic energy variance within a certain local sliding window exceeds the upper limit of a preset benchmark variance interval, marking the circumferential angle interval corresponding to that local sliding window as the damaged skirt tooth region and applying a zero-weight mask; Step S49, during the discrete Fourier transform process, performing Fourier series decomposition only on the curvature signal of the effective skirt tooth region not covered by the zero-weight mask, and extracting the fundamental frequency phase angle corresponding to the main energy peak as the main frequency harmonic phase angle.
[0036] Preferably, the differential comparison in step S5 includes the following sub-steps: Step S51, perform absolute value difference between the aligned curvature map to be inspected and the standard mold reference curvature map to generate a geometric deformation saliency map; Step S52, perform absolute value difference between the aligned albedo map to be inspected and the standard baking albedo template to generate an optical color difference saliency map; construct a dual-channel parallel topology analysis process composed of the geometric deformation saliency map and the optical color difference saliency map.
[0037] Preferably, the dual-channel parallel topology analysis process in step S5 includes the following judgment criteria: when the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold, and the aspect ratio of the extracted connected domain skeleton is greater than 5:1, the connected domain is judged to be a surface physical crack defect; when the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold, and the connected domain shows planar aggregation accompanied by the decay of the average curvature integral, the connected domain is judged to be a pattern blur defect; when the Gaussian curvature in the geometric deformation saliency map shows a positive or negative extreme value abrupt change in the connected domain, the connected domain is judged to be a surface depression or blistering defect; when the difference value in the optical color difference saliency map is greater than the preset albedo anomaly threshold, accompanied by a step decrease in albedo and no anomaly in the geometric deformation saliency map, the connected domain is judged to be a leakage or scorching defect.
[0038] Preferably, in step S1, the light source is four monochromatic white narrow-band light-emitting diodes arranged in a ring. The optical axes of each light source converge symmetrically at the center of the test station surface. The pitch angle of each light source is fixed at 45°, and the spatial azimuth angle of each light source is orthogonally distributed at 90° intervals. When the mooncake to be tested passes through the test station at a uniform speed, the four light sources are lit in a time-division manner at the microsecond level, and the camera synchronously exposes to acquire a sequence of four multi-directional photometric images.
[0039] Preferably, after step S5, the following sub-steps are also included: Step S53, calculate the pixel physical area, geometric centroid physical coordinates and defect severity level of the defect connected region; Step S54, when the defect severity level exceeds the preset release threshold, generate a sorting rejection control signal and transmit the sorting rejection control signal to the downstream sorting mechanism to reject the defective mooncake.
[0040] Example 1: On an automated food baking conveyor line, Cantonese-style five-nut mooncakes with a nominal outer diameter of 80mm and featuring 3D embossed text patterns and periodic side serrations are demolded and transported at a speed of 120 pieces / minute through a visual inspection station. The surface exhibits bright, anisotropic specular reflections due to the application of egg wash and the seepage of oil during high-temperature baking, accompanied by a wide range of gently varying diffuse color changes from a non-uniform Maillard reaction. The inspection system uses an industrial area array camera with a resolution of 1024 pixels × 1024 pixels and a spatial physical resolution of 0.1mm / pixel positioned directly above the mooncake. Four monochromatic white narrow-band LED light sources are symmetrically arranged in a ring around the camera. Each light source has a 45° elevation angle and spatial azimuth angles of 0°, 90°, 180°, and 270°, respectively. The corresponding spatial illumination direction unit vectors are calibrated as follows: , , and In the spatial layout of this vision inspection station, an industrial area array camera is vertically mounted 350mm above the conveyor line via a rigid cantilever. Its optical axis is orthogonal to the plane of the conveyor belt's movement. Four LED light sources are symmetrically fixed in a cross shape around the lens along a 200mm diameter circular aluminum alloy mounting ring. The vertical distance from the light emission center of each light source to the reference plane of the inspection station is 100mm, and the optical axes are precisely converged at the center of the field of view. The hardware topology of the control unit includes an industrial computer, a multi-channel programmable digital pulse generator, a photoelectric speed encoder, and a pneumatic actuator drive board for speed measurement. The encoder is coaxially mounted on the conveyor roller and outputs quadrature clock signals to the pulse generator. The four pulse outputs of the pulse generator are electrically connected to the driving circuits of the four light sources via high-speed optocoupler isolation circuits. Simultaneously, its shutter trigger pin is connected to the external trigger input interface of the camera via a coaxial cable. The high-speed data bus of the industrial computer receives image frames acquired by the camera in real time through a universal serial bus interface and controls the downstream mechanism via the drive board. As the mooncake under test passes through the station at a constant speed, the control unit triggers the four light sources to illuminate in a time-division manner according to a microsecond-level timing sequence. The camera simultaneously exposes for 120μs to acquire four frames of multi-directional photometric image sequence. ,in The optical radiation tensor of the corresponding surface pixel coordinates is constructed by arranging each frame of image along the channel dimension. Specifically, under the condition of a conveying speed of 120 pieces / minute, the actual linear speed of the conveyor belt is 200mm / s; the industrial area array camera adopts a multi-tap charge transfer line global shutter sensor chip, the control unit captures the signal of the workpiece entering the field of view through an external photoelectric switch and simultaneously locks the encoder pulse, and sends pulse light-emitting enable signals to the four light-emitting diode light sources in sequence at 20μs intervals. The duration of each pulse illumination is 120μs, and the total exposure and charge storage time of the entire 4-channel time-division acquisition cycle is controlled within 560μs.
[0041] Within this exposure sequence, the actual physical displacement of the surface under test along the conveyor belt movement direction is only 0.0112 mm, far smaller than the spatial physical resolution of 0.1 mm corresponding to a single pixel of the camera. This ensures that the multi-directional photometric image sequence is completely aligned with the same pixel grid at the microscopic physical level, eliminating motion blur and pixel misalignment. For a representative pixel at the edge of a micro-crack on the surface... The measured grayscale response values of the four channels are as follows: , , and Since the response values of each channel are all within the preset effective grayscale response range of 20 to 240, and have not reached the preset saturation upper limit of 240 or the dark cutoff lower limit of 20, the weight matrix of each channel... Set as a fourth-order identity matrix; use the weighted least squares regression equation Solve the three-dimensional gradient coupling vector ,in, A matrix formed by the effective channel lighting directions. The effective channel grayscale response vector is calculated as follows: , and Then, the L2 norm of the three-dimensional gradient coupling vector is calculated as a scalar of diffuse albedo. The surface unit normal vector is obtained by dividing the coupling vector by the diffuse albedo scalar. Then, the spatial variance of the diffuse albedo scalar in the local neighborhood centered on the target pixel is calculated. In flat material regions where the spatial variance is lower than the preset uniformity threshold, bilateral filtering is used to smooth the high-frequency shot noise in the unit normal vector field of the surface. At the edge of the micro-crack abrupt change where the spatial variance is greater than or equal to the preset uniformity threshold, filtering and smoothing across the edge is stopped to maintain the normal truncation steepness of the geometric edge.
[0042] Obtain the unit normal vector field of the surface after edge preservation and smoothing. Then, the first-order spatial partial derivatives of the normal vector components in the horizontal and vertical image coordinate axes are calculated using the 3x3 differential operator, and the results are obtained at the pixel level. The physical space gradient measured at is , , and Construct the second-order shape operator matrix of the surface. According to the normal projection components and Constructing the first fundamental form of differential to measure tensor coefficients , and To distinguish the curvature values before and after metric correction, the median uncorrected arithmetic mean curvature calculated directly from the spatial partial derivative matrix is denoted as . The median value of the uncorrected Gaussian curvature is denoted as The two quantities marked with an apostrophe only represent intermediate results before orthogonal correction of the tangent space; from the surface unit normal vector, we can obtain... , ,correspond , and After applying tangent space orthogonal correction to the second-order shape operator matrix using the first fundamental form of the differential metric tensor, the mean curvature and Gaussian curvature are respectively... and The surface differential curvature feature map is calculated and generated using the corrected average curvature and Gaussian curvature. The average curvature and Gaussian curvature depend only on the local spatial derivative of the surface unit normal vector field. They remain unchanged in terms of the overall gain and gradual change of the surface reflection intensity. This allows for the separation of the three-dimensional geometric morphology of microcracks and three-dimensional relief patterns from the strong reflection of epidermal oil and the color difference caused by the Maillard reaction during baking. It also suppresses the misjudgment interference caused by the high gloss spots of the surface oil film and the influence of uneven baking color, and extracts the physical concave and convex morphology.
[0043] To address the positioning offset issues caused by spatial rotational misalignment of the mooncake and localized friction damage to the side skirt teeth during high-speed transmission, edge gradient detection is first performed on the albedo image to obtain a discrete set of contour points on the outer edge of the mooncake. Then, minimum circumcircle fitting is performed using this set of contour points. During fitting, the outer edge contour of the mooncake is determined by the circle with the smallest radius that can enclose the effective outer edge contour points, and the geometric center of the outer contour is calculated using the center of the fitted circle. A polar coordinate system is established with the geometric center as the origin, and the rectangular coordinates in the surface differential curvature feature map and the albedo map to be tested are mapped to polar radii. With polar angle The cutoff diameter is between 92% and 99% of the nominal radius of the mooncake, that is... The annular region is used as the radial distribution interval of the side skirt teeth. The radial average integral of the average curvature value within this interval is performed along the polar angle direction to generate a one-dimensional curvature sequence corresponding to the circumferential angle. The one-dimensional curvature sequence is divided into multiple local sliding windows covering the periodic angle of a single tooth, and the local periodic energy variance of the curvature signal within each window is calculated. When the local periodic energy variance within a certain local sliding window exceeds the upper limit of a preset benchmark variance interval, the corresponding circumferential angle interval is marked as a damaged skirt tooth interval. Based on a zero-weight mask, only the effective skirt tooth interval signal without a zero-weight mask is subjected to Fourier series decomposition in the Discrete Fourier Transform to extract the fundamental frequency phase angle corresponding to the main energy peak. Compare the standard mold reference phase angle Obtain the rigid body rotational deviation angle Based on the deviation angle, reverse polar coordinate rotation interpolation is applied to the surface differential curvature feature map and the albedo map to be tested to generate an aligned test spectrum. The physical defects on the side are adaptively isolated by the one-dimensional frequency domain periodic features, thereby reducing the eccentricity solution drift of the rotation center.
[0044] After completing the map alignment, a dual-channel parallel topology analysis workflow consisting of a geometric deformation saliency map and an optical chromatic aberration saliency map is constructed to analyze the aligned curvature map to be examined. Curvature diagram of standard mold reference Generate a geometric deformation saliency map by performing absolute value difference. The aligned albedo map to be inspected Compared with standard baking albedo template Generate optical chromatic aberration saliency map by performing absolute value difference. ;Query standard mold at pixel points Theoretical mean curvature reference value at corresponding coordinates Standard baking albedo template The theoretical diffuse albedo benchmark value at the corresponding coordinates is 195, and the calculated significance value of the geometric curvature residual is... The significance value of the optical albedo residual is Combined with the system's preset geometric curvature anomaly threshold With albedo anomaly threshold Determine if the geometric significance value exceeds the threshold. Furthermore, the optical color difference value is within the normal range. The morphological skeleton of the abnormal connected region was extracted and measured to have an actual length of 3.2 mm, an average width of 0.3 mm, and an aspect ratio greater than 5:1, thus identifying the connected region as a surface physical crack defect. This dual-channel analysis process also incorporates multi-dimensional decision criteria. When the difference value in the geometric deformation saliency map is greater than a preset curvature anomaly threshold and the connected region exhibits planar aggregation accompanied by an average curvature integral decay, it is determined to be a pattern blur defect. When the Gaussian curvature in the geometric deformation saliency map shows a positive or negative extreme abrupt change within the connected region, it is determined to be a surface depression or blistering defect. When the difference value in the optical color difference saliency map is greater than a preset albedo anomaly threshold, accompanied by a step decrease in albedo, and no abnormality is observed in the geometric deformation saliency map... The defects are usually identified as either leaking filling or burnt. The final calculation is to determine the pixel physical area and geometric centroid physical coordinates of the defect's connected domain. The severity level of the defect is determined according to the defect type and the mapping of the connected domain deformation geometric parameters and color difference parameters obtained during the corresponding judgment process. The corresponding level classification and preset release threshold are calibrated before inspection based on the inspection results of qualified samples and samples with defects to be rejected. When the severity level of the defect exceeds the preset release threshold, a sorting and rejection control signal is generated and transmitted to the downstream pneumatic push rod sorting mechanism to reject the defective workpiece. The image calculation and judgment time for a single mooncake is 24.6ms. Independent judgment of surface cracks and surface oil spots is achieved under a high-speed conveying cycle of 120 pieces / minute.
[0045] Example 2: This example verifies the physical effectiveness and computational stability of surface forming defect identification under conditions of strong reflective oil film bright spots, baking color gradients, and intertwined interference from localized damage to the side teeth. A visual inspection and verification platform was constructed, consisting of a continuous conveying mechanism, a multi-directional pulse light source assembly, an area array sensing unit, and a computing processing unit. The area array sensing unit uses an industrial area array camera with a sensor resolution of 1024 pixels × 1024 pixels and a spatial physical resolution of 0.1 mm / pixel, vertically mounted above a mooncake conveying plane with a nominal outer diameter of 80 mm. The light source assembly consists of four groups of monochromatic white narrow-band light-emitting diodes spatially symmetrically distributed with an elevation angle of 45° and an azimuth angle interval of 90°. The camera exposure time... The pulse signal was set to 120μs and triggered synchronously with the pulse signal of the light source, which was lit in a time-division manner at the microsecond level. During the experiment, the sample conveying speed was set to 120 pieces / minute. Mechanical micro-vibration with an amplitude of ±0.15mm and a frequency of 10Hz was superimposed in the conveying direction. The image sensor simulated input superimposed with Gaussian random noise with a signal-to-noise ratio of 32dB. The lower limit of the effective grayscale response range was set to 20, and the upper limit was set to 240. The radial distribution range of the side skirt teeth was taken as 92% to 99% of the nominal radius of the mooncake (40mm), i.e., 36.8mm to 39.6mm. When the radial value was less than 36.8mm, curvature disturbance of the internal surface pattern would be mixed in. When it was greater than 39.6mm, edge space truncation loss would easily occur. Geometric curvature anomaly threshold. Take 0.045 mm⁻¹ as the albedo color difference anomaly threshold. 35 samples were selected. The test samples included 10 groups of working condition samples with different surface grease distribution, baking degree, side tooth damage and molding defect state. At the same time, control group 1 using the traditional two-dimensional gray-scale difference method, control group 2 using the conventional photometric stereo method without removing the high-saturation channel, and control group 3 using the global contour fitting alignment method without applying local variance mask were set.
[0046] Using sample group 1 under standard working condition as the baseline, its four-channel grayscale responses are 142, 138, 135, and 140, respectively. All four channels are within the effective grayscale response range. Using the identity matrix as the weight matrix, after weighted least squares regression, the diffuse reflectance albedo scalar... The value is 196.2, representing the unit surface normal. The mean curvature is calculated from the normal vector field. With a curvature of 0.0152 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is obtained by aligning the phase of the side skirt teeth with a value of 0.000215 mm⁻². The geometric significance value after differencing from the baseline spectrum is 0.12°. 0.0002 mm⁻¹, optical significance The value is 1.2, indicating that no significant connected components have been formed, and the passage is deemed to be allowed normally.
[0047] Under high light saturation conditions, the 4-channel grayscale responses of sample group 2 are 255, 160, 70, and 115. The first channel is discarded after reaching the upper limit of saturation, and the diffuse reflectance albedo is obtained by weighted calculation using the remaining 3 channels. The value is 218.9, representing the unit surface normal. mean curvature With a curvature of 0.1048 mm⁻¹, Gaussian curvature The rigid body rotational deviation angle is 0.01021 mm⁻². The geometric significance value after aligning and differencing the spectrum with the reference spectrum is 14.48°. 0.0898 mm⁻¹, optical significance The value is 23.9; the actual length of the abnormal connected domain is 3.2mm, and the aspect ratio of the skeleton is 5.8:1, which exceeds the 5:1 judgment threshold. Therefore, it is judged as a physical crack.
[0048] Sample group 10, which also exhibits strong reflectivity but has an intact surface, has 4-channel grayscale responses of 255, 185, 130, and 150. After the first channel is saturated, it is also discarded, and the remaining 3 channels are used for weighted solving to obtain the diffuse reflectance albedo scalar. The value is 231.4, representing the unit surface normal. mean curvature With a curvature of 0.0158 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is 0.000235 mm⁻². It is -15.1°; its geometric significance value is The value is 0.0008 mm⁻¹, which is still below the geometric curvature anomaly threshold and is optically significant. The value was 36.4. The connected domain only reflected the specular changes without any geometrical abrupt changes, so it was judged as normal release. As a control, the control group 2, which did not remove the saturated channel, was affected by the specular channel at this sample group. The obtained normal vector was deflected along the specular direction, producing a pseudo geometrical abrupt change of 0.1285 mm⁻¹, which led to a false cracking judgment.
[0049] For sample group 3, the grayscale responses of channels 3 and 4 in the baking process with microcracks in the dark area were 110, 88, 55, and 76, respectively. All channels were effective and weighted using an identity matrix. Regression calculations showed that the diffuse reflectance albedo scalar... Decreased to 120.5, surface unit normal vector The mean curvature is then calculated from the normal vector field. With a curvature of 0.0985 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is 0.00912 mm⁻². It is -8.35°, although optically significant. Reaching 74.5, the geometrically significant value obtained from the curvature plot. The value remains 0.0835 mm⁻¹, the length of the abnormal connected domain is 2.8 mm, and the aspect ratio of the skeleton is 5.3:1. Based on this, it is determined to be a physical crack. When the control group 1 directly processes the sample group based on two-dimensional grayscale difference, the normally baked dark area is judged as a large-area crack or depression defect.
[0050] In sample group 4, where the pattern is blurred under oil film coverage, the grayscale responses of the four channels are 195, 190, 178, and 182. All four channels are effective and use an identity matrix weighting to obtain the diffuse reflectance albedo scalar. The value is 262.8, representing the unit surface normal. mean curvature With a curvature of 0.0028 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is 0.000008 mm⁻². 5.2°; Geometric significance value 0.0122 mm⁻¹, optical significance value The value is 67.8, which corresponds to a surface cluster with an area of 14.5 mm² in the connected domain, accompanied by an attenuation of the average curvature integral, and is judged as a blurry pattern.
[0051] For sample group 5 under the surface pitting and collapse condition, the grayscale responses of the four channels are 125, 95, 145, and 130. All four channels are valid and use an identity matrix weight. The diffuse reflectance albedo scalar is calculated. The value is 175.4, representing the unit surface normal. mean curvature With a curvature of 0.0685 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is -0.00452 mm⁻². -2.15°; Geometric significance value 0.0535 mm⁻¹, optical significance The value is 19.6. Negative Gaussian curvature aggregates appear in the connected domain, forming a saddle-shaped hyperboloid feature, which is determined to be a surface depression.
[0052] Sample group 6, under the surface bubble bulging condition, used a 4-channel grayscale response with values of 168, 172, 112, and 108. All four channels were valid and weighted using an identity matrix. After the same processing, the diffuse reflectance albedo scalar was obtained. The value is 205.1, representing the unit surface normal. mean curvature With a curvature of 0.0792 mm⁻¹, Gaussian curvature The rigid body rotational deviation angle is 0.00624 mm⁻². It is 18.72°; corresponding to a geometric significance value. The optical significance is 0.0642 mm⁻¹. The value is 10.1, and the connected domains exhibit elliptical convex surfaces with abrupt changes in positive Gaussian curvature, which distinguishes them from the negative Gaussian curvature clusters in sample group 5. Based on this, it is determined to be surface bubbling.
[0053] For sample group 7, which experienced scorched skin and leaking filling, the grayscale responses of the four channels were 52, 48, 45, and 46, all within the effective response range. Using an identity matrix weight, the diffuse reflectance scalar was calculated. The value is 67.4, representing the unit surface normal. mean curvature With a curvature of 0.0148 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is 0.000208 mm⁻². 0.85°; Geometric significance value Only 0.0002mm⁻¹, while optically significant value Reaching 127.6, this region exhibits a sharp drop in albedo while maintaining a normal geometric significance value, which, based on the dual-channel determination results, is identified as burnt filling.
[0054] When the side skirt teeth have local defects, the defect rate of sample group 8 is 15%, and the grayscale responses of the four channels are 150, 145, 142, and 146 respectively; all four channels are effective. After applying a zero-weight mask to the angle range corresponding to the damaged skirt teeth, the diffuse albedo scalar... The value is 208.5, representing the unit surface normal. mean curvature With a curvature of 0.0154 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is 0.00022 mm⁻². The geometric significance value is 12.35°. 0.0004 mm⁻¹, optical significance The value is 13.5. After local tooth damage is isolated by masking, no abnormal connected domain is formed, so it is determined to be normal release.
[0055] The proportion of skirt tooth defects in sample group 9 increased to 30%, corresponding to grayscale responses of 148, 142, 140, and 144 for the four channels. All channels remained effective. After zeroing the skirt tooth interval where the local periodic energy variance exceeded the limit, the diffuse reflectance albedo scalar... The value is 204.2, representing the unit surface normal. mean curvature With a curvature of 0.0151 mm⁻¹, Gaussian curvature The rigid body rotation deviation angle is 0.000212 mm⁻². 26.8°; Geometric significance value 0.0001 mm⁻¹, optical significance The value was 9.2, which was determined to be normal release. After performing discrete Fourier transform on the effective skirt tooth intervals of sample groups 8 and 9, the main frequency phase angle deviation was controlled within 0.15°. The control group 3 did not apply a local variance mask, and the missing tooth shape caused a solution eccentricity drift of 0.38mm to 0.72mm in the geometric center of the outer contour. The solution error of the rigid body rotation angle increased to 3.85°, which caused template alignment misalignment.
[0056] The single-piece calculation time of the above 10 sets of tests ranged from 22.4ms to 26.8ms, with an average time of 24.6ms. Multi-directional photometric image processing, spectrum alignment and dual-channel defect judgment were completed under the condition of 120 pieces / minute transport.
[0057] Example 3: On an automated food baking conveyor line, Cantonese-style five-nut mooncakes with a nominal outer diameter of 80mm and a surface decorated with three-dimensional embossed text and 24 periodic side serrations are conveyed at a speed of 120 pieces / minute through a visual inspection station after demolding. The surface exhibits bright oil film spots with strong anisotropic specular reflection due to the application of egg wash and the seepage of oil during high-temperature baking, accompanied by a wide range of gently varying diffuse color gradients caused by a non-uniform Maillard reaction. The inspection system is equipped with an industrial area array camera with a resolution of 1024 pixels × 1024 pixels and a spatial physical resolution of 0.1mm / pixel directly above the mooncake. Four monochromatic white narrow-band LED light sources are symmetrically arranged in a ring around the mooncake. Each light source has a pitch angle of 45° and spatial azimuth angles of 0°, 90°, 180°, and 270°, respectively. The corresponding spatial illumination direction unit vectors are calibrated as follows: , , and As the mooncake under test passes through the workstation at a constant speed, the control unit triggers the illumination of four light sources in a time-division manner at the microsecond level, and the camera simultaneously exposes for 120μs to acquire four frames of multi-directional photometric image sequence. ,in The optical radiation tensor is constructed by arranging each frame of image along the channel dimension. For each pixel The system sets the effective grayscale response range with a lower limit of 20 to filter out dark current cutoff noise and an upper limit of 240 to isolate charge coupling saturation overflow. Channels with grayscale values exceeding the 20-240 range are marked as invalid channels and removed from the solution matrix of the current pixel. The remaining grayscale response is then used to construct the solution matrix. An effective light source illumination matrix consisting of [number] effective channels With effective radiation vector ,in, To eliminate residual nonlinear response interference, a diagonal weight matrix is introduced. Take the intermediate grayscale reference value Calculate the absolute discrete deviation of the grayscale value of each effective channel relative to the intermediate grayscale reference value. Calculate the diagonal weighting coefficients according to the second-order attenuation rule. A diagonal weight matrix is formed by the weights of each effective channel. The weighted quadratic decay model is established based on the photoelectric response linearity and photon shot noise distribution characteristics of the image sensor. In an 8-bit grayscale quantization system, the sensor exhibits the highest signal-to-noise ratio and optimal linearity when the grayscale value is near the intermediate grayscale reference value of 130. However, when the grayscale value approaches the dark cutoff lower limit of 20 or the preset saturation upper limit of 240, the response variance rapidly amplifies quadratically with the absolute discrete deviation. Selecting a constant of 110 as the normalized half-range reference allows the weights of edge pixels at the boundary between 20 and 240 to naturally and smoothly decay to zero. Based on the higher regression confidence of the intermediate high signal-to-noise ratio channel, this eliminates the numerical disturbance of low signal-to-noise ratio pixels at the edges of strongly reflective bright spots on the photometric stereo solution. The weighted least squares regression equation is then used. Solve the three-dimensional gradient coupling vector When channel 1 experiences mirror saturation and is therefore removed, At that time, matrix The condition number was calculated to be 3.18, which is within the preset safety condition number threshold of 5, ensuring stable numerical convergence of the matrix inverse operation; the L2 norm modulus of the three-dimensional gradient coupling vector was calculated as a scalar of diffuse albedo. The surface unit normal vector is obtained by dividing the three-dimensional gradient coupling vector by the diffuse albedo scalar. This achieves physical decoupling between surface three-dimensional orientation and surface albedo.
[0058] Obtaining the initial surface unit normal vector field Subsequently, to eliminate geometric edge blurring while suppressing high-frequency noise, an edge-preserving regularization smoothing mechanism based on local variance of albedo was constructed; the target pixel was selected. Calculate the diffuse albedo scalar value within a 5-pixel × 5-pixel local neighborhood centered on the center, corresponding to a physical spatial coverage size of 0.5mm × 0.5mm. Spatial local variance ,in, The mean reflectance value is defined as the reflectance within a 5-pixel × 5-pixel local neighborhood. The system pre-calibrates the background variance baseline value to 8.5 based on uniform physical property samples of defect-free mooncake crusts and sets a preset uniformity threshold for physical properties. When the spatial local variance at the target pixel satisfies When the region is determined to be a continuous medium surface with uniform physical properties, a spatial Gaussian scale parameter is used. The normal angle scale parameter is 1.5 pixels. High-frequency shot noise in the unit normal vector field of a bilaterally filtered smooth surface with a value of 0.15; when the spatial local variance at the target pixel satisfies When the region is determined to be at the geometric step boundary of a physical crack or pattern edge, the filter spatial weights crossing the edge are forcibly set to zero, and the filter diffusion is frozen to maintain the steepness of the geometric edge normal truncation. In the actual physical mechanism, the surface physical microcracks not only break the spatial continuity of the three-dimensional normal field, but also cause multiple inward absorption and shadow self-blocking of incident light in the crack cavity when the depth of the micro fracture is greater than 0.2 mm. This results in a drastic step jump in the albedo value within a 0.5 mm × 0.5 mm micro-area, and its local discrete variance significantly exceeds the normal material background variance benchmark value. After baking... The large-scale color gradient region produced by the Maillard reaction exhibits a smooth, low-frequency drift in chromaticity on a macroscopic scale. Within a 5-pixel × 5-pixel micro-neighborhood, the albedo gradient change rate is less than 0.5 gray units per millimeter, and the local variance remains stable below a preset uniformity threshold. This allows the local variance of the albedo to serve as an adaptive physical criterion for distinguishing between low-frequency continuous baking color differences and high-frequency physical geometric fractures, maintaining continuity in the smooth color difference region and freezing filtered diffusion at micro-cracks. Subsequently, a 3x3 differential operator is used to calculate the first-order spatial partial derivatives of the smoothed normal vector components in the horizontal and vertical image coordinate axes. , , and Construct the second-order shape operator matrix of the surface. According to the normal projection components and Construct the first fundamental form of differential to measure tensor coefficients , and The median value of the uncorrected arithmetic mean curvature, directly calculated from the spatial partial derivatives, is denoted as The median value of the uncorrected Gaussian curvature is denoted as ; then combined , and The second-order shape operator matrix is subjected to tangent space orthogonal correction, and the mean curvature is calculated according to the metric correction relation. With Gaussian curvature The surface differential curvature feature map is generated. The corrected average curvature and Gaussian curvature depend on the local spatial differential of the surface unit normal vector field and remain unchanged from the large-scale low-frequency color drift caused by baking.
[0059] To eliminate spatial rotational pose deviations caused by conveyor belt mechanical transport and address registration failures due to local tooth contact damage, the system first performs adaptive edge gradient detection on the albedo map to be tested, acquiring a discrete contour point set of the outer edge of the mooncake. For asymmetric contour distortion caused by local contact loss of the side skirt teeth, a random sampling consensus algorithm is used to perform multiple rounds of in-point filtering on the contour point set. Each round uses a least-squares algebraic distance objective function for circumferential fitting, setting the geometric distance tolerance threshold for in-points to 0.3mm. Abnormal discrete points that collapse inward due to tooth breakage and reflective noise from the conveyor belt are removed, retaining only valid contour in-points located on the outer convex hull boundary of the mooncake. Then, minimum circumcircle fitting is performed on the valid contour in-points. The circumference of the fitted minimum circumcircle determines the outer edge contour of the mooncake, and the geometric center coordinates of the outer contour are calculated based on this outer edge contour. Under conditions where 15% to 30% of the skirt teeth experience local mechanical loss, the calculated error of the geometric center eccentricity of the fitted outer contour remains within 0.05mm; Establish a polar coordinate system with the origin, and plot the surface differential curvature feature map. Albedo diagram Mapping to polar coordinate space , where the polar diameter polar angle The cutoff diameter is between 92% and 99% of the nominal radius of 40mm, i.e. The annular region is used as the radial distribution interval of the side skirt teeth. The average curvature value within this interval is radially integrated and averaged along the polar angle direction to generate a one-dimensional curvature sequence of 360 discrete angle sampling points. The sampling angular resolution is 1°; for the single-tooth periodic angle of 15° corresponding to the 24 side skirt teeth, a 15-point sliding window covering the single-tooth period is configured, and the local periodic energy variance of the curvature signal within each local sliding window is calculated. ,in, The mean curvature within the current local sliding window; the single-tooth periodic energy variance benchmark value is pre-calibrated based on the standard non-destructive mold. And set a preset upper limit for the baseline variance interval. When the local periodic energy variance within a certain local sliding window satisfies When the corresponding skirt tooth in the specified interval is determined to have mechanical damage or defects, the circumferential angle interval is marked as the damaged skirt tooth interval and a zero-weight mask is configured. Configure the effective skirt tooth area that is not damaged. In discrete frequency domain transform, only for those satisfying The effective skirt tooth interval curvature signal is decomposed into a 24th-order discrete Fourier series of the fundamental frequency to extract the phase angle of the dominant harmonic. Compare it with the reference phase angle Compare and calculate the rigid body rotational deviation angle of the mooncake. In the frequency domain decomposition process, to eliminate the spectral leakage error caused by the zero-weight mask truncation in the time domain, the algorithm applies a Hanning smoothing weighted window to all continuous intact tooth profile sequences within the effective skirt tooth interval, and uses a dual-spectral-line full-phase interpolation correction algorithm to solve the principal frequency harmonic phase angle. To address the issue of whole-tooth period ambiguity caused by the 15° rotational period symmetry of the 24 side skirt teeth, before frequency domain phase fine-tuning, the system first performs coarse registration based on the principal axis direction on the text relief pattern in the central area of the mooncake. By extracting the second-order image central moment of the relief area, the principal direction angle of the text is determined, and the 360° rotation range is coarsely located within the current 15° single-tooth period. Then, the harmonic phase deviation angle calculated in the frequency domain is superimposed on the whole-tooth period deflection to obtain a globally unique rigid body rotation deviation angle between 0° and 360°. Based on the rigid body rotation deviation angle... Apply reverse rotation interpolation to the surface differential curvature feature map and the albedo map under test in polar coordinates to generate an aligned curvature map under test. Albedo diagram The interference of the damaged skirt tooth region on the rotation alignment is isolated by a zero-weight mask.
[0060] After obtaining the aligned map to be inspected, the system constructs a dual-channel parallel topology analysis process to analyze the aligned curvature map to be inspected. Curvature diagram of standard mold reference Generate a geometric deformation saliency map by performing absolute difference. The aligned albedo map to be inspected Compared with standard baking albedo template Generate optical chromatic aberration saliency map by performing absolute difference calculation The system, based on standard defect-free sample test statistics, calibrates the preset curvature anomaly threshold as follows: The preset albedo anomaly threshold is calibrated as follows: The quantitative settings of the above core judgment parameters are all based on the large-sample discrete test statistics and normal distribution confidence interval derivation of 1000 qualified standard samples. Among them, the local variance of the albedo of the defect-free surface follows a normal distribution with a mathematical expectation of 8.5 and a standard deviation of 4.25. According to the three-standard-deviation criterion, the preset uniformity threshold of physical properties is set to the expected value plus three standard deviations, i.e., 21.25. The upper limit of the variance distribution of the circumferential curvature of the standard mold skirt teeth is determined to be 0.0025 mm⁻² after mechanical tolerance calibration. The mean of the maximum theoretical curvature residual of the normal relief pattern on the defect-free surface is 0.015 mm⁻¹. Combined with the characteristic curvature response mutation amount of 0.06 mm⁻¹ corresponding to the minimum detectable depth of industrial cracks of 0.2 mm, the preset curvature anomaly threshold is set to 0.045 mm⁻¹, and the dividing boundary between the two is taken. The preset albedo anomaly threshold 35 is set between the maximum fluctuation range of normal baking color difference of 25 and the albedo mutation amount of leakage and scorching of filling of 50.
[0061] The Gaussian curvature thresholds of +0.005 mm⁻² and -0.003 mm⁻² correspond to the measured differential geometric extrema of a 1.5 mm diameter bubble hull and a 0.3 mm deep micro-dimple, respectively. In the dual-channel topological connected domain analysis, a classification rule base consisting of four parallel decision branches is configured; the first branch is the crack decision, which is based on the geometric deformation saliency map satisfying... At that time, abnormal connected components are extracted and a morphological skeleton is generated using an eight-neighbor thinning algorithm. The maximum length of the skeleton branches and the average width in the vertical direction are measured. When the aspect ratio of the connected component skeleton is greater than 5:1, it is judged as a surface physical crack defect. The second branch is a pattern fuzzy decision. When the geometric deformation saliency map satisfies Furthermore, when the connected regions exhibit a planar aggregation with an area greater than 8 mm², and the average curvature integral within the connected regions decreases by more than 30% compared to the standard mold reference, it is judged as a blurry pattern or a demolding defect; the third branch is the judgment of surface depression and bubbling, when the geometric deformation saliency map satisfies And the Gaussian curvature of the corresponding region Below When negative extrema accumulate, it is judged as a surface depression defect; when Gaussian curvature... The occurrence of higher than When a positive extreme value abruptly changes, it is judged as a surface bubbling defect; the fourth branch is the decision between leakage and scorching, when the optical color difference significant diagram satisfies Furthermore, the albedo drops sharply to below 80, while the geometric deformation saliency map satisfies... If no abnormalities are found, the defect is judged to be a surface leakage or local scorching. Finally, the pixel physical area and geometric centroid physical coordinates of each abnormal connected region are summarized, and the severity level of the defect is determined according to the defect type and the deformation geometric parameters and color difference parameters obtained for the corresponding connected region, based on the pre-detection calibration relationship. This calibration relationship is established based on the detection results of standard defect-free samples and confirmed defective samples. The preset release threshold is taken as the boundary between the two types of samples in terms of defect severity level. When the defect severity level exceeds the preset release threshold, a sorting and rejection control signal is generated, and a pneumatic push rod action signal is output to complete the rejection of the defective workpiece. The single-piece full-process calculation time is stable at 24.6ms, and independent judgment of geometric concave-convex deformation and surface optical color fluctuation is achieved at a conveying cycle of 120 pieces / minute.
[0062] Example 4: This example combines Figures 1 to 2 This paper describes a visual inspection method for surface molding defects in mooncakes, such as... Figure 1 As shown, a multi-directional photometric image sequence of the mooncake under test is acquired under illumination from four or more known incident light sources. An optical radiation tensor corresponding to the surface pixel coordinates is constructed to execute step S1. The grayscale response values of each pixel in the optical radiation tensor are detected, and invalid channels that reach the preset saturation upper limit or dark cutoff lower limit are removed. A weighted least squares regression equation for the effective channels is constructed, and the diffuse albedo scalar and the surface unit normal vector field are solved to generate the albedo map to be tested to execute step S2. Based on the orthogonal projection components of the surface unit normal vector field, a differential first fundamental form metric tensor is constructed. After correcting the second-order shape operator matrix, the mean curvature and Gaussian curvature are calculated to generate the surface micro-... Step S3 is executed by extracting the surface differential curvature feature map; extracting the geometric center of the outer contour of the mooncake to be tested and converting the surface differential curvature feature map to polar coordinate space; extracting a one-dimensional curvature sequence in the radial distribution range of the side skirt teeth; calculating the local periodic energy variance mask to isolate the damaged skirt tooth range; extracting the main frequency harmonic phase angle by using discrete Fourier transform on the effective skirt tooth range; obtaining the rigid body rotation deviation angle by comparing with the reference phase angle; applying rotation interpolation to the surface differential curvature feature map and the albedo map to be tested based on the deviation angle to generate an aligned test map to be tested to execute step S4; performing differential comparison and alignment of the test map and the reference mold map to output the connected domain deformation geometric parameters and color difference parameters to execute step S5.
[0063] like Figure 2As shown, the dual-channel parallel topology analysis process outputs judgments for various types of surface forming defects. When the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold and the aspect ratio of the extracted connected domain skeleton is greater than 5:1, it is judged as a surface physical crack defect. When the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold and the connected domains are aggregated in a planar manner with the average curvature integral decay, it is judged as a pattern blur defect. When the Gaussian curvature in the geometric deformation saliency map shows a positive or negative extreme value abrupt change in the connected domain, it is judged as a surface depression or blistering defect. When the difference value in the optical color difference saliency map is greater than the preset albedo anomaly threshold, accompanied by a step decrease in albedo and no anomaly is found in the geometric deformation saliency map, it is judged as a leakage or scorching defect.
[0064] Example 5: During batch changeover or continuous operation on an industrial production line, light decay and spatial position drift of the light source can alter the actual illumination conditions of each lighting channel. Before the mooncake to be tested enters the inspection station, the system performs on-site optical parameter initialization calibration. A standard diffuse reflection hemispherical calibration body with known geometric dimensions is placed at the inspection station, and the camera's optical center is vertically aligned with the center of the sphere. The control unit sequentially triggers time-division exposure of four symmetrically arranged LED light sources, acquires a calibration image sequence, extracts the two-dimensional pixel physical offset of the diffuse reflection brightness extreme points on the calibration sphere onto the image plane, and then, based on the known geometric curvature of the calibration sphere, calculates the pitch and azimuth angles of each light source in its current spatial installation posture, verifying and updating the illumination direction unit vector. , , and The spatial component values; at the same time, the gain normalization correction is applied to the average grayscale response of the flat white board collected from the 4 lighting channels to compensate for the thermal decay and dark current drift of the light-emitting diodes under continuous high-frequency pulse lighting conditions, so that the effective grayscale response value of each channel is kept within the preset effective response range of 20 to 240 when the ambient temperature and humidity fluctuate, and the systematic tilt deviation of the normal vector calculation caused by the light intensity attenuation of the single-sided light source is reduced.
[0065] To address the issues of crust color reference drift between different baking recipe batches and the matching interference caused by minor height vibrations of the mechanical conveyor belt on the registration template, the system loads a standard mold reference curvature diagram generated from a standard CAD mold before formal testing. Compared with standard baking albedo template Collect a preset number of qualified, defect-free mooncake samples from the current batch, and use their average albedo as the initial value for albedo compensation for the current batch. This is then used for albedo benchmark correction of the current batch. Subsequently, based on a nominal radius of 40 mm, the radial distribution range of the side skirt teeth within the range of 92% to 99% is analyzed. Dynamic verification is performed; when there is ±0.15mm mechanical vibration interference in the conveying mechanism, the local periodic energy variance background fluctuation baseline within a 15° circumferential period of a single tooth is measured, and the upper limit of the preset benchmark variance interval is locked accordingly. For a phase angle of 0.0025 mm⁻², a phase difference dead zone tolerance of 0.2° is preset when extracting the phase angle of the dominant harmonic using discrete Fourier transform to filter out spurious rigid body rotations introduced by high-frequency jitter; a preset curvature anomaly threshold is used for dual-channel topological connectivity analysis. 0.045mm⁻¹, preset albedo anomaly threshold The value is 35, which enables the visual inspection system to output defect classification results and sorting and rejection control signals under conditions of production line vibration disturbance, batch differences in material color, and light source temperature drift interference.
[0066] Example 6: In the visual inspection of surface forming defects, the processing unit receives the reconstructed surface unit normal vector field after edge-preserving filtering and smoothing. and in spatial physical resolution A 3x3 differential convolution kernel is invoked on a discrete grid to calculate the first-order spatial partial derivatives of the normal vector components in the horizontal and vertical image coordinate axes. , , and ,in This represents the spatial physical resolution of the discrete grid; to correct the projection metric distortion caused by the local tilt angle of the surface under test relative to the imaging optical axis, the normal projection slope component is extracted at each pixel. and Construct the first fundamental form of differential to measure tensor coefficients , and Combined with the surface second-order shape operator matrix consisting of spatial partial derivatives of the metric tensor. Perform tangent space orthogonal correction, and according to ,as well as Calculate the mean curvature With Gaussian curvature Taking a representative defect edge pixel as an example, substitute the normal vector components. , and The slope component is obtained. and The corresponding metric coefficient is , and The measured spatial gradient partial derivatives are respectively , , and If the projection scaling caused by the surface normal tilt angle is ignored, the uncorrected arithmetic mean curvature calculated directly from the spatial partial derivative matrix is 0.105 mm⁻¹, and the uncorrected Gaussian curvature is 0.010225 mm⁻². After substituting the above metric tensor coefficients into the tangent space orthogonal correction relation, the mean curvature is 0.0981 mm⁻¹, and the Gaussian curvature is 0.00916 mm⁻². Compared with the uncorrected results, the mean curvature is overestimated by about 6.6%, and the Gaussian curvature projection amplification is about 10.4%. The corrected curvature is used to characterize the intrinsic geometric curvature distribution of local microcracks in the three-dimensional coordinates of the tangent space.
[0067] Generate aligned geometric deformation saliency map Significant optical color difference diagram Subsequently, the system performs local double-threshold binarization segmentation on the difference saliency map to extract candidate defect connected components; when the geometric deformation saliency map exceeds the preset curvature anomaly threshold... At that time, the eight-neighbor morphological thinning algorithm is applied to the connected domain to peel away the outer boundary pixels layer by layer until a topological skeleton of single-pixel width is retained. The maximum geodesic path length is determined along the skeleton, and the orthogonal cross-sectional width distribution is determined along the skeleton normal. The ratio of the maximum skeleton length to the average cross-sectional width is used as the aspect ratio of the connected domain skeleton. When this ratio is greater than 5:1, it is judged as a surface physical crack defect; when the geometric deformation saliency map satisfies Furthermore, if the connected regions exhibit a planar aggregation with a physical area greater than 8 mm², and the average curvature integral within the connected regions decreases by more than 30% compared to the standard mold reference curvature map, it is judged as a pattern blurring defect; when the geometric deformation saliency map satisfies And the Gaussian curvature within the connected domain Below Negative extreme values clustered or higher When a positive extreme value abruptly occurs, it is determined to be a surface depression defect or a surface blistering defect, respectively; when the optical color difference significance map exceeds the preset albedo anomaly threshold... As the diffuse albedo scalar value drops to below 80, the geometric deformation saliency map simultaneously satisfies... If no geometric abnormalities are found, it is judged as a defect of leakage of filling on the surface or local scorching.
[0068] After completing the defect classification, the system multiplies the total number of pixels contained in each defect's connected region by the physical area of a single pixel. The system calculates the pixel physical area of the defective connected domain and extracts the physical coordinates of the geometric centroid. It calculates the defect severity level based on the calibration relationship established by the defect type and the deformation geometric parameters and color difference parameters of the corresponding connected domain. When the defect severity level exceeds the preset release threshold, a sorting and rejection control signal is generated and transmitted to the downstream pneumatic push rod sorting mechanism. After generating the sorting and rejection control signal, the industrial computer pushes the absolute pulse count value of the conveyor belt encoder corresponding to the current image acquisition time into the first-in-first-out delayed tracking queue. The fixed physical distance from the camera optical axis to the downstream pneumatic push rod impact position is detected to be 600mm. Based on this, the reference encoder pulse count required for the conveyor belt to run this distance is calculated, and the corresponding step pulse amount is deducted in advance using a 24.6ms full-process algorithm to calculate the time consumption. When the cumulative encoder pulse count matches the target pulse count value of the first defective mooncake in the queue, the drive board outputs a high-level trigger pulse to drive the pneumatic solenoid valve, pushing the push rod out and rejecting the defective mooncake into the waste box. The action response positioning error is less than 1.5mm.
[0069] The embodiments of this application have been described above with reference to the accompanying drawings. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. This application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit of this application and the scope of protection of this invention, and all of these forms are within the protection scope of this application.
Claims
1. A visual inspection method for surface molding defects of mooncakes, characterized in that, Includes the following steps: Step S1: Obtain a multi-directional photometric image sequence of the mooncake under illumination from four or more known incident light sources, and construct the optical radiometric tensor of the corresponding surface pixel coordinates. Step S2: Detect the grayscale response value of each pixel in the optical radiation tensor, remove invalid channels that reach the preset saturation upper limit or dark cutoff lower limit, construct the weighted least squares regression equation of the effective channels, solve the diffuse albedo scalar and the surface unit normal vector field, and generate the albedo map to be detected. Step S3: Construct the first fundamental form of the differential metric tensor based on the orthogonal projection components of the surface unit normal vector field, and calculate the mean curvature and Gaussian curvature after correcting the second-order shape operator matrix to generate the surface differential curvature feature map. Step S4: Extract the geometric center of the outer contour of the mooncake to be tested, transform the surface differential curvature feature map to polar coordinate space, extract the one-dimensional curvature sequence in the radial distribution range of the side skirt teeth, calculate the local periodic energy variance mask to isolate the damaged skirt tooth range, use discrete Fourier transform to extract the main frequency harmonic phase angle of the effective skirt tooth range, compare with the reference phase angle to obtain the rigid body rotation deviation angle, and apply rotation interpolation to the surface differential curvature feature map and the albedo map to be tested based on the deviation angle to generate an aligned test map. Step S5: Align the image to be tested with the reference mold image through differential comparison, and output the geometric parameters of the connected domain deformation and the color difference parameters.
2. The visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, Step S2 includes the following sub-steps: Step S21, calculate the diagonal weight matrix in the weighted least squares regression equation based on the absolute discrete deviation of the grayscale response values of the pixels in each effective channel relative to the intermediate grayscale reference value; Step S22, obtain the three-dimensional gradient coupling vector through weighted least squares regression; Step S23, calculate the L2 norm of the three-dimensional gradient coupling vector as the diffuse albedo scalar; Step S24, divide the three-dimensional gradient coupling vector by the diffuse albedo scalar to obtain the unit surface normal vector.
3. The visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, After step S2 calculates the diffuse albedo scalar and the surface unit normal field, the following sub-steps are also included: Step S25, calculate the spatial variance of the diffuse albedo scalar in the local neighborhood centered on the target pixel; Step S26, in areas where the spatial variance is lower than a preset uniformity threshold, use bilateral filtering to smooth the high-frequency noise in the surface unit normal field; at abrupt edges where the spatial variance is greater than or equal to the preset uniformity threshold, stop filtering and smoothing across the edge to maintain the normal truncation steepness of the geometric edge.
4. The visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, Step S4 involves extracting a one-dimensional curvature sequence, which includes the following sub-steps: Step S41, obtaining the outer edge contour of the mooncake to be tested using the minimum circumcircle fitting algorithm; Step S42, calculating the geometric center of the outer contour based on the outer edge contour; Step S43, establishing a polar coordinate system with the geometric center of the outer contour as the origin, and mapping the rectangular coordinates in the surface differential curvature feature map to the polar radius and polar angle; Step S44, selecting an annular region with a polar radius between 92% and 99% of the nominal radius of the mooncake as the radial distribution interval of the side skirt teeth; Step S45, performing radial average integration on the average curvature value within the radial distribution interval of the side skirt teeth along the polar angle direction to generate a one-dimensional curvature sequence corresponding to the circumferential angle.
5. The visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, Step S4, which involves masking the damaged skirt tooth region, includes the following sub-steps: Step S46, dividing the one-dimensional curvature sequence into multiple local sliding windows covering the periodic angle of a single tooth; Step S47, calculating the local periodic energy variance of the curvature signal within each local sliding window; Step S48, when the local periodic energy variance within a certain local sliding window exceeds the upper limit of the preset benchmark variance range, marking the circumferential angle range corresponding to the local sliding window as the damaged skirt tooth region and applying a zero-weight mask. Step S49: During the discrete Fourier transform process, Fourier series decomposition is performed only on the curvature signal of the effective skirt tooth interval not covered by the zero-weight mask, and the fundamental frequency phase angle corresponding to the main energy peak is extracted as the main frequency harmonic phase angle.
6. The visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, The differential comparison in step S5 includes the following sub-steps: Step S51, perform absolute value difference between the aligned curvature map to be inspected and the standard mold reference curvature map to generate a geometric deformation saliency map; Step S52, perform absolute value difference between the aligned albedo map to be inspected and the standard baking albedo template to generate an optical color difference saliency map; construct a dual-channel parallel topology analysis process consisting of the geometric deformation saliency map and the optical color difference saliency map.
7. The visual inspection method for surface molding defects of mooncakes according to claim 6, characterized in that, The dual-channel parallel topology analysis process in step S5 includes the following judgment criteria: when the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold and the aspect ratio of the extracted connected domain skeleton is greater than 5:1, the connected domain is judged to be a surface physical crack defect; when the difference value in the geometric deformation saliency map is greater than the preset curvature anomaly threshold and the connected domain is aggregated in a planar manner with the average curvature integral decay, the connected domain is judged to be a pattern blur defect. When the Gaussian curvature in the geometric deformation saliency map shows a sudden change in positive or negative extrema within the connected domain, the connected domain is determined to be a surface depression or bubbling defect. When the difference value in the optical color difference saliency map is greater than the preset albedo anomaly threshold, accompanied by a step decrease in albedo and no anomaly in the geometric deformation saliency map, the connected region is determined to be a leak or scorch defect.
8. The visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, In step S1, the light source consists of four monochromatic white narrow-band light-emitting diodes arranged in a ring. The optical axes of each light source converge symmetrically at the center of the test station surface. The pitch angle of each light source is fixed at 45°, and the spatial azimuth angle of each light source is orthogonally distributed at 90° intervals. When the mooncake to be tested passes through the test station at a constant speed, the four light sources are lit in a time-division manner at the microsecond level, and the camera is simultaneously exposed to acquire a sequence of four multi-directional photometric images.
9. A visual inspection method for surface molding defects of mooncakes according to claim 1, characterized in that, Step S5 is followed by the following sub-steps: Step S53, calculate the pixel physical area, geometric centroid physical coordinates and defect severity level of the defect connected region; Step S54, when the defect severity level exceeds the preset release threshold, generate a sorting rejection control signal and transmit the sorting rejection control signal to the downstream sorting mechanism to reject the defective mooncake.
Citation Information
Patent Citations
Quality detection method and detection system for baked food production
CN122343181A
