Metal diaphragm part position correction method and system based on improved template matching

CN121685633BActive Publication Date: 2026-11-03NANJING YUNTONG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies for correcting the position of metal diaphragm components suffer from problems such as unstable feature extraction, high matching failure rate, large attitude estimation deviation due to non-rigid deformation, high mismatch rate, lack of closed-loop iterative correction, and insufficient overall real-time performance, making it difficult to meet the precision assembly requirements of high-end intelligent manufacturing.

Method used

Image preprocessing combining the adaptive Retinex algorithm and the DnCNN denoising network, hybrid feature extraction using the ASIFT algorithm and the SuperPoint network, and a two-layer filtering mechanism combining the Guided-PROSAC algorithm and local topology consistency verification, combined with sub-pixel level positioning and mechanical linkage, are used to construct a fully closed-loop control system to achieve precise position correction of the metal diaphragm.

Benefits of technology

It improves the stability of feature extraction under complex lighting and non-rigid deformation conditions, meets the requirements of high-density packaging, achieves sub-millimeter repeatability positioning accuracy, supports 24/7 continuous operation, is suitable for various metal film parts, and meets the real-time requirements of production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121685633B_ABST
    Figure CN121685633B_ABST
Patent Text Reader

Abstract

The application relates to a metal diaphragm part position correction method and system based on improved template matching, which comprises the following steps: image preprocessing is carried out by combining a self-adaptive Retinex algorithm with a DnCNN denoising network; feature points and a confidence map are extracted by fusing an ASIFT algorithm and a SuperPoint network; initial matching is realized by using a FREAK descriptor and a weighted Hamming distance, and initial false matching is filtered based on a bidirectional nearest neighbor criterion; a double-layer filtering mechanism combining a Guided-PROSAC and a local topological structure verification is designed to remove false matching; a pose error vector is calculated by mapping the corner points of a template image to a target image; the pose error vector is transmitted to a mechanical arm controller to correct the position of the metal diaphragm part; and a check mechanism is designed to support closed-loop iterative correction. The application can meet the real-time requirement of a production line on an edge device, solves multiple defects of traditional technology in robustness, precision and automation integration, and provides reliable technical support for precise assembly tasks in intelligent manufacturing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of computer vision and intelligent manufacturing, and in particular to a method and system for correcting the position of metal diaphragm parts based on improved template matching. Background Technology

[0002] In modern high-density electronic manufacturing and precision assembly processes, metal diaphragm components (such as bare PCBs and flexible printed circuit boards) must be precisely placed on designated fixtures or carriers before entering the next process. Their position and angular deviations directly affect the quality of subsequent processes such as surface mount technology (SMT), soldering, and inspection. Currently, the mainstream position adjustment method still relies primarily on manual intervention. Operators visually judge the posture of the metal diaphragm components based on experience and manually push or fine-tune the fixtures to complete the alignment. This method has three major bottlenecks: First, it is inefficient, with each adjustment taking a long time, making it difficult to meet the demands of high-speed automated production lines; second, it has poor repeatability, as angular errors often exceed ±0.5° and positional deviations can reach ±1mm or more due to factors such as individual visual fatigue and fluctuations in attention; third, it has high labor costs, requiring a large number of operators in large-scale production, increasing management complexity and operating expenses.

[0003] To address the aforementioned issues, some attempts have been made to use traditional feature matching algorithms (such as SIFT, SURF, and ORB) combined with template matching to achieve automatic localization of metal diaphragm components. However, these methods face severe challenges in practical applications: First, the surface of metal diaphragm components is typically a copper-clad metal layer, which is highly reflective and has sparse texture, resulting in extremely low contrast, especially under low light or side lighting conditions. This leads to unstable responses from traditional corner detectors and incomplete extraction of key points. Second, dynamic changes in the lighting environment at the production site, such as sunlight interference and lamp aging, cause uneven brightness in the image, severely affecting the consistent expression of feature descriptors. Third, metal diaphragm components are prone to slight bending, warping, or non-rigid stretching deformation during transmission, violating the strict geometric consistency assumption and rendering the matching model based on rigid body transformation ineffective. Finally, when the camera angle is significantly tilted (e.g., a downward angle > 15°), the image exhibits significant perspective distortion, and traditional algorithms lack affine invariance support, causing a sharp drop in matching success rate.

[0004] In recent years, with the development of deep learning, end-to-end learnable feature extraction and matching methods such as SuperPoint, D2-Net, and LoFTR have demonstrated stronger semantic awareness and environmental adaptability. Among them, SuperPoint generates dense and discriminative keypoints through self-supervised training, which improves the matching performance of weakly textured regions to some extent. However, it still suffers from keypoint omissions under extremely low contrast or strong noise interference, and it does not fully consider the prior information unique to metal film components, such as periodic hole arrays and straight edge structures, which limits its practicality. In addition, existing deep matching models mostly focus on natural image registration tasks, lacking small-scale, high-density feature point optimization designs for industrial targets, and their inference speed is also difficult to meet real-time control requirements.

[0005] More importantly, most current vision positioning systems remain at a rudimentary stage of "detection-output coordinates," lacking deep integration with execution units (such as six-axis robotic arms and XY platforms). Even with relatively accurate attitude parameters, issues such as communication delays, inaccurate coordinate mapping, and lack of feedback verification prevent truly fully automatic closed-loop correction. Furthermore, in the feature matching post-processing stage, the traditional RANSAC algorithm relies on random sampling, resulting in slow convergence or even failure when the mismatch rate is high. Standard NMS or distance threshold filtering strategies struggle to handle proximity interference and local topological distortions among high-density positioning apertures, further reducing the overall system stability and reliability.

[0006] Therefore, there is an urgent need to propose a comprehensive solution that integrates image preprocessing enhancement, hybrid feature extraction, dual-layer matching purification, sub-pixel-level positioning, and closed-loop mechanical linkage. This solution aims to overcome the technical bottlenecks of traditional feature matching technology, such as poor robustness, insufficient accuracy, and difficulty in implementation in complex industrial environments. The goal is to build a fully automated position correction system for metal diaphragm parts that is adaptive, highly real-time, and engineering feasible, serving high-end intelligent manufacturing scenarios. Summary of the Invention

[0007] To address the shortcomings of existing technologies, this invention provides a method and system for correcting the position of metal diaphragm components based on improved template matching, aiming to solve the following key technical problems existing in current metal diaphragm component position correction technologies: (1) Traditional feature matching methods are unstable in feature extraction under complex lighting, low contrast, surface reflection and background clutter interference, resulting in a high matching failure rate and making it difficult to guarantee the reliability of continuous production. (2) When the metal diaphragm has non-rigid deformation or large angle tilt, the traditional SIFT / SURF / ORB algorithms lack sufficient affine invariance, resulting in distorted matching point distribution and significantly increased attitude estimation bias. (3) Existing deep learning feature extractors (such as SuperPoint) have certain semantic perception capabilities, but their feature density in weak texture areas is insufficient and they do not integrate the advantages of hand-designed features, so their ability to recognize small-sized, high-density key points (such as positioning holes) is limited. (4) The mismatch rate is high in the feature matching process. The traditional RANSAC algorithm and the nearest neighbor criterion have poor purification effect in high noise environment and are prone to introducing abnormal interior points, which affects the accuracy of homography matrix solution. (5) Lack of efficient matching post-processing mechanism. When faced with densely arranged key points (such as multiple adjacent positioning holes), traditional NMS or fixed threshold screening is prone to missed detection or redundant retention, which will destroy the consistency of local topology. (6) The lack of tight coupling and integration between the vision system and the mechanical actuator, and the lack of a closed-loop iterative correction mechanism, makes it impossible to verify the correction results after a single positioning, and it is difficult to achieve sub-millimeter level repeatability positioning accuracy. (7) The overall real-time performance of the system is insufficient and cannot meet the millisecond-level response requirements of industrial production lines. In particular, there is a significant delay when high-resolution image processing and complex algorithms are connected in series.

[0008] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for correcting the position of a metal diaphragm based on improved template matching, comprising the following steps: The template image and the target image are acquired. The target image is enhanced by the adaptive Retinex algorithm and then fed into the DnCNN denoising network for denoising and quantization distortion. Then, geometric enhancement is performed to obtain the enhanced grayscale target image. The adaptive Retinex algorithm introduces guided filtering to replace the Gaussian blur of the traditional Retinex algorithm. At the same time, a brightness adaptive gain factor is introduced to adjust the enhancement intensity to avoid over-enhancement and artifacts. The guided filtering is guided by the grayscale image of the target image; The brightness adaptive gain factor assigns high gain to dark areas in the target image and low gain to bright areas in the target image. The template image and the enhanced grayscale target image are fed into a hybrid feature extraction mechanism that combines the ASIFT algorithm and the SuperPoint network to detect feature points and obtain feature points and confidence maps. Initial matching is performed on all feature points detected in the template image and the enhanced grayscale target image based on the FREAK descriptor and weighted Hamming distance to generate initial matching point pairs; A two-layer filtering mechanism combining the Guided-PROSAC algorithm and local topological consistency verification is used to remove mismatches from the initial matching point pairs and output clean matching point pairs. The Guided-PROSAC algorithm uses a confidence map to guide the sample selection order of the traditional PROSAC algorithm, prioritizing the selection of initial matching point pairs corresponding to high-confidence feature points to participate in the estimation of the homography matrix and output candidate interior point pairs. The candidate interior point pairs include candidate interior points of the template image and candidate interior points of the enhanced grayscale target image. The optimal homography matrix is ​​fitted to the clean matching point pairs using the RANSAC algorithm. The four corner points in the template image are coarsely mapped. Then, the corner points after coarse mapping are precisely located based on the subpixel thinning algorithm to determine the coordinates of the projected corner points. Combined with the center offset and rotation angle of the metal film in the target image and the ideal position, a complete pose error vector is formed. The pose error vector is packaged into a standard communication protocol format and transmitted to the robotic arm controller via an industrial bus for parsing. The controller plans the optimal motion trajectory, generates joint drive commands, and controls the end effector to drive the metal diaphragm to complete precise translation and rotation transformations, thereby achieving position correction of the metal diaphragm. After each position correction, the template image and the target image are re-captured, and the pose residual between the two is calculated. If the pose residual is higher than the preset threshold, all the above processes are repeated until the pose residual is lower than the preset threshold or the number of iterations reaches the preset maximum number of iterations.

[0009] Optionally, the step of feeding the template image and the enhanced grayscale target image into a hybrid feature extraction mechanism combining the ASIFT algorithm and the SuperPoint network for feature point detection, and obtaining feature points and a confidence map, includes: The ASIFT algorithm is used to simulate all possible affine deformation perspectives, and ASIFT key points are extracted to form a key point set. Run the SuperPoint network to extract dense key points and generate a SuperPoint heatmap; Using ASIFT keypoints as the center, find the nearest points with the strongest corresponding responses in the SuperPoint heatmap and use them as feature points; The SuperPoint heatmap generated by the SuperPoint network serves as the confidence map.

[0010] Optionally, the initial matching of all detected feature points in the template image and the enhanced grayscale target image based on the FREAK descriptor and weighted Hamming distance, generating initial matching point pairs, includes: The FREAK descriptor is used to encode the feature points; Matching weights are assigned based on the information entropy of different bits of feature points using weighted Hamming distance.

[0011] Optionally, the initial matching is implemented based on the bidirectional nearest neighbor matching criterion, and a dynamic threshold is set to filter out initial false matches.

[0012] Optionally, the local topological consistency verification includes: constructing a k-nearest neighbor graph for each candidate interior point, comparing the neighborhood topological structures of the corresponding candidate interior points in the template image and the enhanced grayscale target image, and then calculating the neighborhood topological similarity of the candidate interior point pair. The candidate interior point pair is retained only when the neighborhood topological similarity of the candidate interior point pair is higher than a set threshold.

[0013] Optionally, the coarse mapping of the four preset corner points in the template image includes: mapping the coordinates of the four corner points to the target image coordinate system through the optimal homography matrix to obtain their actual positions in the target image; Optionally, the precise positioning of the corner points after coarse mapping based on the sub-pixel thinning algorithm and the determination of the projected corner point coordinates includes: using a gradient interpolation-based sub-pixel thinning algorithm to precisely position the corner points after coarse mapping.

[0014] The present invention also provides a metal diaphragm position correction system based on improved template matching, for applying the metal diaphragm position correction method based on improved template matching, comprising: an image acquisition and preprocessing module, a feature extraction module, an initial matching module, a two-layer filtering module, a pose error calculation module, and a robotic arm control module; Optionally, the image acquisition and preprocessing module is equipped with a high-resolution industrial camera and a ring LED light source, and has a built-in adaptive Retinex algorithm and DnCNN denoising network to acquire template images and target images and preprocess the target images, automatically completing illumination correction and enhancement and noise suppression. Optionally, the feature extraction module integrates a dual-engine feature extractor of ASIFT algorithm and SuperPoint network to obtain feature points and confidence maps; Optionally, the initial matching module performs initial matching on feature points to generate initial matching point pairs; Optionally, the dual-layer filtering module integrates the Guided-PROSAC algorithm with local topology consistency verification to remove erroneous matches from the initial matching point pairs and output clean matching point pairs. Optionally, the pose error calculation module performs coarse mapping and precise positioning on the four preset corner points in the template image based on the clean matching point pair to determine the coordinates of the projected corner points. It then combines the offset of the center of the metal film piece and the rotation angle between the target image and the ideal position to form a complete pose error vector. Optionally, the robotic arm control module receives the pose error vector sent by the pose error calculation module, performs optimal motion trajectory planning, generates joint drive commands, and controls the end effector to drive the metal diaphragm to complete precise translation and rotation transformations, thereby achieving position correction of the metal diaphragm.

[0015] Optionally, the image acquisition and preprocessing module provides an image enhancement API interface to support batch preprocessing and visual debugging.

[0016] Optionally, the initial matching module integrates the FREAK descriptor and the weighted Hamming distance, implements initial matching based on the bidirectional nearest neighbor matching criterion, and sets a dynamic threshold to filter out initial false matches.

[0017] Optionally, the robotic arm control module supports re-capturing template and target images after each position correction, calculating the pose residual between the two, and re-executing all the above processes if the pose residual is higher than a preset threshold, until the pose residual is lower than the preset threshold or the number of iterations reaches the preset maximum number of iterations.

[0018] By employing the above technical solution, the present invention provides a method and system for correcting the position of metal diaphragm components based on improved template matching, which has at least the following beneficial effects: (1) This invention effectively overcomes interference from complex lighting, low contrast, and non-rigid deformation by designing an adaptive Retinex algorithm and a DnCNN denoising network to jointly denoise and extract features using a hybrid ASIFT algorithm and SuperPoint network. (2) This invention meets the requirements of high-density packaging by combining the Guided-PROSAC algorithm with local topology consistency verification and corner point precise positioning based on sub-pixel thinning algorithm. (3) The system constructed by the present invention realizes the full closed-loop control of "visual perception - decision-making - execution - feedback", without human intervention and supports continuous operation 24 / 7; the system is equipped with the proposed metal diaphragm position correction method based on improved template matching, which does not rely on specific hardware light source or fixture marking, and is applicable to various types of metal diaphragms without Mark points or only natural features; at the same time, the system is modularly designed, which is easy to integrate into the MES / SCADA system and supports remote monitoring, data traceability and OTA upgrade; (4) The method proposed in this invention can meet the real-time requirements of the production line through TensorRT acceleration and model pruning optimization, and solves the multiple defects of traditional technology in terms of robustness, accuracy and automation integration, providing reliable technical support for precise assembly tasks in intelligent manufacturing. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of a method for correcting the position of a metal diaphragm based on improved template matching according to the present invention. Figure 2 These are images acquired under typical working conditions in an industrial workshop, as described in this embodiment of the invention. Figure 3 This is a diagram of the DnCNN denoising network structure used for data preprocessing in this invention. Detailed Implementation

[0020] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. This will allow for a full understanding of how the present application uses technical means to solve technical problems and achieve technical effects, and to facilitate its implementation.

[0021] Those skilled in the art will understand that all or part of the steps in the implementation of the methods of the embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0022] Please refer to Figures 1-3 This illustration demonstrates a specific implementation of this embodiment. This embodiment performs image preprocessing using an adaptive Retinex algorithm combined with a DnCNN denoising network; it integrates the affine invariance of the ASIFT algorithm with the semantic awareness capability of the SuperPoint network to construct a hybrid feature extraction mechanism; it utilizes the FREAK descriptor and weighted Hamming distance to achieve efficient initial matching and filters initial mismatches based on the bidirectional nearest neighbor criterion; it designs a two-layer filtering mechanism combining Guided-PROSAC and local topology verification to eliminate mismatches; it accurately maps the corner points of the template image to the target image using a RANSAC-optimized homography matrix to calculate the pose error vector; it transmits the pose error vector to the robotic arm controller for metal diaphragm position correction; and it designs a verification mechanism to support closed-loop iterative correction, ensuring that the inference speed on the edge device meets the real-time requirements of the production line. This solves multiple defects of traditional technologies in terms of robustness, accuracy, and automation integration, providing reliable technical support for precise assembly tasks in intelligent manufacturing.

[0023] Please refer to Figure 1This embodiment proposes a method for correcting the position of a metal diaphragm based on improved template matching. The method includes the following steps: S1. Acquire template image and target image. After enhancing the target image with adaptive Retinex algorithm, it is fed into DnCNN denoising network for denoising and quantization distortion to obtain grayscale target image. As a preferred embodiment of step S1, the specific process includes: S11. Raw image acquisition, including: Scene coverage design: Images are collected under typical working conditions in an industrial workshop, such as... Figure 2 As shown, it covers three types of lighting scenes. Figure 2 The images captured in the three scenes are, from left to right: strong light scene (natural light and top lighting from 12:00 to 13:00 noon), weak light scene (ring light source only from 19:00 to 20:00 in the evening), and polarized light scene (incident light from a single window from 14:00 to 15:00 in the afternoon). Data Acquisition Process Control: The PLC controls the conveyor belt to transport the metal diaphragm to the inspection station, triggering the industrial camera to automatically capture images (capture interval 1s, exposure time 500μs, gain 1dB). 500 images are captured for each scene, for a total of 3×4×2×500=12000 original images, which are saved in BMP format to avoid compression artifacts affecting subsequent processing.

[0024] This embodiment collects template images and target images in various real industrial environments, covering a variety of typical lighting conditions such as day and night alternation, side lighting, and reflective surfaces, to construct a widely representative image database.

[0025] S12. Image preprocessing is performed, including: Enhanced Adaptive Retinex Algorithm: An improved adaptive Retinex algorithm is adopted, with the guided filter window size set to 15×15 and the brightness adaptive gain factor set to 1.8. The illumination component separation and reflection component extraction are implemented based on MATLAB. After processing, the grayscale contrast of the edge of the positioning hole in the dark area is improved by more than 40%, and the proportion of overexposed pixels in the highlight area is reduced from 15% to below 3%. The core principle of the Retinex algorithm is to decompose an image into illumination and reflection components. The reflection component contains the true details of the image, and the enhancement goal is to improve the visibility of details by suppressing the illumination component and amplifying the reflection component. Traditional Retinex algorithms use a fixed gain factor to adjust the reflection component, which cannot adapt to the different enhancement needs of dark, normal, and bright areas in an image. The brightness-adaptive gain factor designed in this invention is a coefficient that dynamically changes with the local brightness of the image: a higher gain is applied to dark areas to focus on enhancing the reflection component and restoring details in dark areas; a lower gain is applied to bright areas to weaken the amplification of the reflection component and avoid artifacts caused by over-enhancement; and a medium gain is used for normal brightness areas to balance detail preservation and naturalness.

[0026] The adaptive Retinex algorithm estimates the illumination components of an image by using guided filtering (the guided image is a grayscale image of the original image), resulting in a smoothed illumination component map. Then calculate the local brightness mean of the illumination component map. In pixels Centered on, take a size of For a local window, the mean value of the illumination components within the window is calculated using the following formula: ; Among them, the local window radius , The illumination component values ​​of the pixels within the local window. , These represent the horizontal and vertical unit components of the local window radius during the calculation process, respectively. , These represent the horizontal and vertical coordinates of a pixel, respectively. In this embodiment... Set it to 15.

[0027] The adaptive Retinex algorithm designed in this invention separates the illumination components of the target image, focusing on enhancing the visibility of key structures such as the edges of metal film components, positioning holes, and scale lines, improving the feature response intensity of low-illuminance areas, improving the smoothness of the illumination map while preserving edge information, and adjusting the enhancement intensity through a brightness adaptive gain factor to avoid over-enhancement and the introduction of artifacts. It restores the details of shadow areas while preserving color constancy, significantly improving the problem of missed detection of key points caused by uneven illumination.

[0028] Deployment of DnCNN denoising network: The DnCNN denoising network was trained based on the PyTorch framework. The training dataset used was the BSD500 noisy dataset, with 100 training epochs, a batch size of 16, and the optimizer was Adam (initial learning rate 1e-4). The trained model was converted to ONNX format and accelerated by TensorRT quantization (FP16 precision). The denoising inference time on Jetson AGX Xavier was 20ms / frame, and the peak signal-to-noise ratio (PSNR) of the denoised image was improved by 8-12dB. The DnCNN denoising network of this invention effectively removes sensor noise, compression artifacts, and other interference while maintaining clear edges. Its structure can be referred to [reference needed]. Figure 3 The input is a noisy image, which is processed through a feature extraction layer (Conv+ReLU), several stacked convolutional layers (Conv+BN+ReLU), and a reconstruction layer (Conv) to finally obtain a residual image, which is used to generate a denoised image. The preprocessing strategy of combining the DnCNN denoising network with the adaptive Retinex algorithm significantly improves the image signal-to-noise ratio and contrast consistency, laying the foundation for stable feature extraction in weak texture regions.

[0029] Geometric augmentation and annotation: Data augmentation was performed on the denoised images, including horizontal flipping (50% probability), random rotation (-5°~5°, step size 1°), and scaling (0.9~1.1 times, step size 0.05), generating 36,000 augmented images. Using the LabelMe annotation tool, the center coordinates of the four positioning holes and the coordinates of the four corner points of the metal diaphragm in each image were manually annotated, generating JSON format annotation files. The metal diaphragm dataset was constructed and divided into training, validation, and test sets in a 7:2:1 ratio for subsequent SuperPoint network fine-tuning and algorithm performance verification.

[0030] By employing the aforementioned comprehensive preprocessing methods, the diversity of data is expanded, the system's tolerance to attitude changes is enhanced, and images under extreme lighting conditions (such as strong backlighting and local overexposure) still possess high-quality matchable features. This provides stable input for subsequent feature extraction, alleviating the problems of unstable feature extraction, high matching failure rate, and difficulty in ensuring the reliability of continuous production caused by traditional feature matching methods under complex lighting, low contrast, surface reflection, and background clutter interference.

[0031] S2. The template image and the enhanced grayscale target image are fed into a hybrid feature extraction mechanism combining the ASIFT algorithm and the SuperPoint network to detect feature points and obtain feature points and confidence maps.

[0032] As a preferred embodiment of step S2, the specific process includes: S21, ASIFT algorithm configuration: The ASIFT algorithm is implemented in the OpenCV framework. Affine transformation sampling parameters are set (tilt angle range: -60°~60°, step size 10°; scaling factor range: 0.7~1.3, step size 0.1). Keypoints with affine invariance are extracted, averaging 200-300 keypoints per image. The keypoint repetition rate (the matching ratio of keypoints under different poses of the same metal diaphragm) reaches over 85%. The extracted ASIFT keypoints have scale, angle, and tilt invariance, greatly expanding the field of view coverage. This is suitable for situations where metal diaphragms have large tilts or perspective distortions, alleviating the problem that traditional SIFT / SURF / ORB algorithms lack sufficient affine invariance, leading to distorted matching point distribution and significantly increased pose estimation bias when metal diaphragms have non-rigid deformations or large field of view tilts.

[0033] S22. SuperPoint model fine-tuning, including: fine-tuning the pre-trained SuperPoint network (trained on the COCO dataset) using the metal diaphragm dataset constructed in step S1 above, adjusting the SuperPoint network output layer to adapt to the dimensions of the metal diaphragm features (keypoint confidence threshold 0.8, descriptor dimension 256), training for 50 epochs, batch size 8, learning rate 1e-5, and using the MSE loss function for optimization; after fine-tuning, the SuperPoint network has improved accuracy in dense keypoint detection on the test set and increased keypoint density in weakly textured regions (regions without positioning holes on the edges of metal diaphragms).

[0034] This invention uses the SuperPoint network to extract semantically aware interest points, which achieves a more robust response to changes in illumination and texture loss through self-supervised learning.

[0035] S23. Feature Fusion Mechanism Implementation: Write a feature fusion program that uses ASIFT keypoints as a reference and searches for the maximum response point within a 5×5 pixel range centered on the ASIFT keypoint in the feature heatmap generated by SuperPoint (this heatmap serves as a confidence map for subsequent Guided-PROSAC algorithm use). This maximum response point is then used as the fused feature point.

[0036] The fused feature points carry composite descriptive information that combines geometric invariance and context awareness. This hybrid feature extraction mechanism overcomes the poor performance of the traditional SIFT algorithm in weakly textured regions, significantly improving keypoint coverage and matching stability. It performs particularly well in low-texture borders and circular positioning hole regions, significantly improving feature point density and distribution uniformity. This alleviates the problem that while existing deep learning feature extractors have some semantic awareness, they suffer from insufficient feature density in weakly textured regions and lack the advantages of integrating hand-designed features, resulting in limited recognition capabilities for small-sized, high-density keypoints (such as positioning holes).

[0037] This step combines the ASIFT algorithm with the SuperPoint network to simulate all possible affine deformation perspectives of the metal diaphragm, extracting key points with affine invariance. For reflective areas of the copper-clad metal layer of the metal diaphragm, affine transformation is used to compensate for perspective deviations, ensuring that key points can still be stably extracted from the edges of the positioning holes in reflective areas, avoiding the "positioning hole loss" problem caused by perspective tilt. The SuperPoint network has been fine-tuned and functionally adapted to the characteristics of metal diaphragms, which have a high proportion of weak textures and small positioning hole sizes. Traditional methods either use the ASIFT algorithm alone or the SuperPoint network alone. The hybrid fusion mechanism designed in this invention, based on ASIFT and supplemented by SuperPoint, is specifically designed for the complex industrial environment of metal diaphragm detection and the characteristics of the metal diaphragm itself, solving the robustness and accuracy bottlenecks of traditional single feature extraction methods in the position correction of metal diaphragms.

[0038] S3. Perform initial matching on all feature points detected in the template image and the enhanced grayscale target image based on the FREAK descriptor and weighted Hamming distance to generate initial matching point pairs; As a preferred embodiment of step S3, the specific process includes: S31, FREAK descriptor encoding, including: To address the issues of the BRIEF descriptor's lack of rotation invariance and insufficient discriminative power, the FREAK (Fast RetinaKeypoint) descriptor is used instead. Inspired by the sampling structure of the human retina, it possesses natural rotation normalization capabilities and higher matching robustness. The fused keypoints are encoded using the FREAK descriptor (sampling radius 16 pixels, number of neighbors 43) to generate a 64-bit binary descriptor, ensuring both rotation invariance and computational efficiency.

[0039] S32, Weighted Hamming distance matching, including: This implementation uses Python to calculate the weighted Hamming distance. Based on the stability of each bit of the FREAK descriptor in the training set (bits with a standard deviation less than 0.2 are assigned a weight of 1.2, and bits with a standard deviation greater than or equal to 0.2 are assigned a weight of 0.8), the bidirectional nearest neighbor matching threshold is set to 0.8. After the initial matching, each image obtains an average of 80-100 pairs of initial matching points.

[0040] This invention introduces a weighted Hamming distance in the matching stage, allocating matching weights based on the information entropy (reflecting stability) of different bits of feature points to enhance discrimination capabilities and avoid misjudgments caused by high-bit flips due to noise. The matching process employs a bidirectional nearest neighbor (BNN) matching criterion: a matching point pair is accepted only if the nearest neighbor of feature point A in the source image is point B in the target image, and the nearest neighbor of B is also A. This step can quickly eliminate a large number of obvious erroneous matches, reducing the burden of subsequent processing. Simultaneously, a dynamic threshold is set to filter initial erroneous matches, outputting an initial set of matching point pairs as the basis for the next step of erroneous match elimination. This strategy significantly improves the discriminative power and anti-interference ability between descriptors while ensuring real-time performance.

[0041] This step involves targeted optimization design based on the characteristics of industrial scenarios and core matching requirements for metal diaphragm component inspection, forming an efficient matching scheme adapted to the features of metal diaphragms. This solves the three major bottlenecks of traditional matching methods in metal diaphragm component template matching: insufficient descriptor discriminative power, high matching time, and high mismatch rate. This invention combines the size and distribution of key features of the metal diaphragm component (positioning holes, edge lines) to precisely adjust the FREAK sampling parameters: optimizing the sampling radius, preserving and weighting the number of neighbors, and adapting the rotation-normalized benchmark. Traditional FREAK does not optimize for the circular features of the positioning holes and the reflective texture of the metal diaphragm component; traditional Hamming distance assigns equal weight to all bits, failing to consider the difference between effective and invalid bits in the feature encoding of the metal diaphragm component. This invention designs a weighted Hamming distance based on information entropy to achieve targeted optimization. The core logic is that bits corresponding to effective features of the metal diaphragm component in the descriptor have high information entropy and are assigned high weights; bits corresponding to noise have low information entropy and are assigned low weights.

[0042] S4. Based on the two-layer filtering mechanism combining the Guided-PROSAC algorithm and local topology consistency verification, the initial matching point pairs are erroneous and clean matching point pairs are output. As a preferred embodiment of step S4, the specific process includes: S41, Guided-PROSAC algorithm filtering: Guided by the confidence map generated by the SuperPoint network, a high confidence threshold (0.9) is set, and initial matching point pairs with confidence higher than the threshold are sampled first to participate in homography matrix estimation. The number of sampling iterations is 500, and the inlier determination distance threshold is 1.5 pixels. After filtering, the mismatch rate decreases and the homography matrix solution time is reduced.

[0043] The Guided-PROSAC algorithm designed in this invention, based on the traditional PROSAC (Progressive Sample Consensus) algorithm, uses confidence maps to provide spatial prior information (such as key point density distribution and gradient direction consistency) to guide the sample selection order and accelerate the convergence speed. The traditional PROSAC does not clearly define the "physical meaning of confidence", and in the metal film scene, it is easy to mistakenly regard the high response of "reflective noise points and background clutter points" as "high confidence matching pairs", resulting in a large number of invalid samples. In this invention, the core value of the confidence map lies in strongly binding the "confidence level" to the true and effective features of the metal diaphragm: After fine-tuning the SuperPoint network with the metal diaphragm dataset, the high-confidence regions (confidence > 0.8) in the generated confidence map accurately correspond to the positioning holes and edge lines of the metal diaphragm, while the low-confidence regions (confidence < 0.6) correspond to reflective areas, weak texture areas of copper plating, and background clutter. Furthermore, the core flaw of the traditional PROSAC algorithm is its difficulty in distinguishing between "true weak texture matching pairs" and "reflective noise mismatch pairs," leading to a concentration of mismatch pairs in the final output candidate interior points, directly affecting the accuracy of the homography matrix. The confidence map, by quantifying the reliability of feature points, provides an objective basis for the PROSAC algorithm to filter mismatches. Therefore, the confidence map guides the traditional PROSAC algorithm, which can accurately lock the positioning holes, edges and other strong features of the metal diaphragm in the position correction scenario of the present invention, reduce invalid sampling and avoid noise interference; improve the purity of inliers, and provide a guarantee for the high-precision homography matrix; adapt to industrial pain points such as reflection, weak texture and non-rigid deformation of metal diaphragms, and ensure that the algorithm can stably output effective inlier sets under complex working conditions, ultimately supporting the position correction accuracy of metal diaphragms and the success rate of continuous operation of the production line.

[0044] S42. Local Topological Consistency Verification: For the candidate inliers output by the Guided-PROSAC algorithm, construct a k-nearest neighbor graph (k=5), calculate the ratio of the relative angle (error tolerance 5°) and the distance (error tolerance 0.1) between each candidate inlier and its nearest neighbor. Only when the neighborhood topological similarity of the candidate inlier pair is higher than the set threshold is the candidate inlier pair retained. After filtering, each image retains 40-60 clean matching point pairs.

[0045] This invention employs a two-layer filtering mechanism that combines the Guided-PROSAC algorithm with local topology consistency verification. This effectively addresses challenging scenarios such as repetitive patterns, occlusion, and partial overlap, significantly reducing the outlier rate, eliminating abnormal matches with inconsistent structures, and ensuring the spatial logical rationality of the final interior point set.

[0046] The initial matching and mismatch removal method designed in this invention solves the problems of high mismatch rate in feature point matching process, poor purification effect of traditional RANSAC algorithm and nearest neighbor criterion in high noise environment, easy introduction of abnormal interior points, affecting the accuracy of homography matrix solution, and lack of efficient post-matching processing mechanism in traditional feature point matching algorithm. When facing densely arranged key points (such as multiple adjacent positioning holes), traditional NMS or fixed threshold screening is prone to missed detection or redundant retention, which destroys the consistency of local topology.

[0047] S5. Use the RANSAC algorithm to fit the optimal homography matrix to the clean matching point pairs, perform coarse mapping on the four preset corner points in the template image, and then use the sub-pixel thinning algorithm to accurately locate the corner points after coarse mapping, determine the coordinates of the projected corner points, and combine the center offset and rotation angle of the metal film piece in the target image and the ideal position to form a complete pose error vector. As a preferred embodiment of step S5, the specific process includes: S51. Homography Matrix Solution: Based on the RANSAC algorithm, using OpenCV's findHomography function, with an inlier reprojection error threshold of 1.0 pixel, the optimal 3×3 homography matrix from the template image to the target image is solved, establishing the pixel mapping relationship between the template image and the target image. The matrix solution accuracy (reprojection error) is controlled within 0.5 pixels. The obtained optimal homography matrix accurately describes the projection transformation relationship (including rotation, translation, scaling, and perspective distortion) between the template image and the target image.

[0048] S52, Subpixel-level Corner Location: The coordinates of the four corner points of the template image (preset as (0,0), (120,0), (120,180), (0,180), in mm) are mapped to the pixel coordinate system of the target image through the optimal homography matrix to obtain the initial corner coordinates; a subpixel thinning algorithm based on gradient interpolation (such as the Lucas-Kanade optical flow method) is used for subpixel thinning, with 20 iterations and a convergence threshold of 1e-4 pixels. The final corner location accuracy reaches 0.08 pixels (corresponding to an actual distance of 0.0046 mm), generating the projected corner coordinates.

[0049] S53. Position error calculation: Calculate the center offset of the metal film piece (including the x-coordinate offset) based on the coordinates of the projected corner points. and y coordinate offset ): ; Calculate the rotation angle : ;

[0050] in Represents the x-coordinate of the center of the target image. This represents the x-coordinate of the center of the ideal position. This represents the y-coordinate of the center of the target image. This represents the y-coordinate of the center of the ideal position. For the y-component of the target image edge vector, For the x-component of the target image edge vector, Represents the arctangent function. Returns the distance from the origin (0,0) to the point... The angle formed by the line segment and the positive x-axis.

[0051] S6. Pack the pose error vector into a standard communication protocol format and transmit it to the robotic arm controller via the industrial bus for parsing, plan the optimal motion trajectory, generate joint drive commands, and control the end effector to drive the metal diaphragm to complete precise translation and rotation transformations, thereby realizing the position correction of the metal diaphragm. As a preferred embodiment of step S6, the specific process includes: S61. After receiving the pose error vector, the robotic arm controller calls the built-in inverse kinematics solver to generate joint drive commands, which control the end effector to drive the metal diaphragm to complete precise translation and rotation transformations.

[0052] S62. Design the joint drive command format, including the center offset of the metal diaphragm component ( , (Unit: mm, Accuracy: 0.001 mm), Rotation angle ( The instructions are encapsulated in JSON format (unit: °, precision: 0.01 °) and include the instruction number (used for closed-loop feedback verification) to ensure readability and parsing efficiency.

[0053] S63. Industrial Bus Communication: A communication program is developed based on the EtherCAT protocol. The edge computing device acts as the master station, and the robotic arm controller acts as the slave station, enabling real-time sending and receiving of commands. The communication success rate is high, with no packet loss or delay.

[0054] S7. After each position correction, take a new photo to capture the template image and the target image, and calculate the pose residual between the two. If the pose residual is higher than the preset threshold, repeat all the above processes until the pose residual is lower than the preset threshold or the number of iterations reaches the preset maximum number of iterations.

[0055] As a preferred embodiment of step S7, the specific process includes: S71. Single calibration process: After receiving the pose error command, the robot arm controller corrects the position of the metal diaphragm piece. The single correction time is about 1.5 seconds. After the correction is completed, the conveyor belt sends the metal diaphragm piece back to the inspection station, triggering the industrial camera to re-shoot and enter the next round of calibration process.

[0056] S72, Iteration Termination Condition: Set the pose residual tolerance threshold ( , If the pose residual after a single correction is lower than the threshold, the iteration is terminated; otherwise, the above correction process is repeated, with a maximum of 3 iterations allowed to ensure that the final pose residual meets the requirements. In the test set images, most metal film parts can meet the standard with 1-2 iterations. The average total correction time is less than 300ms, as the entire process is scheduled in real time by edge computing devices, meeting the production line cycle time requirements.

[0057] The aforementioned method for correcting the position of metal diaphragm components links the pose error information with the robotic arm control system, alleviating the problem that the lack of tight coupling and integration between the vision system and the mechanical actuator, as well as the lack of a closed-loop iterative correction mechanism, makes it impossible to verify the correction results after a single positioning and thus makes it difficult to achieve sub-millimeter level repeatability accuracy.

[0058] This application also provides a metal diaphragm position correction system based on improved template matching, which is used to apply the metal diaphragm position correction method based on improved template matching, including: an image acquisition and preprocessing module, a feature extraction module, an initial matching module, a two-layer filtering module, a pose error calculation module, and a robotic arm control module. The image acquisition and preprocessing module is equipped with a high-resolution industrial camera and a ring LED light source. It has built-in adaptive Retinex algorithm and DnCNN denoising network to acquire template images and target images and preprocess the target images, automatically completing illumination correction and enhancement and noise suppression. Specifically, a 5-megapixel industrial camera with a 16mm fixed-focus lens was selected to ensure an image resolution of 2592×1944 pixels; a ring LED light source (color temperature 6500K, brightness adjustable from 0-255 levels) was configured, and a 45° oblique lighting method was adopted to reduce the specular reflection of the copper-plated metal layer on the surface of the metal film; the vertical distance between the industrial camera and the metal film was fixed at 60cm, and it was installed directly above the inspection station using an industrial bracket to ensure that the shooting field of view completely covers the area of ​​the metal film.

[0059] Industrial camera intrinsic parameter calibration: Zhang Zhengyou calibration method is adopted. 20 checkerboard images with different angles and positions are taken using a 9×12 checkerboard grid (square size 10mm). The camera intrinsic parameter matrix and distortion coefficients are solved by OpenCV calibration function. Distortion correction is performed on the subsequently acquired images to eliminate the influence of lens optical distortion on feature localization.

[0060] System hand-eye calibration: The system adopts the "eye on hand" calibration mode. The robotic arm drives the camera to take pictures of the calibration plate fixed on the worktable, and collects 15 sets of robotic arm end poses (X / Y / Z coordinates and rotation angles around the X / Y / Z axes) and corresponding chessboard images. The Tsai-Lenz algorithm is used to solve the transformation matrix (rotation matrix R and translation vector T) between the camera coordinate system and the robotic arm end coordinate system, so as to achieve accurate mapping from pixel coordinates to robotic arm world coordinates, with the mapping error controlled within 0.05mm.

[0061] The image acquisition and preprocessing module provides an image enhancement API interface, supporting batch preprocessing and visual debugging.

[0062] The feature extraction module integrates a dual-engine feature extractor of ASIFT algorithm and SuperPoint network to obtain feature points and confidence maps. The initial matching module performs initial matching on feature points to generate initial matching point pairs; The initial matching module integrates the FREAK descriptor and weighted Hamming distance, implements initial matching based on the bidirectional nearest neighbor matching criterion, and sets a dynamic threshold to filter out initial false matches.

[0063] The dual-layer filtering module integrates the Guided-PROSAC algorithm and local topology consistency verification to remove mismatches from the initial matching point pairs and output clean matching point pairs. The pose error calculation module performs coarse mapping and precise positioning on the four preset corner points in the template image based on clean matching point pairs to determine the coordinates of the projected corner points. It then combines the offset of the center of the metal film piece and the rotation angle between the target image and the ideal position to form a complete pose error vector. The robotic arm control module receives the pose error vector sent by the pose error calculation module, performs optimal motion trajectory planning, generates joint drive commands, and controls the end effector to drive the metal diaphragm to complete precise translation and rotation transformations, thereby achieving position correction of the metal diaphragm. The robotic arm control module supports re-capturing template and target images after each position correction, and calculating the pose residual between the two. If the pose residual is higher than a preset threshold, all the above processes are re-executed until the pose residual is lower than the preset threshold or the number of iterations reaches the preset maximum number of iterations.

[0064] The system constructed by this invention solves the problem of insufficient overall real-time performance of traditional metal diaphragm component position correction systems, which cannot meet the millisecond-level response requirements of industrial production lines, especially the problem of significant delays when high-resolution image processing and complex algorithms are run in series.

[0065] This application also provides accuracy verification and performance evaluation to assess the performance of the method, i.e., the system of the present invention, including: (1) Positioning accuracy test: The deviation between the actual position and the ideal position of the corrected metal diaphragm was measured using a laser interferometer (accuracy 0.001mm). In 100 repeated tests, the average center offset of the metal diaphragm in the x-coordinate was 0.032mm, the average center offset of the metal diaphragm in the y-coordinate was 0.028mm, and the average deviation of the rotation angle was 0.035°. All of these are better than the traditional method and meet the sub-millimeter positioning accuracy requirements.

[0066] (2) Robustness test: The performance of the method of the present invention was tested under interference scenarios (sudden change in illumination; surface contamination; partial occlusion). The matching success rate and correction compliance rate were significantly higher than those of the traditional SIFT algorithm, proving the strong robustness of the method of the present invention in complex scenarios.

[0067] (3) Real-time test: The processing time of each module of the constructed system was statistically analyzed, including the image acquisition and preprocessing module, feature extraction module, initial matching module, two-layer filtering module, pose error calculation module, and robotic arm control module. The total processing time met the real-time control requirements.

[0068] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in 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 those different embodiments or examples.

[0069] 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).

[0070] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for correcting the position of a metal diaphragm based on improved template matching, characterized in that, include: The template image and the target image are acquired. The target image is enhanced by the adaptive Retinex algorithm and then fed into the DnCNN denoising network for denoising and quantization distortion. Then, geometric enhancement is performed to obtain the enhanced grayscale target image. The adaptive Retinex algorithm introduces guided filtering to replace the Gaussian blur of the traditional Retinex algorithm, and introduces a brightness adaptive gain factor to adjust the enhancement intensity to avoid over-enhancement and artifacts. The guided filtering is guided by the grayscale image of the target image; The brightness adaptive gain factor assigns high gain to dark areas in the target image and low gain to bright areas in the target image. The template image and the enhanced grayscale target image are fed into a hybrid feature extraction mechanism that combines the ASIFT algorithm and the SuperPoint network to detect feature points and obtain feature points and confidence maps. Initial matching is performed on all feature points detected in the template image and the enhanced grayscale target image based on the FREAK descriptor and weighted Hamming distance to generate initial matching point pairs; Based on the two-layer filtering mechanism that combines the Guided-PROSAC algorithm with local topology consistency verification, false matches are removed from the initial matching point pairs, and clean matching point pairs are output. The Guided-PROSAC algorithm uses a confidence map to guide the sample selection order of the traditional PROSAC algorithm, prioritizing the selection of initial matching point pairs corresponding to high-confidence feature points to participate in the estimation of the homography matrix and outputting candidate interior point pairs; the candidate interior point pairs include candidate interior points of the template image and candidate interior points of the enhanced grayscale target image; The optimal homography matrix is ​​fitted to the clean matching point pairs using the RANSAC algorithm. The four corner points in the template image are coarsely mapped. Then, the corner points after coarse mapping are precisely located based on the subpixel thinning algorithm to determine the coordinates of the projected corner points. Combined with the center offset and rotation angle of the metal film in the target image and the ideal position, a complete pose error vector is formed. The pose error vector is packaged into a standard communication protocol format and transmitted to the robotic arm controller via an industrial bus for parsing. The controller plans the optimal motion trajectory, generates joint drive commands, and controls the end effector to drive the metal diaphragm to complete precise translation and rotation transformations, thereby achieving position correction of the metal diaphragm. After each position correction, the template image and the target image are re-captured, and the pose residual between the two is calculated. If the pose residual is higher than the preset threshold, all the above processes are repeated until the pose residual is lower than the preset threshold or the number of iterations reaches the preset maximum number of iterations.

2. The method for correcting the position of a metal diaphragm based on improved template matching according to claim 1, characterized in that: The step of feeding the template image and the enhanced grayscale target image into a hybrid feature extraction mechanism combining the ASIFT algorithm and the SuperPoint network for feature point detection, and obtaining feature points and a confidence map, includes: The ASIFT algorithm is used to simulate all possible affine deformation perspectives, and ASIFT key points are extracted to form a key point set. Run the SuperPoint network to extract dense key points and generate a SuperPoint heatmap; Using ASIFT keypoints as the center, find the nearest points with the strongest corresponding responses in the SuperPoint heatmap and use them as feature points; The SuperPoint heatmap generated by the SuperPoint network serves as the confidence map.

3. The method for correcting the position of a metal diaphragm based on improved template matching according to claim 1, characterized in that: The initial matching of all feature points detected in the template image and the enhanced grayscale target image based on the FREAK descriptor and weighted Hamming distance is performed to generate initial matching point pairs, including: The FREAK descriptor is used to encode the feature points; Matching weights are assigned based on the information entropy of different bits of feature points using weighted Hamming distance.

4. The method for correcting the position of a metal diaphragm based on improved template matching according to claim 3, characterized in that: The initial matching is based on the bidirectional nearest neighbor matching criterion, and a dynamic threshold is set to filter out initial false matches.

5. The method for correcting the position of a metal diaphragm based on improved template matching according to claim 1, characterized in that: The local topology consistency verification includes: constructing a k-nearest neighbor graph for each candidate interior point, comparing the neighborhood topology of the corresponding candidate interior points in the template image and the enhanced grayscale target image, and then calculating the neighborhood topology similarity of the candidate interior point pair. Only when the neighborhood topology similarity of the candidate interior point pair is higher than a set threshold is the candidate interior point pair retained.

6. The method for correcting the position of a metal diaphragm based on improved template matching according to claim 1, characterized in that: The coarse mapping of the four preset corner points in the template image includes: mapping the coordinates of the four corner points to the target image coordinate system through the optimal homography matrix to obtain their actual positions in the target image; The method of accurately locating corner points after coarse mapping based on subpixel thinning algorithm and determining the coordinates of projected corner points includes: using a gradient interpolation-based subpixel thinning algorithm to accurately locate corner points after coarse mapping.

7. A metal diaphragm position correction system based on improved template matching, used to apply the metal diaphragm position correction method based on improved template matching as described in any one of claims 1-6, characterized in that: include: Image acquisition and preprocessing module, feature extraction module, initial matching module, two-layer filtering module, pose error calculation module, robotic arm control module; The image acquisition and preprocessing module is equipped with a high-resolution industrial camera and a ring LED light source. It has built-in adaptive Retinex algorithm and DnCNN denoising network to acquire template images and target images and preprocess the target images, automatically completing illumination correction and enhancement and noise suppression. The feature extraction module integrates a dual-engine feature extractor of ASIFT algorithm and SuperPoint network to obtain feature points and confidence maps. The initial matching module performs initial matching on feature points to generate initial matching point pairs; The dual-layer filtering module integrates the Guided-PROSAC algorithm and local topology consistency verification to remove mismatches from the initial matching point pairs and output clean matching point pairs. The pose error calculation module performs coarse mapping and precise positioning on the four preset corner points in the template image based on clean matching point pairs to determine the coordinates of the projected corner points. It then combines the offset of the center of the metal film piece and the rotation angle between the target image and the ideal position to form a complete pose error vector. The robotic arm control module receives the pose error vector sent by the pose error calculation module, performs optimal motion trajectory planning, generates joint drive commands, and controls the end effector to drive the metal diaphragm to complete precise translation and rotation transformations, thereby achieving position correction of the metal diaphragm.

8. A metal diaphragm position correction system based on improved template matching according to claim 7, characterized in that: The image acquisition and preprocessing module provides an image enhancement API interface, supporting batch preprocessing and visual debugging.

9. A metal diaphragm position correction system based on improved template matching according to claim 7, characterized in that: The initial matching module integrates the FREAK descriptor and weighted Hamming distance, implements initial matching based on the bidirectional nearest neighbor matching criterion, and sets a dynamic threshold to filter out initial false matches.

10. A metal diaphragm position correction system based on improved template matching according to claim 7, characterized in that: The robotic arm control module supports re-capturing template and target images after each position correction, and calculating the pose residual between the two. If the pose residual is higher than a preset threshold, all the above processes are re-executed until the pose residual is lower than the preset threshold or the number of iterations reaches the preset maximum number of iterations.

Citation Information

Patent Citations

  • Pose registration method and device based on local structure vector alignment

    CN114943753A

  • Cross-scale image matching method under double cameras

    CN120726356A