Intelligent lantern appearance defect automatic detection method and system combined with image recognition

By acquiring panoramic images of the lantern using a multi-degree-of-freedom vision device and performing stitching correction, the top plate bayonet array and the starting segment of the bone piece are identified. The complete bone piece groove trajectory is extracted and compared with an ideal equiangular spiral path, solving the problem of difficulty in identifying the integrity of the lantern structure in existing technologies and achieving efficient and accurate defect detection.

CN120831370BActive Publication Date: 2026-01-13SHAOYANG XINDA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511315997.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-16
Publication Date
2026-01-13
Estimated Expiration
2045-09-16

AI Technical Summary

Technical Problem

Existing image detection technologies are unable to effectively identify key defects in the integrity of the lantern structure, such as the presence of the starting section of the bone piece, whether the groove trajectory of the complete bone piece conforms to the design rules, and whether the end of the bone piece is accurately connected to the base plate slot, which may lead to quality problems such as loosening, deformation, or breakage during product use.

Method used

A panoramic image of the lantern is acquired using a multi-degree-of-freedom vision device, which is then stitched together and geometrically corrected. The outline of the top plate is identified and a top plate bayonet array is constructed. The effective starting segment of the bone plate groove is searched, the complete bone plate groove trajectory is extracted, and it is compared with an ideal equiangular spiral path. Combined with the symmetry mapping relationship of the lantern, the end connection status is determined, thus realizing layered and progressive defect detection.

Benefits of technology

It significantly improves the accuracy and efficiency of defect detection, avoids computational redundancy and misjudgment, ensures the structural stability and aesthetic consistency of products, and enhances the engineering practicality and reliability of the detection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120831370B_ABST
    Figure CN120831370B_ABST
Patent Text Reader

Abstract

The application provides an intelligent lantern appearance defect automatic detection method and system combined with image recognition, relates to the technical field of defect detection, and comprises the following steps: searching for an effective bone piece starting section of a bone piece groove in a preset fan-shaped search area; if the effective bone piece starting section of the bone piece groove cannot be searched in the preset fan-shaped search area, it is determined that a bone piece groove starting point of a current top plate bayonet position is missing, a structural starting point missing defect exists, and the detection is ended; consistency checking is performed based on accumulated deviation, if the checking fails, the detection is ended; an actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate area is recognized, the distance between the actual bottom plate bayonet position and the end of a complete bone piece groove track is determined, and the detection result of the lantern is determined based on the distance. Based on the detection logic of three-level linkage, the physical structure law of the lantern is followed, the systematic quality control from the local to the global and from the shape to the function is realized, and the chain error caused by starting point misjudgment or track drift is effectively avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of defect detection technology, and in particular to an automatic detection method and system for appearance defects of smart lanterns that combines image recognition. Background Technology

[0002] With the deep integration of industrial automation and intelligent manufacturing technologies, the high-end lantern manufacturing industry has increasingly stringent requirements for the inspection of product appearance quality and structural integrity. In a typical production process, customers usually first complete the lantern frame molding using high-precision molds, followed by assembly and surface treatment. To ensure that the final product meets design standards in terms of shape, symmetry, and connection reliability, manufacturers urgently need an efficient, objective, and repeatable automated inspection method. However, traditional inspection methods rely heavily on manual visual inspection or basic image comparison, making it difficult to systematically identify key defects affecting the structural integrity of the lantern, especially the three core issues related to the frame grooves: the existence of effective frame starting segments, whether the trajectory of the complete frame groove conforms to the design rules, and whether the ends of the frame accurately connect to the base plate slots. These issues directly relate to the structural stability and aesthetic consistency of the lantern. Failure to detect them in time will lead to serious quality problems such as frame loosening, deformation, or even breakage during product use.

[0003] Existing image detection technologies have significant limitations when applied to complex curved surface structures. Firstly, regarding the identification of effective bone fragment starting segments, traditional edge detection algorithms (such as Canny and Sobel), while able to extract contour information from images, cannot distinguish between noise, texture interference, and the actual starting point of the bone fragment, and lack the ability to make causal judgments about the rationality of the starting direction. For example, if the bone fragment does not extend correctly from the top plate notch, or if the starting direction deviates significantly from the design axis, ordinary algorithms struggle to automatically identify such structural starting point defects. Secondly, for the extraction and verification of the complete bone fragment groove trajectory, existing methods often employ simple curve fitting or template matching, but fail to consider the unique geometric patterns of lanterns (such as equiangular spiral distribution), resulting in a lack of sensitivity to non-rigid deformations such as slight twists and local offsets, leading to a high false positive rate. More critically, in assessing the end-connection status, most systems only roughly determine whether the bone fragment has reached the bottom plate area, without accurately quantifying the spatial distance between the actual bottom plate notch position and the end of the complete bone fragment groove trajectory, and without establishing a top-to-bottom notch mapping relationship to determine whether the connection is aligned. This detection method, which lacks structural semantic understanding, cannot effectively identify hidden defects such as misaligned insertions or fictitious connections. Summary of the Invention

[0004] This application aims to at least partially address one of the technical problems in the related art.

[0005] To achieve the above objectives, embodiments of this application propose an automatic detection method for appearance defects of smart lanterns that combines image recognition, including:

[0006] Step 1: Acquire a panoramic image of the lantern using a multi-degree-of-freedom vision device, and perform stitching and geometric correction to generate a standardized lantern surface unfolding diagram;

[0007] Step 2: Identify the top plate outline in the standardized lantern surface unfolded diagram, and extract multiple top plate slot positions that are evenly distributed in the circumferential direction of the top plate outline to form a top plate slot array.

[0008] Step 3: For each top plate bayonet position in the top plate bayonet array, construct a preset fan-shaped search area based on the bone segment extension direction, and search for the effective bone segment starting segment of the bone segment groove within the preset fan-shaped search area; if no effective bone segment starting segment of the bone segment groove is found within the preset fan-shaped search area, it is determined that the starting point of the bone segment groove at the current top plate bayonet position is missing, indicating a structural starting point missing defect, and the detection ends and a defective product is output; if an effective bone segment starting segment of the bone segment groove is found within the preset fan-shaped search area, proceed to step 4;

[0009] Step 4: Based on the effective bone fragment starting segment, extract the complete bone fragment groove trajectory and determine the cumulative deviation from the ideal equiangular spiral path. Perform a consistency check based on the cumulative deviation. If the check passes, proceed to step 5. If the check fails, end the detection, determine that the bone fragment has a structural trajectory distortion defect, and output a defective product.

[0010] Step 5: For the complete bone fragment groove trajectory that has passed inspection, identify the actual bottom plate latch position corresponding to the top plate latch position in the bottom plate area, determine the distance between the actual bottom plate latch position and the end of the complete bone fragment groove trajectory, and determine the lantern's detection result based on the distance.

[0011] In another embodiment, searching for the effective starting segment of the bone fragment groove within a preset fan-shaped search area includes:

[0012] Step 31: Determine the gradient of each pixel within the preset fan-shaped search area to obtain the gradient direction and gradient magnitude;

[0013] Step 32: Preset a first threshold, select the first pixel and determine whether the gradient magnitude of the first pixel is greater than the first threshold. If so, take the first pixel as the starting point of the path.

[0014] Step 33: Preset a second threshold, select the next pixel and determine whether the gradient direction deviation between the current pixel and the previous pixel is less than the second threshold and whether the gradient magnitude is greater than the first threshold. If yes, the current pixel is taken as a path node; otherwise, it is discarded. Continue until all pixels are selected and it is determined whether they are path nodes or discarded.

[0015] Step 34: Connect the starting point of the path and all path nodes to form a gradient path. Determine whether the consecutively connected starting points and / or path nodes in the gradient path are greater than the third threshold. If so, define the gradient path as a valid gradient path; otherwise, discard it.

[0016] Step 35: Determine whether the deviation between the gradient direction of the starting point or path node of the effective gradient path and the extension direction of the bone slice is less than the direction tolerance. If so, define the effective gradient path as the effective bone slice starting segment.

[0017] In another implementation, the third threshold is 3-10 pixel units, with an orientation tolerance of ±5°.

[0018] In another embodiment, a pre-defined fan-shaped search area is defined as follows: a fan-shaped search range with an angle of ±15° is constructed along the extension direction of the bone fragment, starting from the position of the top plate latch.

[0019] In another implementation, based on the effective bone fragment starting segment, the complete bone fragment groove trajectory is extracted and the cumulative deviation from the ideal isoangular spiral path is determined. A consistency check is then performed based on the cumulative deviation, including:

[0020] Step 41: Starting from the end of the effective bone fragment's initial segment, extract the complete bone fragment groove trajectory downwards along the sidewall to obtain the measured trajectory point set;

[0021] Step 42: Obtain the ideal equiangular spiral path and the ideal trajectory point set using the ideal equiangular spiral path model;

[0022] Step 43: Determine the cumulative deviation between the measured trajectory point set and the ideal trajectory point set;

[0023] Step 44: Preset a fourth threshold and determine whether the cumulative deviation is greater than the fourth threshold. If yes, it means the inspection has failed, and the bone fragment is determined to have a structural trajectory distortion defect and output as unqualified. If no, it means the inspection has passed.

[0024] In another implementation, the actual base plate latch position corresponding to the top plate latch position within the base plate area is identified, the distance between the actual base plate latch position and the end of the complete bone fragment groove trajectory is determined, and the detection result of the lantern is determined based on the distance, including:

[0025] Step 51: Based on the symmetry of the lantern, define the mapping relationship between the top plate latch position and the bottom plate latch position;

[0026] Step 52: In the standardized unfolded view of the lantern surface, identify the outline of the base plate and extract multiple base plate slot positions that are evenly distributed in the circumferential direction to form a base plate slot array.

[0027] Step 53: Based on the mapping relationship, identify the actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate outline;

[0028] Step 54: Determine the distance between the actual base plate bayonet position and the end of the groove trajectory of the complete bone piece, preset the target tolerance threshold, and determine whether the distance is greater than the target tolerance threshold. If so, it is determined that there is a connection failure defect between the bone piece and the actual base plate bayonet position and a defective product is output; otherwise, a qualified product is output.

[0029] In another embodiment, the end of the complete bone fragment groove trajectory is determined by performing spatial correlation analysis between the end portion of the complete bone fragment groove trajectory and the position of the base plate slot.

[0030] In another embodiment, the end of the complete bone fragment groove trajectory is determined by performing spatial correlation analysis on the end portion of the complete bone fragment groove trajectory and the position of the base plate latch, including:

[0031] Detect whether the endpoint of the complete bone fragment groove trajectory is located at the bottom plate notch position of the bottom plate contour. If so, take the actual endpoint of the complete bone fragment groove trajectory as the end of the complete bone fragment groove trajectory. If the complete bone fragment groove trajectory is interrupted prematurely outside the bottom plate contour, extend along the end of the complete bone fragment groove trajectory to intersect with the bottom plate contour and take the intersection point as the end of the complete bone fragment groove trajectory. If the complete bone fragment groove trajectory forks within the bottom plate notch contour, perform connected component analysis on each branch and select the endpoint of the longest branch as the end of the complete bone fragment groove trajectory.

[0032] In another implementation, if the complete bone fragment groove trajectory is divergent or blurred, the centroid of the high-response area is taken as the end of the complete bone fragment groove trajectory by combining the brightness and edge strength weights of the base plate bayonet outline.

[0033] This invention also discloses an automatic detection system for appearance defects of intelligent lanterns that combines image recognition, comprising the following modules:

[0034] Image acquisition module: used to acquire panoramic images of the lantern through a multi-degree-of-freedom vision device, and to perform stitching and geometric correction to generate a standardized lantern surface unfolding diagram;

[0035] The bayonet recognition module is used to identify the top plate outline in the standardized unfolded drawing of the lantern surface, and extract multiple top plate bayonet positions that are evenly distributed in the circumferential direction of the top plate outline to form a top plate bayonet array.

[0036] Effective bone fragment starting segment detection module: Used for each top plate bayonet position in the top plate bayonet array, it constructs a preset fan-shaped search area based on the bone fragment extension direction, and searches for the effective bone fragment starting segment of the bone fragment groove within the preset fan-shaped search area; if no effective bone fragment starting segment of the bone fragment groove is found within the preset fan-shaped search area, it is determined that the starting point of the bone fragment groove at the current top plate bayonet position is missing, indicating a structural starting point missing defect, and the detection ends and a defective product is output;

[0037] Complete bone fragment groove trajectory detection module: Based on the effective bone fragment starting segment, extract the complete bone fragment groove trajectory and determine the cumulative deviation from the ideal equiangular spiral path. Perform consistency check based on the cumulative deviation. If the check fails, end the detection, determine that the bone fragment has a structural trajectory distortion defect and output a defective product.

[0038] The bayonet detection module is used to inspect the complete bone fragment groove trajectory that has passed through, identify the actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate area, determine the distance between the actual bottom plate bayonet position and the end of the complete bone fragment groove trajectory, and determine the detection result of the lantern based on the distance.

[0039] Compared with the prior art, an automatic detection method for appearance defects of an intelligent lantern combined with image recognition provided by this application constructs a preset sector search area based on the bone chip extension direction, actively searches for the effective starting segment of the bone chip groove within the defined area, and realizes the hierarchical progressive and step-by-step screening logic for defect detection, significantly improving the accuracy, efficiency and interpretability of detection. This method first focuses on the verification of the existence of the starting segment: if no effective bone chip starting segment that meets the requirements of gradient amplitude, direction continuity and length can be detected within the preset sector search area, it is immediately determined that there is a structural starting point missing defect at this position, the subsequent process is terminated and unqualified products are output, avoiding the ineffective tracking of invalid paths and greatly reducing the calculation redundancy and misjudgment risk. After confirming the existence of the effective starting segment, taking this segment as a credible starting point, the complete bone chip groove trajectory is extracted downward along the side wall and compared with the ideal equiangular spiral path generated based on the lantern design parameters to calculate the cumulative deviation; if the deviation exceeds the preset fourth threshold, it is determined as a structural trajectory distortion defect, and the process is also terminated and unqualified products are output, ensuring that only bone chips with geometric shapes conforming to the design rules can enter the next stage. Finally, for the bone chips that pass the inspection in the first two stages, the evaluation of the end connection state is further performed: based on the symmetry mapping relationship of the lantern, the actual bottom plate bayonet position corresponding to the top plate bayonet is accurately located, and the spatial distance between it and the end of the complete bone chip groove trajectory is measured; if this distance exceeds the target tolerance threshold, it is determined that there is a connection failure defect and unqualified products are output; otherwise, the product is determined to be qualified. Based on the three-level联动 detection logic of starting point - trajectory - connection, it not only strictly follows the physical structure law of the lantern, but also realizes the systematic quality control from local to global and from form to function, effectively avoiding the chain errors caused by misjudgment of the starting point or trajectory drift in the traditional method, and significantly improving the precision rate of defect recognition and the engineering practicability of the detection system.

[0040] It should be noted that the term "三级联动" in the original text is not a common English expression. I translated it as "three-level联动" for the purpose of maintaining the integrity of the original text. You may need to adjust it according to the actual situation.This application achieves intelligent determination of the trajectory end by performing spatial correlation analysis on the end portion of the complete bone fragment groove trajectory and the position of the base plate bayonet, significantly improving the accuracy and robustness of the end-point positioning. Based on different working conditions that may occur in actual detection, this method designs a multi-mode adaptive recognition mechanism: when the trajectory endpoint accurately falls within the base plate bayonet area, the actual endpoint is directly used as the trajectory end, ensuring high-precision positioning under normal conditions; when the trajectory is prematurely interrupted outside the base plate contour due to image blurring, occlusion, or edge breakage, it extends along the end direction and intersects with the base plate contour to restore the theoretical insertion point, effectively compensating for errors caused by missing local information; when the trajectory forks in the bayonet area, the endpoint of the longest branch is selected through connected component analysis, prioritizing the path most likely to continue the main direction, avoiding connection deviations caused by misjudging short branches. This end-point determination strategy, which combines physical logic and image features, not only overcomes the shortcomings of traditional edge detection methods in terms of inaccurate positioning when the end is blurred or broken, but also fully considers the actual interference factors in the lantern manufacturing process. It ensures that the true termination position of the bone piece groove can still be determined stably and reliably in complex industrial scenarios, providing a high-confidence geometric basis for subsequent judgment on whether the bone piece is accurately inserted into the base plate bayonet, and greatly improving the intelligence level and reliability of connection status detection. Attached Figure Description

[0041] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0042] Figure 1 This is a flowchart illustrating the automatic detection method for appearance defects of smart lanterns that combines image recognition, as provided in an embodiment of this application.

[0043] Figure 2 This is a structural diagram of the intelligent lantern appearance defect automatic detection system combined with image recognition provided in an embodiment of this application;

[0044] Figure 3 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0045] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0046] The following describes an embodiment of the present application of an automatic detection method for appearance defects of a smart lantern that incorporates image recognition, with reference to the accompanying drawings.

[0047] It should be noted that the execution subject of the automatic detection method for appearance defects of smart lanterns combined with image recognition in this application embodiment is the automatic detection system for appearance defects of smart lanterns combined with image recognition in this application embodiment. The automatic detection system for appearance defects of smart lanterns combined with image recognition can be configured in an electronic device so that the electronic device can perform the function of automatic detection of lantern appearance defects.

[0048] like Figure 1 As shown, the automatic detection method for appearance defects of smart lanterns combined with image recognition includes the following steps:

[0049] Step 1: Acquire a panoramic image of the lantern using a multi-degree-of-freedom vision device, and then stitch and geometrically correct the image to generate a standardized lantern surface unfolding diagram.

[0050] Lanterns are typically manufactured using high-precision molds to injection mold or press-form the frame, ensuring that the basic geometry of the top plate, bottom plate, and frame pieces meets design requirements. However, structural defects such as frame piece misalignment, trajectory distortion, or incomplete end connections may still occur during demolding, handling, or subsequent assembly. Therefore, after mold forming, automated appearance defect inspection is necessary to ensure factory quality. At the start of inspection, the lantern under test is fixed on a rotating worktable. A multi-degree-of-freedom vision device (containing multiple adjustable-angle industrial cameras) is arranged around the lantern, simultaneously acquiring surface images from different perspectives. After each camera acquires multiple local high-resolution images in a pre-calibrated coordinate system, the fragmented views are fused into a complete panoramic image using an image stitching algorithm (based on feature point SIFT or ORB registration methods). Subsequently, the panoramic image undergoes geometric distortion correction, and based on the lantern's cylindrical or conical surface model, it is unfolded into a two-dimensional planar image—a standardized lantern surface unfolded image. The unfolded diagram preserves the spatial continuity and relative positional relationship of the bone fragment grooves, laying the foundation for subsequent accurate identification of the top plate slot, tracking of the bone fragment trajectory, and positioning of the bottom plate slot under a unified coordinate system.

[0051] Step 2: Identify the top plate outline in the standardized lantern surface unfolded diagram, and extract multiple top plate slot positions that are evenly distributed in the circumferential direction of the top plate outline to form a top plate slot array.

[0052] Edge detection algorithms (such as the Canny operator) are used to process the standardized unfolded image to determine the approximate boundary of the roof panel contour. Since lantern roof panels typically have relatively regular geometric shapes (e.g., circular), techniques such as Hough transform can be used to further extract the specific contour of the roof panel from the detected edge information. Once the roof panel contour is accurately identified, the positions of the uniformly distributed roof panel notches along the circumference can be analyzed. Specifically, by calculating the center point of the roof panel contour as the reference origin and based on the known number and distribution pattern of the notches according to the roof panel design parameters, several equally divided regions can be defined along the circumference of the roof panel contour. Within each region, template matching or feature descriptor-based methods are applied to accurately locate the positions of the roof panel notches. Considering potential manufacturing errors or material deformation during actual production, Local Binary Pattern (LBP) or other texture analysis techniques can be combined to enhance the accuracy and robustness of notch recognition. Finally, all identified roof panel notches are arranged in circumferential order to form an ordered array of roof panel notches.

[0053] Step 3: For each top plate bayonet position in the top plate bayonet array, construct a preset fan-shaped search area based on the bone segment extension direction, and search for the effective bone segment starting segment of the bone segment groove within the preset fan-shaped search area; if no effective bone segment starting segment of the bone segment groove is found within the preset fan-shaped search area, it is determined that the starting point of the bone segment groove at the current top plate bayonet position is missing, indicating a structural starting point missing defect, and the detection ends and a defective product is output; if an effective bone segment starting segment of the bone segment groove is found within the preset fan-shaped search area, proceed to step 4;

[0054] The preset fan-shaped search area includes: taking the position of the top plate latch as the starting point, constructing a fan-shaped search range with an angle of ±15° along the extension direction of the bone piece.

[0055] The effective starting segment of the bone fragment, which searches for bone fragment grooves within a preset fan-shaped search area, includes:

[0056] Step 31: Determine the gradient of each pixel within the preset fan-shaped search area to obtain the gradient direction and gradient magnitude.

[0057] First, the standardized lantern surface unfolded image needs to be converted to grayscale to simplify subsequent calculations. Then, a gradient operator (such as the Sobel operator) is used to perform convolution operations on the image, and the gradient component Gx in the horizontal direction and the gradient component Gy in the vertical direction of each pixel are calculated.

[0058] Based on the two components mentioned above, the gradient magnitude and gradient direction of the pixel can be further calculated:

[0059] The gradient magnitude represents the edge intensity, and the calculation formula is: , This represents the gradient magnitude.

[0060] The gradient direction indicates the direction of the edge, and the calculation formula is: , The gradient direction value is expressed in angular form (e.g., 0°~360° or -180°~180°), and can be quantized into 8 or 4 main directions (e.g., 0°, 45°, 90°, etc.) as needed, to facilitate subsequent direction consistency judgment.

[0061] In this embodiment, each pixel within a preset fan-shaped search area is traversed, and its gradient magnitude and direction are calculated for each pixel. The results are then stored as a gradient vector field. This gradient vector field not only reflects the edge intensity of each point in the image but also provides edge orientation information, laying the foundation for subsequently tracing continuous, oriented bone fragment groove starting segments from high-gradient regions. Especially for linear structures with a clear extension direction, such as lantern-shaped bone fragments, the consistency of gradient direction becomes a key basis for identifying valid starting segments.

[0062] Step 32: Preset a first threshold, select the first pixel and determine whether the gradient magnitude of the first pixel is greater than the first threshold. If so, take the first pixel as the starting point of the path.

[0063] A set of known defect-free lantern samples were used for testing. The minimum gradient magnitude of the initial segment region of the bone fragment was counted, and 80% of this value was taken as the first threshold to ensure a high recall rate for normal structures.

[0064] After determining the first threshold, the pixels within the fan-shaped search area are traversed, and the first pixel with a gradient magnitude greater than the threshold is found in row-major or spiral order. This point is selected as the first pixel and serves as the starting point for tracing the bone fragment groove trajectory. The theoretical basis for selecting the first high-gradient point that meets the condition as the starting point is:

[0065] Physical rationality: The bone fragment extends from the top plate slot, and its starting position should have obvious edge features and a high gradient amplitude;

[0066] Noise resistance: Low gradient regions are mostly flat backgrounds or noise, and have no structural significance;

[0067] Uniqueness and repeatability: Search for the first high gradient point in a fixed order to avoid inconsistencies caused by random selection.

[0068] Therefore, taking the first pixel with a gradient magnitude greater than the first threshold as the starting point of the path not only conforms to the basic principle of image edge detection (such as the double threshold idea in Canny edge detection), but also provides a stable and reliable initial condition for subsequent continuous tracking of the bone fragment trajectory along the gradient direction, which is a key step in achieving accurate initial segment recognition.

[0069] Step 33: Preset a second threshold, select the next pixel and determine whether the gradient direction deviation between the current pixel and the previous pixel is less than the second threshold and whether the gradient magnitude is greater than the first threshold. If yes, the current pixel is taken as a path node; otherwise, it is discarded. This process continues until all pixels have been selected and it is determined whether they are path nodes or discarded.

[0070] Gradient direction deviation refers to the absolute value of the difference between the gradient direction values ​​of adjacent pixels.

[0071] The second threshold serves as an indicator to determine whether the gradient direction deviation between adjacent pixels meets the standard. Therefore, this embodiment determines the second threshold using parameters from historical qualified lanterns. Specifically, it involves collecting surface unfolded images of 20 to 50 historical qualified lanterns and extracting the effective bone segment starting segment. The gradient direction difference between each pair of adjacent pixels is recorded, and the standard deviation and mean of all gradient direction differences are calculated. The sum of the mean and twice the standard deviation is used as the second threshold in this embodiment.

[0072] Starting from the path origin, the next possible path node is found using an eight-neighbor search. That is, for the current pixel, its eight neighboring pixels (up, down, left, right, and diagonal) are examined, and candidate points are selected in descending order of gradient magnitude or in order of direction closest to the current path trend.

[0073] The current pixel is accepted as a path node only if both of the following conditions are met:

[0074] (a) Gradient direction deviation < second threshold: ensures smooth path extension direction, conforms to bone sheet geometry, and eliminates noise or cross textures caused by abrupt changes in direction;

[0075] (b) Gradient magnitude > first threshold: ensure that the point belongs to a strong edge region with sufficient structural saliency, and avoid mistakenly including weak response regions (such as shadows, gradients) into the path.

[0076] If any condition is not met, the point is removed and not included in the path. This dual-condition constraint mechanism borrows the hysteresis threshold concept from Canny edge detection, which can maintain path continuity while effectively suppressing noise propagation.

[0077] Step 34: Connect the starting point of the path and all path nodes to form a gradient path. Determine whether the starting point and / or path nodes of the continuously connected paths in the gradient path are greater than the third threshold. If so, define the gradient path as a valid gradient path; otherwise, discard it.

[0078] The starting point of the path and all retained path nodes are connected sequentially according to their connection order during the tracking process to form a continuous gradient path. Then, it is determined whether the total length of the continuously connected starting points and / or path nodes (i.e., the number of pixels contained in the path) is greater than a preset third threshold. If the path length is greater than the third threshold, it is defined as a valid gradient path; otherwise, it is considered an invalid path and discarded. The core function of this step is to verify the rationality of the candidate paths obtained from the initial tracking from the geometric length dimension, in order to distinguish between the real bone fragment starting segment and short, noisy edges, texture interference, or locally broken segments.

[0079] The setting of the third threshold needs to be determined comprehensively based on image resolution, bone fragment structural features, and actual detection requirements. Although the bone fragment groove may be relatively long in physical scale (e.g., the starting segment corresponds to several millimeters), in the image preprocessing stage, due to factors such as uneven illumination, blurred edges, or local occlusion, the actual continuously high-gradient segment that can be stably detected may be relatively short. Therefore, this embodiment does not rely on the complete physical length, but focuses on whether there is a continuous edge with consistent direction, stable intensity, and sufficient length to characterize the existence of the structure. Setting the third threshold to at least 3 pixels and an upper limit of 10 pixels (3-10 pixel units) can effectively filter out single-point noise or double-point false triggers, balancing the local continuity of the starting segment in the image and its anti-interference ability. This threshold range has been verified by a large number of experiments, which significantly reduces false judgments caused by surface defects or imaging noise while ensuring a high recall rate for the true starting segment. The genuine bone-like grooves, as the key structure supporting the lantern's skeleton, have a defined extension length and spatial continuity; their starting segment cannot be merely a few isolated edge points. False edges, such as random noise, surface scratches, or localized reflections, typically appear as short, discrete fragments, making it difficult to form a sufficiently long, coherent path. By introducing a length-filtering mechanism, such false positive responses can be effectively eliminated, significantly improving the robustness and reliability of the detection.

[0080] Step 35: Determine whether the deviation between the gradient direction of the starting point or path node of the effective gradient path and the extension direction of the bone slice is less than the direction tolerance. If so, define the effective gradient path as the effective bone slice starting segment.

[0081] The lantern's ribs are arranged regularly from the top plate slot along radial or helical tangential directions, exhibiting a high degree of rotational symmetry. In an ideal design, the starting direction of each rib should strictly point to or be tangential to a theoretical path (equiangular spiral). Therefore, the deviation between its gradient direction and the design direction should theoretically approach 0°. A directional tolerance of ±5° introduces a reasonable engineering tolerance zone based on the ideal design, ensuring both a high recognition rate of the actual structure and effectively eliminating false edges with significant directional deviations.

[0082] In lantern design, the ribs extend radially or helically from the top plate's latch. This direction can be determined through geometric modeling. For example, if the top plate is a circular structure and the latch is located on the circumference, the theoretical direction of the rib extension is radially outward from the center of the top plate towards the latch location.

[0083] Deviation refers to the absolute value of the angle between the gradient direction of the starting point or path node of the effective path and the extension direction of the bone piece. In this embodiment, it is preferred that the deviation between each path node on the effective gradient path and the extension direction of the bone piece is less than the direction tolerance before the effective gradient path is defined as the effective bone piece starting segment. This ensures that only paths that meet the design expectations in both spatial position and geometric direction are accepted, thereby effectively eliminating false detections caused by texture interference or structural misalignment.

[0084] Compared to traditional edge detection or template matching methods, this invention significantly improves the accuracy, robustness, and physical interpretability of starting segment identification through a multi-level collaborative mechanism involving gradient analysis, direction constraints, length verification, and design direction comparison. Existing technologies typically rely solely on single edge intensity information or global template matching, making it difficult to distinguish the true starting edge of a bone fragment from background noise, texture interference, or local defects. This is especially problematic under complex conditions such as uneven lighting, surface reflection, or slight deformation, which can easily lead to false detections or missed detections. This solution, by introducing dual constraints of gradient magnitude and direction, not only requires path nodes to have sufficient edge intensity (first threshold) but also forces their gradient direction to remain continuous within a local range (second threshold), effectively suppressing the propagation of false edges with abrupt direction changes and ensuring that the tracking path conforms to the geometric characteristics of a smooth bone fragment extension. Furthermore, by setting a third threshold, short, discrete noise segments are excluded, retaining only candidate paths with structural continuity, achieving a leap from pixel-level edges to structural-level line segments. Finally, by introducing a deviation judgment from the theoretical bone segment extension direction, and combining image features with the physical design principles of the lantern, this method ensures that the identified starting segment is not only continuous, high-intensity, and oriented in the image, but also conforms to the design expectations in spatial orientation. This fundamentally eliminates misjudgments based on incorrect orientation but similar shape. Overall, this method constructs a four-level verification chain of intensity → direction → length → semantics, which is significantly superior to the simple intensity → position matching mode of traditional methods. It can stably and reliably identify truly effective bone segment starting segments in real-world industrial scenarios with high noise, low contrast, and local deformation, providing a high-confidence starting point for subsequent trajectory integrity detection and connection status assessment, and significantly improving the accuracy and automation level of defect detection.

[0085] Step 4: Based on the effective bone fragment starting segment, extract the complete bone fragment groove trajectory and determine the cumulative deviation from the ideal equiangular spiral path. Perform a consistency check based on the cumulative deviation. If the check passes, proceed to Step 5. If the check fails, end the detection, determine that the bone fragment has a structural trajectory distortion defect, and output a defective product.

[0086] Step 41: Starting from the end of the effective bone fragment's initial segment, extract the complete bone fragment groove trajectory downwards along the sidewall to obtain the measured trajectory point set.

[0087] Using the end of the effective bone fragment's initial segment as the initial seed point, the complete bone fragment groove trajectory is extracted downwards along the lantern's sidewall. In the standardized lantern surface unfolded image, a local search window is set around this end point, and adjacent pixels with high gradient responses are detected within this window. Since the bone fragment groove appears as a continuous, smooth linear structure in the image, and its extension direction has a certain continuity, pixels with the smallest angular deviation from the current path direction and a gradient magnitude greater than a first threshold are preferentially selected as the next trajectory point. An improved gradient tracking algorithm is used during the tracking process, combined with a direction prediction mechanism: the possible position of the next pixel is predicted based on the local tangent direction of the current path, and a focused search is performed in that direction to improve tracking efficiency and accuracy. Meanwhile, to address potential edge breaks or local blurring, a hysteresis connection mechanism is introduced: when the gradient magnitude of a pixel falls below a first threshold, causing tracking interruption, another high-response point with a gradient magnitude greater than the first threshold is searched within a certain range near the interruption point. The Euclidean distance between this point and the previous trajectory point is then checked to see if it is less than a preset distance threshold (15 pixels), and if the gradient direction deviation between the two is less than 15°. If these conditions are met, the point is considered a continuation of the original trajectory and is bridged, preventing the entire trajectory from breaking due to local defects. Throughout the tracking process, all confirmed trajectory points are recorded sequentially, forming an ordered two-dimensional coordinate sequence, i.e., the measured trajectory point set.

[0088] Step 42: Use the ideal isoangular spiral path model to obtain the ideal isoangular spiral path and the ideal trajectory point set.

[0089] The process of obtaining an ideal equiangular spiral path and generating an ideal trajectory point set using an ideal equiangular spiral path model is a common technique in image detection and geometric modeling, widely used in modeling and quality comparison of industrial products with regular spiral structures. This process constructs an ideal equiangular spiral path model that conforms to the lantern's geometric laws based on the lantern's structural design parameters: top plate radius, bottom plate radius, number of loops of the bone pieces, and overall height. Because an equiangular spiral has a constant angle between the tangent and radial direction at any point, it accurately reflects the design intent of the bone pieces extending smoothly and symmetrically from the top plate to the bottom plate. After the model is established, starting from the top plate's latch position, the spiral path is discretized along the circumference at a preset angular resolution (e.g., every 0.1 radians or a fixed pixel step), generating a series of theoretical trajectory points, which are then arranged sequentially to form the ideal trajectory point set.

[0090] Step 43: Determine the cumulative deviation between the measured trajectory point set and the ideal trajectory point set.

[0091] The measured trajectory point set and the ideal trajectory point set are placed in the same image coordinate system and spatially aligned, including translation, rotation, and scale normalization, to eliminate the overall offset caused by image stitching errors or positioning deviations. Subsequently, to establish the correspondence between the two point sets, a nearest neighbor search strategy is adopted: for each point in the measured trajectory point set, the nearest Euclidean distance point in the ideal trajectory point set is found; conversely, linear or spline interpolation can be performed on the ideal trajectory point set to match the distribution density of the measured points. Based on this, the local deviation between each pair of corresponding points, i.e., the Euclidean distance between the two points, is calculated.

[0092] Step 44: Preset a fourth threshold and determine whether the cumulative deviation is greater than the fourth threshold. If yes, it means the inspection has failed, and the bone fragment is determined to have a structural trajectory distortion defect and output as unqualified. If no, it means the inspection has passed.

[0093] A batch of historically qualified lantern samples were collected, and the measured trajectory point sets were extracted from the grooves of their ribs. The cumulative deviation between each sample and its corresponding ideal trajectory was calculated. By statistically analyzing the deviation data of this batch of qualified samples, the mean and standard deviation were obtained. The sum of the mean and three times the standard deviation was used as a fourth threshold. If the cumulative deviation exceeds this value, it can be considered that the lantern deviates from the normal process level and has significant trajectory distortion.

[0094] Existing technologies only focus on local edge strength or overall shape similarity, making it difficult to distinguish the actual bone fragment trajectory from noise, texture interference, or local deformation. This is especially problematic in industrial environments with uneven lighting, surface reflection, or slight deformation, easily leading to false positives or false negatives. Our proposed solution, however, achieves a leap from local feature recognition to global structural verification by following a complete chain: starting from an effective initial segment → tracing along directional continuity → constructing a set of measured trajectory points → comparing with an ideal equiangular spiral path → quantifying accumulated deviations. As a key component bearing structural function, the lantern bone fragment's groove trajectory follows strict geometric rules (equiangular spiral) in its design, exhibiting directional continuity, length stability, and path predictability. Therefore, any manufacturing deviation that causes the actual trajectory to deviate from the ideal model by more than a threshold constitutes a structural defect. This method ensures the physical validity of the tracking starting point (extending only from the verified valid starting segment), avoiding misjudgment of the entire trajectory caused by starting from false edges; it introduces an ideal equiangular spiral path model as a design benchmark, reflecting respect for and quantitative restoration of the original product design intent; through point set matching and cumulative deviation calculation, it transforms trajectory differences into measurable numerical indicators, overcoming the limitations of subjective judgment in traditional visual inspection; combined with a fourth threshold based on statistical calibration of historical qualified samples, it achieves objective and repeatable automatic discrimination. Overall, this embodiment can not only detect obvious breaks or offsets, but also identify small but cumulative trajectory distortions, significantly outperforming the qualitative observation mode of traditional methods. It has stronger anti-interference capabilities, higher detection consistency and interpretability in complex industrial scenarios, truly realizing a technological upgrade from experience-based quality inspection to data-driven intelligent inspection.

[0095] Step 5: For the complete bone fragment groove trajectory that has passed inspection, identify the actual bottom plate latch position corresponding to the top plate latch position in the bottom plate area, determine the distance between the actual bottom plate latch position and the end of the complete bone fragment groove trajectory, and determine the lantern's detection result based on the distance.

[0096] Step 51: Based on the symmetry of the lantern, define the mapping relationship between the top plate latch position and the bottom plate latch position.

[0097] Since most lanterns employ rotational symmetry (such as hexagonal, octagonal, or circular structures), the slots on their top and bottom plates are distributed in a one-to-one correspondence, axially aligned pattern. First, the top plate slot array was extracted in step 2, and the angular position of each slot in the standardized unfolded diagram was obtained (calculating the polar angle of each slot with the top plate center as the origin). Assuming the lantern has N ribs, the theoretical angular interval between adjacent slots is 360° / N. For example, for an octagonal lantern (N=8), the slots are evenly distributed every 45°. Based on this, a mapping rule is established: for each top plate slot, there should be a corresponding bottom plate slot on the edge of the bottom plate directly below it, used to fix the end of the rib. This mapping relationship can be expressed as the mathematical function M: θtop→θbottom, where θtop is the polar angle of the top plate slot, and θbottom is the theoretical polar angle of the corresponding bottom plate slot; ideally, they are equal. If manufacturing deviations cause the bottom plate slot position to shift, it is allowed to be considered aligned within an angular tolerance range of ±2° to 3°.

[0098] Calculating the polar angle by determining the center is a standard calculation method.

[0099] Step 52: In the standardized unfolded view of the lantern surface, identify the outline of the base plate and extract multiple base plate slot positions that are evenly distributed in the circumferential direction to form a base plate slot array.

[0100] The generation process of the bottom plate bayonet array is the same as that of the top plate bayonet array, and will not be described in detail in this embodiment.

[0101] Step 53: Based on the mapping relationship, identify the actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate outline.

[0102] Based on the rotational symmetry of the lantern, each base plate slot should be located on the edge of the base plate in the same or approximately polar angle direction as its corresponding top plate slot.

[0103] In another implementation, a ray is drawn from the center of the top plate as the pole, along the polar angle direction (e.g., 45°, 90°, 135°, etc.) of each top plate notch towards the bottom plate region. A local search window (e.g., a region with a width of 10 pixels extending along the arc length of the contour) is set near the intersection of this ray and the bottom plate contour. Within this window, template matching or edge feature analysis methods are used to identify the actual bottom plate notches. If a groove matching the shape characteristics is detected within the search range of the expected angular direction, its center point is taken as the actual bottom plate notch position corresponding to that top plate notch.

[0104] Step 54: Determine the distance between the actual base plate bayonet position and the end of the groove trajectory of the complete bone piece, preset the target tolerance threshold, and determine whether the distance is greater than the target tolerance threshold. If so, it is determined that there is a connection failure defect between the bone piece and the actual base plate bayonet position and a defective product is output; otherwise, a qualified product is output.

[0105] The target tolerance threshold is pre-set based on design specifications and production standards to ensure consistent product quality. For example, for this type of lantern, the design requirements specify that the ideal distance from the end of the groove trajectory of the bone piece to the corresponding edge of the base plate should be 10 mm. Considering normal fluctuations during the manufacturing process, the maximum allowable deviation is set as the target tolerance threshold, such as ±2 mm. This means that any actual measurement exceeding the range of 8 to 12 mm will be considered non-compliant.

[0106] Using computer vision or 3D scanning technology, the actual position coordinates of each base plate notch and the coordinates of the end of the corresponding bone plate groove trajectory are accurately obtained. Through geometric calculations (such as the Euclidean distance formula), the straight-line distance between these two points can be calculated. This distance is then compared to a target tolerance threshold. If the distance exceeds the range of 8 to 12 millimeters, a connection failure defect is identified.

[0107] Existing technologies typically rely solely on overall contour comparison or regional grayscale analysis to determine the presence of a locking mechanism, making it difficult to establish a precise correspondence between the locking mechanisms of the top and bottom plates. This is especially problematic when the locking mechanism is partially obscured, deformed, or has manufacturing offsets, leading to mismatches or missed detections. This solution, however, constructs a geometric mapping relationship between the top and bottom plate locking mechanisms, fully utilizing the inherent rotational symmetry of the lantern. This transforms the detection problem from unordered search to directional localization, significantly narrowing the search range and improving recognition efficiency and reliability. The bottom plate locking array is extracted from the standardized unfolded diagram, ensuring the integrity and positional consistency of the bottom plate contour. Based on the mapping relationship, the actual bottom plate locking positions are accurately identified within the theoretically corresponding area, avoiding computational redundancy and mismatch risks associated with global traversal. By quantifying the spatial distance between the end of the bone fragment groove trajectory and the corresponding bottom plate locking mechanism and comparing it with a preset target tolerance threshold, objective and quantifiable automatic identification of connection failure defects is achieved. If the distance exceeds the limit, it indicates that the bone fragment is not accurately inserted or the bottom plate locking mechanism is misaligned, posing a risk of structural loosening. This method can not only detect obvious defects or breaks, but also identify minor assembly deviations that affect functionality, overcoming the drawbacks of traditional visual inspection that rely on subjective experience and lack physical correspondence. Overall, this solution constructs a closed-loop logic of symmetry guidance → array extraction → mapping positioning → distance verification, realizing a technological leap from coarse observation to precise verification. It has stronger anti-interference capabilities, higher detection accuracy and repeatability in complex industrial scenarios, effectively ensuring the structural integrity and assembly reliability of lantern products.

[0108] By performing spatial correlation analysis on the end portion of the complete bone fragment groove trajectory and the position of the base plate latch, the end of the complete bone fragment groove trajectory is determined, including:

[0109] Detect whether the endpoint of the complete bone fragment groove trajectory is located at the bottom plate slot position of the bottom plate outline; if so, take the actual endpoint of the complete bone fragment groove trajectory as the end of the complete bone fragment groove trajectory.

[0110] If the complete bone fragment groove trajectory is interrupted prematurely outside the base plate contour, then extend along the end direction of the complete bone fragment groove trajectory to intersect with the base plate contour, and take the intersection point as the end of the complete bone fragment groove trajectory.

[0111] Linear fitting is performed on several points at the end of the trajectory (e.g., the last 5 points) to obtain a local extension direction vector. A ray is then extended forward from the trajectory endpoint along this direction and intersects with the base plate contour curve. The intersection point is the theoretical insertion position. For example, if a trajectory is interrupted 3mm from the edge of the base plate, the ray is extended after fitting its direction and intersects with the base plate contour near the center of the notch; this intersection point is taken as the trajectory endpoint. This method is based on the physical assumption that "bone fragments tend to extend in straight lines or smooth curves," thus recovering incomplete information caused by local missing parts.

[0112] If the complete bone fragment groove trajectory branches within the base plate bayonet outline, then perform connected component analysis on each branch and select the endpoint of the longest branch as the end of the complete bone fragment groove trajectory.

[0113] In the base plate bayonet area, if the trajectory branches due to material wrinkles or imaging artifacts (such as parallel double lines or Y-shaped branches), a connected component analysis strategy is adopted. First, starting from the trajectory breakpoint, all edge pixels connected to the main path are extracted within the base plate bayonet contour and divided into multiple branches according to connectivity. The pixel length of each branch is calculated, and the endpoint of the longest branch is selected as the final trajectory end. For example, if a trajectory splits into two near the base plate, with lengths of 12 pixels and 7 pixels respectively, the endpoint of the 12-pixel branch is selected as the valid end. This strategy prioritizes retaining the main path most likely to continue the original direction, avoiding positioning errors caused by mistakenly selecting shorter branches.

[0114] If the complete bone fragment groove trajectory is divergent or blurred, the centroid of the high-response area is taken as the end of the complete bone fragment groove trajectory by combining the brightness and edge strength of the base plate bayonet outline.

[0115] When the edge of the bone fragment's end region becomes diffused or blurred due to uneven lighting or material transparency, relying solely on geometric tracking is insufficient to determine the precise endpoint. In this case, the system combines image features of the base plate's bayonet outline for weighted localization: calculating the grayscale gradient amplitude and brightness contrast within the bayonet region to generate a response heatmap; weighting high-response areas (such as pixels with gradient amplitudes greater than a first threshold) and calculating the centroid coordinates as the end of the complete bone fragment's groove trajectory.

[0116] It is worth noting that this embodiment strictly follows the execution sequence of first detecting the effective bone fragment starting segment, then verifying the consistency between the complete bone fragment groove trajectory and the ideal path, and finally judging the connection status between the end and the base plate. This logic has an irreversible dependency in terms of technology. If an effective bone fragment starting segment that meets the requirements of gradient, length, and direction cannot be found within the preset fan-shaped search area, it is judged as a structural starting point missing defect and a defective product is directly output, reflecting the preliminary and decisive role of starting point detection. Only after confirming that the starting segment is valid will step 4 be entered, where the complete trajectory is extracted based on the starting point and its cumulative deviation from the ideal equiangular spiral path is calculated; if the deviation exceeds the fourth threshold, it is judged as a structural trajectory distortion defect and the detection is terminated. This design ensures that only trajectories with continuous shape and reasonable direction enter the final connection judgment, avoiding invalid analysis of obviously abnormal paths. Finally, in step 5, only bone fragments that have passed the previous tests are identified based on the mapping relationship to identify the corresponding base plate bayonet, and the connection failure is judged by spatial distance. If the order is reversed, for example, if the end connection is checked first, defective products with incorrect starting points or severely distorted trajectories that happen to be near the checkpoint might be mistakenly judged as qualified, leading to missed inspections. Therefore, this step-by-step, risk-prone inspection process not only conforms to the physical extension of bone fragments from the top plate to the bottom plate, but also ensures the accuracy and efficiency of the inspection results; the execution order cannot be changed.

[0117] This embodiment also discloses an automatic detection system for appearance defects of intelligent lanterns that combines image recognition, including the following modules:

[0118] Image acquisition module: used to acquire panoramic images of the lantern through a multi-degree-of-freedom vision device, and to perform stitching and geometric correction to generate a standardized lantern surface unfolding diagram;

[0119] The bayonet recognition module is used to identify the top plate outline in the standardized unfolded drawing of the lantern surface, and extract multiple top plate bayonet positions that are evenly distributed in the circumferential direction of the top plate outline to form a top plate bayonet array.

[0120] Effective bone fragment starting segment detection module: Used for each top plate bayonet position in the top plate bayonet array, it constructs a preset fan-shaped search area based on the bone fragment extension direction, and searches for the effective bone fragment starting segment of the bone fragment groove within the preset fan-shaped search area; if no effective bone fragment starting segment of the bone fragment groove is found within the preset fan-shaped search area, it is determined that the starting point of the bone fragment groove at the current top plate bayonet position is missing, indicating a structural starting point missing defect, and the detection ends and a defective product is output;

[0121] Complete bone fragment groove trajectory detection module: Based on the effective bone fragment starting segment, extract the complete bone fragment groove trajectory and determine the cumulative deviation from the ideal equiangular spiral path. Perform consistency check based on the cumulative deviation. If the check fails, end the detection, determine that the bone fragment has a structural trajectory distortion defect and output a defective product.

[0122] The bayonet detection module is used to inspect the complete bone fragment groove trajectory that has passed through, identify the actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate area, determine the distance between the actual bottom plate bayonet position and the end of the complete bone fragment groove trajectory, and determine the detection result of the lantern based on the distance.

[0123] To implement the above embodiments, this application also proposes an electronic device. Please see [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. For example... Figure 3 As shown, the electronic device 500 includes: a processor 501 and a memory 502 communicatively connected to the processor 501; the memory 502 stores computer-executable instructions; the processor 501 executes the computer-executable instructions stored in the memory to implement the method provided in the foregoing embodiments.

[0124] To implement the above embodiments, this application also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.

[0125] To implement the above embodiments, this application also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.

[0126] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0127] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0128] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0129] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0130] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0131] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0132] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0133] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. An automatic detection method for appearance defects of intelligent lanterns combining image recognition, characterized in that, Includes the following steps: Step 1: Acquire a panoramic image of the lantern using a multi-degree-of-freedom vision device, and perform stitching and geometric correction to generate a standardized lantern surface unfolding diagram; Step 2: Identify the top plate outline in the standardized lantern surface unfolded diagram, and extract multiple top plate slot positions that are evenly distributed in the circumferential direction of the top plate outline to form a top plate slot array. Step 3: For each top plate bayonet position in the top plate bayonet array, construct a preset fan-shaped search area based on the bone segment extension direction, and search for the effective bone segment starting segment of the bone segment groove within the preset fan-shaped search area; if no effective bone segment starting segment of the bone segment groove is found within the preset fan-shaped search area, it is determined that the starting point of the bone segment groove at the current top plate bayonet position is missing, indicating a structural starting point missing defect, and the detection ends and a defective product is output; if an effective bone segment starting segment of the bone segment groove is found within the preset fan-shaped search area, proceed to step 4; Step 4: Based on the effective bone fragment starting segment, extract the complete bone fragment groove trajectory and determine the cumulative deviation from the ideal equiangular spiral path. Perform a consistency check based on the cumulative deviation. If the check passes, proceed to step 5. If the check fails, end the detection, determine that the bone fragment has a structural trajectory distortion defect, and output a defective product. Based on the effective bone fragment starting segment, the complete bone fragment groove trajectory is extracted and the cumulative deviation from the ideal isoangular spiral path is determined. A consistency check is then performed based on the cumulative deviation, including: Step 41: Starting from the end of the effective bone fragment's initial segment, extract the complete bone fragment groove trajectory downwards along the sidewall to obtain the measured trajectory point set; Step 42: Obtain the ideal equiangular spiral path and the ideal trajectory point set using the ideal equiangular spiral path model; Step 43: Determine the cumulative deviation between the measured trajectory point set and the ideal trajectory point set; Step 44: Preset a fourth threshold and determine whether the cumulative deviation is greater than the fourth threshold. If yes, it means the inspection has failed, and the bone fragment is determined to have a structural trajectory distortion defect and output as unqualified. If no, it means the inspection has passed. Step 5: For the complete bone fragment groove trajectory that has passed inspection, identify the actual bottom plate latch position corresponding to the top plate latch position in the bottom plate area, determine the distance between the actual bottom plate latch position and the end of the complete bone fragment groove trajectory, and determine the detection result of the lantern based on the distance; Determine the distance between the actual base plate bayonet position and the end of the groove trajectory of the complete bone fragment, and determine the lantern's detection results based on this distance, including: Step 51: Based on the symmetry of the lantern, define the mapping relationship between the top plate latch position and the bottom plate latch position; Step 52: In the standardized unfolded view of the lantern surface, identify the outline of the base plate and extract multiple base plate slot positions that are evenly distributed in the circumferential direction to form a base plate slot array. Step 53: Based on the mapping relationship, identify the actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate outline; Step 54: Determine the distance between the actual base plate bayonet position and the end of the groove trajectory of the complete bone piece, preset the target tolerance threshold, and determine whether the distance is greater than the target tolerance threshold. If so, it is determined that there is a connection failure defect between the bone piece and the actual base plate bayonet position and a defective product is output; otherwise, a qualified product is output.

2. The method according to claim 1, characterized in that, Search for the effective starting segment of the bone fragment within the preset fan-shaped search area, including: Step 31: Determine the gradient of each pixel within the preset fan-shaped search area to obtain the gradient direction and gradient magnitude; Step 32: Preset a first threshold, select the first pixel and determine whether the gradient magnitude of the first pixel is greater than the first threshold. If so, take the first pixel as the starting point of the path. Step 33: Preset a second threshold, select the next pixel and determine whether the gradient direction deviation between the current pixel and the previous pixel is less than the second threshold and whether the gradient magnitude is greater than the first threshold. If yes, the current pixel is taken as a path node; otherwise, it is discarded. Continue until all pixels are selected and it is determined whether they are path nodes or discarded. Step 34: Connect the starting point of the path and all path nodes to form a gradient path. Determine whether the consecutively connected starting points and / or path nodes in the gradient path are greater than the third threshold. If so, define the gradient path as a valid gradient path; otherwise, discard it. Step 35: Determine whether the deviation between the gradient direction of the starting point or path node of the effective gradient path and the extension direction of the bone slice is less than the direction tolerance. If so, define the effective gradient path as the effective bone slice starting segment.

3. The method according to claim 2, characterized in that, The third threshold is 3-10 pixel units, with an orientation tolerance of ±5°.

4. The method according to claim 2, characterized in that, The preset fan-shaped search area includes: taking the position of the top plate latch as the starting point, constructing a fan-shaped search range with an angle of ±15° along the extension direction of the bone piece.

5. The method according to claim 1, characterized in that, By performing spatial correlation analysis on the end portion of the complete bone fragment groove trajectory and the position of the base plate bayonet, the end of the complete bone fragment groove trajectory is determined.

6. The method according to claim 5, characterized in that, By performing spatial correlation analysis on the end portion of the complete bone fragment groove trajectory and the position of the base plate latch, the end of the complete bone fragment groove trajectory is determined, including: Detect whether the endpoint of the complete bone fragment groove trajectory is located at the bottom plate notch position of the bottom plate contour. If so, take the actual endpoint of the complete bone fragment groove trajectory as the end of the complete bone fragment groove trajectory. If the complete bone fragment groove trajectory is interrupted prematurely outside the bottom plate contour, extend along the end of the complete bone fragment groove trajectory to intersect with the bottom plate contour and take the intersection point as the end of the complete bone fragment groove trajectory. If the complete bone fragment groove trajectory forks within the bottom plate notch contour, perform connected component analysis on each branch and select the endpoint of the longest branch as the end of the complete bone fragment groove trajectory.

7. The method according to claim 1, characterized in that, If the complete bone fragment groove trajectory is divergent or blurred, the centroid of the high-response area is taken as the end of the complete bone fragment groove trajectory by combining the brightness and edge strength of the base plate bayonet outline.

8. An automatic detection system for appearance defects of intelligent lanterns combined with image recognition, used to execute the automatic detection method for appearance defects of intelligent lanterns combined with image recognition as described in any one of claims 1-7, characterized in that, Includes the following modules: Image acquisition module: used to acquire panoramic images of the lantern through a multi-degree-of-freedom vision device, and to perform stitching and geometric correction to generate a standardized lantern surface unfolding diagram; The bayonet recognition module is used to identify the top plate outline in the standardized unfolded drawing of the lantern surface, and extract multiple top plate bayonet positions that are evenly distributed in the circumferential direction of the top plate outline to form a top plate bayonet array. Effective bone fragment starting segment detection module: Used for each top plate bayonet position in the top plate bayonet array, it constructs a preset fan-shaped search area based on the bone fragment extension direction, and searches for the effective bone fragment starting segment of the bone fragment groove within the preset fan-shaped search area; if no effective bone fragment starting segment of the bone fragment groove is found within the preset fan-shaped search area, it is determined that the starting point of the bone fragment groove at the current top plate bayonet position is missing, indicating a structural starting point missing defect, and the detection ends and a defective product is output; Complete bone fragment groove trajectory detection module: Based on the effective bone fragment starting segment, extract the complete bone fragment groove trajectory and determine the cumulative deviation from the ideal equiangular spiral path. Perform consistency check based on the cumulative deviation. If the check fails, end the detection, determine that the bone fragment has a structural trajectory distortion defect and output a defective product. The bayonet detection module is used to inspect the complete bone fragment groove trajectory that has passed through, identify the actual bottom plate bayonet position corresponding to the top plate bayonet position in the bottom plate area, determine the distance between the actual bottom plate bayonet position and the end of the complete bone fragment groove trajectory, and determine the detection result of the lantern based on the distance.

Citation Information

Patent Citations

  • Novel removable receipts lantern

    CN206803023U

  • Surface defect detection method, system, equipment, and terminal thereof

    US12307653B1