A step-by-step stitching method for optical surface defect images based on adaptive feature extraction

Through the combination of adaptive feature extraction and RANSAC methods, the problem of long splicing time and inaccuracy in optical surface defect detection is solved, and accurate panoramic splicing and robustness improvement of optical element surface defects are achieved, which is suitable for a variety of optical element surfaces. Detection of defects.

CN115082314BActive Publication Date: 2024-10-18INST OF OPTICS & ELECTRONICS CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210744926.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-28
Publication Date
2024-10-18
Estimated Expiration
2042-06-28

AI Technical Summary

Technical Problem

Existing optical surface defect detection methods are time-consuming and inaccurate in the splicing process, and have poor robustness, especially in terms of scale and rotation invariance. They are difficult to adapt to situations such as color and illumination changes, and simple feature extraction cannot complete panoramic images. Splicing.

Method used

The step-by-step splicing method of optical surface defect images using adaptive feature extraction is used to extract feature points in the overlapping areas of the sub-images through the SIFT algorithm, combined with the RANSAC method to eliminate false matching points, and the classification step-by-step processing is used to splice the defect images, giving priority to splicing four sub-images of bit-relationships, followed by sub-images of three-bit and two-bit relationships, and are fused using the defect gradient mean when necessary.

Benefits of technology

It achieves accurate panoramic splicing of optical element surface defects, reduces splicing errors, improves speed and robustness, reduces the impact of splicing dislocation caused by guide rail motion errors, can effectively splice scratches that penetrate multiple sub-images, and improves quantification Accuracy of assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082314B_ABST
    Figure CN115082314B_ABST
Patent Text Reader

Abstract

The present invention provides a method for step-by-step stitching of optical surface defect images with adaptive feature extraction, including: feature extraction of sub-images, marking and classification of sub-images, classification fusion and stitching of images, feature extraction of overlapping areas of sub-images using SIFT algorithm, defective overlapping areas are recorded as 1, otherwise 0; the areas marked as 1 are stitched using SIFT algorithm, the descriptors of defect feature points are adaptively reduced in dimension, the feature matching points are screened using RANSAC algorithm, the unity matrix is ​​obtained, and fusion stitching is achieved through affine transformation, and images with four-bit relationships are spliced ​​first, followed by three-bit and two-bit images. The areas marked as 0 are spliced ​​according to the relative positions of coordinates, the overlapping areas are classified and fused and stitched using two methods, and the obtained several large-block images are used to achieve panoramic stitching of surface defects of optical elements. The present invention provides an efficient and fast stitching method for panoramic stitching of optical surface defect images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of optical detection, and in particular relates to a method for step-by-step splicing of optical surface defect images by adaptive feature extraction. Background Art

[0002] With the continuous development of advanced optical manufacturing technology, ultra-precision optical components are widely used in aerospace, microelectronic equipment, optical precision measurement and other fields. Since defects on the surface of components such as scratches and pits will cause light scattering and thus affect the performance of the optical system, the detection of optical surface defects is crucial.

[0003] Optical microscopic dark field imaging is an effective method for detecting surface defects of optical components, among which defect image stitching is a key technology. The stitching of microscopic scattering dark field images of the surface of optical components is to stitch multiple dark field sub-images of the same optical component surface into a panoramic image, so as to analyze and evaluate the surface defects of the optical components later. In recent years, image stitching technology has developed rapidly, and the more popular ones are image stitching methods based on feature matching, including image preprocessing, image registration, and image fusion. The most widely used are SIFT, SURF, and Harris algorithms. The window threshold of the Harris corner detection algorithm requires prior knowledge and is not scale-rotation invariant. SURF is fast, real-time, and robust, but its performance in scale invariance, rotation invariance, and other performance is not ideal, and it is not suitable for occasions such as color and illumination changes. SIFT was originally proposed by David G. Lowe (David G. Lowe. Distinctive Image Features from Scale-Invariant Keypoints [J]. International Journal of Computer Vision, 2004, 60 (2): 91-110). It is almost unaffected by changes in image illumination, affine changes (image rotation angle, scaling, etc.) and noise, and has strong anti-interference capabilities. However, not every captured sub-image has defects, and the panoramic image cannot be stitched simply using a feature extraction stitching algorithm. Image classification and step-by-step processing are required. Summary of the invention

[0004] The purpose of the present invention is to provide a method for step-by-step stitching of optical surface defect images with adaptive feature extraction, which is used to stitch sub-images with defects such as scratches or pitting collected under an optical microscopy method, realize the stitching of a panoramic image of surface defects of optical elements, and overcome the problems of existing stitching methods such as long time consumption, inaccurate stitching and poor robustness.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is: a method for step-by-step splicing of optical surface defect images with adaptive feature extraction, the steps are as follows:

[0006] Step S1: The area array camera takes multiple dark-field images of microscopic scattering of the optical element surface along a designated path "S" shape. Each dark-field image of microscopic scattering of the optical element surface is taken as a sub-image, and the starting coordinates of each sub-image are recorded. Any two sub-images are required to have overlapping areas.

[0007] Step S2: input sub-images, and convert the starting coordinates of each sub-image into pixel starting coordinates, then use SIFT algorithm to extract feature points from the overlapping area of ​​each sub-image, obtain coarse matching feature points, and count the number of feature points;

[0008] Step S3: Record the number of feature points in the overlapping area, and mark the overlapping area with k(i, m), where i represents the sub-image sequence, and m=1, 2, 3, 4 represent the upper, right, lower, and left regions of sub-image i respectively. If the number of feature points in the overlapping area m is greater than the threshold T 0 , then k(i, m) = 1, otherwise k(i, m) = 0;

[0009] Step S4: if sub-image i satisfies ∑k(i, m)=4, then sub-image i satisfies a four-bit relationship, that is, the overlapping areas of sub-image i and the adjacent sub-images above, below, left and right have obvious defect features. Similarly, if ∑k(i, m)=3, then sub-image i satisfies a three-bit relationship. If ∑k(i, m)=2, then sub-image i satisfies a two-bit relationship. When splicing, the feature extraction and matching method is preferentially used to splice sub-images with a four-bit relationship, followed by splicing sub-images that satisfy the three-bit relationship and the two-bit relationship. Finally, two adjacent defect images with features are spliced: the overlapping areas where both adjacent images are 1 are solved and refined by the RANSAC method to obtain the transformation matrix, remove the wrong matching points, and then perform image fusion and splicing according to the calculated transformation matrix.

[0010] Step S5: the area where k(i, m)=0 is moved by Δx, Δy according to the relative position of the coordinates so as to overlap with the overlapping area of ​​the neighboring area, and then the overlapping area is merged and spliced;

[0011] Step S6: Repeat steps S3 to S5 until all sub-images are stitched together to obtain a panoramic image.

[0012] Furthermore, in step S2, the steps of extracting SIFT feature points are as follows:

[0013] S2.1 Establish sub-image scale space and represent it with image Gaussian pyramid

[0014] The spatial function L(x, y, σ) of a certain scale in the sub-image is obtained by convolving the Gaussian function G(x, y, σ) with variable parameters and the original input sub-image I(x, y):

[0015] L(x,y,σ)=G(x,y,σ)*I(x,y)

[0016] Among them, σ represents the scale space factor. The smaller σ is, the clearer the sub-image is, indicating the details of the sub-image. The larger σ is, the blurrier the sub-image is, indicating the general appearance of the sub-image.

[0017] S2.2 Constructing the Gaussian difference function DOG operator

[0018] In the number of groups with different scale parameters, the Gaussian difference pyramid can be obtained by subtracting adjacent layers in each group. The Gaussian difference function DOG is expressed as:

[0019] D(x,y,σ)=[G(x,y,kσ)-G(x,y,σ)]*I(x,y)=L(x,y,kσ)-L(x,y,σ)

[0020] The feature points are composed of local extreme points in the DOG space. The middle detection point is compared with its 8 adjacent points of the same scale and 18 points corresponding to the upper and lower adjacent scales, a total of 26 points. The obtained extreme points are used as candidate feature points. The principal curvature of the DOG function D(x) of the candidate feature point is proportional to the eigenvalue of the Hessian matrix H:

[0021]

[0022] D xx (x, y) represents the second-order partial derivative in the x direction of the corresponding position in the neighborhood of the candidate feature point; D xy (x, y) means to find the partial derivatives in the x and y directions for the corresponding positions in the neighborhood of the candidate feature point; D yy (x, y) means to find the second-order partial derivative in the y direction for the corresponding position in the neighborhood of the candidate feature point;

[0023] Let α = λmax = D xx (x, y) is the maximum eigenvalue of H, β=λmin=D yy (x, y) is the smallest eigenvalue of H, where α = γβ, then:

[0024]

[0025] Det(H)=αβ

[0026] Trace(H)=α+β

[0027] Trace(H) is the trace of matrix H, Det(H) is the determinant of matrix H, and its value is minimum when the two eigenvalues ​​are equal. The relationship between the ratio γ and the threshold T is detected to filter out unstable edge response points.

[0028] S2.3 Determination of the main direction of feature points

[0029] The feature point direction parameters are given to make the feature point rotation invariant. The gradient direction distribution characteristics of the pixel neighborhood of the feature point are statistically analyzed using a histogram. The gradient value m(x, y) and the direction angle θ(x, y) are as follows:

[0030]

[0031]

[0032] Where m(x, y) is the gradient value, θ(x, y) is the direction angle; L(x+1, y) is the scale space value of the pixel point (x+1, y), L(x-1, y) is the scale space value of the pixel point (x-1, y), L(x, y+1) is the scale space value of the pixel point (x, y+1), and L(x, y-1) is the scale space value of the pixel point (x, y-1);

[0033] S2.4 Establishing feature point descriptors

[0034] The original 128-dimensional descriptor is improved by dimensionality reduction, and a descriptor with adaptive dimension N is used. The similarity measure of the descriptor is the weighted Euclidean distance d. ij It is expressed as:

[0035]

[0036] Among them, r ij Represents the feature points in the template image, s ij Represents the feature points in the matching image, ω ij represents the weight, and N is the descriptor dimension;

[0037] The closer to the feature point, the greater the weight. The paired key point descriptors that are finally retained need to satisfy the Euclidean distance less than the threshold.

[0038] Fusion and splicing, the RANSAC method is used to solve and refine the transformation matrix, eliminate incorrect matching points, and then perform image fusion and splicing based on the calculated transformation matrix.

[0039] Furthermore, in step S5, the fusion is divided into two cases: if there is no defect feature in the overlapping area, the corresponding pixels of the two overlapping areas are averaged; if there is a defect in the overlapping area but the defect is too weak to extract sufficient effective feature points for matching, the defect gradient mean is used for fusion;

[0040] Assuming that the gray value of the midpoint start position a of the defect area in the overlapping area is L1, and the gray value of the midpoint end position b of the farthest radial distance of the defect is L2, the gray value AB (x, y) of each pixel on the midline can be re-expressed as:

[0041]

[0042] Where K1(x, y) is the gray value of the pixel along the ab direction, and M is the number of pixels along the ab direction;

[0043] Then correct the gray value K2(x, y) of each defective pixel in the cd direction perpendicular to the ab direction. First, calculate the pixel average value of the entire overlapping area. At this time, the gray value of the pixel point on the midline ab is recorded as A 1 B 1 (x, y), for each pixel point on ab, there is a vertical direction cd, and the pixel J in each cd direction is corrected to:

[0044]

[0045] That is, the gradient mean fusion map of the entire defect area is obtained.

[0046] Furthermore, the descriptor of the adaptive dimension is determined by the defect feature point and the neighboring pixels. Assuming that the number of pixels from the feature point to the point with the gray value of 0 in the neighboring pixel is P, when P is greater than the threshold T 1 , the dimension remains unchanged, and 16 seed points are generated; when T 2 <P<T 1 , generate 8 seed points, the dimension will be 64; when 0<P<T 2 , generate four seed points, the dimension will be 32 dimensions, when the feature points are matched, if two adjacent Figure 1 If the dimensions of feature point descriptions are different, the maximum value is selected as the common dimension.

[0047] The present invention has the following advantages compared with the prior art:

[0048] a. The method of the present invention realizes the panoramic stitching of microscopic dark field defect images on the surface of optical components, restores the true situation of the surface defects of optical components, and facilitates the subsequent quantitative evaluation of the surface defects of components.

[0049] b. The present invention adopts a classified and step-by-step stitching method to divide the sub-images collected by the microscope into two categories: one is an image with defects and capable of feature extraction, and the other is an image without defects or with defects that are not obvious enough to extract feature points. The two types of images are processed separately, which effectively solves the problem of slow stitching of surface defects of large-aperture optical components, greatly reduces stitching errors, and improves stitching speed.

[0050] c. The present invention can effectively splice the scratches that run through multiple sub-images, reducing the impact of splicing misalignment caused by guide rail motion errors.

[0051] d. The present invention uses the SIFT feature extraction algorithm with adaptive dimensionality reduction combined with RANCS to remove erroneous matching points in overlapping areas that satisfy four-, three-, and two-bit relationships, and then uses a single matrix transformation to splice the image, thereby reducing the splicing error and having high robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 A flow chart of a method for step-by-step splicing of optical surface defect images with adaptive feature extraction according to the present invention;

[0053] Figure 2 It is a schematic diagram of the splicing of four features in the present invention;

[0054] Figure 3 It is a schematic diagram of the pixel gradient mean;

[0055] Figure 4 This is the experimental test diagram of the present invention, where Figure 4 (a) shows the 16 sub-images captured by the camera. Figure 4 (b) Four large blocks are obtained by step-by-step splicing. Figure 4 (c) is a stitched dark-field microscopic panoramic image. DETAILED DESCRIPTION

[0056] To further illustrate the features of the present invention, the present invention is described in detail below with reference to specific implementation examples and the accompanying drawings.

[0057] Figure 1 The figure is a flow chart of a method for step-by-step stitching of optical surface defect images based on adaptive feature extraction of the present invention, comprising the following steps:

[0058] Step a: The camera takes multiple dark-field images of microscopic scattering on the surface of the optical element along the designated “S”-shaped path. Each dark-field image of microscopic scattering on the surface of the optical element is taken as a sub-image, and the starting coordinates of each sub-image are recorded. Any two adjacent sub-images are required to have an overlapping area.

[0059] Step b: Input sub-images and convert the starting coordinates of each sub-image into pixel starting coordinates. Then use SIFT algorithm to extract feature points from the overlapping area of ​​each sub-image to obtain coarse matching feature points and record the number. Specifically, use k(i, m) to mark the overlapping area, where i represents the sub-image sequence and m=1, 2, 3, 4 represent the top, right, bottom and left areas of sub-image i respectively. If the number of feature points in the overlapping area m is greater than the threshold T 0 , then k(i, m) = 1, otherwise k(i, m) = 0.

[0060] like Figure 2 As shown, a total of 12 sub-images are collected, and each sub-image has a partial overlapping area with the adjacent sub-image, that is, the area included by the sub-image boundary and the dotted line. The curved solid line in the overlapping area represents the defect. If sub-image A7 satisfies ∑k(i, m)=4, the sub-image satisfies the four-bit relationship, and the feature extraction and matching method is preferentially used to splice with the upper, lower, left and right adjacent sub-images to ensure that the defect information is not lost, and then the sub-images with other relationships are spliced.

[0061] Step c: Based on step b, the RANSAC method is used to solve and refine the transformation matrix of the overlapping area where both adjacent sub-images are 1, and the wrong matching points are eliminated. Then, the sub-images are fused and spliced ​​according to the calculated transformation matrix.

[0062] Step d: Move the area where k(i, m)=0 in step b by Δx, Δy according to the relative position of the coordinates, and merge and splice the overlapping areas.

[0063] Step e: Repeat steps b, c, and d until all sub-images are stitched together to obtain a panoramic image.

[0064] Furthermore, step b extracting SIFT feature points in the overlapping area of ​​sub-images includes the following steps:

[0065] 2.1 Establish sub-image scale space (represented by image Gaussian pyramid)

[0066] The spatial function L(x, y, σ) of a certain scale in the sub-image is obtained by convolving the Gaussian function G(x, y, σ) with variable parameters and the original input sub-image I(x, y):

[0067] L(x,y,σ)=G(x,y,σ)*I(x,y)

[0068] Among them, σ is a scale space factor. The smaller σ is, the clearer the local point is. On the contrary, the larger σ is, the blurrier the sub-image is and the less it can reflect the details of the sub-image.

[0069] 2.2 Constructing the Gaussian difference function DOG operator

[0070] In the groups with different scale parameters, the Gaussian difference pyramid can be obtained by subtracting adjacent layers in each group. The Gaussian difference function DOG is expressed as:

[0071] D(x,y,σ)=[G(x,y,kσ)-G(x,y,σ)]*I(x,y)=L(x,y,kσ)-L(x,y,σ)

[0072] The feature points are composed of local extreme points in the DOG space. The middle detection point is compared with the 26 points around it. If it is the maximum or minimum value, it is an extreme point, otherwise it is not. Some extreme points are located at the edge of the sub-image and need to be removed. The principal curvature of the DOG function D(x) of the candidate feature point can be obtained from the Hessian matrix H:

[0073]

[0074] D xx (x, y) represents the second-order partial derivative in the x direction of the corresponding position in the neighborhood of the candidate feature point; D xy (x, y) means to find the partial derivatives in the x and y directions for the corresponding positions in the neighborhood of the candidate feature point; D yy (x, y) means to find the second-order partial derivative in the y direction of the corresponding position in the neighborhood of the candidate feature point;

[0075] Assume that the two eigenvalues ​​of the matrix H are α and β, where α = γβ.

[0076] Det(H)=αβ

[0077] Trace(H)=α+β

[0078] Trace(H) is the trace of matrix H, and Det(H) is the determinant of matrix H.

[0079]

[0080] When the two eigenvalues ​​are equal, the value is the smallest. The larger the ratio γ is, the more likely the point is on the edge. The relationship between the ratio γ and the threshold T is detected to filter out unstable edge response points.

[0081] 2.3 Determination of the main direction of feature points

[0082] The gradient value m(x, y) and direction angle θ(x, y) are as follows:

[0083]

[0084]

[0085] Among them, m(x, y) is the gradient magnitude value, θ(x, y) is the direction angle, L(x+1, y) is the scale space value of the pixel point (x+1, y), L(x-1, y) is the scale space value of the pixel point (x-1, y), L(x, y+1) is the scale space value of the pixel point (x, y+1), and L(x, y-1) is the scale space value of the pixel point (x, y-1).

[0086] 2.4 Establishing feature point descriptors

[0087] The original 128-dimensional descriptor is improved and reduced in dimension, and an adaptive dimensional descriptor is used. The adaptive dimensional descriptor is determined by the defect feature point and the neighboring pixels. Assuming that the number of pixels from the feature point to the farthest point with a gray value of 0 in the neighboring pixel is P, when P is greater than the threshold T 1 , the dimension remains unchanged, and 16 seed points are generated; when T 2 <P<T 1 , generate 8 seed points, the dimension will be 64; when 0<P<T 2 , four seed points are generated, and the dimension will be 32. When matching feature points, if the description dimensions of a pair of feature points in two adjacent sub-images are different, the maximum value is selected as the common dimension.

[0088] The matching of feature points is completed by comparing the key point descriptors in the two point sets, and the similarity measure of the descriptors is the weighted Euclidean distance. r ij Represents the feature points in the template image, s ij Represents the feature points in the matching image, ω ij represents the weight, and N is the descriptor dimension.

[0089] Furthermore, in step c, the feature descriptors generated by the SIFT algorithm are used to remove false matching points, and the mapping relationship between feature points is found through the random sampling consistent RANSAC algorithm. Four pairs are selected from all matching points each time, and then the one with the largest number of internal points is selected as the final result, the homography matrix is ​​calculated, and the sub-images are fused and spliced ​​through affine transformation.

[0090] Furthermore, when coordinate stitching is used in step d, the fusion is divided into two cases. If there is no defect feature in the overlapping area at all, the corresponding pixels of the two overlapping areas are averaged; if there is a defect in the overlapping area but the defect is too weak to extract sufficiently effective feature points for matching, the defect gradient is used for fusion.

[0091] like Figure 3As shown in the figure: Assuming that the gray value of the starting position a of the defect area in the overlapping area is L1, and the gray value of the midpoint end position b of the farthest radial distance of the defect is L2, the gray value AB (x, y) of each pixel on the midline can be re-expressed as:

[0092]

[0093] Among them, K1(x, y) is the gray value of the pixel along the ab direction, and M is the number of pixels along the ab direction. Then correct the gray value K2(x, y) of the defective pixel in each cd direction perpendicular to the ab direction. Calculate the pixel average value of the entire overlapping area, and the gray value of the pixel point on the midline ab is recorded as A 1 B 1 (x, y), for each pixel on ab, there is a vertical direction cd, and each pixel in the cd direction That is, the gradient mean fusion map of the entire defect area is obtained.

[0094] The specific effects of the method proposed by the present invention are as follows Figure 4 , Figure 4 (a) is 16 sub-images collected by a microscope. The defect is imaged by dark field microscopy to obtain a bright image of the defect. By extracting features from each sub-image, four overlapping areas are marked, and then four large blocks are finally obtained according to the step-by-step splicing method of the present invention. Figure 4 middle Figure 4 As shown in (b), the last sub-image has no features and can only be used as an independent piece. Coordinate stitching is used and then the stitching image is reassembled. Figure 4 (b) The four sub-images get the final panorama Figure 4 (c).

[0095] The above detection method can be used not only for defective splicing of optical microscopic dark field scattering flat surface elements, but also for defective splicing of optical microscopic dark field scattering curved surface elements.

[0096] The above description is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any person familiar with the technology can understand and think of any changes or substitutions within the technical scope disclosed by the present invention, which should be included in the scope of the present invention.

Claims

1. A method for step-by-step stitching of optical surface defect images based on adaptive feature extraction, characterized in that: It includes the following steps: Step S1: The camera takes multiple microscopic scattering dark-field images of the surface of the optical element along the specified path in an "S" shape. Each microscopic scattering dark-field image of the surface of the optical element is used as a sub-image, and the starting coordinates X and Y of each sub-image are recorded. It is required that any two adjacent sub-images have an overlapping area; Step S2: Input the sub-images, convert the starting coordinates of each sub-image into pixel starting coordinates, then use the SIFT algorithm to extract feature points from the overlapping areas of each sub-image to obtain roughly matched feature points, and count the number of feature points; In step S2, the steps of SIFT feature point extraction are as follows: S2.1 Establish the scale space of the sub-image and represent it with the image Gaussian pyramid Spatial function of a certain scale in a sub-image Gaussian function with variable parameters and the original input sub-image Convolution gives: , Among them, σ represents the scale space factor. The smaller σ is, the clearer the sub-image is, representing the details of the sub-image. The larger σ is, the more blurred the sub-image is, representing the general appearance of the sub-image; S2.2 Construct the Difference of Gaussian (DOG) operator In different groups of scale parameters, subtracting adjacent layers within each group can obtain the Difference of Gaussian pyramid. The Difference of Gaussian function DOG is expressed as: , , Feature points are composed of local extreme points in the DOG space. The middle detection point is compared with 8 adjacent points of the same scale and 18 points corresponding to the upper and lower adjacent scales, a total of 26 points. The obtained extreme points are used as candidate feature points. The principal curvature of the DOG function D(x) of the candidate feature points is proportional to the eigenvalues of the Hessian matrix H: , It means to find the second-order partial derivative in the x direction for the corresponding position of the candidate feature point neighborhood; It means to find the partial derivatives in the x and y directions for the corresponding positions in the neighborhood of the candidate feature point; It means to find the second-order partial derivative in the y direction for the corresponding position of the candidate feature point neighborhood; Let α=λmax= is the maximum eigenvalue of H, β=λmin= is the minimum eigenvalue of H, where α=γβ, then: , , , Trace(H) is the trace of the matrix H, Det(H) is the determinant of the matrix H. When the two eigenvalues are equal, its value is the smallest. Detect the magnitude relationship between the detection ratio γ and the threshold T to filter out unstable edge response points; S2.3 Determine the main direction of the feature points Assign directional parameters to feature points to make them rotationally invariant, and use histograms to calculate the distribution characteristics of the gradient direction and gradient value of the pixels in the neighborhood of feature points. and direction angle As shown below: , , in, is the gradient value, is the direction angle; is the scale space value of the pixel point (x+1,y), is the scale space value of the pixel point (x-1, y), is the scale space value of the pixel point (x, y+1), is the scale space value of the pixel point (x+1,y); S2.4 Establish the feature point descriptor The original 128-dimensional descriptor is improved by dimensionality reduction, and an adaptive dimensional descriptor is used. The similarity measure of the descriptor uses the weighted Euclidean distance It is expressed as: , in, represents the feature points in the template image, Represents the feature points in the matching image, represents the weight, To describe the sub-dimension; The closer to the feature point, the greater the weight. The finally remaining paired key point descriptors need to satisfy that the Euclidean distance is less than the threshold; Fusion and stitching: Use the RANSAC method to solve and refine the transformation matrix, eliminate the wrong matching points, and then perform image fusion and stitching according to the calculated transformation matrix; The descriptor with adaptive dimension is determined by the defective feature points and the neighboring pixels. Assume that the number of pixels of the farthest point from the feature point to the neighboring pixels with a gray value of 0 is P. When P is greater than the threshold T1, the dimension remains unchanged and 16 seed points are generated; when T2 < P < T1, 8 seed points are generated and the dimension will be 64 dimensions; when 0 < P < T2, 4 seed points are generated and the dimension will be 32 dimensions. When feature points are matched, if the description dimensions of a pair of feature points in two adjacent images are different, then select the maximum value as the common dimension; Step S3: Record the quantity, use Mark the overlapping areas, where i represents the sub-image sequence, and m=1,2,3,4 represent the upper, right, lower, and left areas of sub-image i respectively. If the number of feature points in the overlapping area m is greater than the threshold T0, then ,otherwise ; Step S4: If the sub-image i satisfies , then sub-image i satisfies the four-bit relationship, that is, the overlapping areas of sub-image i and the upper, lower, left and right adjacent images have obvious defect features. Similarly, if , then the sub-image i satisfies the three-dimensional relationship if , then sub-image i satisfies the two-bit relationship. When stitching, the feature extraction and matching method is used to splice the sub-images with four-bit relationships first, followed by the sub-images that satisfy the three-bit and two-bit relationships. Finally, the two adjacent defect images with features are stitched together: the overlapping area where the two adjacent images are both 1 is solved and refined by the RANSAC method to calculate and refine the transformation matrix, remove the wrong matching points, and then perform image fusion and stitching according to the calculated transformation matrix; Step S5: The area where k(i,m)=0 is moved according to the relative position of the coordinates , , so that it coincides with the overlapping area of ​​the neighborhood, and then the overlapping area is merged and spliced; Step S6: Repeat steps S3 to S5 until all sub-images are stitched to obtain a panoramic image.

2. The method for step-by-step stitching of optical surface defect images based on adaptive feature extraction according to claim 1, characterized in that: In step S5, the fusion is divided into two cases. If there are no defective features in the overlapping area, take the average value of the corresponding pixels in the two overlapping areas; if there are defects in the overlapping area but the defects are too weak to extract enough effective feature points for matching, use the average value of the defect gradients for fusion; Assuming that the gray value of the starting position a of the defect area in the overlapping area is L1, and the gray value of the midpoint end position b of the farthest radial distance of the defect is L2, then the gray value of each pixel on the midline is can be re-expressed as: , in, is the gray value of the pixel along the ab direction, and M is the number of pixels along the ab direction; Then correct the gray value of each defective pixel in the cd direction perpendicular to the ab direction First, the pixel average value of the entire overlapping area is calculated. At this time, the grayscale of the pixel point on the midline ab is recorded as For each pixel point on ab, there is a vertical direction cd, and each pixel in the cd direction Corrected to: ) That is, the gradient mean fusion map of the entire defective area is obtained.

Citation Information

Patent Citations

  • Image stitching method based on overlapping region scale-invariant feather transform (SIFT) feature points

    CN102968777A

  • Image registration and multi-resolution fusion-based panoramic image splicing method

    CN108416732A