Position offset detection method and device and sensor
By acquiring image information from a through-beam correction sensor, screening the target edge, performing light intensity sampling and gradient calculation, and combining it with a diffraction compensation model, the problem of low sensor detection accuracy is solved, achieving more accurate and stable position offset measurement.
Patent Information
- Application Number
- CN202511244300.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-09-02
AI Technical Summary
When detecting the edge position deviation of the object to be measured, the existing through-beam correction sensor is affected by signal noise and material surface characteristics, resulting in insufficient detection accuracy, prone to misjudgment or unstable detection.
By acquiring the image information of the object to be tested detected by the sensor, screening the target edge, sampling the pixel light intensity information along the normal direction of the target edge, constructing a forward discrete gradient sequence, calculating the discrete centroid weight sequence, determining the continuous centroid, and calculating the compensation value in combination with the diffraction compensation model to perform displacement offset compensation.
The measurement accuracy and stability of position offset are improved, and the accuracy and reliability of detection are enhanced.
Smart Images

Figure CN120765729A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of position offset detection, and in particular relates to a method, device, and sensor for detecting position offset. Background Art
[0002] A web-correcting sensor uses laser technology to detect edge deviations of an object under test. When the object shifts, the sensor detects the change in edge position and sends a signal to the control system. A web-correcting sensor is a device used to detect and correct the positional deviations of objects under test (such as paper, film, or metal strips) on a production line. Existing through-beam web-correcting sensors still have some shortcomings in processing one-dimensional linear image signals. For example, when processing the one-dimensional linear image signal acquired by the sensor, the detection accuracy of edge deviations may be insufficient due to factors such as signal noise and material surface characteristics (such as reflections and uneven transparency), making misjudgments and unstable detection more likely to occur. Summary of the Invention
[0003] In view of this, embodiments of the present application provide a method, device, and sensor for detecting position offset, which can improve the measurement accuracy of the offset.
[0004] In a first aspect, an embodiment of the present application provides a method for detecting position offset, comprising: Acquiring image information of the object to be detected by the sensor, and screening the target edge based on the image information; Sampling light intensity information of pixel points at the edge of the target along a normal direction of the edge of the target to obtain light intensity information of the sampling points; Construct 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; Determining a displacement offset of the target edge based on the continuous centroids; Obtaining a distance between a receiver of the sensor and the object to be measured, and calculating a compensation value based on the distance and a diffraction compensation model; The displacement offset is compensated based on the compensation value to determine the position offset of the object to be measured.
[0005] In some embodiments, determining the displacement offset of the target edge based on the continuous centroids includes: determining a first position of a centroid of the target edge based on the continuous centroids; Obtaining a second position of the centroid of the target edge, where the second position is determined based on a previous frame of image information of the object to be measured; determining a center of mass offset based on the first position and the second position; The displacement offset of the target edge is obtained by multiplying the continuous centroid offset by the pixel size of the sensor.
[0006] In some embodiments, determining the displacement offset of the target edge based on the continuous centroids includes: Obtaining a pre-calibrated fitting formula, wherein the fitting formula includes: a calculation relationship between displacement and continuous center of mass; Inputting the continuous centroid into a fitting formula to calculate the displacement of the target edge; Based on the displacement of the target edge and the reference displacement corresponding to the continuous centroid, the displacement offset of the target edge is obtained.
[0007] In some embodiments, the method further comprises: Controlling the sample to be tested to move at equal intervals, and detecting the image information corresponding to each reference displacement and the actual displacement of the sample to be tested during the equal interval movement; Determine the continuous centroid of the target edge corresponding to each reference displacement based on the image information corresponding to each reference displacement; The fitting formula is obtained by performing fitting based on the continuous centroid corresponding to each reference displacement and the actual displacement.
[0008] In some embodiments, screening target edges based on the image information includes: determining light intensity information of each pixel based on the image information; Obtaining the deviation between each light intensity information and the light intensity threshold; The pixel with the smallest deviation is determined as the target pixel; Sampling is performed within a preset range from the target pixel point to obtain multiple target pixel points; The target edge is determined based on a plurality of target pixel points.
[0009] In some embodiments, determining the target edge based on a plurality of target pixels includes: determining an initial edge based on the plurality of target pixels; Obtain user measurement requirements; The target edge is selected from the initial edges based on the measurement requirement.
[0010] In some embodiments, constructing a forward discrete gradient sequence based on light intensity information of sampling points includes: Calculate the gradient between sampling points based on the light intensity information of the sampling points; A forward discrete gradient sequence is obtained based on the gradient between sampling points.
[0011] In some embodiments, calculating a discrete centroid weight sequence based on the gradient sequence, and determining a continuous centroid based on the discrete centroid weight sequence, comprises: Multiply the coordinates of the sampling points and the corresponding gradients to obtain the discrete centroid weights 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; The first summation result is divided by the second summation result to obtain a continuous centroid.
[0012] Obtain a discrete centroid sequence based on the discrete centroids corresponding to each layer; The discrete centroid sequence is interpolated to obtain the continuous centroid.
[0013] In a second aspect, an embodiment of the present application provides a position offset detection device, comprising: An acquisition module, configured to acquire image information of the object to be detected by the sensor, and filter target edges based on the image information; A sampling module, configured to sample light intensity information of pixel points at the edge of the target along a normal direction of the edge of the target to obtain light intensity information of the sampling points; A construction module for constructing a forward discrete gradient sequence based on the light intensity information of the sampling points; A 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; a determination module, configured to determine a displacement offset of the target edge based on the continuous centroids; A second calculation module is used to obtain the distance between the receiver of the sensor and the object to be measured, and calculate a compensation value based on the distance and a diffraction compensation model; A compensation module is used to compensate the displacement offset based on the compensation value to determine the position offset of the object to be measured.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described methods when executing the computer program.
[0015] In a fourth aspect, an embodiment of the present application provides a sensor comprising the electronic device described in the third aspect.
[0016] In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the method of any of the above.
[0017] In a sixth aspect, an embodiment of the present application provides a computer program product, when the computer program product is run on a terminal device, the sensor is caused to perform the method of any of the above.
[0018] Compared with the prior art, the embodiment of the present application has the following beneficial effects: The method for detecting position offset provided by the embodiment of the present application can obtain image information of a to-be-measured object detected by a sensor, filter a target edge based on the image information, sample 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, construct a forward discrete gradient sequence based on the light intensity information of the sampling point, 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 to-be-measured object, 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 to-be-measured object, thereby improving the measurement accuracy of the position offset and the stability of the measurement. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0020] Figure 1 A structural schematic diagram of a sensor is provided for the embodiment of the present application; Figure 2 A schematic diagram of detection of position offset is provided for the embodiment of the present application; Figure 3 An implementation flow schematic diagram of a method for detecting position offset is provided for the embodiment of the present application; Figure 4 An implementation flow schematic diagram of another method for detecting position offset is provided for the embodiment of the present application; Figure 5 A structural schematic diagram of a position offset detection device is provided for the embodiment of the present application; Figure 6 A structural schematic diagram of a sensor is provided for the embodiment of the present application. DETAILED DESCRIPTION
[0021] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0022] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0023] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0024] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if it is detected" can be interpreted as meaning "upon determining" or "in response to determining" or "upon detecting" or "in response to detecting", depending on the context.
[0025] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0026] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized.
[0027] Based on the problems in the related art, the embodiment of the present application provides a method for detecting position offset that can be applied to sensors. Figure 1 A schematic diagram of the structure of a sensor is provided for the embodiment of the present application, such as Figure 1As shown, this sensor is a through-beam deflection sensor, comprising a receiving device and a transmitting device. The transmitting device's main transmitting system operates based on system parameters. This system controls the laser driver using laser parameters, thereby emitting parallel light from the transmitting device. The transmitting device also uses system hardware to detect the laser driver and adjust the laser parameters to control the laser driver. The receiving device's receiving system operates based on system parameters. This system controls the receiving device to acquire image data using exposure parameters, determine the target edge based on the image data, determine the continuous center of mass based on the target edge, determine the displacement offset based on the continuous center of mass, and determine the position offset of the object under test based on the displacement offset.
[0028] In the embodiment of the present application, the receiving device and the transmitting device communicate via the controller protocol. The receiving device may communicate with other devices via other communication protocols. Figure 2 A schematic diagram of a position offset detection provided in an embodiment of the present application is shown as follows: Figure 2 As shown in the figure, the object to be measured is placed between the receiving end and the transmitting end. The reflecting end emits parallel light, and the receiving end collects data to obtain image information. Figure 3 A schematic diagram of the implementation flow of a method for detecting position offset provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the detection method of position offset includes: Step S101 : acquiring image information of the object to be detected by a sensor, and screening target edges based on the image information.
[0029] In the embodiments of this application, the object to be tested refers to an object requiring positional offset detection, such as paper in the printing industry, fabric in the textile industry, or chips in the electronics manufacturing field. Image information is image data of the object to be tested, acquired by the receiver. This image information includes information such as the object's appearance, color, and light intensity. The target edge is the edge region selected from the image information of the object to be tested for focused detection and analysis.
[0030] In embodiments of the present application, image information of the object to be detected can be obtained by a receiving end. An edge detection algorithm can be used based on the image information to determine the target edge. In some embodiments, target edges can be automatically filtered from the image information based on user needs. This filtering of target edges is intended to focus on edge regions that are critical for detecting positional offsets and eliminate irrelevant interference.
[0031] Step S102 : sampling light intensity information of pixel points at the edge of the target along the normal direction of the edge of the target to obtain light intensity information of the sampling points.
[0032] In this embodiment, the normal direction is perpendicular to the tangent direction of the target edge curve at that point. In optical detection, light intensity sampling along the normal direction can more accurately capture changes in light intensity near the edge. When sampling light intensity information at a pixel point, multiple sampling points are selected at regular intervals to obtain light intensity information for each sampling point.
[0033] In the embodiment of the present application, for discrete edge points, the difference method can be used to approximately calculate the tangent direction, and then the perpendicular line is found to obtain the normal direction. Along the determined normal direction, multiple sampling points are selected at regular intervals. The light intensity information of each sampling point is obtained in sequence. The size of the sampling interval affects the sampling accuracy and computational complexity. The smaller the interval, the finer the sampling, but the greater the computational complexity.
[0034] In an embodiment 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 by the least squares 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), then for the point (x0, y0) on the curve, the slope of its tangent is k=f′(x0), then the normal slope of the point is kn=-k1 (when k is not 0), and the vector of the normal direction can be determined.
[0035] Each sampling point has its corresponding light intensity value, which will be used for subsequent gradient calculations.
[0036] In the embodiments of the present application, the sampling spacing d can be pre-set based on actual application requirements and image resolution. For example, when the image resolution is high and precise edge analysis is required, the spacing can be reduced. Starting from each point on the target edge, the positions of the various sampling points are determined sequentially along the normal direction according to the set spacing. The light intensity values corresponding to these sampling points in the image are then read.
[0037] Step S103: constructing a forward discrete gradient sequence based on the light intensity information of the sampling points.
[0038] In this embodiment of the present application, the forward discrete gradient sequence is formed by calculating the difference (gradient) between the light intensity values at the sampling points. The gradient reflects the rate of change of the light intensity in that direction. Arranging the gradients of each layer in the sampling order forms 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 the light intensity in that direction. Finally, arranging the gradients of each layer in the sampling order forms the forward discrete gradient sequence.
[0039] 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.
[0040] In this embodiment, discrete centroids can only appear at integer coordinates. It is generally assumed that the discrete centroid is at the highest gradient value, and the coordinates corresponding to the discrete centroid weights are distributed on integer coordinates. The discrete centroid weight sequence is calculated based on the gradient sequence, using a specific calculation method (such as multiplying the sampling point coordinates by the corresponding gradient) to obtain the discrete centroid weights for each sampling layer. Continuous centroids can appear at non-integer coordinates.
[0041] In an embodiment of the present application, the continuous centroid may be calculated by determining the continuous centroid based on the discrete centroid weight sequence.
[0042] Step S105 : determining the displacement offset of the target edge based on the continuous centroids.
[0043] In the embodiment of the present application, the displacement offset is the offset of the target edge relative to the reference position, reflecting the change in the edge position of the object to be measured.
[0044] In this embodiment of the present application, the displacement offset can be obtained by multiplying the center of mass offset by the sensor's pixel size. The sensor's pixel size represents the actual physical size represented by each pixel. Through this multiplication, the center of mass offset (in pixels) can be converted to the actual physical displacement offset.
[0045] In some embodiments, a pre-calibrated fitting formula may be used to calculate the displacement of the target edge by inputting the continuous centroid into the fitting formula, and then obtain the displacement offset of the target edge based on the displacement of the target edge and the reference displacement corresponding to the continuous centroid.
[0046] 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.
[0047] In the embodiments of this application, the diffraction compensation model is a mathematical model based on the principle of light diffraction. It is used to calculate the error caused by the diffraction effect of light in edge position offset detection, thereby compensating for the detection results. The compensation value is calculated using the diffraction compensation model based on the light intensity information of the target edge, and is used to correct the detection results to eliminate the impact of the diffraction effect on edge position offset detection.
[0048] In the embodiment of the present application, the diffraction compensation model, the Fresnel diffraction model, can be based on the Fresnel diffraction phenomenon. When light passes through an edge / small hole within a limited distance, Fresnel diffraction will occur. When the tooling distance (the distance from the object to the receiver) changes, the diffraction intensity of the edge changes, and the half-wave zone radius of the Fresnel diffraction changes, which means that the edge light intensity information has changed. Therefore, the acquisition of edge light intensity information depends to a certain extent on the value of the tooling distance. The edge position can be compensated by the Fresnel diffraction model. The calculation formula of the Fresnel diffraction model can be simplified as follows: , where X is the half-band wavelength (unit: m), C is a constant (derived from experiments, different usage scenarios have different values, usually derived from experiments), is the wavelength of light, z is the distance from the 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, it is only necessary to study the radius of the half-wave band closest to the edge. When the C value is 1, the complete half-wave band radius can be obtained, but the C value is generally determined by experiments.
[0049] In an embodiment of the present application, the user can determine the distance between the sensor's receiver and the object to be measured, and the C value is constant at 0.25 (derived from experiments), so that the distance from the continuous center of mass to the trough of the half-wave band (that is, the actual position of the edge of the object to be measured) can be calculated. This value is the compensation value.
[0050] Step S107 : compensating the displacement offset based on the compensation value to determine the position offset of the object to be measured.
[0051] In the embodiment of the present application, the displacement offset and the position compensation value can be comprehensively considered, and the displacement offset and the compensation value can be added or weighted (the weighting coefficient is determined according to the actual situation) to obtain the total offset.
[0052] In some embodiments, after the position offset is determined, it may 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.
[0053] An embodiment of the present application provides a method for detecting position offset, which obtains image information of an object to be measured detected by a sensor, and filters the target edge based on the image information; samples the light intensity information of pixel points on the target edge along the normal direction of the target edge to obtain the light intensity information of the sampling points; constructs a forward discrete gradient sequence based on the light intensity information of the sampling points; calculates a discrete centroid weight sequence based on the gradient sequence, and determines a continuous centroid based on the discrete centroid weight sequence; determines the displacement offset of the target edge based on the continuous centroid; obtains the distance between the sensor receiver and the object to be measured, and calculates a compensation value based on the distance and a diffraction compensation model; compensates for the displacement offset based on the compensation value to determine the position offset of the object to be measured, which can improve the measurement accuracy of the position offset and improve the measurement stability.
[0054] In some embodiments, step S101 is implemented by the following steps: Step S1011: determining the light intensity information of each pixel based on the image information.
[0055] In the embodiments of the present application, pixels are the basic building blocks of an image. In a digital image, the image is discretized into small square regions, each of which is a pixel. Pixels have specific location coordinates. Light intensity information represents the intensity of light received by a pixel, typically expressed as a numerical value. Light intensity information reflects the ability of different locations on the surface of the object to be measured to reflect or transmit light.
[0056] In an embodiment of the present application, for a grayscale image, the grayscale value of each pixel can be directly read as light intensity information, and for a color image, the average method, weighted average method, and maximum method can be used to extract light intensity information.
[0057] Step S1012: Obtain the deviation between each light intensity information and the light intensity threshold; and determine the pixel point with the smallest deviation as the target pixel point.
[0058] In an embodiment of the present application, the light intensity threshold is a pre-set light intensity value used to distinguish different areas in the image. By comparing the light intensity of the pixel with the light intensity threshold, the image can be divided into two parts with light intensity higher than the threshold and lower than the threshold, thereby helping to identify the edge of the target. The selection of the light intensity threshold needs to be adjusted according to factors such as the characteristics of the object to be measured and the lighting conditions. The deviation threshold is used to measure the degree of difference between the light intensity of the pixel and the light intensity threshold. The size of the deviation threshold affects the sensitivity and accuracy of edge detection. A smaller deviation threshold will detect more subtle edge changes, but may also introduce noise; a larger deviation threshold is the opposite. The target pixel point is the location of the pixel point in the image that meets specific conditions (such as the deviation between the light intensity and the light intensity threshold is less than the deviation threshold). These target pixel points are preliminarily screened points that may be located near the edge of the target.
[0059] In the embodiment of the present application, an appropriate light intensity threshold can be set through experiments or experience based on factors such as the characteristics of the object to be tested, lighting conditions, and detection requirements. For example, if the surface reflected light of the object to be tested is strong and the background reflected light is weak, a light intensity threshold between the two can be set.
[0060] In an embodiment of the present application, each pixel in the image can be traversed, the difference between the light intensity of the pixel and the light intensity threshold can be calculated, and its absolute value can be taken as the deviation, that is, d=|IT|, where I is the light intensity of the pixel, T is the light intensity threshold, and then the pixel with the smallest deviation is determined as the target pixel.
[0061] For example, the target pixel point can be represented by (X, Y). Table 1 is a corresponding relationship table of the target pixel points and light intensity information provided by the embodiment of the present application, as shown in Table 1: Table 1
[0062] As shown in Table 1, the minimum deviation corresponds to the target pixel 11.
[0063] Step S1013: Sampling is performed within a preset range from the target pixel point to obtain a plurality of sampled target pixel points.
[0064] In an embodiment of the present application, the preset range is a pre-set distance range used for further sampling around the target pixel points that have been preliminarily screened out. The size of the preset range depends on factors such as the size of the object to be measured, the width of the edge, and the detection accuracy requirements. The sampled target pixel points are points selected within the preset range from the preliminarily screened target pixel points for further determining the target edge. By analyzing and processing these sampled target pixel points, the target edge can be located more accurately. The target edge is the location of the edge of the object to be measured determined after screening and sampling, and is the basis for subsequent operations such as position offset detection and size measurement.
[0065] In an embodiment of the present application, the size of the preset range is determined based on factors such as the size of the object to be measured, the width of the edge, and the detection accuracy requirements. For example, if the edge of the object to be measured is wider, the preset range can be appropriately increased; if the detection accuracy requirements are high, the preset range should be smaller. For sampling in which the shape of the object to be measured is rectangular, the target pixel point preliminarily screened out can be used as the center, and sampling can be performed in accordance with the preset range in the horizontal and vertical directions. For example, a certain number of pixels are taken from the center point to the left and right in the horizontal direction, and a certain number of pixels are taken from the center point to the top and bottom in the vertical direction to form a rectangular sampling area. For sampling in which the shape of the object to be measured is circular, circular sampling can be performed with the target pixel point preliminarily screened out as the center and the preset range as the radius. A certain number of pixels are evenly selected within the circular area as sampling target pixels.
[0066] Continuing with the above example, the preset range is 5 points above and below the target pixel point, and the sampling points include: target pixel points between target pixel point 6 and target pixel point 16.
[0067] Step S1014: obtaining the target edge based on the positions of multiple sampling points.
[0068] Continuing with the above example, the range between target pixel 6 and target pixel 16 can be considered as the target edge.
[0069] The method provided in the embodiment 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 whose deviation from the light intensity threshold is less than the deviation threshold. Because the target edge is usually the location where the light intensity changes significantly, this method can effectively focus the attention on the vicinity of the edge, reducing the processing of irrelevant areas in the image, thereby laying the foundation for subsequent more accurate determination of the edge position. Sampling is performed within a preset range from the target pixel points that have been preliminarily screened out, further refining the process of determining the edge position. The setting of the preset range can be adjusted according to the characteristics of the target edge. For example, for wider edges, appropriately expanding the sampling range can capture the edge information more comprehensively; for narrower edges, reducing the sampling range can improve positioning accuracy. By analyzing the sampled target pixel points, the actual position of the target edge can be found more accurately, avoiding the errors that may be caused by directly performing edge detection on the entire image.
[0070] In some embodiments, step S101 may also be implemented by the following steps: Step S1015: determining an initial edge based on the multiple target pixels.
[0071] Step S1016: Obtain the user's measurement requirements.
[0072] In the embodiments of the present application, a user can input measurement requirements through a graphical user interface or a command line. For example, a user can select an edge feature to be measured (such as measuring inner diameter, measuring diameter, measuring glass, measuring multiple objects) through a menu, or specify an edge region to be measured.
[0073] Step S1017 : Filter the target edge from the initial edge position based on the measurement requirement.
[0074] In this embodiment of the present application, if the measurement requirement is specific edge features, feature calculation and analysis are performed on the initial edge positions to filter out edge positions that meet the requirements. If the user specifies a measurement area, the initial edge positions are filtered out based on the user-selected area and are used as target edges. This filtering is achieved by determining whether the edge position's coordinates are within the user-specified area.
[0075] The method provided in the embodiment of the present application can avoid unnecessary measurement and analysis of all edges in the image by first determining the initial edge position and then screening according to the user's measurement requirements, thereby reducing the introduction of errors. For example, only the edges of a specific area of the target object are focused on, eliminating the interference of other irrelevant edges, thereby improving the accuracy of the measurement. In addition, the method provided in the embodiment of the present application can meet the diverse measurement needs of different users. Different users may have different measurement focuses on the edges of the target object. This method can flexibly screen the target edges according to the specific needs of the user and is suitable for a variety of different application scenarios, such as industrial detection, medical image analysis, remote sensing image processing, etc.
[0076] In some embodiments, step S103 may be implemented by the following steps: Step S1031 : Calculate the gradient between the sampling points based on the light intensity information of the sampling points.
[0077] In the embodiment of the present application, the gradient represents the degree of spatial variation of light intensity. A larger gradient value indicates a more drastic change in light intensity, which usually corresponds to an edge area in an image.
[0078] In the embodiment of the present application, the forward difference method or the backward difference method can be used to calculate the gradient. When calculating the gradient, different calculation formulas can be set according to the usage scenario. The calculation formulas may include: The calculation formula of the divergent variable weight type is as follows: ; The gradient calculation formula of the centralized variable weight type is as follows: ; The gradient calculation formula of the fixed weight type is as follows: ; Among them, X is the target pixel point (coordinate), Y is the light intensity information, and n is the number of diffuse sampling points. The divergent variable weight calculation formula is suitable for scenes where the light intensity of a single pixel is easily disturbed. The concentrated variable weight gradient calculation formula is suitable for scenes that require precise positioning of the light intensity gradient of a single pixel. The fixed weight gradient calculation formula is suitable for traditional ideal gradient calculation.
[0079] In the embodiment of the present application, a calculation formula can be pre-set according to the usage scenario of the sensor. After obtaining the light intensity information of the sampling point, the corresponding calculation formula can be called to calculate the gradient.
[0080] Step S1033: Obtain a forward discrete gradient sequence based on the gradient of the sampling point.
[0081] In the embodiment of the present application, the gradient values are arranged in sequence along the normal direction according to the sampling points to form a forward discrete sequence G1, G2, ..., Gn. This sequence is the forward discrete gradient sequence. The discrete gradient sequence has a corresponding relationship with the sampled target pixel points. Continuing with the above example, the discrete gradient sequence can be represented by Table 2: Table 2
[0082] The method provided in the embodiment of the present application can capture the changes in light intensity near the edge of the target in more detail by sampling and gradient calculation along the normal direction.
[0083] In some embodiments, step S104 may be implemented by the following steps: Step S1041, multiplying the coordinates of the sampling point and the corresponding gradient to obtain a discrete centroid weight 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; dividing the first summation result by the second summation result to obtain a continuous centroid.
[0084] In the embodiment of the present application, the continuous centroid can be calculated by the following formula: Continuous centroid calculation: ; in, is the gradient of the i-th sampling point, i is the corresponding coordinate, is the starting coordinate of the sampling point, The ending coordinates of the sampling point.
[0085] In the embodiment of the present application, the discrete centroid weights are arranged in order to form a discrete centroid weight sequence.
[0086] Taking the above example, a discrete centroid weight and target pixel point corresponding relationship table provided by the text application embodiment of Table 3 is shown in Table 3. Table 3
[0087] In the embodiment of the 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.
[0088] The method provided by the embodiment of the application multiplies the coordinates of the sampling points and the corresponding gradients to obtain discrete centroid weights 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 accuracy of edge positioning.
[0089] In some embodiments, step S105 can be implemented by the following steps: Step S1051, determining a first position of the continuous centroid.
[0090] In the embodiment of the application, after the continuous centroid is determined, the first position can also be determined, and the first position can be considered as the position of the target edge.
[0091] Step S1052, obtaining a second position of the continuous centroid determined in the previous frame of image information.
[0092] In the embodiment of the application, for the previous frame of image information, the continuous centroid can also be determined in the above manner to obtain the second position. The second position is the position of the target edge when the previous frame of image information is collected.
[0093] Step S1053, determining a centroid offset based on the first position and the second position.
[0094] In the embodiment of the application, the first position can be subtracted from the second position to obtain the centroid offset.
[0095] 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.
[0096] Step S1054, multiplying the continuous centroid offset by the pixel size of the sensor to obtain the displacement offset of the target edge.
[0097] In the embodiments of the present application, the sensor pixel size is typically provided by the sensor manufacturer or can be determined through calibration or other methods. Assuming the sensor pixel sizes are px (horizontal pixel size) and py (vertical pixel size), the continuous centroid offsets (Δx, Δy) are multiplied by the corresponding pixel sizes to obtain the horizontal and vertical displacements (dx, dy) of the continuous centroid.
[0098] Continuing with the above example, assuming 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. The displacement calculation accuracy is within μm, and the resolution can reach 0.1um. Assuming 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, which can also achieve a resolution of less than 1um.
[0099] In the method provided in the embodiment of the present application, the image coordinates are usually discrete pixel coordinates, but in practical applications it is often necessary to know the displacement of objects or features in the actual physical space. By multiplying the continuous center of mass offset by the pixel size of the sensor, the change in the center of mass position in the image can be converted into a displacement offset in the actual physical space, providing an accurate data basis for subsequent physical quantity measurement, motion analysis, etc. The calculation of the continuous center of mass has taken into account the gradient information and interpolation processing, and can more accurately reflect the change in the center of mass position. On this basis, multiplying by the precise pixel size for conversion can further improve the measurement accuracy of the displacement offset and reduce the error caused by coordinate conversion.
[0100] In the embodiments of the present application, the offset can be directly calculated using the concept of pixel size. However, in reality, the optical lens group imaging at the transmitting end is not an absolutely ideal parallel light spot, 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: Step S1055: obtaining a pre-calibrated fitting formula, wherein the fitting formula includes: a calculation relationship between displacement and continuous centroid.
[0101] In an embodiment of the present application, a set of known data (in this scenario, the continuous center of mass and the corresponding actual displacement of equal-spaced movement) can be fitted using mathematical methods (such as least squares method, polynomial fitting, etc.) to obtain a mathematical expression that can describe the relationship between the independent variable (continuous center of mass) and the dependent variable (displacement).
[0102] In an embodiment of the present application, the object to be measured can be precisely controlled to move at known equal intervals in an experimental environment. For example, in an optical measurement system, a high-precision translation stage can be used to move the object to be measured to ensure that the reference displacement of each movement is accurate and known. After each movement of the object to be measured, the discrete centroid weight sequence mentioned above is calculated based on the gradient sequence, and then the continuous centroid is obtained by interpolation processing. The continuous centroid corresponding to the object to be measured at this time is detected and recorded, and 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.
[0103] In an embodiment of the present application, the sample object to be tested can be controlled to move at equal intervals, and the image information corresponding to each reference displacement and the actual displacement of the sample object to be tested during the equal interval movement can be detected; based on the image information corresponding to each reference displacement, the continuous centroid of the target edge corresponding to each reference displacement is determined; based on the continuous centroid corresponding to each reference displacement and the actual displacement, fitting is performed to obtain the fitting formula.
[0104] For example, the reference displacement with equal spacing is 200 μm. Table 4 is a corresponding relationship table between a continuous centroid and a reference displacement provided in an embodiment of the present application, as shown in Table 4: Table 4
[0105] By controlling the sample to be tested to move at equal intervals, the actual displacement can be measured. The fitting formula is obtained by fitting the actual displacement with the continuous center of mass. The fitting formula is as follows: X=A*fC 4 +B*fC 3 +C*fC 2 +D*fC, where A, B, C, and D are the coefficients obtained by fitting.
[0106] Step S1056: Input the continuous centroid into a fitting formula to calculate the displacement of the target edge.
[0107] In the embodiment of the present application, the displacement of the target edge can be calculated using a fitting formula.
[0108] Step S1057 : obtaining a displacement offset of the target edge based on the displacement of the target edge and the reference displacement corresponding to the continuous centroid.
[0109] In the embodiment of the present application, the displacement of the continuous center of mass can be subtracted from the reference displacement corresponding to the continuous center of mass to obtain the displacement offset.
[0110] For example, Table 5 is a schematic table for determining a displacement offset provided in an embodiment of the present application, as shown in Table 5: Table 5
[0111] As shown in Table 5, the displacement offset can be obtained by using the fitting formula of the continuous center of mass to map the displacement minus the reference displacement corresponding to the continuous center of mass.
[0112] Based on the above embodiments, the present invention further provides a method for detecting position offset. Figure 4 A schematic diagram of the implementation flow of another method for detecting position offset provided in an embodiment of the present application is shown as follows: Figure 4 Shown, including: Step S401: The image sensor is exposed to obtain image information.
[0113] In an embodiment of the present application, the laser can be controlled to turn on synchronously, so as to obtain image information through exposure of the image sensor. After obtaining the image information, the image information can be temporarily stored. After temporarily storing the image information, the laser system can be turned off.
[0114] In step S402 , the positions and polarities of all edges on the image are roughly determined by using threshold detection and threshold filtering.
[0115] Step S403: selecting edges that require secondary calculation according to measurement requirements.
[0116] In the embodiment of the present application, the measurement requirements may include: edge offset measurement, inner diameter offset measurement, diameter offset measurement, glass offset measurement, multiple object offset measurement, etc. The edge of the secondary calculation here may be the target edge in the above embodiment.
[0117] Step S404: collecting edge samples at edge positions to construct a forward discrete gradient sequence.
[0118] Step S405 , performing gradient discrete centroid calculation based on the obtained discrete gradient sequence, converting the discrete centroid into a valid continuous centroid, and thereby determining the position of the continuous centroid.
[0119] Step S406: Calculate the offset position based on the continuous centroids.
[0120] In the embodiment of the present application, the offset position can be calculated by continuous centroids and fitting formulas, or by continuous execution positions corresponding to two pieces of image information.
[0121] Step S407: Calculate the compensation value based on the diffraction compensation model.
[0122] In the embodiment of the present application, the diffraction compensation model can be a Fresnel diffraction model. According to the Fresnel diffraction phenomenon, when light passes through an edge / small hole within a limited distance, Fresnel diffraction will occur. When the tooling distance (the distance from the object to the receiver) changes, the diffraction intensity of the edge changes, and the half-wave zone radius of the Fresnel diffraction changes, which means that the edge light intensity information has changed. Therefore, the acquisition of edge light intensity information depends to a certain extent on the value of the tooling distance. The Fresnel diffraction model can be used to compensate for the calculated edge position. The calculation formula of the Fresnel diffraction model can be simplified as: , where X is the half-band wavelength (unit: m), C is a constant (derived from experiments, different usage scenarios have different values, usually derived from experiments), is the wavelength of light, z is the distance from the 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, it is only necessary to study the radius of the half-wave band closest to the edge. When the C value is 1, the complete half-wave band radius can be obtained, but the C value is generally determined by experiments.
[0123] In the embodiment of the present application, the user confirms the distance z value, and the C value is constant at 0.25 (derived from experiments). The distance from the continuous center of mass to the trough of the half-wave band can be obtained, thereby obtaining the compensation value. For example, when the tooling distance is 50mm, the compensation value is approximately 31.86um.
[0124] Step S408 : Compensating the displacement offset based on the compensation value to determine the position offset of the object to be measured.
[0125] The method provided in the embodiment of the present application can detect position offset with high precision and high resolution.
[0126] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0127] According to the aforementioned embodiments, the embodiments of the present application provide a position offset detection device, wherein the modules included in the device and the units included in each module can be implemented by a processor in a computer device; of course, they can also be implemented by a specific logic circuit; during implementation, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0128] The embodiment of the present application provides a position offset detection device, Figure 5 A structural schematic diagram of a position offset detection device provided by the embodiment of the present application is shown in the figure, Figure 5 The position offset detection device 500 comprises: The acquisition module 501 is used for acquiring image information of a to-be-measured object detected by a sensor, and filtering a target edge based on the image information; The sampling module 502 is used for sampling light intensity information of a pixel point on the target edge in a normal direction of the target edge, to obtain light intensity information of a sampling point; The construction module 503 is used for constructing a forward discrete gradient sequence based on the light intensity information of the sampling point; The first calculation module 504 is used for calculating a discrete centroid weight sequence based on the gradient sequence, and determining a continuous centroid based on the discrete centroid weight sequence; The determination module 505 is used for determining a displacement offset of the target edge based on the continuous centroid; The second calculation module 506 is used for acquiring 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; The compensation module 507 is used for compensating the displacement offset based on the compensation value, to determine a position offset of the to-be-measured object.
[0129] In some embodiments, the determination module 505 comprises: The first determination unit is used for determining a first position of the continuous centroid; The first acquisition unit is used for acquiring a second position of the continuous centroid determined in a previous frame of image information; The second determination unit is used for determining a centroid offset based on the first position and the second position; The first calculation unit is used for multiplying the continuous centroid offset by a pixel size of the sensor to obtain the displacement offset of the target edge.
[0130] In some embodiments, the determination module 505 comprises: The second acquisition unit is used for acquiring a fitting formula pre-calibrated, wherein the fitting formula comprises a calculation relationship between a displacement and a continuous centroid; The input unit is used for inputting the continuous centroid into the fitting formula to calculate a displacement of the target edge; The second calculation unit is used for 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.
[0131] In some embodiments, the position offset detection device further comprises: A control module is used to control the sample to be tested to move at equal intervals and detect the image information corresponding to each reference displacement and the actual displacement of the sample to be tested during the equal interval movement; A continuous centroid determination module, configured to determine the continuous centroid of the target edge corresponding to each reference displacement based on image information corresponding to each reference displacement; The fitting module is used to perform fitting based on the continuous center of mass corresponding to each reference displacement and the actual displacement to obtain the fitting formula.
[0132] In some embodiments, the acquisition module includes: a third determining unit, configured to determine light intensity information of each pixel point based on the image information; A third obtaining unit is used to obtain the deviation between each light intensity information and the light intensity threshold; a fourth determining unit, configured to determine the pixel point with the smallest deviation as the target pixel point; A sampling unit, configured to perform sampling within a preset range from the target pixel point to obtain a plurality of target pixel points; A fifth determining unit is configured to determine the target edge based on a plurality of target pixels.
[0133] In some embodiments, the acquisition module includes: a sixth determining unit, configured to determine an initial edge based on the plurality of target pixel points; A fourth obtaining unit, configured to obtain a user's measurement requirements; A screening unit is configured to screen the target edge from the initial edges based on the measurement requirement.
[0134] In some embodiments, a building block comprises: a third calculation unit, configured to calculate the gradient of the sampling point based on the light intensity information of the sampling point; The first obtaining unit is used to obtain a forward discrete gradient sequence based on the gradient of the sampling point.
[0135] In some embodiments, the first computing module includes: The fourth calculation unit is used to multiply the coordinates of the sampling point and the corresponding gradient to obtain discrete center of mass weights to obtain a discrete center of mass weight sequence; sum the discrete center of mass weights in the discrete center of mass 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 center of mass.
[0136] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.
[0137] In addition, the position offset detection device shown above can be a software unit, a hardware unit, or a combination of software and hardware. It can also be integrated into a sensor as an independent pendant, or exist as an independent terminal device.
[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0139] Figure 6 This is a schematic diagram of the structure of the sensor provided in the embodiment of the present application. Figure 6 As shown, the sensor 3 of this embodiment may include: at least one processor 30 ( Figure 6 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 at least one processor 30. When the processor 30 executes the computer program 32, the steps in any of the above-mentioned method embodiments are implemented, or when the processor 30 executes the computer program 32, the functions of the modules / units in the above-mentioned apparatus or system embodiments are implemented.
[0140] For example, computer program 32 may be divided into one or more modules / units, one or more of which are stored in memory 31 and executed by processor 30 to implement the present application. One or more modules / units may be a series of computer program 32 instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of computer program 32 in sensor 3.
[0141] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program 32. When the computer program 32 is executed by the processor 30, the steps in the above-mentioned method embodiments can be implemented.
[0142] An embodiment of the present application provides a computer program product. When the computer program product runs on a sensor, the sensor can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0143] If the integrated unit is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the process steps in the above-mentioned method embodiments can be implemented by computer program 32 instructing the relevant hardware. Computer program 32 can be stored in a computer-readable storage medium. When executed by processor 30, computer program 32 can implement the steps of each of the above-mentioned method embodiments. Computer program 32 includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. Computer-readable media can include at least: any entity or device capable of carrying computer program code to a terminal, recording media, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, removable hard drives, magnetic disks, or optical disks. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electric carrier signals or telecommunication signals.
[0144] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0145] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0146] In the embodiments provided in this application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0147] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0148] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for detecting position offset, characterized in that: include: Acquiring image information of the object to be detected by the sensor, and screening the target edge based on the image information; Sampling light intensity information of pixel points at the edge of the target along a normal direction of the edge of the target to obtain light intensity information of the sampling points; Construct 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; Determining a displacement offset of the target edge based on the continuous centroids; Obtaining a distance between a receiver of the sensor and the object to be measured, and calculating a compensation value based on the distance and a diffraction compensation model; The displacement offset is compensated based on the compensation value to determine the position offset of the object to be measured.
2. The method according to claim 1, characterized in that The determining of the displacement offset of the target edge based on the continuous centroids includes: determining a first position of the continuous centroid; Obtaining a second position of the continuous centroid determined in the previous frame of image information; determining a center of mass offset based on the first position and the second position; The displacement offset of the target edge is obtained by multiplying the continuous centroid offset by the pixel size of the sensor.
3. The method according to claim 1, characterized in that The determining of the displacement offset of the target edge based on the continuous centroids includes: Obtaining a pre-calibrated fitting formula, wherein the fitting formula includes: a calculation relationship between displacement and continuous center of mass; Inputting the continuous centroid into a fitting formula to calculate the displacement of the target edge; Based on the displacement of the target edge and the reference displacement corresponding to the continuous centroid, the displacement offset of the target edge is obtained.
4. The method according to claim 3, characterized in that The method further comprises: Controlling the sample to be tested to move at equal intervals, and detecting the image information corresponding to each reference displacement and the actual displacement of the sample to be tested during the equal interval movement; Determine the continuous centroid of the target edge corresponding to each reference displacement based on the image information corresponding to each reference displacement; The fitting formula is obtained by performing fitting based on the continuous centroid corresponding to each reference displacement and the actual displacement.
5. The method according to claim 1, wherein The screening of target edges based on the image information includes: determining light intensity information of each pixel based on the image information; Obtaining the deviation between each light intensity information and the light intensity threshold; The pixel with the smallest deviation is determined as the target pixel; Sampling is performed within a preset range from the target pixel point to obtain multiple target pixel points; The target edge is determined based on a plurality of target pixel points.
6. The method according to claim 5, characterized in that The determining the target edge based on a plurality of target pixels includes: determining an initial edge based on the plurality of target pixels; Obtain user measurement requirements; The target edge is selected from the initial edges based on the measurement requirement.
7. The method according to claim 1, characterized in that The constructing of a forward discrete gradient sequence based on the light intensity information of the sampling points includes: Calculate the gradient of the sampling point based on the light intensity information of the sampling point; The forward discrete gradient sequence is obtained based on the gradient of the sampling points.
8. The method according to claim 1, characterized in that The step of calculating a discrete centroid weight sequence based on the gradient sequence and determining a continuous centroid based on the discrete centroid weight sequence comprises: 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.
9. A position offset detection device, characterized in that: include: An acquisition module, configured to acquire image information of the object to be detected by the sensor, and filter target edges based on the image information; A sampling module, configured to sample light intensity information of pixel points at the edge of the target along a normal direction of the edge of the target to obtain light intensity information of the sampling points; A construction module for constructing a forward discrete gradient sequence based on the light intensity information of the sampling points; A 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; a determination module, configured to determine a displacement offset of the target edge based on the continuous centroids; A second calculation module is used to obtain the distance between the receiver of the sensor and the object to be measured, and calculate a compensation value based on the distance and a diffraction compensation model; A compensation module is used to compensate the displacement offset based on the compensation value to determine the position offset of the object to be measured.
10. A sensor comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Displacement sensor, displacement measurement method, displacement measurement program and storage medium
JP2016090340A