Method, device and sensor for detecting a positional offset
By screening target edges, sampling light intensity information, constructing gradient sequences, and calculating the centroid in a through-beam polarization correction sensor, and combining this with a diffraction compensation model, the problem of low sensor detection accuracy was solved, achieving higher accuracy and more stable position offset detection.
Patent Information
- Application Number
- CN202511244300.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-09-02
AI Technical Summary
Existing through-beam correction sensors are susceptible to signal noise and material surface characteristics when detecting edge position deviations of the object being measured, resulting in insufficient detection accuracy and a tendency to misjudge or unstable detection.
By acquiring the image information of the object under test detected by the sensor, the target edge is screened, the light intensity information of the pixel is sampled along the normal direction of the target edge, a positive discrete gradient sequence is constructed, the discrete centroid weight sequence is calculated to determine the continuous centroid, the compensation value is calculated by combining the diffraction compensation model, and the displacement offset is compensated to determine the position offset.
It improves the measurement accuracy and stability of position offset, thereby enhancing the accuracy and reliability of detection.
Smart Images

Figure CN120765729B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of position offset detection, and particularly relates to a position offset detection method, device and sensor. BACKGROUND
[0002] The deviation correction sensor detects the position offset of the edge of the measured object through laser technology. When the measured object deviates, the deviation correction sensor detects the change of the edge position and sends a signal to the control system. The deviation correction sensor is a device for detecting and correcting the position offset of the measured object (such as paper, film, metal strip, etc.) on the production line. The existing against type deviation correction sensor still has some deficiencies in one-dimensional linear image signal processing. For example, when processing the one-dimensional linear image signal obtained by the sensor, due to the influence of signal noise and material surface characteristics (such as reflection, uneven transparency, etc.), the detection accuracy of the position offset of the edge of the measured object is not high enough, and misjudgment or unstable detection may occur. SUMMARY
[0003] Therefore, the embodiments of the present application provide a position offset detection method, device and sensor, which can improve the measurement accuracy of the offset.
[0004] In a first aspect, the embodiments of the present application provide a position offset detection method, comprising:
[0005] Obtaining image information of a measured object detected by a sensor, and screening a target edge based on the image information;
[0006] Sampling light intensity information of a pixel point on the target edge along a normal direction of the target edge to obtain light intensity information of a sampling point;
[0007] Constructing a forward discrete gradient sequence based on the light intensity information of the sampling point;
[0008] Calculating a discrete centroid weight sequence based on the gradient sequence, and determining a continuous centroid based on the discrete centroid weight sequence;
[0009] Determining a displacement offset of the target edge based on the continuous centroid;
[0010] Obtaining a distance between a receiver of the sensor and the measured object, and calculating a compensation value based on the distance and a diffraction compensation model;
[0011] Compensating the displacement offset based on the compensation value to determine the position offset of the measured object.
[0012] In some embodiments, the determination of the displacement offset of the target edge based on the continuous centroid comprises:
[0013] The first position of the centroid of the target edge is determined based on the continuous centroids;
[0014] Obtain the second position of the centroid of the target edge, wherein the second position is determined based on the image information of the previous frame of the object under test;
[0015] The centroid offset is determined based on the first position and the second position;
[0016] The displacement offset of the target edge is obtained by multiplying the continuous centroid offset by the pixel size of the sensor.
[0017] In some embodiments, determining the displacement offset of the target edge based on the continuous centroid includes:
[0018] Obtain a pre-calibrated fitting formula, wherein the fitting formula includes: the calculated relationship between displacement and continuous centroid;
[0019] The displacement of the target edge is calculated by inputting the continuous centroid into the fitting formula;
[0020] The displacement offset of the target edge is obtained based on the displacement of the target edge and the reference displacement corresponding to the continuous centroid.
[0021] In some embodiments, the method further includes:
[0022] The sample to be tested is controlled to move at equal intervals, and the image information corresponding to each reference displacement and the actual displacement of the sample to be tested are detected during the equal interval movement.
[0023] The continuous centroid of the target edge at each reference displacement is determined based on the image information corresponding to each reference displacement.
[0024] The fitting formula is obtained by fitting the continuous centroid and the actual displacement corresponding to each reference displacement.
[0025] In some embodiments, filtering target edges based on the image information includes:
[0026] The light intensity information of each pixel is determined based on the image information;
[0027] Obtain the deviation between each light intensity information and the light intensity threshold;
[0028] The pixel with the smallest deviation is identified as the target pixel.
[0029] Sampling is performed within a preset range from the target pixel to obtain multiple target pixels;
[0030] The target edge is determined based on multiple target pixels.
[0031] In some embodiments, the determining the target edge based on the plurality of target pixel points comprises:
[0032] determining an initial edge based on the plurality of target pixel points;
[0033] obtaining a measurement requirement of a user;
[0034] filtering the target edge from the initial edge based on the measurement requirement.
[0035] In some embodiments, the constructing the forward discrete gradient sequence based on the light intensity information of the sampling points comprises:
[0036] calculating a gradient between the sampling points based on the light intensity information of the sampling points;
[0037] obtaining the forward discrete gradient sequence based on the gradient between the sampling points.
[0038] In some embodiments, the calculating the discrete centroid weight sequence based on the gradient sequence and determining the continuous centroid based on the discrete centroid weight sequence comprises:
[0039] multiplying the coordinates of the sampling points and the corresponding gradients to obtain a discrete centroid weight, so as to obtain the discrete centroid weight sequence;
[0040] summing the discrete centroid weights in the discrete centroid weight sequence to obtain a first summation result;
[0041] summing the gradients to obtain a second summation result;
[0042] dividing the first summation result by the second summation result to obtain the continuous centroid.
[0043] obtaining a discrete centroid sequence based on the corresponding discrete centroids of each layer;
[0044] performing interpolation processing on the discrete centroid sequence to obtain the continuous centroid.
[0045] In a second aspect, an embodiment of the present application provides a position offset detection device, comprising:
[0046] an acquisition module, configured to acquire image information of a to-be-measured object detected by a sensor, and filter a target edge based on the image information;
[0047] a sampling module, configured to sample light intensity information of pixel points on the target edge in a normal direction of the target edge to obtain light intensity information of sampling points;
[0048] a construction module, configured to construct a forward discrete gradient sequence based on the light intensity information of the sampling points;
[0049] The first calculation module is configured to calculate a discrete centroid weight sequence based on the gradient sequence, determine a continuous centroid based on the discrete centroid weight sequence;
[0050] The determination module is configured to determine a displacement offset of the target edge based on the continuous centroid;
[0051] The second calculation module is configured to obtain a distance between a receiver of the sensor and the object to be measured, and calculate a compensation value based on the distance and a diffraction compensation model;
[0052] The compensation module is configured to compensate the displacement offset based on the compensation value to determine a position offset of the object to be measured.
[0053] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method of any of the above aspects when executing the computer program.
[0054] In a fourth aspect, a sensor is provided, which includes the electronic device of the third aspect.
[0055] In a fifth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executable on a processor to implement the method of any of the above aspects.
[0056] In a sixth aspect, a computer program product is provided, which, when executed on a terminal device, causes a sensor to implement the method of any of the above aspects.
[0057] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0058] The method for detecting a position offset provided by the embodiments of the present application can obtain image information of an object to be measured detected by a sensor, filter a target edge based on the image information, sample light intensity information of pixel points on the target edge along a normal direction of the target edge to obtain light intensity information of sampling points, construct a forward discrete gradient sequence based on the light intensity information of the sampling points, calculate a discrete centroid weight sequence based on the gradient sequence, determine a continuous centroid based on the discrete centroid weight sequence, determine a displacement offset of the target edge based on the continuous centroid, obtain a distance between a receiver of the sensor and the object to be measured, calculate a compensation value based on the distance and a diffraction compensation model, and compensate the displacement offset based on the compensation value to determine a position offset of the object to be measured, thereby improving the measurement accuracy of the position offset and the stability of the measurement. BRIEF DESCRIPTION OF DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0060] Figure 1 A structural schematic diagram of a sensor is provided for the embodiments of the present application.
[0061] Figure 2 A schematic diagram of position offset detection is provided for the embodiments of the present application.
[0062] Figure 3 An implementation flow schematic diagram of a position offset detection method is provided for the embodiments of the present application.
[0063] Figure 4 An implementation flow schematic diagram of another position offset detection method is provided for the embodiments of the present application.
[0064] Figure 5 A structural schematic diagram of a position offset detection device is provided for the embodiments of the present application.
[0065] Figure 6 A structural schematic diagram of a sensor is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0066] In the following description, specific details are set forth in order to provide a thorough understanding of the embodiments of the present application. However, persons skilled in the art will understand that the present application can be practiced without these specific details. In other instances, well-known structures, devices, circuits, and methods have not been described in detail in order to avoid obscuring the present application.
[0067] It should be understood that, when used in the specification and the appended claims of the present application, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0068] It should also be understood that the term "and / or" used in the specification and the appended claims of the present application means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0069] As used in this application and the appended claims, the term “if’ can be construed to mean “when” or “once” or “in response to a determination” or “in response to the occurrence of” depending on the context. Similarly, the phrase “if it is determined” or “if [a stated determination] is made” can be construed to mean “once it is determined” or “in response to the determination,” or “once [the stated determination] is made,” or “in response to the making of [the stated determination]” depending on the context.
[0070] In addition, in the description of the present application and the appended claims, the terms “first”, “second”, “third”, etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0071] In the present application, the reference “one embodiment” or “some embodiments” and the like means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the present application. Therefore, the statements “in one embodiment”, “in some embodiments”, “in other some embodiments”, “in further some embodiments” and the like appearing in different places in the specification are not necessarily all referring to the same embodiment, but mean “one or more but not all embodiments”, unless otherwise specifically emphasized.
[0072] Based on the problems in the related art, the present application provides a position offset detection method which can be applied to a sensor, Figure 1 For the embodiments of the present application, a schematic diagram of the structure of a sensor is provided, as shown in Figure 1 The sensor is a pair of shooting type deviation correction sensor. The sensor includes a receiving end device and a transmitting end device. The transmitting end main system of the transmitting end device operates based on system parameters. The transmitting end main system controls the laser drive through laser parameter control, so as to emit parallel light through the transmitting end. The transmitting end device also detects the laser drive through system hardware, so as to adjust the laser parameter control of the laser drive. The receiving end system of the receiving end device operates based on system parameters. The receiving end system controls the receiving end to perform image data acquisition through exposure parameter, determines the target edge based on the image data, determines the continuous mass center based on the target edge, determines the displacement offset based on the continuous mass center, and determines the position offset of the measured object based on the displacement offset.
[0073] In the embodiments of the present application, the receiving end device and the transmitting end device communicate through a controller protocol. The receiving end device can communicate with other devices through other communication protocols. Figure 2 For the embodiments of the present application, a schematic diagram of position offset detection is provided, as shown in Figure 2 The measured object is arranged between the receiving end and the transmitting end. The reflecting end emits parallel light, and the receiving end acquires data to obtain image information. Figure 3 For the embodiments of the present application, an implementation flowchart of a position offset detection method is provided, as shown inFigure 3 As shown, the position offset detection method comprises:
[0074] In step S101, image information of the object to be detected is acquired by a sensor, and a target edge is selected based on the image information.
[0075] In the embodiments of the present application, the object to be detected refers to an object that needs to be detected for position offset, such as paper in the printing industry, cloth in the textile industry, and chips in the electronic manufacturing field. The image information refers to image data of the object to be detected acquired by a receiving end, which contains information such as appearance features, color, and light intensity of the object to be detected. The target edge refers to an edge region that needs to be detected and analyzed in focus, which is selected from the image information of the object to be detected.
[0076] In the embodiments of the present application, the image information of the object to be detected can be acquired by a receiving end. The target edge can be obtained by using an edge detection algorithm based on the image information. In some embodiments, the target edge can be automatically selected from the image information based on the needs of a user. The target edge is selected to focus on the edge region that is significant for the detection of position offset and to exclude irrelevant interference.
[0077] In step S102, light intensity information of a pixel point on the target edge is sampled along a normal direction of the target edge, and light intensity information of a sampling point is obtained.
[0078] In the embodiments of the present application, the normal direction refers to a direction perpendicular to a tangent direction of the target edge curve at the point. In optical detection, sampling light intensity along the normal direction can more accurately capture the change of light intensity near the edge. When sampling the light intensity information of the pixel point, a plurality of sampling points are selected at a certain interval, and the light intensity information of each sampling point is acquired.
[0079] In the embodiments of the present application, for discrete edge points, a differential method can be used to approximately calculate the tangent direction, and then the normal direction is obtained by finding the perpendicular line. A plurality of sampling points are selected at a certain interval along the determined normal direction. The light intensity information of each sampling point is acquired in sequence. The size of the sampling interval affects the precision and calculation amount of sampling. The smaller the interval, the more precise the sampling, but the larger the calculation amount.
[0080] In the embodiments of the present application, if the target edge is an irregular curve composed of discrete pixel points, a local linear approximation method can be used. For each pixel point on the edge, consider the pixel points in a certain neighborhood around it, and fit a straight line through the least square method. The normal direction of the straight line can be used as the normal direction of the pixel point. If the edge can be represented by a continuous function, for example, the edge curve equation obtained by the edge detection algorithm is y = f(x), for the point (x0, y0) on the curve, the slope of the tangent line k = f'(x0), then the normal slope kn = -k1 (when k is not 0), and then the normal direction vector can be determined.
[0081] Each sampling point has its corresponding light intensity value, which will be used for subsequent gradient calculation.
[0082] In the embodiments of the present application, the sampling interval d can be pre-set according to actual application requirements and the resolution of the image. For example, in the case of high image resolution and the need for accurate edge analysis, the interval can be reduced. Starting from each point on the target edge, the positions of the sampling points are determined in turn along the normal direction according to the set interval. Then the corresponding light intensity values of these sampling points in the image are read.
[0083] Step S103, constructing a forward discrete gradient sequence based on the light intensity information of the sampling points.
[0084] In the embodiments of the present application, the forward discrete gradient sequence is the difference (gradient) calculated from the light intensity values of the sampling points. The gradient reflects the rate of change of light intensity in that direction. The gradients of each layer are arranged in the sampling order to form the forward discrete gradient sequence. Then, the difference between the light intensity values of adjacent sampling points is calculated to obtain the light intensity gradient. The gradient reflects the rate of change of light intensity in that direction. Finally, the gradients of each layer are arranged in the sampling order to form the forward discrete gradient sequence.
[0085] Step S104, calculating a discrete centroid weight sequence based on the gradient sequence, and determining a continuous centroid based on the discrete centroid weight sequence.
[0086] In the embodiments of the present application, the discrete centroid can only appear on integer coordinates. It is generally believed that the discrete centroid is at the highest value of the gradient, and the coordinates corresponding to the discrete centroid weight are distributed on integer coordinates. The discrete centroid weight sequence is obtained by a certain calculation method (such as multiplying the sampling point coordinates by the corresponding gradient) from the gradient sequence to obtain the discrete centroid weight of each sampling layer. The continuous centroid can appear on non-integer coordinates.
[0087] In the embodiments of the present application, the continuous centroid can be calculated by determining the continuous centroid based on the discrete centroid weight sequence.
[0088] Step S105, determining the displacement offset of the target edge based on the continuous centroid.
[0089] In the embodiments of the present application, the displacement offset is the offset of the target edge relative to the reference position, which reflects the change of the edge position of the object to be measured.
[0090] In the embodiments of the present application, the centroid offset can be multiplied by the pixel size of the sensor to obtain the displacement offset. The pixel size of the sensor represents the actual physical size represented by each pixel. Through this multiplication operation, the centroid offset (in pixels) can be converted into the actual physical displacement offset.
[0091] In some embodiments, the fitting formula can be calibrated in advance, the displacement of the target edge is calculated by inputting the continuous centroid into the fitting formula, and then the displacement offset of the target edge is obtained based on the displacement of the target edge and the reference displacement corresponding to the continuous centroid.
[0092] Step S106, obtaining the distance between the receiver of the sensor and the object to be measured, and calculating a compensation value based on the distance and a diffraction compensation model.
[0093] In the embodiments of the present application, the diffraction compensation model is a mathematical model established based on the diffraction principle of light, which is used to calculate the error caused by the diffraction effect of light in the detection of edge position offset, and then to compensate and correct the detection result. The compensation value is a value calculated by using the diffraction compensation model according to the light intensity information of the target edge, which is used to correct the detection result, so as to eliminate the influence of the diffraction effect on the detection of edge position offset.
[0094] In the embodiments of the present application, the diffraction compensation model is the Fresnel diffraction model. According to the Fresnel diffraction phenomenon, when light passes through an edge / small hole within a limited distance, Fresnel diffraction phenomenon will occur. When the tool distance (the distance between the object to be measured and the receiver) changes, the diffraction intensity of the edge changes, the half-wave band radius of the Fresnel diffraction changes, which means that the edge light intensity information changes. Therefore, the acquisition of the edge light intensity information depends on the value of the tool distance to some extent. The Fresnel diffraction model can be used to compensate the edge position. The calculation formula of the Fresnel diffraction model can be simplified as: where X is the half-wave band wavelength (unit: m), C is a constant (obtained by experiment, different values for different use scenarios, usually obtained by experiment), is the wavelength of light, z is the distance between the object to be measured and the receiver (unit: m). When the research object is a circular hole, the circular hole will contain n half-wave bands. When the research object is an edge, only the half-wave band radius closest to the edge needs to be studied. When the value of C is 1, the complete half-wave band radius can be obtained, but the value of C is generally determined by experiment.
[0095] In the embodiments of the present application, the user can determine the distance between the receiver of the sensor and the object to be measured, and the value of C is constant at 0.25 (obtained by experiment), so that the distance from the continuous centroid to the half-waveband wave trough (i.e. the actual position of the edge of the object to be measured) can be calculated, and this value is the compensation value.
[0096] In step S107, the displacement offset is compensated based on the compensation value to determine the position offset of the object to be measured.
[0097] In the embodiments of the present application, the displacement offset and the compensation value can be considered comprehensively, and the displacement offset and the compensation value can be added or weighted summed (the weighting coefficient is determined according to the actual situation) to obtain the total offset.
[0098] In some embodiments, after the position offset is determined, it can be sent to a control system, and the control system controls the actuator to perform position correction on the object to be measured based on the position offset.
[0099] The position offset detection method provided in the embodiments of the present application can obtain the image information of the object to be measured detected by the sensor, filter the target edge based on the image information, sample the light intensity information of the pixel points on the target edge in the normal direction of the target edge to obtain the light intensity information of the sampling points, construct a forward discrete gradient sequence based on the light intensity information of the sampling points, calculate a discrete centroid weight sequence based on the gradient sequence, determine a continuous centroid based on the discrete centroid weight sequence, determine the displacement offset of the target edge based on the continuous centroid, obtain the distance between the receiver of the sensor and the object to be measured, calculate a compensation value based on the distance and a diffraction compensation model, and compensate the displacement offset based on the compensation value to determine the position offset of the object to be measured, so that the measurement accuracy of the position offset can be improved and the stability of the measurement can be improved.
[0100] In some embodiments, step S101 is implemented by the following steps:
[0101] In step S1011, the light intensity information of each pixel point is determined based on the image information.
[0102] In the embodiments of the present application, a pixel point is a basic unit of an image. In a digital image, the image is discretized into small square regions, and each region is a pixel point. A pixel point has a specific position coordinate. The light intensity information represents the intensity of the light received by the pixel point, which is usually represented by a numerical value. The light intensity information reflects the reflection or transmission ability of the surface of the object to be measured at different positions.
[0103] In the embodiments of the present application, for a grayscale image, the grayscale value of each pixel point can be directly read as the light intensity information, and for a color image, the average value method, weighted average method, or maximum value method can be used to extract the light intensity information.
[0104] In step S1012, the deviation between each light intensity information and the light intensity threshold value is obtained, and the pixel point with the minimum deviation is determined as the target pixel point.
[0105] In the embodiments of the present application, the light intensity threshold value is a pre-set light intensity value, which is used to distinguish different regions in the image. By comparing the light intensity of the pixel point with the light intensity threshold value, the image can be divided into two parts, i.e., the part with light intensity higher than the threshold value and the part with light intensity lower than the threshold value, thereby helping to identify the target edge. The selection of the light intensity threshold value needs to be adjusted according to the characteristics of the object to be measured, the lighting conditions, and other factors. The deviation threshold value is used to measure the difference between the light intensity of the pixel point and the light intensity threshold value. The size of the deviation threshold value affects the sensitivity and accuracy of edge detection. A smaller deviation threshold value can detect more subtle edge changes, but it may also introduce noise. A larger deviation threshold value is the opposite. The target pixel point is the position of the pixel point in the image that meets a certain condition (e.g., the deviation between the light intensity and the light intensity threshold value is less than the deviation threshold value). These target pixel points are the points that are preliminarily screened out and are likely to be located near the target edge.
[0106] In the embodiments of the present application, the appropriate light intensity threshold value can be set through experiments or experience according to the characteristics of the object to be measured, the lighting conditions, and the detection requirements, and other factors. For example, if the surface of the object to be measured reflects light strongly and the background reflects light weakly, a light intensity threshold value between the two can be set.
[0107] In the embodiments of the present application, each pixel point in the image can be traversed, the difference between the light intensity of the pixel point and the light intensity threshold value is calculated, and the absolute value of the difference is taken as the deviation, i.e., d = |I - T|, where I is the light intensity of the pixel point and T is the light intensity threshold value, and then the pixel point with the minimum deviation is determined as the target pixel point.
[0108] Exemplarily, the target pixel point can be represented as (X, Y). Table 1 is a correspondence table of the target pixel point and the light intensity information provided by the embodiments of the present application, as shown in Table 1:
[0109] Table 1
[0110]
[0111] As shown in Table 1, the minimum deviation corresponds to the target pixel point 11.
[0112] In step S1013, sampling is performed within a pre-set range from the target pixel point to obtain a plurality of sampling target pixel points.
[0113] In the embodiments of the present application, the preset range is a pre-set distance range, which is used for further sampling around the preliminarily screened target pixel point. The size of the preset range depends on the size of the object to be measured, the width of the edge, and the detection accuracy requirement and other factors. The sampling target pixel point is a point selected within the preset range from the preliminarily screened target pixel point, which is used for further determining the target edge. By analyzing and processing these sampling target pixel points, the target edge can be more accurately located. The target edge is the position of the edge of the object to be measured determined after screening and sampling, and is the basis for subsequent detection of position offset, size measurement and other operations.
[0114] In the embodiments of the present application, the size of the preset range is determined according to the size of the object to be measured, the width of the edge, and the detection accuracy requirement and other factors. For example, if the edge of the object to be measured is relatively wide, the preset range can be appropriately increased; if the detection accuracy requirement is high, the preset range should be smaller. For sampling of the object to be measured in the shape of a rectangle, the preliminarily screened target pixel point can be taken as the center, and sampling can be performed in the horizontal and vertical directions according to the preset range respectively. For example, a certain number of pixel points are taken to the left and right of the center point in the horizontal direction, and a certain number of pixel points are taken upward and downward of the center point in the vertical direction, forming a rectangular sampling region. For sampling of the object to be measured in the shape of a circle, the preliminarily screened target pixel point can be taken as the center, and circular sampling can be performed with the preset range as the radius. A certain number of pixel points are uniformly selected in the circular region as the sampling target pixel points.
[0115] Taking the above example, the preset range is the upper and lower five points of the target pixel point, and the sampling points include the target pixel points between the target pixel point 6 and the target pixel point 16.
[0116] In step S1014, the target edge is obtained based on the positions of the plurality of sampling points.
[0117] Taking the above example, the range between the target pixel point 6 and the target pixel point 16 can be considered as the target edge.
[0118] The method provided in the embodiments of the present application can preliminarily lock the area where the target edge may exist by determining the light intensity information of each pixel point and screening out the target pixel points with a light intensity threshold deviation less than a deviation threshold. Because the target edge is usually a position where the light intensity changes obviously, this method can effectively focus the attention on the edge, reduce the processing of irrelevant areas in the image, and thus lay a foundation for more accurately determining the edge position in the subsequent process. Sampling within a preset range from the target pixel points screened out preliminarily can further refine the determination process of the edge position. The preset range can be adjusted according to the characteristics of the target edge, for example, for a wider edge, appropriately expanding the sampling range can more comprehensively capture the edge information; for a narrower edge, reducing the sampling range can improve the positioning accuracy. Through the analysis of the sampled target pixel points, the actual position of the target edge can be more accurately found, and the error caused by directly performing edge detection on the entire image can be avoided.
[0119] In some embodiments, step S101 can also be implemented by the following steps:
[0120] Step S1015, determining an initial edge based on the plurality of target pixel points.
[0121] Step S1016, obtaining a measurement requirement of a user.
[0122] In the embodiments of the present application, the user can input the measurement requirement through a graphical user interface or a command line, etc. For example, the user can select the edge features (such as measuring the inner diameter, measuring the diameter, measuring the glass, measuring a plurality of measurement objects) to be measured through a menu, or specify the edge area to be measured.
[0123] Step S1017, screening the target edge from the initial edge position based on the measurement requirement.
[0124] In the embodiments of the present application, if the measurement requirement is a specific edge feature, the initial edge position is subjected to feature calculation and analysis, and the edge position meeting the requirement is screened out. If the user specifies a measurement area, the edge position located in the area is screened out from the initial edge position as the target edge according to the area selected by the user. The screening can be realized by judging whether the coordinates of the edge position are in the area specified by the user.
[0125] The method provided in the embodiments of the present application can avoid unnecessary measurement and analysis on all edges in the image by first determining the initial edge position and then screening according to the measurement requirements of the user, thereby reducing the introduction of errors. For example, only the edges of the specific region of the target object are focused on, and the interference of other irrelevant edges is excluded, thereby improving the accuracy of measurement. In addition, the method provided in the embodiments of the present application can meet the diversified measurement requirements of different users. Different users may have different measurement focuses on the edges of the target object, and the method can flexibly screen the target edges according to the specific requirements of the user, and is suitable for various application scenarios, such as industrial detection, medical image analysis, remote sensing image processing, and the like.
[0126] In some embodiments, step S103 can be implemented by the following steps:
[0127] In step S1031, the gradient between the sampling points is calculated based on the light intensity information of the sampling points.
[0128] In the embodiments of the present application, the gradient represents the degree of change of light intensity in space, and the greater the gradient value, the more intense the change in light intensity, which usually corresponds to the edge region in the image.
[0129] In the embodiments of the present application, the forward difference or backward difference method can be used to calculate the gradient, and different calculation formulas can be set according to the use scenario when calculating the gradient. The calculation formula can include:
[0130] The calculation formula of the divergent variable weight type is as follows:
[0131] ;
[0132] The gradient calculation formula of the concentrated variable weight type is as follows:
[0133] ;
[0134] The gradient calculation formula of the fixed weight type is as follows:
[0135] ;
[0136] Wherein, X is the target pixel point (coordinate), Y is the light intensity information, and n is the number of sampling points of diffusion. The calculation formula of the divergent variable weight type is suitable for scenarios where the light quantity of a single pixel is easily disturbed. The gradient calculation formula of the concentrated variable weight type is suitable for scenarios where the gradient of the light quantity of a single pixel needs to be accurately positioned. The gradient calculation formula of the fixed weight type is suitable for traditional ideal gradient calculation.
[0137] In the embodiments of the present application, the calculation formula can be pre-set according to the use scenario of the sensor. After the light intensity information of the sampling points is obtained, the corresponding calculation formula can be called to calculate the gradient.
[0138] Step S1033, obtaining a forward discrete gradient sequence based on the gradient of the sampling point.
[0139] In the embodiments of the present application, the gradient values are arranged in sequence along the normal direction of the sampling point to form a forward discrete sequence G1, G2,..., Gn, which is the forward discrete gradient sequence. The discrete gradient sequence has a corresponding relationship with the sampled target pixel point. In the above example, the discrete gradient sequence can be represented by Table 2:
[0140] Table 2
[0141]
[0142] The method provided in the embodiments of the present application can more carefully capture the change of light intensity near the target edge by sampling and gradient calculation along the normal direction.
[0143] In some embodiments, step S104 can be implemented by the following steps:
[0144] Step S1041, multiplying the coordinates of the sampling points and the corresponding gradients to obtain discrete centroid weights to obtain a discrete centroid weight sequence; summing the discrete centroid weights in the discrete centroid weight sequence to obtain a first summation result; summing the gradients to obtain a second summation result; and dividing the first summation result by the second summation result to obtain a continuous centroid.
[0145] In the embodiments of the present application, the continuous centroid can be calculated by the following formula:
[0146] Continuous centroid calculation: ;
[0147] wherein, is the gradient of the i-th sampling point, i is the corresponding coordinate, is the starting coordinate of the sampling point, is the ending coordinate of the sampling point.
[0148] In the embodiments of the present application, the discrete centroid weights are arranged in sequence to form a discrete centroid weight sequence.
[0149] In the above example, Table 3 shows a discrete centroid weight and target pixel point corresponding relationship table provided in the embodiments of the present application, as shown in Table 3,
[0150] Table 3
[0151]
[0152] In the embodiments of the present application, the continuous centroid can be calculated by the above formula, and the position of the continuous centroid can be considered as the position of the target edge.
[0153] The method provided in the embodiments of the present application multiplies the coordinates of the sampling points and the corresponding gradients to obtain discrete centroid weights, so as to obtain a discrete centroid weight sequence; sums the discrete centroid weights in the discrete centroid weight sequence to obtain a first summation result; sums the gradients to obtain a second summation result; and divides the first summation result by the second summation result to obtain a continuous centroid, thereby improving the positioning accuracy of the edge.
[0154] In some embodiments, step S105 can be implemented by the following steps:
[0155] Step S1051, determining a first position of the continuous centroid.
[0156] In the embodiments of the present application, after the continuous centroid is determined, the first position can also be determined, which can be considered as the position of the target edge.
[0157] Step S1052, obtaining a second position of the continuous centroid determined in the previous frame of image information.
[0158] In the embodiments of the present application, for the previous frame of image information, the continuous centroid can also be determined by the above-mentioned method, so as to obtain the second position. The second position is the position of the target edge when the previous frame of image information is collected.
[0159] Step S1053, determining a centroid offset based on the first position and the second position.
[0160] In the embodiments of the present application, the first position can be subtracted from the second position, and then the centroid offset is obtained.
[0161] For example, the first position is 11.84959136, the second position is 11.842388133, and the centroid offset can be expressed as: ΔfC=11.84959136-11.842388133=0.007203227.
[0162] Step S1054, multiplying the continuous centroid offset by the pixel size of the sensor to obtain a displacement offset of the target edge.
[0163] In the embodiments of the present application, the pixel size of the sensor is usually provided by the sensor manufacturer, or can be determined by calibration or other methods. Assuming that the pixel size of the sensor is px (horizontal pixel size) and py (vertical pixel size). The continuous centroid offset (Δx, Δy) is multiplied by the corresponding pixel size, respectively, to obtain the displacement offset (dx, dy) of the continuous centroid in the horizontal and vertical directions.
[0164] Taking the above example, assuming that the pixel size of the linear array sensor used is 14um*14um, the offset can be simply calculated as ΔX=0.007203227*14=0.100845178um, and the displacement calculation accuracy is within um, and the resolution can reach the level of 0.1um. Assuming that the pixel size of the linear array sensor used is 63.5um*63.5um, the offset can be simply calculated as ΔX=0.007203227*63.5=0.4574049145um, and a resolution within 1um can also be achieved.
[0165] The method provided in the embodiments of the present application usually uses discrete pixel coordinates as image coordinates, and in actual applications, it is often necessary to know the displacement of an object or a feature in the actual physical space. By multiplying the continuous centroid offset by the pixel size of the sensor, the change in the centroid position in the image can be converted into the displacement offset in the actual physical space, thereby providing an accurate data basis for subsequent physical quantity measurement and motion analysis. The calculation of the continuous centroid has taken into account the gradient information and interpolation processing, and can more accurately reflect the change in the centroid position. On this basis, multiplying by the accurate pixel size for conversion can further improve the measurement accuracy of the displacement offset and reduce the error caused by coordinate conversion.
[0166] In the embodiments of the present application, the offset can be directly calculated using the concept of pixel size. However, in fact, the imaging of the optical lens at the transmitting end is not absolutely ideal parallel light spots, and there may be slight divergence angles, which will affect the position of the edge. In view of this, in some embodiments, step S105 can be implemented by the following steps:
[0167] In step S1055, a pre-calibrated fitting formula is obtained, wherein the fitting formula includes a calculation relationship between the displacement and the continuous centroid.
[0168] In the embodiments of the present application, a mathematical method (such as the least square method, polynomial fitting, etc.) can be used to fit a group of known data (in this scenario, the continuous centroid and the actual displacement corresponding to the equidistant movement) to obtain a mathematical expression that can describe the relationship between the independent variable (continuous centroid) and the dependent variable (displacement).
[0169] In the embodiments of the present application, the measured object can be accurately controlled to move at a known equal interval in an experimental environment. For example, in an optical measurement system, a high-precision displacement table can be used to move the measured object, ensuring that each movement of the reference displacement is accurate and known. After each movement of the measured object, the previously mentioned gradient sequence-based calculation of the discrete centroid weight sequence is used, and the continuous centroid is obtained through interpolation processing. The continuous centroid corresponding to the measured object at this time is detected and recorded. The actual displacement of the equal interval movement corresponding to the recorded series of continuous centroids is used as data, and a mathematical fitting method is used to establish a calculation relationship between the displacement and the continuous centroid. Common fitting methods include linear fitting, polynomial fitting, etc.
[0170] In the embodiments of the present application, the sample to be measured can be controlled to move at an equal interval, and the image information corresponding to each reference displacement and the actual displacement of the sample to be measured during the equal interval movement can be detected. The target edge corresponding to each reference displacement is determined based on the continuous centroid. The fitting formula is obtained based on the continuous centroid corresponding to each reference displacement and the actual displacement.
[0171] Exemplarily, the reference displacement at an equal interval is 200um, and Table 4 is a corresponding relationship table between the continuous centroid and the reference displacement provided by the embodiments of the present application, as shown in Table 4:
[0172] Table 4
[0173]
[0174] By controlling the sample to be measured to move at an equal interval, the actual displacement can be measured, and the fitting formula can be obtained by fitting the actual displacement and the continuous centroid. The fitting formula is as follows:
[0175] X=A*fC 4 +B*fC 3 +C*fC 2 +D*fC, wherein A, B, C, and D are coefficients obtained by fitting.
[0176] In step S1056, the continuous centroid is input into the fitting formula to calculate the displacement of the target edge.
[0177] In the embodiments of the present application, the displacement of the target edge can be calculated by the fitting formula.
[0178] In step S1057, the displacement of the target edge and the reference displacement corresponding to the continuous centroid are used to obtain the displacement offset of the target edge.
[0179] In the embodiments of the present application, the displacement offset can be obtained by subtracting the reference displacement corresponding to the continuous centroid from the displacement of the continuous centroid.
[0180] Exemplarily, Table 5 is a determination schematic table of displacement offset provided by the embodiment of the present application, as shown in Table 5:
[0181] Table 5
[0182]
[0183] As shown in Table 5, the displacement offset can be obtained by mapping the displacement of the continuous centroid minus the reference displacement corresponding to the continuous centroid by using the fitting formula of the continuous centroid.
[0184] Based on the foregoing various embodiments, the embodiment of the present application further provides a position offset detection method, Figure 4 The implementation flowchart of another position offset detection method provided by the embodiment of the present application is shown in FIG. 4, which includes: Figure 4
[0185] In step S401, the image sensor is exposed to obtain image information.
[0186] In the embodiment of the present application, the laser can be controlled to be synchronously turned on, so as to obtain the image information by exposing the image sensor. After the image information is obtained, the image information can be temporarily stored, and the laser system can be turned off after the image information is temporarily stored.
[0187] In step S402, the position and polarity of all edges on the image are determined by using threshold detection and threshold filtering.
[0188] In step S403, the edges that need to be calculated twice are selected according to the measurement requirement.
[0189] In the embodiment of the present application, the measurement requirement can include edge offset measurement, inner diameter offset measurement, diameter offset measurement, glass offset measurement, multiple object offset measurement, etc. The edges that need to be calculated twice can be the target edges in the foregoing embodiments.
[0190] In step S404, edge sample collection is performed at the position of the edge, and a forward discrete gradient sequence is constructed.
[0191] In step S405, the discrete gradient sequence is calculated according to the obtained discrete gradient sequence, the discrete centroid is converted into an effective continuous centroid, and the position of the continuous centroid is determined.
[0192] In step S406, the offset position is calculated based on the continuous centroid.
[0193] In the embodiment of the present application, the offset position can be calculated by using the continuous centroid and the fitting formula, or the offset position can be calculated by using the continuously executed positions corresponding to the two image information.
[0194] In step S407, the compensation value is calculated based on the diffraction compensation model.
[0195] In the embodiments of the present application, the diffraction compensation model can be a Fresnel diffraction model. According to the Fresnel diffraction phenomenon, light will undergo the Fresnel diffraction phenomenon when passing through an edge / small hole within a limited distance. When the tool distance (the distance from the measured object to the receiver) changes, the diffraction intensity of the edge changes, the half-wave band radius of the Fresnel diffraction changes, which means that the edge light intensity information changes. Therefore, the acquisition of the edge light intensity information depends on the value of the tool distance to some extent. The Fresnel diffraction model can be used to compensate the calculation of the edge position. The calculation formula of the Fresnel diffraction model can be simplified as: wherein X is the half-wave band wavelength (unit: m), C is a constant (obtained by experiment, different values for different use scenarios, usually obtained by experiment), is the wavelength of light, and z is the distance from the measured object to the receiver (unit: m). When the research object is a circular hole, the circular hole will contain n half-wave bands. When the research object is an edge, only the radius of the nearest half-wave band to the edge needs to be studied. When the value of C is 1, the complete half-wave band radius can be obtained, but the value of C is generally determined by experiment.
[0196] In the embodiments of the present application, the user confirms the distance z value, and the value of C is constant at 0.25 (obtained by experiment). The distance from the continuous centroid to the half-wave band valley can be obtained, and thus the compensation value can be obtained. For example, when the tool distance is 50 mm, the compensation value is about 31.86 um.
[0197] In step S408, the displacement offset is compensated based on the compensation value to determine the position offset of the measured object.
[0198] The method provided in the embodiments of the present application can detect the position offset with high precision and high resolution.
[0199] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution. The execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0200] According to the foregoing embodiments, the embodiments of the present application provide a position offset detection device, each module included in the device and each unit included in each module can be implemented by a processor in a computer device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA).
[0201] The embodiments of the present application provide a position offset detection device, Figure 5 A structural schematic diagram of a position offset detection device provided by the embodiments of the present application is shown in Figure 5 The position offset detection device 500 includes:
[0202] The acquisition module 501 is configured to acquire image information of a to-be-measured object detected by a sensor, and filter a target edge based on the image information.
[0203] The sampling module 502 is configured to sample light intensity information of a pixel point along a normal direction of the target edge on the target edge to obtain light intensity information of a sampling point.
[0204] The construction module 503 is configured to construct a forward discrete gradient sequence based on the light intensity information of the sampling point.
[0205] The first calculation module 504 is configured to calculate a discrete centroid weight sequence based on the gradient sequence, and determine a continuous centroid based on the discrete centroid weight sequence.
[0206] The determination module 505 is configured to determine a displacement offset of the target edge based on the continuous centroid.
[0207] The second calculation module 506 is configured to acquire a distance between a receiver of the sensor and the to-be-measured object, and calculate a compensation value based on the distance and a diffraction compensation model.
[0208] The compensation module 507 is configured to compensate the displacement offset based on the compensation value to determine a position offset of the to-be-measured object.
[0209] In some embodiments, the determination module 505 includes:
[0210] The first determination unit is configured to determine a first position of the continuous centroid.
[0211] The first acquisition unit is configured to acquire a second position of a continuous mass center determined in previous frame image information.
[0212] The second determination unit is configured to determine a mass center offset based on the first position and the second position.
[0213] The first calculation unit is configured to multiply the continuous mass center offset by a pixel size of a sensor to obtain a displacement offset of the target edge.
[0214] In some embodiments, the determination module 505 comprises:
[0215] The second acquisition unit is configured to acquire a fitting formula pre-calibrated, wherein the fitting formula comprises a calculation relationship between displacement and continuous mass center.
[0216] The input unit is configured to input the continuous mass center into the fitting formula to calculate the displacement of the target edge.
[0217] The second calculation unit is configured to obtain a displacement offset of the target edge based on the displacement of the target edge and a reference displacement corresponding to the continuous mass center.
[0218] In some embodiments, the position offset detection apparatus further comprises:
[0219] The control module is configured to control the sample to be tested to move at equal intervals, and detect image information corresponding to each reference displacement and actual displacement of the sample to be tested during the equal interval movement.
[0220] The continuous mass center determination module is configured to determine a continuous mass center of the target edge corresponding to each reference displacement based on the image information corresponding to each reference displacement.
[0221] The fitting module is configured to fit the continuous mass center corresponding to each reference displacement and the actual displacement to obtain the fitting formula.
[0222] In some embodiments, the acquisition module comprises:
[0223] The third determination unit is configured to determine light intensity information of each pixel point based on the image information.
[0224] The third acquisition unit is configured to acquire a deviation between each light intensity information and a light intensity threshold.
[0225] The fourth determination unit is configured to determine a target pixel point as a pixel point with the smallest deviation.
[0226] The sampling unit is configured to sample within a preset range from the target pixel point to obtain a plurality of target pixel points.
[0227] The fifth determining unit is configured to determine the target edge based on the plurality of target pixel points.
[0228] In some embodiments, the acquisition module comprises:
[0229] The sixth determining unit is configured to determine an initial edge based on the plurality of target pixel points.
[0230] The fourth acquisition unit is configured to acquire a measurement requirement of the user.
[0231] The screening unit is configured to screen the target edge from the initial edge based on the measurement requirement.
[0232] In some embodiments, the construction module comprises:
[0233] The third calculating unit is configured to calculate the gradient of the sampling point based on the light intensity information of the sampling point.
[0234] The first obtaining unit is configured to obtain the forward discrete gradient sequence based on the gradient of the sampling point.
[0235] In some embodiments, the first calculating module comprises:
[0236] The fourth calculating unit is configured to multiply the coordinate of the sampling point and the corresponding gradient to obtain a discrete centroid weight, so as to obtain a discrete centroid weight sequence; sum the discrete centroid weights in the discrete centroid weight sequence to obtain a first summation result; sum the gradients to obtain a second summation result; and divide the first summation result by the second summation result to obtain a continuous centroid.
[0237] It should be noted that the information interaction, execution process and the like between the above-mentioned devices / units are based on the same concept as the method embodiments of the present application, and the specific functions and the technical effects brought by the same can be referred to the method embodiment part, and will not be described here.
[0238] In addition, the position offset detection device shown above can be a software unit, a hardware unit, or a combination of software and hardware, and can also be integrated into a sensor as an independent plug-in, or can exist as an independent terminal device.
[0239] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the above described functions. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or software. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the application. The specific working process of the unit and module in the system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0240] Figure 6 A structural schematic diagram of a sensor provided by an embodiment of the application is shown in FIG. 1. As shown in FIG. 1, the sensor 3 of the embodiment can include at least one processor 30 (only one processor 30 is shown in the figure), a memory 31, and a computer program 32 stored in the memory 31 and executable on the at least one processor 30. The processor 30 implements the steps in any of the foregoing method embodiments when executing the computer program 32, or the processor 30 implements the functions of the modules / units in the foregoing device and system embodiments when executing the computer program 32. Figure 6 Figure 6 For example, the computer program 32 can be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 30 to complete the application. One or more modules / units can be a series of computer program 32 instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program 32 in the sensor 3.
[0241] An embodiment of the application further provides a computer readable storage medium, which stores the computer program 32. The computer program 32 is executed by the processor 30 to implement the steps in the foregoing method embodiments.
[0242] An embodiment of the application provides a computer program product, which, when executed on a sensor, causes the sensor to implement the steps in the foregoing method embodiments.
[0243] An embodiment of the application provides a computer program product, which, when executed on a sensor, causes the sensor to implement the steps in the foregoing method embodiments.
[0244] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. According to such understanding, the computer program 32 can be used to instruct the related hardware to complete all or part of the processes in the above-mentioned embodiments. The computer program 32 can be stored in a computer readable storage medium, and the computer program 32 can implement the steps of each method embodiment when executed by the processor 30. The computer program 32 includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the terminal, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal and a software distribution medium. For example, a U disk, a mobile hard disk, a magnetic disk or an optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunications signal.
[0245] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.
[0246] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0247] In the embodiments provided in the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other ways. For example, the apparatus / network device embodiments described above are only schematic. The division of the modules or units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0248] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may also be distributed to multiple network units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.
[0249] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method of detecting a positional offset, characterized by, The method comprises the following steps: obtaining image information of a to-be-measured object detected by a sensor, and screening a target edge based on the image information; sampling light intensity information of pixel points on the target edge in a normal direction of the target edge to obtain light intensity information of sampling points; constructing a forward discrete gradient sequence based on the light intensity information of the sampling points; calculating a discrete centroid weight sequence based on the gradient sequence, and determining a continuous centroid based on the discrete centroid weight sequence, wherein the calculation of the discrete centroid weight sequence based on the gradient sequence and the determination of the continuous centroid based on the discrete centroid weight sequence comprise: multiplying the coordinates of the sampling points and the corresponding gradients to obtain discrete centroid weights to obtain a discrete centroid weight sequence; summing the discrete centroid weights in the discrete centroid weight sequence to obtain a first summation result; summing the gradients to obtain a second summation result; and dividing the first summation result by the second summation result to obtain the continuous centroid; determining a displacement offset of the target edge based on the continuous centroid, wherein the determination of the displacement offset of the target edge based on the continuous centroid comprises: obtaining a fitting formula pre-calibrated, wherein the fitting formula comprises a calculation relationship between displacement and the continuous centroid; inputting the continuous centroid into the fitting formula to calculate the displacement of the target edge; and obtaining the displacement offset of the target edge based on the displacement of the target edge and a reference displacement corresponding to the continuous centroid; obtaining a distance between a receiver of the sensor and the to-be-measured object, and calculating a compensation value based on the distance and a diffraction compensation model; compensating the displacement offset based on the compensation value to determine a position offset of the to-be-measured object.
2. The method of claim 1, wherein, The method further comprises: controlling the sample to-be-measured object to move at equal intervals, and detecting image information corresponding to each reference displacement and an actual displacement of the sample to-be-measured object during the movement at equal intervals; determining a continuous centroid of the target edge corresponding to each reference displacement based on the image information corresponding to each reference displacement; fitting the continuous centroid corresponding to each reference displacement and the actual displacement to obtain the fitting formula.
3. The method of claim 1, wherein, The screening of the target edge based on the image information comprises: determining light intensity information of each pixel point based on the image information; obtaining a deviation between each light intensity information and a light intensity threshold value; determining a target pixel point with the smallest deviation; sampling within a preset range from the target pixel point to obtain a plurality of target pixel points; determining the target edge based on the plurality of target pixel points.
4. The method of claim 3, wherein, The determination of the target edge based on the plurality of target pixel points comprises: determining an initial edge based on the plurality of target pixel points; obtaining a measurement requirement of a user; screening the target edge from the initial edge based on the measurement requirement.
5. The method of claim 1, wherein, The construction of the forward discrete gradient sequence based on the light intensity information of the sampling points comprises: calculating the gradient of the sampling point based on the light intensity information of the sampling point; obtaining the forward discrete gradient sequence based on the gradient of the sampling point.
6. A device for detecting a positional offset, characterized in that The method comprises the following steps: an obtaining module, configured to obtain image information of a to-be-measured object detected by a sensor, and screen a target edge based on the image information; The sampling module is configured to sample light intensity information of pixels along a normal direction of the target edge to obtain light intensity information of sampling points; The construction module is configured to construct a forward discrete gradient sequence based on the light intensity information of the sampling points; The first calculation module is configured to calculate a discrete centroid weight sequence based on the gradient sequence, and determine a continuous centroid based on the discrete centroid weight sequence, including: multiplying coordinates of the sampling points and corresponding gradients to obtain discrete centroid weights, so as to obtain the discrete centroid weight sequence; summing the discrete centroid weights in the discrete centroid weight sequence to obtain a first summation result; summing the gradients to obtain a second summation result; and dividing the first summation result by the second summation result to obtain the continuous centroid; The determination module is configured to determine a displacement offset of the target edge based on the continuous centroid, including: obtaining a fitting formula pre-calibrated, wherein the fitting formula includes a calculation relationship between a displacement and the continuous centroid; inputting the continuous centroid into the fitting formula to calculate a displacement of the target edge; and obtaining the displacement offset of the target edge based on the displacement of the target edge and a reference displacement corresponding to the continuous centroid; The second calculation module is configured to obtain a distance between a receiver of the sensor and the object to be measured, and calculate a compensation value based on the distance and a diffraction compensation model; The compensation module is configured to compensate the displacement offset based on the compensation value, so as to determine a position offset of the object to be measured.
7. A sensor comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 5. The processor executes the computer program to implement the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Displacement sensor, displacement measurement method, displacement measurement program and storage medium
JP2016090340A