A magnetic circuit drop detection method and system to overcome the reflection of metal surface of relay

Through the binocular structured light vision system and the improved NCC algorithm, randomly distributed speckle images are generated for three-dimensional reconstruction, which solves the problem of data loss in surface measurement of high reflectivity objects and achieves high-precision three-dimensional reconstruction of metal surfaces and magnetic circuit drop. detection.

CN114332373BActive Publication Date: 2024-08-27HUAQIAO UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111639658.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2024-08-27
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

Traditional 3D measurement systems are difficult to accurately measure surfaces with high reflectivity, resulting in image pixel saturation and data loss. Existing structured light 3D scanning technology does not work well when metal surfaces are reflective.

Method used

A binocular structured light vision system is used to generate randomly distributed digital speckle images with adjustable size and density. Image matching is performed through an improved NCC algorithm. Three-dimensional point cloud reconstruction is performed based on camera calibration and triangulation principles, and the point cloud segmentation algorithm is used to obtain the image. Magnetic circuit drop.

Benefits of technology

It overcomes the influence of high-gloss shiny spots on the metal surface, achieves high-precision three-dimensional dynamic reconstruction and magnetic circuit plane segmentation, and ensures the accuracy of magnetic circuit drop detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114332373B
    Figure CN114332373B
Patent Text Reader

Abstract

The present invention discloses a magnetic circuit drop detection method and system that overcomes the reflection of the metal surface of the relay. Aiming at the problem that the local high-reflection area on the metal surface affects the detection, the speckle pattern is designed and adjusted to achieve accurate three-dimensional reconstruction of the speckle projection. The present invention first designs the parameters of the speckle image (including size and density), then uses the binocular stereo vision principle, adopts the improved NCC algorithm to achieve stereo matching and finally obtains the three-dimensional contour information of the relay under test, and then uses the random sampling consistency (RANSAC) combined with the Euclidean clustering algorithm to segment the point cloud, obtains the relay magnetic circuit drop plane, and performs evaluation, thereby overcoming the detection difficulty of the relay in the presence of reflective shiny points, and the result is accurate and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of three-dimensional reconstruction, and in particular to a magnetic circuit drop detection method and system for overcoming the reflection of metal surface of a relay. Background Art

[0002] The traditional projection three-dimensional precision measurement system has certain requirements for the optical properties of the surface of the object being measured. Since strong mirror reflection can easily cause pixel saturation captured by the camera, the surface of the object being measured is required to have sufficient diffuse reflection and no large-area mirror reflection. However, in the actual measurement process, the materials of the objects being measured are different, and their surfaces have different reflection characteristics, so the effect of the coded pattern projected onto the object is affected to varying degrees. Among them, the high reflectivity of the object surface causes image pixel saturation, which ultimately leads to the failure of the object's three-dimensional reconstruction results. Therefore, it is of great research significance and application value to study the surface three-dimensional morphology measurement of high-reflectivity objects and further improve the existing structured light three-dimensional scanning technology.

[0003] In addition, the three-dimensional digital speckle measurement method has now developed into a non-contact, full-field effective measurement method with low requirements for the measurement environment, high sensitivity, automated data processing, and a wide range of applications. It has become an important part of modern optical measurement; speckle-based structured light only requires a single image to achieve three-dimensional reconstruction, and is also one of the important dynamic measurement methods. Summary of the invention

[0004] In view of the above-mentioned problems such as metal reflection causing image saturation and resulting in data loss, the present invention proposes a magnetic circuit drop detection method and system that overcomes the reflection of the metal surface of the relay.

[0005] The present invention adopts the following technical solution:

[0006] On the one hand, a magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay includes the following steps:

[0007] S101, building a binocular structured light vision system including a left camera, a right camera and a projector, and obtaining the intrinsic and extrinsic parameters of the left and right cameras through camera calibration;

[0008] S102, generating a digital speckle image with adjustable coding size and density and random distribution;

[0009] S103, projecting the speckle image onto the surface of the relay to be tested by the projector, photographing the projected object by the left camera and the right camera to obtain left and right images, performing epipolar correction on the left and right images, and matching the corrected left and right images by using an improved NCC algorithm to obtain a parallax image;

[0010] S104, using the calibrated internal and external parameters of the camera and the parallax image to obtain depth information, calculate the three-dimensional data of the relay under test, and perform three-dimensional point cloud reconstruction;

[0011] S105, evaluating the magnetic circuit drop of the relay, performing denoising filtering on the three-dimensional point cloud, obtaining two-plane data of the magnetic circuit by point cloud segmentation, and obtaining the magnetic circuit drop result by using a distance formula.

[0012] Preferably, in S101, the method of obtaining the intrinsic and extrinsic parameters of the left and right cameras by camera calibration includes: using Zhang Zhengyou calibration method to obtain the intrinsic and extrinsic parameters of the left and right cameras using checkerboard markers.

[0013] Preferably, in S102, the method for generating a digital speckle image includes:

[0014] S1021, set an image of size h×w, and set the size of the square speckle to d×d;

[0015] S1022, from the speckle design conditions, the number of speckle spots can be obtained as u×v,

[0016]

[0017] Where floor represents the rounding function; u represents the number of horizontal speckles in the image; v represents the number of vertical speckles in the image;

[0018] S1023, construct a two-dimensional array index of size u×v, and set the corresponding serial number of each 3d×3d nine-grid window to 0-8; traverse the two-dimensional array, obtain the random serial number value of each window through the rand random function, and store the window serial number value that meets the judgment condition into the two-dimensional array index according to the design condition of the speckle; as follows:

[0019] index[i][j]=rand(9)

[0020]

[0021] S1024, converting the serial number value in the two-dimensional array into scattered spot coordinates (x, y), the conversion formula is as follows:

[0022]

[0023] The horizontal coordinate x of the speckle is the integer of the current serial number divided by 3, and the vertical coordinate y is the remainder of the current serial number divided by 3;

[0024] S1025, generating a final speckle image according to the set speckle size and speckle spot coordinates.

[0025] Preferably, in S103, the speckle image is projected onto the surface of the relay to be tested by the projector, the projected object is photographed by the left camera and the right camera to obtain left and right images, and epipolar correction is performed on the left and right images, specifically including:

[0026] The speckle image is projected onto the surface of the relay to be tested by the projector, and the projected object is photographed by the left camera and the right camera to obtain left and right initial images, and the initial images are subjected to epipolar correction. The corresponding epipolar lines of the corrected left and right images are horizontally aligned and are consistent with the row level of the image. At this time, the image matching can be converted into a two-dimensional image that is expanded only along the row direction of the image, and finally the corrected horizontally aligned left and right images are obtained.

[0027] Preferably, in S103, the corrected left and right images are matched using an improved NCC algorithm to obtain a parallax image, which specifically includes:

[0028] The intensity of the left and right images to be matched after correction is expressed as I L (x,y) and I R (x, y), obtain a non-negative disparity value d0 so that the following equation holds:

[0029] I L (x, y) = I R (x, y - d0)

[0030] Where (x, y) represents the pixel coordinates, and d0 represents the disparity value of the corresponding pixel match;

[0031] In order to solve the image matching problem in the framework based on local windows, a left image window of size N1×N2 is assumed, with its center located at the coordinate (x, y). The calculation formula of the normalized correlation coefficient NCC of the right image window corresponding to the disparity value d is defined as:

[0032]

[0033] in:

[0034] d∈(0,...,D)

[0035] I R =I R (x+j, y+j)

[0036]

[0037]

[0038] I L =I L (x+j,y+j+d)

[0039]

[0040] n∈(1,...,N1)

[0041] m∈(1,...,N2)

[0042] The expression of the normalized cross-correlation coefficient NCC is NCC(d), where d represents the disparity value, and its range is d∈(0, ..., D), and D is the maximum disparity range; R is the pixel value at position (x+j, y+j) in the right image window, and its range is (x, y) is the pixel coordinate of the center of the window; Represents the average value of all pixels in the right image window; I L is the pixel value at position (x+j, y+j+d) in the left image window, and its range is And d∈(0,...,D), represents the average value of all pixels in the left window; then d0 is an integer disparity, and the corresponding maximum correlation coefficient solution can be expressed as follows:

[0043]

[0044] In order to obtain a higher precision sub-pixel disparity, a continuous spatial parameter τ is introduced, and the sub-pixel disparity value can be expressed as:

[0045] d′(x,y)=d0(x,y)-τ(x,y)

[0046] Wherein, d′(x, y) represents the sub-pixel disparity value at the coordinate (x, y);

[0047] The expression of the continuous space parameter τ is:

[0048]

[0049]

[0050] Among them, the parameters is the correlation coefficient at disparity d0, represents the correlation coefficient when the disparity is d0-1; the parameter λ represents the norm ratio of adjacent windows when the disparity is d0 and d0-1 respectively; r represents the ratio of the correlation coefficients of the two windows; where, represents the value of each pixel in the right image window when the disparity is d0, It represents the value of each pixel in the window when the disparity is d0-1. and Represent the average values ​​of each pixel in the two windows respectively; the two parameters λ and r are used to represent the correlation between the two windows; according to the similarity relationship, the sub-pixel position between adjacent pixels can be determined by the formula.

[0051] Preferably, in S104, the depth information is obtained by using the calibrated internal and external parameters of the camera and the parallax image, the three-dimensional data of the relay under test is calculated, and the three-dimensional point cloud is reconstructed. The reconstruction formula is as follows:

[0052]

[0053] Where f represents the focal length of the camera after epipolar correction; [u L ,v L ] represents the pixel coordinates of the point on the left image, in pixels; (u0,v0) represents the coordinates of the pixel origin on the image, [x,y,z] represents the pixel coordinates [u L ,v L ] The three-dimensional coordinates of the point corresponding to the value are in mm; represents the image imaging center of the left camera, in pixels; B represents the baseline length between the left and right images, in mm; Indicates the imaging center of the right camera, in pixels.

[0054] Preferably, the S105 specifically includes:

[0055] Perform denoising filtering on the point cloud obtained by 3D reconstruction;

[0056] The point cloud segmentation is performed using a random sampling consistency algorithm to obtain the magnetic circuit plane where the armature and yoke of the metal surface of the relay to be measured are located;

[0057] Since the point cloud data of the two planes are close, the fitted planes are approximate. Then the Euclidean clustering segmentation algorithm is used to separate the point cloud data of the armature and yoke planes respectively. The armature plane equation is fitted and substituted into the point cloud of the yoke plane to obtain the normal distance through the point-to-plane distance formula, and the magnetic circuit drop is obtained.

[0058] On the other hand, a magnetic circuit drop detection system for overcoming the reflection of the metal surface of the relay includes:

[0059] Binocular vision system building module, used to build a binocular structured light vision system including a left camera, a right camera and a projector, and obtain the intrinsic and extrinsic parameters of the left and right cameras through camera calibration;

[0060] A speckle projection module, used for generating a digital speckle image with adjustable coding size and density and random distribution;

[0061] A data acquisition module projects the speckle image onto the surface of the relay under test through a projector, photographs it through left and right cameras to obtain left and right images, and performs polar line correction;

[0062] The image matching module uses the improved NCC algorithm to match the corrected image to obtain a disparity image;

[0063] The 3D reconstruction module is used to restore the depth information from the intrinsic and extrinsic parameters obtained by camera calibration and parallax, and reconstruct the 3D point cloud based on the triangulation principle;

[0064] A point cloud processing module is used to denoise the obtained three-dimensional point cloud, and then use a random consensus algorithm and a Euclidean clustering segmentation algorithm to perform point cloud segmentation and separation to obtain point cloud data of the armature and yoke planes;

[0065] The drop calculation module is used to obtain the drop result by substituting the yoke point cloud into the plane equation obtained by armature fitting through the point-to-surface distance calculation formula for the obtained armature and yoke magnetic circuit drop point cloud data.

[0066] The beneficial effects of the present invention are as follows:

[0067] The present invention generates a speckle image with controllable density and high recognition by presetting the speckle distribution conditions, and can offset the highlight points on the metal surface by changing the projected speckle size; an improved NCC algorithm is used to improve the accuracy of image matching, and only a single speckle pattern needs to be projected to achieve accurate three-dimensional dynamic reconstruction; in addition, the binocular speckle structured light system of the present invention can overcome the highlight points on the metal surface of the relay, establish a dense point cloud, and realize the segmentation of the magnetic circuit plane, thereby completing the detection of the drop.

[0068] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments, but the magnetic circuit drop detection method and system for overcoming the reflection of the metal surface of the relay of the present invention are not limited to the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0070] Figure 1 is a flow chart of a method according to an embodiment of the present invention;

[0071] Figure 2 Schematic diagram of the structure of a binocular structured light vision system according to an embodiment of the present invention;

[0072] Figure 3 A schematic diagram of a binocular structured light vision system actually constructed according to an embodiment of the present invention;

[0073] Figure 4 A schematic diagram of a relay under test according to an embodiment of the present invention;

[0074] Figure 5 Schematic diagram of the reflective area on the metal surface of a relay according to an embodiment of the present invention;

[0075] Figure 6 A schematic diagram of a speckle pattern generated by an embodiment of the present invention;

[0076] Figure 7 A schematic diagram of a three-dimensional reconstruction of a relay is completed for an embodiment of the present invention;

[0077] Figure 8 The data schematic diagram of the magnetic circuit plane after point cloud segmentation is realized in an embodiment of the present invention; wherein (a) is a schematic diagram of the armature surface; (b) is a schematic diagram of the armature yoke surface;

[0078] Fig. 9 The structure block diagram of the magnetic circuit drop detection system for overcoming the reflection of the metal surface of the relay according to an embodiment of the present invention. DETAILED DESCRIPTION

[0079] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0080] See also Figure 1 As shown, the present invention provides a magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay, comprising the following steps:

[0081] S101, building a binocular structured light vision system including a left camera, a right camera and a projector, and obtaining the intrinsic and extrinsic parameters of the left and right cameras through camera calibration;

[0082] S102, generating a digital speckle image with adjustable coding size and density and random distribution;

[0083] S103, projecting the speckle image onto the surface of the relay to be tested by the projector, photographing the projected object by the left camera and the right camera to obtain left and right images, performing epipolar correction on the left and right images, and matching the corrected left and right images by using an improved NCC algorithm to obtain a parallax image;

[0084] S104, using the calibrated internal and external parameters of the camera and the parallax image to obtain depth information, calculate the three-dimensional data of the relay under test, and perform three-dimensional point cloud reconstruction;

[0085] S105, evaluating the magnetic circuit drop of the relay, performing denoising filtering on the three-dimensional point cloud, obtaining two-plane data of the magnetic circuit by point cloud segmentation, and obtaining the magnetic circuit drop result by using a distance formula.

[0086] For details, see Figures 2 to 4 As shown, a binocular structured light vision system is constructed, which includes a left camera 201, a projector 202 and a right camera 203, and also includes a stage 205 for placing a relay 204 to be tested.

[0087] Further in S101, the method of obtaining the internal and external parameters of the left and right cameras by camera calibration includes: using Zhang Zhengyou calibration method to obtain the internal and external parameters of the left and right cameras using chessboard markers.

[0088] In step S102, the size relationship between the shiny spots on the metal surface of the relay and the actual projected spots is the key to the speckle projection to overcome the reflection effect of the shiny spots and complete the three-dimensional measurement. In order to make the generated digital speckle image unique, it is guaranteed by generating scattered spots at random positions. At the same time, in order to overcome the influence of the shiny spots on the metal surface, it is necessary to adjust the size and density of the generated scattered spots according to the actual size of the shiny spots. When the speckle size is adjusted appropriately, this method can better overcome the three-dimensional measurement in the presence of shiny spots. In order to make the speckle have the characteristics of uniqueness, controllability of size and density, and strong contrast, the design of the digital speckle image specifically meets the following conditions:

[0089] (1) The speckle pattern is composed of white dots distributed on a black background, and the pixels of each white dot can be adjusted to n×n;

[0090] (2) There is only one white pixel in a window consisting of every nine pixels;

[0091] (3) Any two white points are not adjacent, and there are no other white points in the eight-neighborhood of any white point.

[0092] Specifically, in S102, the method for generating a digital speckle image includes:

[0093] S1021, set an image of size h×w, and set the size of the square speckle to d×d;

[0094] S1022, from the speckle design conditions, the number of speckle spots can be obtained as u×v,

[0095]

[0096] Where floor represents the rounding function; u represents the number of horizontal speckles in the image; v represents the number of vertical speckles in the image;

[0097] S1023, construct a two-dimensional array index of size u×v, and set the corresponding serial number of each 3d×3d nine-grid window to 0-8; traverse the two-dimensional array, obtain the random serial number value of each window through the rand random function, and store the window serial number value that meets the judgment condition into the two-dimensional array index according to the design condition of the speckle; as follows:

[0098] index[i][j]=rand (9)

[0099]

[0100] S1024, converting the serial number value in the two-dimensional array into scattered spot coordinates (x, y), the conversion formula is as follows:

[0101]

[0102] The horizontal coordinate x of the speckle is the integer of the current serial number divided by 3, and the vertical coordinate y is the remainder of the current serial number divided by 3;

[0103] S1025, generating a final speckle image according to the set speckle size d and the speckle coordinates (x, y). According to the influence of the size of the highlight points on the metal surface, the density and speckle size of the generated random speckle image are adjusted accordingly, and the setting angles of the left and right cameras are appropriately adjusted to avoid large-area reflections during the imaging process.

[0104] See Figure 5, which is a schematic diagram of the reflective area on the metal surface of the relay according to an embodiment of the present invention; Figure 6 , which is a schematic diagram of a speckle pattern generated by this embodiment of the present invention.

[0105] In S103, the speckle image is projected onto the surface of the relay to be tested by the projector, the projected object is photographed by the left camera and the right camera to obtain left and right images, and epipolar correction is performed on the left and right images, specifically including:

[0106] The speckle image is projected onto the surface of the relay to be tested by the projector, and the projected object is photographed by the left camera and the right camera to obtain left and right initial images, and the initial images are subjected to epipolar correction. The corresponding epipolar lines of the corrected left and right images are horizontally aligned and are consistent with the row level of the image. At this time, the image matching can be converted into a two-dimensional image that is expanded only along the row direction of the image, and finally the corrected horizontally aligned left and right images are obtained.

[0107] Furthermore, in S103, the corrected left and right images are matched using an improved NCC algorithm to obtain a disparity image, which specifically includes:

[0108] The intensity of the left and right images to be matched after correction is expressed as IL (x,y) and I R (x, y), obtain a non-negative disparity value d0 so that the following equation holds:

[0109] I L (x,y)=I R (x,y-d0)

[0110] Where (x, y) represents the pixel coordinates, and d0 represents the disparity value of the corresponding pixel match.

[0111] In order to solve the image matching problem in the framework based on local windows, a left image window of size N1×N2 is assumed, with its center located at the coordinate (x, y). The calculation formula of the normalized cross correlation coefficient (NCC) of the right image window corresponding to the disparity value of the window is defined as:

[0112]

[0113] in:

[0114] d∈(0,…,D)

[0115] I R =I R (x+j, y+j)

[0116]

[0117]

[0118] I L =I L (x+j,y+j+d)

[0119]

[0120] n∈(1,...,N1)

[0121] m∈(1,...,N2)

[0122] The expression of the normalized cross correlation coefficient (NCC) is NCC(d), where d represents the disparity value, and its range is d∈(0,…,D), and D is the maximum disparity range; R is the pixel value at position (x+j,y+j) in the right image window, and its range is (x,y) is the pixel coordinate of the center of the window; Represents the average value of all pixels in the right image window; I Lis the pixel value at position (x+j,y+j+d) in the left image window, and its range is And d∈(0,…,D), represents the average value of all pixels in the left window; then d0 is an integer disparity, and the corresponding maximum correlation coefficient solution can be expressed as follows:

[0123]

[0124] In order to obtain a higher precision sub-pixel disparity, a continuous spatial parameter τ is introduced, and the sub-pixel disparity value can be expressed as:

[0125] d'(x,y)=d0(x,y)-τ(x,y)

[0126] Where d′(x,y) represents the sub-pixel disparity value at the coordinate (x,y);

[0127] The expression of the continuous space parameter τ is:

[0128]

[0129]

[0130] Among them, the parameters is the correlation coefficient at disparity d0, represents the correlation coefficient when the disparity is d0-1; the parameter λ represents the norm ratio of adjacent windows when the disparity is d0 and d0-1 respectively; r represents the ratio of the correlation coefficients of the two windows; where, represents the value of each pixel in the right image window when the disparity is d0, It represents the value of each pixel in the window when the disparity is d0-1. and Represent the average values ​​of each pixel in the two windows respectively; the two parameters λ and r are used to represent the correlation between the two windows; according to the similarity relationship, the sub-pixel position between adjacent pixels can be determined by the formula.

[0131] Specifically, in S104, the depth information is obtained by using the calibrated internal and external parameters of the camera and the parallax image, the three-dimensional data of the relay under test is calculated, and the three-dimensional point cloud is reconstructed. The reconstruction formula is as follows:

[0132]

[0133] Where, represents the focal length of the camera after epipolar correction; [u L ,v L ] represents the pixel coordinates of the point on the left image, in pixels; (u0,v0) represents the coordinates of the pixel origin on the image, [x,y,z] represents the pixel coordinates [u L,v L ] The three-dimensional coordinates of the point corresponding to the value are in mm; represents the image imaging center of the left camera, in pixels; B represents the baseline length between the left and right images, in mm; Indicates the imaging center of the right camera, in pixels.

[0134] See also Figure 7 Shown is a schematic diagram of the three-dimensional reconstruction of the relay completed in the embodiment.

[0135] Specifically, the S105 includes:

[0136] Perform denoising filtering on the point cloud obtained by 3D reconstruction;

[0137] The random sampling consensus algorithm (RANSAC) is used to segment the point cloud to obtain the magnetic circuit plane where the armature and yoke of the metal surface of the relay to be measured are located;

[0138] Since the point cloud data of the two planes are close, the fitted planes are approximate. Then the Euclidean clustering segmentation algorithm is used to separate the point cloud data of the armature and yoke planes respectively. The armature plane equation is fitted and substituted into the point cloud of the yoke plane to obtain the normal distance through the point-to-plane distance formula, and the magnetic circuit drop is obtained.

[0139] See also Figure 8 , which is a data schematic diagram of the magnetic circuit plane after point cloud segmentation according to an embodiment of the present invention.

[0140] See also Fig. 9 As shown, the present invention provides a magnetic circuit drop detection system for overcoming the reflection of the metal surface of the relay, comprising:

[0141] A binocular vision system building module 901 is used to build a binocular structured light vision system including a left camera, a right camera and a projector, and obtain the intrinsic and extrinsic parameters of the left and right cameras through camera calibration;

[0142] A speckle projection module 902 is used to generate a digital speckle image with adjustable coding size and density and random distribution;

[0143] The data acquisition module 903 projects the speckle image onto the surface of the relay under test through a projector, photographs it through left and right cameras to obtain left and right images, and performs polar line correction;

[0144] An image matching module 904 matches the corrected image using an improved NCC algorithm to obtain a parallax image;

[0145] The 3D reconstruction module 905 is used to restore the depth information from the intrinsic parameters and extrinsic parameters obtained by camera calibration and the parallax, and reconstruct the 3D point cloud according to the triangulation principle;

[0146] The point cloud processing module 906 is used to denoise the obtained three-dimensional point cloud, and then use the random consensus algorithm and the Euclidean clustering segmentation algorithm to segment and separate the point cloud to obtain the point cloud data of the armature and yoke planes;

[0147] The drop calculation module 907 is used to obtain the drop result by substituting the yoke point cloud into the plane equation obtained by armature fitting through the point-to-plane distance calculation formula for the obtained armature and yoke magnetic circuit drop point cloud data.

[0148] Specific implementation of a magnetic circuit drop detection system for overcoming the reflection of the metal surface of a relay. The same magnetic circuit drop detection method for overcoming the reflection of the metal surface of a relay will not be repeated in this embodiment.

[0149] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A magnetic circuit drop detection method for overcoming the reflection of the metal surface of a relay, characterized in that: The steps include: S101, building a binocular structured light vision system including a left camera, a right camera and a projector, and obtaining the intrinsic and extrinsic parameters of the left and right cameras through camera calibration; S102, generating a digital speckle image with adjustable coding size and density and random distribution; S103, projecting the speckle image onto the surface of the relay to be tested by the projector, photographing the projected object by the left camera and the right camera to obtain left and right images, performing epipolar correction on the left and right images, and matching the corrected left and right images by using an improved NCC algorithm to obtain a parallax image; S104, using the calibrated internal and external parameters of the camera and the parallax image to obtain depth information, calculate the three-dimensional data of the relay under test, and perform three-dimensional point cloud reconstruction; S105, evaluating the magnetic circuit drop of the relay, performing denoising filtering on the three-dimensional point cloud, obtaining two-plane data of the magnetic circuit by point cloud segmentation, and obtaining the magnetic circuit drop result by using a distance formula; In S102, the method for generating a digital speckle image includes: S1021, set an image of size h×w, and set the size of the square speckle to d×d; S1022, from the speckle design conditions, the number of speckles can be obtained as u×v, Where floor represents the rounding function; u represents the number of horizontal speckles in the image; v represents the number of vertical speckles in the image; S1023, construct a two-dimensional array index of size u×v, and set the corresponding serial number of each 3d×3d nine-grid window to 0-8; traverse the two-dimensional array, obtain the random serial number value of each window through the rand random function, and store the window serial number value that meets the judgment condition into the two-dimensional array index according to the design condition of the speckle; as follows: index[i][j]=rand(9) S1024, converting the serial number value in the two-dimensional array into scattered spot coordinates (x, y), the conversion formula is as follows: The horizontal coordinate x of the speckle is the integer of the current serial number divided by 3, and the vertical coordinate y is the remainder of the current serial number divided by 3; S1025, generating a final speckle image according to the set speckle size and speckle spot coordinates.

2. The magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay as claimed in claim 1 is characterized in that: In S101, the method of obtaining the intrinsic parameters and extrinsic parameters of the left and right cameras by camera calibration includes: using the Zhang Zhengyou calibration method to obtain the intrinsic and extrinsic parameters of the left and right cameras using a chessboard marker.

3. The magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay as claimed in claim 1 is characterized in that: In S103, the speckle image is projected onto the surface of the relay to be tested by the projector, the projected object is photographed by the left camera and the right camera to obtain left and right images, and epipolar correction is performed on the left and right images, specifically including: The speckle image is projected onto the surface of the relay to be tested by the projector, and the projected object is photographed by the left camera and the right camera to obtain left and right initial images, and the initial images are subjected to epipolar correction. The corresponding epipolar lines of the corrected left and right images are horizontally aligned and are consistent with the row level of the image. At this time, the image matching can be converted into a two-dimensional image that is expanded only along the row direction of the image, and finally the corrected horizontally aligned left and right images are obtained.

4. The magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay as claimed in claim 1 is characterized in that: In S103, the corrected left and right images are matched using an improved NCC algorithm to obtain a disparity image, which specifically includes: The intensity of the left and right images to be matched after correction is expressed as I L (x,y) and I R (x, y), obtain a non-negative disparity value d0 so that the following equation holds: I L (x,y)=I R (x,y-d0) Where (x, y) represents the pixel coordinates, and d0 represents the disparity value of the corresponding pixel match; In order to solve the image matching problem in the framework based on local windows, a left image window of size N1×N2 is assumed, with its center located at the coordinate (x, y). The calculation formula of the normalized correlation coefficient NCC of the right image window corresponding to the disparity value d of the window is defined as: in: d∈(0,…,D) I R =I R (x+j,y+j) I L =I L (x+j,y+j+d) n∈(1,…,N1) m∈(1,…,N2) The expression of the normalized cross-correlation coefficient NCC is NCC(d), where d represents the disparity value, and its range is d∈(0,…,D), and D is the maximum disparity range; R is the pixel value at position (x+j,y+j) in the right image window, and its range is (x,y) is the pixel coordinate of the center of the window; Represents the average value of all pixels in the right image window; I L is the pixel value at position (x+j,y+j+d) in the left image window, and its range is And d∈(0,…,D), represents the average value of all pixels in the left window; then d0 is an integer disparity, and the corresponding maximum correlation coefficient solution can be expressed as follows: In order to obtain a higher precision sub-pixel disparity, a continuous spatial parameter τ is introduced, and the sub-pixel disparity value can be expressed as: d'(x, y) = d0(x, y) - τ(x, y) Where d′(x,y) represents the sub-pixel disparity value at the coordinate (x,y); The expression of the continuous space parameter τ is: Among them, the parameters is the correlation coefficient at disparity d0, represents the correlation coefficient when the disparity is d0-1; the parameter λ represents the norm ratio of adjacent windows when the disparity is d0 and d0-1 respectively; r represents the ratio of the correlation coefficients of the two windows; where, represents the value of each pixel in the right image window when the disparity is d0, It represents the value of each pixel in the window when the disparity is d0-1. and Represent the average values ​​of each pixel in the two windows respectively; the two parameters λ and r are used to represent the correlation between the two windows; according to the similarity relationship, the sub-pixel position between adjacent pixels can be determined by the formula.

5. The magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay as claimed in claim 1 is characterized in that: In S104, the depth information is obtained by using the calibrated internal and external parameters of the camera and the parallax image, the three-dimensional data of the relay under test is calculated, and the three-dimensional point cloud is reconstructed. The reconstruction formula is as follows: Where f represents the focal length of the camera after epipolar correction; [u L ,v L ] represents the pixel coordinates of the point on the left image, in pixels; (u0,v0) represents the coordinates of the pixel origin on the image, [x,y,z] represents the pixel coordinates [u L ,v L ] The three-dimensional coordinates of the point corresponding to the value are in mm; represents the image imaging center of the left camera, in pixels; B represents the baseline length between the left and right images, in mm; Indicates the imaging center of the right camera, in pixels.

6. The magnetic circuit drop detection method for overcoming the reflection of the metal surface of the relay as claimed in claim 1, characterized in that: The S105 specifically includes: Perform denoising filtering on the point cloud obtained by 3D reconstruction; The point cloud segmentation is performed using a random sampling consistency algorithm to obtain the magnetic circuit plane where the armature and yoke of the metal surface of the relay to be measured are located; Since the point cloud data of the two planes are close, the fitted planes are approximate. Then the Euclidean clustering segmentation algorithm is used to separate the point cloud data of the armature and yoke planes respectively. The armature plane equation is fitted and substituted into the point cloud of the yoke plane to obtain the normal distance through the point-to-plane distance formula, and the magnetic circuit drop is obtained.

7. A magnetic circuit drop detection system that overcomes the reflection of the metal surface of the relay, characterized in that: include: Binocular vision system building module, used to build a binocular structured light vision system including a left camera, a right camera and a projector, and obtain the intrinsic and extrinsic parameters of the left and right cameras through camera calibration; A speckle projection module, used for generating a digital speckle image with adjustable coding size and density and random distribution; A data acquisition module projects the speckle image onto the surface of the relay under test through a projector, photographs it through left and right cameras, obtains left and right images, and performs polar line correction; The image matching module uses the improved NCC algorithm to match the corrected image to obtain a disparity image; The 3D reconstruction module is used to restore the depth information from the intrinsic and extrinsic parameters obtained by camera calibration and parallax, and reconstruct the 3D point cloud based on the triangulation principle; A point cloud processing module is used to denoise the obtained three-dimensional point cloud, and then use a random consensus algorithm and a Euclidean clustering segmentation algorithm to perform point cloud segmentation and separation to obtain point cloud data of the armature and yoke planes; The drop calculation module is used to obtain the drop result by using the point-to-surface distance calculation formula for the obtained armature and yoke magnetic circuit drop point cloud data and substituting the yoke point cloud into the plane equation obtained by armature fitting; The method for generating a digital speckle image includes: Set an image of size h×w and set the square speckle size to d×d; From the speckle design conditions, the number of speckles can be obtained as u×v, Where floor represents the rounding function; u represents the number of horizontal speckles in the image; v represents the number of vertical speckles in the image; Construct a two-dimensional array index of size u×v, and set the corresponding serial number of each 3d×3d nine-grid window to 0-8; traverse the two-dimensional array, obtain the random serial number value of each window through the rand random function, and store the window serial number value that meets the judgment condition in the two-dimensional array index according to the design conditions of the speckle; as follows: index[i][j]=rand(9) Convert the serial number value in the two-dimensional array to the scattered spot coordinates (x, y). The conversion formula is as follows: The horizontal coordinate x of the speckle is the integer of the current serial number divided by 3, and the vertical coordinate y is the remainder of the current serial number divided by 3; The final speckle image is generated according to the set speckle size and speckle coordinates.