Displacement detection method, system, apparatus, electronic device, and storage medium

CN116222396BActive Publication Date: 2026-09-11ARCSOFT CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211551631.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2026-09-11
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

然而,该方案需要在机械系统上安装精细印刷的编码标尺,且编码标尺需要安装在随待进行位移测量的物体移动而同步移动的移动导轨机构上,工艺要求高、操作难度大

Benefits of technology

[0073] Compared with related technologies, this application calculates the actual displacement value of a moving object based on the arrangement pattern of the coded columns of the coded pattern in the displacement detection image. Since the coded pattern is directly attached to the surface of the moving object, no additional moving guide rail is required, making it simple and convenient to achieve synchronous movement of the coded pattern as the moving object moves. Based on this, it solves the problem of high process requirements and operational difficulty in related technologies that rely on installed moving guide rails for displacement measurement. In this embodiment, calculating the actual displacement value based on the coded pattern not only reduces process requirements and simplifies operation, but also achieves higher accuracy in the actual measurement value due to the higher precision of each coded column.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116222396B_ABST
    Figure CN116222396B_ABST
Patent Text Reader

Abstract

This application relates to a displacement detection method, system, apparatus, electronic device, and storage medium. The displacement detection method includes acquiring a displacement detection image containing at least a portion of a coded pattern. The coded pattern is attached to the surface of a moving object to be displaced and includes multiple regularly arranged coded columns. In the displacement detection image, a current coded measurement value of the moving object relative to a preset reference is calculated based on the arrangement information of the coded columns. Based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value, the actual displacement value of the moving object relative to the preset reference is calculated. This method solves the problems of high process requirements and difficult operation in related technologies, reduces process requirements, and simplifies operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to image processing technology, and more particularly to a displacement detection method, system, apparatus, electronic device, and storage medium. Background Technology

[0002] In engineering machine measurement and control systems, the need for motion control based on measuring the linear displacement of mechanical systems is widespread. To achieve this measurement, specialized linear displacement sensors have emerged, such as potentiometer-type displacement sensors, draw-wire displacement sensors, angular displacement sensors, linear variable differential transformers (LVDTs), and other displacement sensors. However, in practical applications, installing these specialized linear displacement sensors typically requires reserving installation interfaces and modifying existing equipment, resulting in high costs, poor flexibility, and limited applicability.

[0003] To overcome this problem, a vision-based non-contact optical displacement measurement system has been proposed. During displacement measurement, light emitted from a punctured light source of the optical displacement measurement system passes through a coded scale to reach an image detector. A moving guide mechanism causes the coded scale to shift. The coded scale can have wide and narrow barcodes, such as... Figure 1 As shown, wide barcodes represent 1, narrow barcodes represent 0, and the interval between adjacent barcodes is d. After processing the acquired image information, the processor obtains the integer and fractional parts of the position coordinates. Combining these two parts yields the complete position coordinates. However, this scheme requires the installation of a finely printed coded scale on the mechanical system. Furthermore, the coded scale needs to be mounted on a moving guide mechanism that moves synchronously with the object being displaced, resulting in high technological requirements and operational difficulty.

[0004] Currently, no effective solution has been proposed for the problem that displacement measurement in related technologies requires the use of pre-installed moving guide rails, which leads to high process requirements and operational difficulties. Summary of the Invention

[0005] This application provides a displacement detection method, system, device, electronic device, and storage medium, which reduces the complexity of displacement detection implementation.

[0006] In a first aspect, this application provides a displacement detection method, the method comprising:

[0007] A displacement detection image is acquired, wherein the displacement detection image contains at least a portion of a coded pattern, the coded pattern being attached to the surface of the moving object to be displacement detected, and including multiple regularly arranged coded columns;

[0008] In the displacement detection image, the current coded measurement value of the moving object relative to a preset reference is calculated based on the arrangement information of the coded columns, wherein the current coded measurement value is the displacement value calculated based on the number of coded columns;

[0009] Based on the current encoded measurement value and the proportional relationship between the current encoded measurement value and the actual displacement value, the actual displacement value of the moving object relative to the preset reference is calculated.

[0010] In some embodiments, the row direction of the coded pattern is consistent with the movement direction of the moving object, the column direction of the coded pattern is perpendicular to the row direction, and the coded values ​​of two adjacent coded columns are different.

[0011] In some embodiments, calculating the current coded measurement value of the moving object relative to a preset reference based on the arrangement information of the coded columns in the displacement detection image includes:

[0012] Determine a first coded measurement value for the target column in the displacement detection image, wherein the first coded measurement value is the absolute coded distance of the target column relative to the preset reference;

[0013] A second coded measurement value is determined based on the lateral coded distance from the imaging center of the image acquisition device to the target column in the displacement detection image, wherein the image acquisition device is used to acquire the displacement detection image;

[0014] The current coded measurement value of the moving object is determined based on the first coded measurement value and the second coded measurement value.

[0015] In some embodiments, determining the second coded measurement value based on the lateral coded distance from the imaging center of the image acquisition device to the target column in the displacement detection image includes:

[0016] Determine the first abscissa of the imaging center on the displacement detection image;

[0017] Determine the second abscissa of the target column on the displacement detection image;

[0018] The second encoding measurement value is calculated based on the difference between the first and second horizontal coordinates and the unit width of the encoded column in the row direction.

[0019] In some embodiments, the method for obtaining the second horizontal coordinate and the unit width includes:

[0020] Determine the abscissa corresponding to each coded column in the displacement detection image, wherein the distance between the coded column and the target column has a linear relationship with the abscissa of the coded column, and the second abscissa and the unit width are parameters of the linear relationship;

[0021] A system of linear equations is determined based on the x-coordinates of the multiple coded columns, the distance between each coded column and the target column, and the linear relationship.

[0022] Solve the system of linear equations to obtain the second abscissa and the unit width.

[0023] In some embodiments, determining the abscissa corresponding to each coded column in the displacement detection image includes:

[0024] The projection value of each column pixel in the displacement detection image in the row direction is determined based on the pixel value of each pixel in the displacement detection image.

[0025] Using the row direction as the horizontal axis, the projection curve is determined based on the projection values ​​of each column of pixels in the row direction;

[0026] The x-coordinates of each coded column are determined based on the x-coordinates of the abrupt changes on the projection curve.

[0027] In some embodiments, the encoding pattern includes an encoding area and a positioning area, the positioning area extending along the row direction, and the positioning area and the encoding area arranged sequentially in the column direction.

[0028] In some embodiments, the coding column includes multiple coding units, and the height of the positioning area is proportional to the height of the coding unit.

[0029] In some embodiments, acquiring the displacement detection image includes:

[0030] The positioning region is identified in the initial displacement detection image;

[0031] The boundary of the coded region in the initial displacement detection image is determined based on the positioning region;

[0032] The initial displacement detection image is cropped according to the boundary of the coded region to obtain an effective coded image as the final displacement detection image.

[0033] In some embodiments, identifying the localization region in the initial displacement detection image includes:

[0034] Multiple scattered first line segments are obtained from the initial displacement detection image. The multiple first line segments are clustered and fused to determine multiple fused second line segments.

[0035] Based on the filtering conditions determined by the location information of the positioning area, multiple second line segments are filtered to obtain one or more target line segment groups;

[0036] The positioning area in the initial displacement image is determined based on the position and size information of at least one of the target line segment groups.

[0037] In some embodiments, the positioning area is divided into multiple positioning sub-regions in the column direction; determining the boundary of the coding region in the initial displacement detection image based on the positioning area includes:

[0038] Calculate the height value of the positioning sub-region determined by the target line segment group based on the positioning identifiers of different line segments in the target line segment group;

[0039] The positioning marker of the image near the center of the initial displacement detection image is shifted by a preset distance in the column direction towards the center of the image to obtain the boundary marker of the encoding area;

[0040] The boundaries of the coded regions in the initial displacement detection image are determined based on multiple boundary identifiers.

[0041] In some embodiments, calculating the height value of the positioning sub-region determined by the target line segment group based on the positioning identifiers of different line segments in the target line segment group includes:

[0042] The multiple intersection points of the target line segment group and the edge of the initial displacement detection image are all used as the positioning markers;

[0043] The reference height value of the positioning sub-region is determined based on the positioning identifier in the same column of the target line segment group;

[0044] The height value of the positioning sub-region is determined based on the weighted calculation result of multiple reference height values.

[0045] In some embodiments, the encoded values ​​of each encoded column in the encoded pattern are all different; or,

[0046] In the coding pattern, each coding column cycles according to a preset rule, and there is a displacement marker between two cycles, wherein the displacement marker is used to indicate the order of the cycles.

[0047] In some embodiments, the method for obtaining the proportional relationship between the current coded measurement value and the actual displacement value includes:

[0048] Determine the maximum displacement range of the moving object;

[0049] When the moving object is at the starting point of the maximum displacement range, calculate the starting point encoded measurement value of the moving object relative to the preset reference.

[0050] When the moving object is at the end of the maximum displacement range, calculate the end-point encoded measurement value of the moving object relative to the preset reference.

[0051] Based on the actual length of the maximum displacement range, the starting point coded measurement value, and the ending point coded measurement value, determine the proportional relationship between the current coded measurement value and the actual displacement value.

[0052] In some embodiments, after acquiring the displacement detection image, the method further includes:

[0053] A first reference coding column is determined from multiple coding columns in the displacement detection image, and a coding column in a preset coding sequence whose coding value is the same as the coding value of the first reference coding column is determined as a second reference coding column;

[0054] The sorting of the first reference coding column is corrected to the sorting of the second reference coding column in the preset coding sequence, and the sorting of other coding columns in the displacement detection image is determined sequentially according to the corrected sorting of the first reference coding column.

[0055] Calculate the difference between the displacement detection image and two coded columns with the same order in the preset coding sequence, and determine the sum of differences corresponding to the first reference coded column based on the differences between all coded columns;

[0056] By sequentially using all the coded columns in the displacement detection image as the first reference coded columns, multiple difference sums are obtained, and the minimum difference sum is determined among the multiple difference sums;

[0057] The first reference coding column corresponding to the minimum difference is regarded as the true value coding column. Based on the sorting result determined by the true value coding column, the coding column in the displacement detection image is corrected to the coding column with the same sorting in the preset coding sequence.

[0058] Secondly, embodiments of this application provide a displacement detection system, the system including an coded pattern, an imaging device, and a processor;

[0059] The coded pattern is attached to the surface of the moving object to be displaced and includes multiple regularly arranged coded columns.

[0060] The imaging device is used to acquire a displacement detection image containing at least a portion of the coded pattern;

[0061] The processor is configured to calculate, in the displacement detection image, the current coded measurement value of the moving object relative to a preset reference based on the arrangement information of the coded columns, and calculate the actual displacement value of the moving object relative to the preset reference based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value, wherein the current coded measurement value is the displacement value calculated based on the number of coded columns.

[0062] In some embodiments, the imaging device includes a light source, an optical path conversion component, and an image acquisition device;

[0063] The imaging light emitted by the light source reaches the coded pattern through the optical path conversion component. The first reflected ray of the imaging light after being reflected by the coded pattern reaches the optical path conversion component. The second reflected ray of the first reflected ray after being reflected again by the optical path conversion component reaches the image acquisition device.

[0064] In some embodiments, the light source is a diffused light source; and / or,

[0065] The optical path conversion component is a semi-transparent, semi-reflective mirror; and / or,

[0066] The optical axis of the image acquisition device is coaxial with the optical axis of the second reflected light.

[0067] Thirdly, embodiments of this application provide a displacement detection device, including an acquisition module, an encoding calculation module, and a displacement calculation module;

[0068] The acquisition module is used to acquire a displacement detection image, wherein the displacement detection image contains at least a portion of a coding pattern, the coding pattern is attached to the surface of the moving object to be displaced, and includes multiple regularly arranged coding columns;

[0069] The encoding calculation module is used to calculate the current encoded measurement value of the moving object relative to a preset reference in the displacement detection image based on the arrangement information of the encoding columns, wherein the current encoded measurement value is the displacement value calculated based on the number of encoding columns;

[0070] The displacement calculation module is used to calculate the actual displacement value of the moving object relative to the preset reference based on the current encoded measurement value and the proportional relationship between the current encoded measurement value and the actual displacement value.

[0071] Fourthly, embodiments of this application provide an electronic device including a processor and a memory, the memory being used to store executable instructions of the processor; the processor is configured to execute the displacement detection method as described in any of the first aspects above by executing the executable instructions.

[0072] Fifthly, embodiments of this application provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the displacement detection method as described in any of the first aspects above.

[0073] Compared with related technologies, this application calculates the actual displacement value of a moving object based on the arrangement pattern of the coded columns of the coded pattern in the displacement detection image. Since the coded pattern is directly attached to the surface of the moving object, no additional moving guide rail is required, making it simple and convenient to achieve synchronous movement of the coded pattern as the moving object moves. Based on this, it solves the problem of high process requirements and operational difficulty in related technologies that rely on installed moving guide rails for displacement measurement. In this embodiment, calculating the actual displacement value based on the coded pattern not only reduces process requirements and simplifies operation, but also achieves higher accuracy in the actual measurement value due to the higher precision of each coded column.

[0074] Other features and advantages of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the application. Other advantages of this application can be realized and obtained by means of the solutions described in the description and the accompanying drawings. Attached Figure Description

[0075] The accompanying drawings are used to provide an understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.

[0076] Figure 1 This is a schematic diagram of a vision-based non-contact optical displacement measurement system in related technologies;

[0077] Figure 2 This is a schematic diagram illustrating an application scenario of the displacement detection method according to an embodiment of this application;

[0078] Figure 3 This is a flowchart of a displacement detection method according to an embodiment of this application;

[0079] Figure 4 This is a schematic diagram of an encoding pattern according to an embodiment of this application;

[0080] Figure 5 This is a flowchart of a method for obtaining current encoded measurement values ​​according to an embodiment of this application;

[0081] Figure 6 This is a flowchart of a method for determining a second encoded measurement value according to an embodiment of this application;

[0082] Figure 7This is a schematic diagram illustrating the calculation of the horizontal coordinate of the encoded column according to an embodiment of this application;

[0083] Figure 8 This is a schematic diagram of the projection curve according to an embodiment of this application;

[0084] Figure 9 This is a schematic diagram of the positioning area and the encoding area according to an embodiment of this application;

[0085] Figure 10 This is a flowchart of a method for acquiring displacement detection images according to an embodiment of this application;

[0086] Figure 11 This is a schematic diagram illustrating the location area identification according to an embodiment of this application;

[0087] Figure 12 This is a schematic diagram of the imaging range according to an embodiment of this application;

[0088] Figure 13 This is a flowchart of a method for confirming the boundary of the encoding area according to an embodiment of this application;

[0089] Figure 14 This is a schematic diagram of obtaining the encoding area according to an embodiment of this application;

[0090] Figure 15 This is a flowchart of a method for obtaining proportional relationships according to an embodiment of this application;

[0091] Figure 16 This is a flowchart of a displacement detection method according to a preferred embodiment of this application;

[0092] Figure 17 This is a structural block diagram of a displacement detection system according to an embodiment of this application;

[0093] Figure 18 This is a schematic diagram of the imaging device according to an embodiment of this application;

[0094] Figure 19 This is a structural block diagram of a displacement detection device according to an embodiment of this application. Detailed Implementation

[0095] This application describes several embodiments, but these descriptions are exemplary and not restrictive, and it will be apparent to those skilled in the art that many more embodiments and implementations are possible within the scope of the embodiments described herein. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with, or may replace, any feature or element of any other embodiment.

[0096] This application includes and contemplates combinations of features and elements known to those skilled in the art. The embodiments, features, and elements disclosed in this application may also be combined with any conventional features or elements to form a unique inventive scheme as defined by the claims. Any feature or element of any embodiment may also be combined with features or elements from other inventive schemes to form another unique inventive scheme as defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in this application may be implemented individually or in any suitable combination. Therefore, the embodiments are not limited except by the limitations imposed by the appended claims and their equivalents. Furthermore, various modifications and changes may be made within the scope of the appended claims.

[0097] Furthermore, in describing representative embodiments, the specification may have presented methods and / or processes as a specific sequence of steps. However, the method or process should not be limited to the specific order of steps described herein, to the extent that it does not depend on such a specific order. As will be understood by those skilled in the art, other sequences of steps are also possible. Therefore, the specific order of steps set forth in the specification should not be construed as a limitation of the claims. Moreover, the claims concerning the method and / or process should not be limited to the steps performed in the written order, and those skilled in the art will readily understand that these orders can be varied and still remain within the spirit and scope of the embodiments of this application.

[0098] The displacement detection method provided in this application can be applied to, for example... Figure 2 The application environment shown. Figure 2 This is a schematic diagram illustrating an application scenario of the displacement detection method according to an embodiment of this application, such as... Figure 2As shown, the moving object 21 to be displaced is coated with a coded pattern 22. During the movement of the moving object 21 along the displacement direction, the imaging device 23 images the moving object 21 and the coded pattern 22 to obtain a displacement detection image. An image processing device (not shown) calculates the actual displacement value based on the coded pattern 22 in the displacement detection image. The image processing device can be, but is not limited to, various personal computers, laptops, tablets, standalone servers, or server clusters composed of multiple servers.

[0099] In some of these embodiments, Figure 3 This is a flowchart of a displacement detection method according to an embodiment of this application, such as... Figure 3 As shown, the method includes:

[0100] Step S301: Obtain a displacement detection image, wherein the displacement detection image contains at least a portion of a coding pattern, the coding pattern is attached to the surface of the moving object to be displaced, and includes multiple regularly arranged coding columns.

[0101] In this embodiment, displacement detection images can be acquired using image acquisition devices such as cameras. Specifically, the image acquisition device can be a common visible light imaging camera or an infrared camera. The color of the encoded pattern can also vary depending on the type of image acquisition device. For example, the encoded pattern can be in black and white. Depending on the imaging conditions and detection accuracy requirements, the black and white binary encoding method can be extended to encoding schemes using different gray levels or other color bases. Different color information can also be used to increase the complexity of the encoded pattern. When using black and white to implement the encoded pattern, the light source can be selected from appropriate infrared light, monochromatic light, or white light based on the target material. When using a colored encoded pattern, the light source can be selected from white light or multiple images can be taken using different monochromatic lights for each measurement, depending on the color of the encoded pattern. In this embodiment, black and white refer to the fact that each pixel in the image signal ultimately captured by the image acquisition device can be distinguished into two categories based on brightness. This can be achieved by printing two colors of different brightness or spraying coatings of different materials to make different areas of the encoded pattern have different reflectivities, thus obtaining an image signal containing black and white.

[0102] For example, the coded pattern includes two coded units with different brightness but the same size, such as... Figure 4 As shown, the two types of encoding units can be implemented by filling cells with two colors of different brightness, or by spraying cells with two different spraying materials with different reflectivities. Each column in the encoding pattern is an encoding column. In the figure, h represents the height of the encoding unit, and t represents the width of the encoding unit.

[0103] The coded pattern can be directly attached to the surface of a moving object by means of printing, spraying, or etching. Alternatively, it can be attached to a medium (such as plastic film, paper, or cloth) and come into contact with the surface of the moving object. It can be a planar two-dimensional barcode, binary code, or other similar pattern, and is easy to install on existing systems, adding measurement functionality. Preferably, the length of the coded pattern needs to be greater than or equal to the distance the moving object needs to travel, so that the movement of the moving object can be calculated in real time during its movement.

[0104] Displacement detection images are images captured by image acquisition devices at the moment when displacement detection of a moving object is required. They contain some or all of the coded patterns. Because the coded patterns are in the form of a cell array with regular arrangement between the coded columns, the displacement value can be calculated based on the pattern between the coded columns. It should be noted that the arrangement pattern between the coded columns can be set according to the moving range of the object and / or the required measurement accuracy of the actual displacement value.

[0105] Step S302: In the displacement detection image, calculate the current coded measurement value of the moving object relative to the preset reference based on the arrangement information of the coded columns, wherein the current coded measurement value is the displacement value calculated based on the number of coded columns.

[0106] Specifically, the coding columns of the coding pattern can represent numerical values. In this embodiment, the arrangement information of the coding columns can be the changing pattern of each numerical value. For example, if the numerical values ​​of each coding column increase in the direction of movement, then the displacement value can be calculated based on the increasing numerical value.

[0107] In this embodiment, the preset reference is the starting point for calculating the actual displacement value. It can be set at the initial position of the moving object, the starting point of the coded pattern, or a point in the moving path.

[0108] The coded measurement value is a displacement value related to the coded value or number of coded columns. For example, if the coded values ​​of adjacent coded columns increase by 1, and there are 10 coded columns between two positions, the coded measurement value between these two positions is 10. In this embodiment, the current coded measurement value is the coded measurement value between the current position of the moving object and a preset reference.

[0109] Step S303: Calculate the actual displacement value of the moving object relative to the preset reference based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value.

[0110] In this embodiment, the actual displacement value differs from the coded measurement value; it is a displacement value calculated using actual length units such as millimeters or centimeters. Since the position and size of the coded pattern are fixed after it is attached to the surface of the moving object, there is a fixed proportional relationship between the length of the coded pattern in the direction of movement and the actual distance the moving object needs to move. This proportional relationship can be calculated through a preset calibration process. Based on this proportional relationship and the coded measurement value, the actual displacement value of the moving object can be calculated.

[0111] Through steps S301 to S303, this embodiment calculates the actual displacement value of a moving object based on the arrangement information of the coded columns of the coded pattern in the displacement detection image. Since the coded pattern is directly attached to the surface of the moving object, it easily and conveniently achieves the function of synchronously moving the coded pattern with the moving object, thus eliminating the need for an additional moving guide rail. Furthermore, as the moving object moves, the coded pattern attached to the object's surface is captured, thereby achieving the purpose of obtaining the displacement of the moving object based on the coded pattern, providing a non-contact displacement detection method based on an image acquisition device. Based on this, it solves the problem of high process requirements and operational difficulty in related technologies that rely on installed moving guide rails for displacement measurement. In this embodiment, calculating the actual displacement value based on the coded pattern not only reduces process requirements and simplifies operation, but also, due to the higher precision of each coded column, results in higher accuracy in the calculation of the actual measured value.

[0112] It should be noted that in this embodiment, the moving object undergoes linear displacement, moving back and forth along a one-dimensional direction to generate displacement changes. Preferably, the row direction of the encoding pattern is consistent with the direction of movement of the moving object, the column direction of the encoding pattern is perpendicular to the row direction, and the encoding values ​​of two adjacent encoding columns are different. In this embodiment, the different encoding values ​​of two adjacent encoding columns are beneficial for identifying two different encoding columns in the displacement detection image, further improving the accuracy of displacement detection.

[0113] Furthermore, the displacement detection method in this embodiment is applicable to both planar and curved surfaces. When the surface of the moving object is curved, only an adaptive change to the encoding pattern is needed. For example, on the one hand, given that the initial encoding pattern is already determined, when attaching the encoding pattern to the curved surface, the projection of the encoding pattern on the imaging plane needs to be the same as the initial encoding pattern. On the other hand, the shape of the encoding pattern in the attached state can also be modified according to the shape of the moving object's surface, such as a curved surface or other regular or irregular shapes, to ensure that the encoding pattern falls on a plane perpendicular to the optical axis of the image acquisition device. This helps to eliminate the influence of inconsistent heights of different encoding units in the same column after imaging the encoding pattern on a curved surface or other non-planar surface on image processing decoding.

[0114] In this application, the actual displacement value of the moving object is the absolute displacement relative to a preset reference. In some embodiments, the current coded measurement value consists of two parts: a first coded measurement value and a second coded measurement value. The first coded measurement value is the absolute coded distance of the target column in the displacement detection image relative to the preset reference, and the second coded measurement value is the lateral coded distance from the imaging center to the target column in the displacement detection image. Figure 5 This is a flowchart of a method for obtaining current encoded measurement values ​​according to an embodiment of this application, such as... Figure 5 As shown, the method includes the following steps:

[0115] Step S501: Determine the first coded measurement value of the target column in the displacement detection image, wherein the first coded measurement value is the absolute coded distance of the target column relative to a preset reference.

[0116] Since a coding column comprises multiple coding units, each representing a numerical value, the coding column itself can represent a numerical value. Furthermore, it can also represent the column's order within the entire coding pattern. Therefore, by setting the arrangement of each coding unit in the coding column, the numerical value of each column can represent the coding distance between that column and a preset reference. For example, using black and white as the two most basic coding units to form a coding column, if black represents "0" and white represents "1," and the column length is 4, then there can be multiple coding schemes such as "0001," "0010," and "0011." Arranging different coding schemes according to a pattern yields a coding pattern.

[0117] In this embodiment, the target column is an encoded column in the displacement detection image, used to calculate the first encoded measurement value and the second encoded measurement value. It can be set to any column in the displacement detection image, and the position of the target column is the same in different displacement detection images. Preferably, the target column is the first column in the displacement detection image closest to the origin of the image coordinate system. In other embodiments, the target column can also be set to other encoded columns located in the middle or at the edge of the displacement detection image.

[0118] Step S502: Determine the second coded measurement value based on the lateral coded distance from the imaging center of the image acquisition device to the target column in the displacement detection image, wherein the image acquisition device is used to acquire the displacement detection image.

[0119] In this embodiment, the current coded measurement value and the actual displacement value are calculated based on the imaging center of the image acquisition device. Therefore, when calculating the second coded measurement value, it is necessary to calculate the lateral coded distance from the imaging center to the target column.

[0120] Step S503: Determine the current coded measurement value of the moving object based on the first coded measurement value and the second coded measurement value.

[0121] Having obtained the first coded measurement value between the target column and the preset reference, and the second coded measurement value between the imaging center and the target column, the current coded measurement value between the imaging center and the preset reference can be obtained by summing them.

[0122] By using steps S501 to S503, the information in the coded pattern can be fully utilized to calculate the current coded measurement value more accurately.

[0123] Furthermore, an image coordinate system can be established in the displacement detection image, with the horizontal axis aligned with the direction of movement of the moving object and the vertical axis perpendicular to that direction of movement. Figure 6 This is a flowchart of a method for determining a second encoded measurement value according to an embodiment of this application, as shown below. Figure 6 As shown, the method includes the following steps:

[0124] Step S601: Determine the first abscissa of the imaging center on the displacement detection image.

[0125] The imaging center is generally considered to be at the center of the displacement detection image. Therefore, after establishing a coordinate system in the displacement detection image, the coordinates of the imaging center in the coordinate system can be determined based on the size of the displacement detection image. If the displacement detection image is obtained after correction processing such as stretching, perspective transformation, or affine transformation, the position of the imaging center after correction processing can also be calculated using the parameters of the stretching, perspective transformation, or affine transformation.

[0126] Step S602: Determine the second horizontal coordinate of the target column on the displacement detection image.

[0127] Since the target column has a certain width in the row direction, the x-coordinate of any point on that width can be used as the second x-coordinate.

[0128] Step S603: Calculate the second code measurement value based on the difference between the first and second horizontal coordinates and the unit width of the code column in the row direction.

[0129] In this application, the current encoded measurement value is a displacement value calculated based on the number of encoded columns. Therefore, the second encoded measurement value also needs to be calculated based on the number of encoded columns. In this embodiment, after obtaining the difference between the first and second horizontal coordinates, the number of encoded columns between the first and second horizontal coordinates is calculated based on the unit width of each encoded column in the row direction, thereby determining the second encoded measurement value. As shown in Formula 1:

[0130] x2=(x c Formula 1 -x0) / t

[0131] In Formula 1, x2 represents the second coded measurement value, x c x represents the first horizontal coordinate of the imaging center on the displacement detection image, x0 represents the second horizontal coordinate of the target column on the displacement detection image, and t represents the unit width of the coded column. Since the coding pattern is preset, the unit width of the coded column in the displacement detection image can also be pre-calibrated.

[0132] By using steps S601 to S603 above, the distance between the imaging center and the target column is calculated based on the image information in the displacement detection image, and a more accurate second coded measurement value can be obtained in real time.

[0133] In the coded pattern, the width of each coded column is the same. After imaging, due to image distortion and other reasons, it may be necessary to recalculate the unit width of each coded column in the displacement detection image and at the same time calculate the second horizontal coordinate.

[0134] In some embodiments, an image coordinate system is established in the displacement detection image, and the abscissa corresponding to the end of the width of the coded column closest to the origin of the image coordinate system is used as the abscissa of the coded column. The method for obtaining the second abscissa of the target column and the unit width is as follows: first, determine the abscissa corresponding to each coded column in the displacement detection image. Specifically, when the coded column is composed of coded units of two types of image signals, the boundary of each coded column can be determined according to the change of image signals between adjacent columns.

[0135] Understandably, the greater the distance between the encoded column and the target column, the larger the difference between the x-coordinate of the encoded column and the second x-coordinate of the target column. Therefore, the distance between the encoded column and the target column has a linear relationship with the x-coordinate of the encoded column, while the second x-coordinate and the unit width are parameters for this linear relationship. For example, if we take the encoded column closest to the origin of the image coordinate system as the target column, with a second x-coordinate of x0 and a unit width of t, then the x-coordinate of each encoded column... i = x0 + i × t, where i represents the i-th encoded column calculated from the origin of the image coordinate system. In other embodiments, if the target column is not the encoded column closest to the origin of the image coordinate system, i can have positive or negative values, with negative values ​​indicating that the encoded column is to the left of the target column and positive values ​​indicating that the encoded column is to the right of the target column.

[0136] In displacement detection images, multiple x values ​​can be obtained based on the changes in the image signals of coded units in adjacent coded columns. i And the corresponding i value, and then based on the x-coordinates of multiple coded columns, the distance between each coded column and the target column, and the linear relationship, determine the system of linear equations, as shown in Formula 2:

[0137]

[0138] In this embodiment, since the coding column closest to the origin is used as the target column, the value of i ranges from 1 to n-1, where n represents the number of all coding columns in the displacement detection image.

[0139] Finally, based on x1 to x2 read from the displacement detection image n-1 By finding the value of n and solving the system of linear equations, we can obtain the second x-coordinate and the unit width. It can be seen that solving for x0 and t requires at least two equations, in which case x0 and t can be obtained directly. Preferably, to obtain more accurate x0 and t, the number of equations in the system can be greater than two. In this case, the optimal x0 and t can be obtained using the least squares method, thereby improving the accuracy of measuring the actual displacement of the moving object.

[0140] In some embodiments, the captured displacement detection image can be first converted into a curve of the encoded values ​​of each column of pixels, and then the horizontal coordinate of each encoded column can be calculated. Figure 7 This is a schematic diagram illustrating the calculation of the horizontal coordinate of the encoded column according to an embodiment of this application, as shown below. Figure 7 As shown, an image coordinate system is established with the row direction as the horizontal axis x and the column direction as the vertical axis y.

[0141] First, the projection value of each column of pixels in the displacement detection image along the row direction is determined based on the pixel values ​​of each pixel in the image. The pixel value of each pixel is determined by the image signal provided by the encoding unit; different colors of the encoding units correspond to different image signals. For example, when the encoding column consists of black and white encoding units, black represents a value of "0" and white represents a value of "1". In the displacement detection image, one encoding unit is displayed as several pixels, and the pixel values ​​of all pixels corresponding to a black encoding unit are 0. Similarly, the pixel value of each pixel in the displacement detection image can be read. Specifically, with a black pixel value of 0 and a white pixel value of 255, the average pixel value of each column of pixels in the displacement detection image is calculated, thus obtaining the projection value of that column of pixels along the row direction.

[0142] Next, using the row direction as the horizontal axis, the projection curve is determined as the encoding value curve for each column of pixels based on the projection values ​​of each column of pixels in the row direction. For example, the pixel values ​​of a column of pixels can be added together to obtain the projection value of that column of pixels. By calculating the projection value of each column of pixels in turn, the projection curve can be obtained. Since the encoding unit is rectangular and has a certain width, there will be multiple horizontal line segments in the projection curve, and the two ends of the horizontal line segments will have abrupt changes. In this embodiment, the horizontal coordinate corresponding to the point of abrupt change of each horizontal line segment is used as the horizontal coordinate of the encoding column. Therefore, the horizontal coordinate of each encoding column can be determined based on the horizontal coordinate of the abrupt change of the projection curve. In other embodiments, the horizontal coordinate of any point in the horizontal line segment can also be used as the horizontal coordinate of the corresponding encoding column, as long as the horizontal coordinate of all encoding columns is kept consistent.

[0143] In this embodiment, the projection image of the coded column is first obtained based on the displacement detection image. Then, the second horizontal coordinate and unit width are calculated based on the projection image. If there is a large difference between the unit width obtained from the projection image and the unit width obtained from the coded pattern by the corresponding ratio, it can be considered that there is an abnormality in the image acquisition device or the image processing process, and it can be checked and corrected in time.

[0144] In some embodiments, such as Figure 8 As shown, the projection curve exhibits small fluctuations. Therefore, a fluctuation threshold can be set for filtering to reduce the impact of noise. Furthermore, for incomplete coded columns on both sides of the displacement detection image, filtering can be performed by pre-setting a width threshold, or by filtering based on the unit width t of the calculated coded column. That is, during displacement detection, the calculation starts from the first complete coded column to ensure the accuracy of displacement detection.

[0145] In some embodiments, in order to improve the calculation accuracy and speed of the coded image in the displacement detection image, the coded pattern includes two parts: a coded area and a positioning area. After quickly locating the positioning area from the displacement detection image, the coded area with a preset positional relationship with the positioning area can be quickly located, thereby improving the efficiency and accuracy of obtaining the displacement of the moving object based on the coded area.

[0146] For example, such as Figure 9 As shown, the positioning area extends along the row direction in a long strip shape, ensuring that the positioning function is not easily affected by the movement of moving objects, thus facilitating positioning. Figure 9The dashed boxes in the diagram are for illustrative purposes only and do not belong to the encoding pattern itself. On the other hand, the elongated positioning area is simple and easy to identify, simplifying not only the design complexity of the positioning area but also further simplifying the positioning difficulty. Furthermore, the positioning area and the encoding area are arranged sequentially in the column direction. In this embodiment, the length of the positioning area is greater than or equal to a preset length, facilitating the identification of the positioning area. When decoding the displacement detection image, the range to be decoded is first determined based on the positioning area to more accurately determine the encoding area.

[0147] Specifically, in cases where the encoded pattern includes an encoding area and a positioning area, Figure 10 This is a flowchart of a method for acquiring displacement detection images according to an embodiment of this application, such as... Figure 10 As shown, the method includes the following steps:

[0148] Step S1001: Identify the positioning area in the initial displacement detection image.

[0149] The positioning area can be distinguished from the coding area by special lines, shapes, or colors, such as dashed lines, dotted lines, triangles, dots, QR codes, and colors different from the coding area. These markings can be placed at the boundary of the positioning area or at a preset distance from the boundary of the positioning area. When the above markings are recognized, the range of the positioning area can be determined based on these markings.

[0150] Step S1002: Determine the boundary of the coding area in the initial displacement detection image based on the positioning area.

[0151] Both the positioning area and the encoding area are regular geometric shapes that can be adjacent or spaced at a preset distance to facilitate differentiation in the displacement detection image. Therefore, after identifying the positioning area, the boundary of the encoding area can be determined based on the preset positional relationship between the positioning area and the encoding area.

[0152] Step S1003: The initial displacement detection image is cropped according to the boundary of the coding region to obtain an effective coding image as the final displacement detection image.

[0153] By using steps S1001 to S1003 above, first identifying the positioning area and then identifying the coding area, the accuracy of coding area identification can be improved.

[0154] It should be noted that this embodiment does not limit the number of positioning areas. In the displacement detection image, the positioning area can be set only above or below the encoding area, or it can be set both above and below the encoding area. The positioning area can be continuous or segmented in the row direction. Continuous positioning areas can meet the requirement of acquiring displacement detection images at any time, while the position of segmented positioning areas can be set according to the acquisition frequency of the displacement detection image. The length of the positioning area needs to meet a preset length. Preferably, the length of the continuous positioning area in the row direction is greater than the movement range of the moving object, so as to ensure that the displacement detection image has a positioning area at any position and at any time.

[0155] Furthermore, the height of the positioning area and the height of the encoding unit are in a preset ratio. The height of the positioning area refers to its length in the column direction. When the height of the positioning area and the encoding unit are proportional, it is convenient to determine the position of the encoding area after the positioning area is identified. Preferably, this ratio is 1:1.

[0156] In some embodiments, the positioning area is rectangular, and the boundary of the rectangle can be identified based on the Hough transform, and the positioning area can be identified based on the boundary of the rectangle. Figure 11 This is a schematic diagram of the location area identification according to an embodiment of this application, such as... Figure 11 As shown, in this embodiment, the original displacement detection image acquired by the image acquisition device is used as the initial displacement detection image. Then, multiple scattered first line segments are obtained from the initial displacement detection image by extracting point sets, such as A1A2, A3A4, A5A6, A7A8, and A9A. 10 The initially extracted first line segments need further clustering to avoid detection failures in the localization region. Therefore, the initially extracted first line segments are not necessarily the complete boundaries of the localization region. Thus, multiple first line segments need to be clustered and fused to determine the complete second line segments after fusion. Preferably, before acquiring the first line segments, the initial displacement detection image can be processed based on Canny edge detection. To further optimize performance, the initial displacement detection image can be downsampled before edge detection. After identifying multiple first line segments, first line segments with excessively large angles to the horizontal direction or excessively short lengths can be filtered out before fusion. During clustering and fusion, each first line segment is first converted into the form (a, b), where (a, b) satisfies ax + by + 1 = 0, and (x, y) are the coordinates of points on the line segment in the initial displacement detection image. Then, similar line segment fragments can be further clustered and fused using mean shift or other clustering methods, ultimately merging the same class to obtain several merged second line segments.

[0157] Because the above line segment extraction and fusion process is based on the complete initial displacement detection image, some line segments in the encoding area will also be extracted. Therefore, multiple second line segments need to be filtered according to pre-set filtering conditions to obtain one or more target line segment groups. The filtering conditions are determined by the location information of the positioning area, and the target line segment groups are line segments within the same positioning area. For example, in this embodiment, the positioning area is located above and below the initial displacement detection image. The filtering conditions can be to select second line segments within the preset areas above and below the initial displacement detection image, and remove second line segments from other areas. This process can be implemented based on the coordinates of each second line segment in the image coordinate system. After filtering, the two second line segments closest to the image edge can be considered as a target line segment group. For example, after determining B1B2, B3B4, C1C2, and C3C4 as second line segments, B1B2 and B3B4 are located at the edge position above the initial displacement detection image, and are denoted as one target line segment group. C1C2 and C3C4 are located at the edge position below the initial displacement detection image, and are denoted as another target line segment group.

[0158] Different target line segment groups can locate different positioning areas. Therefore, the positioning area in the initial displacement image is determined based on the position and size information of at least one target line segment group. For example, the target line segment group can be directly used as the boundary of the corresponding positioning area. Alternatively, as in this embodiment, a preset distance can be set between the target line segment group and the boundary of the positioning area. Furthermore, in this embodiment, the length of the line segment in the target line segment group can be used as the length of the positioning area in the row direction. Of course, in other embodiments, the length of the line segment in the target line segment group and the length of the positioning area can also have a numerical relationship such as difference or multiple.

[0159] Typically, to ensure the effective length of the coded region in the initial displacement detection image, the coded region is located in the central region of the initial displacement detection image, while the localization region is located in the edge region. Therefore, different localization regions are separated by the coded region. If a localization region contains multiple target line segment groups, the localization region can be determined based on the target line segment group closest to the edge of the initial displacement detection image and the target line segment group closest to the center of the initial displacement detection image.

[0160] By detecting, fusing, and locating line segments as described above, the location area in the initial displacement detection image can be determined more accurately and quickly.

[0161] In some embodiments, the positioning area is divided into multiple positioning sub-regions along the column direction, and each positioning sub-region is an elongated strip extending along the row direction. It should be noted that positioning areas located at different positions within the encoding area are considered different positioning areas; for example, in... Figure 11In the image, there is a positioning area above the coding area and another positioning area below it. Each positioning area can have its own sub-regions. Since light-colored sub-regions are difficult to identify during image detection, typically only one group of target line segments corresponding to a dark-colored sub-region can be detected. In this case, one group of target line segments defines one positioning sub-region. Then, based on the positional and dimensional relationship between the light-colored and dark-colored sub-regions, the entire positioning area can be determined.

[0162] Furthermore, in order to achieve accurate imaging of the coded pattern and avoid loss of image information, the imaging range of the imaging device can be set to be in a preset proportion to the area of ​​the coded pattern; optionally, the preset proportion range is [70%, 100%]. For example, for Figure 12 The image acquisition device can cover at least the upper boundary of the black positioning sub-region above the coded pattern and the lower boundary of the black stripe of the positioning sub-region below the coded pattern.

[0163] Specifically, when the positioning area includes multiple positioning sub-regions, Figure 13 This is a flowchart of a method for confirming the boundary of the encoding area according to an embodiment of this application, as shown below. Figure 13 As shown, the method includes the following steps:

[0164] Step S1301: Calculate the height value of the positioning sub-region determined by the target line segment group based on the positioning identifiers of different line segments in a target line segment group.

[0165] Any point on either of the two second line segments in the target line segment group can be used as a positioning marker, and the height value of the positioning sub-region can be determined based on the difference in the ordinates of the positioning markers. Preferably, the endpoints of the second line segments can be used as positioning markers for calculation.

[0166] Step S1302: The positioning marker near the center of the image of the initial displacement detection image is shifted by a preset distance in the column direction towards the center of the image to obtain the boundary marker of the coding area.

[0167] In this embodiment, a positioning area includes at least two types of positioning sub-regions that provide different image signals. One type is easily detected during image detection and is denoted as the first type of positioning sub-region, such as a dark-colored positioning sub-region. The other type is not easily detected and is denoted as the second type of positioning sub-region, such as a light-colored positioning sub-region. During image detection, positioning markers are first determined based on the first type of positioning sub-regions. Based on the positional and dimensional relationships between different positioning sub-regions, the positioning markers can be shifted to the boundary between the encoding area and the positioning area. Specifically, for a positioning area located above the encoding area, the positioning markers near the image center are shifted downwards; for a positioning area located below the encoding area, the positioning markers near the image center are shifted upwards.

[0168] The preset distance for translation can be determined based on the distance between the first type of positioning sub-region and the coding area. Preferably, the first type of positioning sub-region, the second type of positioning sub-region, and the coding area are set adjacent to each other. In this case, the preset distance is determined based on the size parameters of the second type of positioning sub-region.

[0169] Step S1303: Determine the boundary of the coded region in the initial displacement detection image based on multiple boundary markers.

[0170] Since the coding region covers the entire row direction, its boundary in the row direction is assumed to be the edge of the initial displacement detection image in the row direction. In this case, the boundary marker can at least determine the boundary of the coding region in the column direction. If the positioning region is continuous in the row direction and its length is greater than or equal to that of the coding region, with the endpoint of the second line segment as the positioning marker, the boundary of the coding region in both the column and row directions can be determined simultaneously based on the translated positioning marker.

[0171] Through the above steps S1301 to S1303, the positioning area is identified based on the positioning sub-regions of different image signals in the positioning area, avoiding the influence of positioning areas with only one type of image signal on the identification of the coding area, and improving the accuracy of the identification of the boundary between the positioning area and the coding area.

[0172] Preferably, adjacent positioning sub-regions have the same height but different encoding values; that is, the first and second types of positioning sub-regions are alternately set. This facilitates rapid identification of the positioning area during the image detection process. If the second type of positioning sub-region is adjacent to the encoding area, it can also reduce the influence of the positioning area on the encoding area during image cropping. (Reference) Figure 14 The initial displacement detection image includes an encoding region and two positioning regions, located above and below the encoding region, respectively. The first type of positioning sub-region is black, and the second type is white. Each positioning region includes three sub-regions arranged in a sequence of white, black, and white. In this embodiment, the intersection point of the second line segment closest to the image center in the target line segment group with the image edge is determined as the positioning marker. For example, the positioning markers can be obtained as points B3, B4, C1, and C2 from the line segment detection results. By offsetting these positioning markers a distance m towards the image center on the y-axis, Q1, Q2, Q3, and Q4 are obtained, where m is the height of each positioning sub-region, which can be determined by the average distance between two second line segments in the same target line segment group. In this embodiment, Q1, Q2, Q3, and Q4 are the boundary markers of the encoding region; the boundary of the encoding region can be determined based on these four points.

[0173] Furthermore, after determining the boundary markers, the effective coding region can be determined based on the boundary markers. Based on this effective coding region, an affine transformation can be performed to correct the image and reduce calculation errors, resulting in the final displacement detection image. Specifically, the coordinates of Q1, Q2, Q3, and Q4 after perspective transformation are (0,0), (w_code,0), (w_code,h_code), and (0,h_code), respectively. Here, w_code and h_code are the width and height of the displacement detection image after homography transformation, and their specific values ​​can be set as empirical values ​​based on the actual requirements of displacement detection performance and accuracy.

[0174] Furthermore, the height value of the positioning sub-region can be determined in the following way to improve the calculation accuracy of the positioning sub-region height value. Specifically, multiple intersection points of the target line segment group and the edge of the initial displacement detection image are used as positioning markers. In the image coordinate system, the reference height value of the positioning sub-region is determined based on the positioning markers in the same column of the target line segment group. Specifically, the difference in the ordinate of two positioning markers in the same column can be used as the reference height value. Then, the height value of the positioning sub-region is determined based on the weighted calculation result of multiple reference height values.

[0175] Preferably, the ratio of the height value of the positioning sub-region to the height value of the encoding unit is a fixed value, which facilitates determining the height value of the encoding unit based on the height value of the positioning sub-region. Therefore, during image processing decoding, if the difference between the rising or falling edge variation amplitude and this height value is too large in the projection image, it can be considered that the image acquisition device has a serious noise influence, and it needs to be checked. Optionally, the fixed value is 1.

[0176] In some embodiments, the encoded values ​​of each encoded column in the encoded pattern are all different, facilitating displacement calculation. For example, the entire encoded pattern can be implemented based on Gray code. Since any two adjacent codes in Gray code differ by only one bit, after forming the encoded pattern, adjacent encoded columns will only have one different image signal generated by a single encoded unit. Therefore, if the image acquisition device experiences imaging errors due to environmental interference, or if errors occur during image processing of the image output by the image acquisition device, the encoded recognition results can be corrected according to the principle of maximum probability estimation, assuming that the error probability of each group of codes is consistent. Therefore, implementing the encoded pattern using Gray code makes it easy to detect and correct errors in displacement detection images.

[0177] Specifically, the Gray code encoding sequence is fixed. Several consecutive valid encoding columns identified in the encoding pattern should match the Gray code encoding sequence; otherwise, it can be considered that there is a problem with the image acquisition device or the image processing process. When a match cannot be made, i.e., the Gray code recognition result is abnormal, each encoding column can be processed cyclically. Under the assumption that "the probability of error recognition for each encoding column and the probability of error recognition for each encoding unit in the encoding column are consistent", the recognition result of the encoding column is corrected by the following method: 1) Determine a first reference encoding column among multiple encoding columns in the displacement detection image, and determine the encoding column whose encoding value in the preset encoding sequence is the same as the encoding value of the first reference encoding column as the second reference encoding column. The preset encoding column is the true encoding sequence of the encoding pattern; 2) Correct the order of the first reference encoding column to the order of the second reference encoding column in the preset encoding sequence. Determine the order of other encoding columns in the displacement detection image according to the corrected order of the first reference encoding column. For example, if the first reference encoding column... If the initial sorting is 1, but the sorting of the corresponding second reference coding sequence is 2, then the sorting of the first reference coding column is corrected to 2, and the sorting of other coding columns in the displacement detection image is modified according to the corrected sorting; 3) Calculate the difference between two coding columns with the same sorting in the displacement detection image and the preset coding sequence, and determine the sum of differences corresponding to the first reference coding column based on the differences between all coding columns with the same sorting; 4) Take all coding columns in the displacement detection image as the first reference coding column in turn, obtain multiple sums of differences, and determine the minimum sum of differences among the multiple sums of differences; 5) Take the first reference coding column corresponding to the minimum sum of differences as the true value coding column, and correct the coding columns in the displacement detection image to the coding columns with the same sorting in the preset coding sequence according to the sorting result determined by the true value coding column.

[0178] The difference between the coded columns can be determined by the edit distance between the coded columns in the displacement detection image and the preset coded sequence. The edit distance refers to the minimum number of operations required to correct the coded columns in the displacement detection image to the coded columns in the preset coded sequence. These operations include adding, subtracting, and / or modifying. The edit distance can be quickly calculated using a dynamic programming algorithm.

[0179] For example, the preset encoding sequence is Gray code, including

[0000] ,

[0001] ,

[0011] ,

[0010] ,

[0110] ,

[0111] ,

[0101] . When the displacement detection image is misidentified, it becomes

[0000] ,

[0001] ,

[0010] ,

[0011] ,

[0110] ,

[0111] . When

[0010] in the displacement detection image is used as the first reference encoding column, it can be seen that

[0010] in the preset encoding sequence is ordered as 4. Therefore, the encoding column order in the displacement detection image is corrected to 2, 3, 4, 5, 6, 7, that is, the order in the displacement detection image is 2, 3, 4, 5, 6, 7. The

[0000] ,

[0001] ,

[0010] ,

[0011] ,

[0110] , and

[0111] correspond to the

[0001] ,

[0011] ,

[0010] ,

[0110] ,

[0111] , and

[0101] ordered as 2, 3, 4, 5, 6, and 7 in the preset coding sequence, respectively. Therefore, to correct the

[0000] ordered as 2 in the displacement detection image to the

[0001] ordered as 2 in the preset coding sequence, a value needs to be corrected, that is, the edit distance is 1. Similarly, the edit distances for the orders 3, 4, 5, 6, and 7 are 1, 0, 2, 1, and 1, respectively. So the sum of the differences with the first reference coding column is 6.

[0180] In other embodiments, the decision to report an error or correct an error can be made based on the number of erroneous coding columns determined after traversing the coding columns in the displacement detection image.

[0181] In some embodiments, the coded columns in the coded pattern cycle according to a preset rule. Each cycle represents a fixed displacement distance, and there is a displacement marker between two cycles, indicating the order of the cycles, i.e., the number of cycles that have been performed since the preset reference. Specifically, patterns such as DataMatrix codes, numerical patterns, or symbol codes representing the corresponding displacement distances are added between each cycle, which is suitable for cases with long displacement distances.

[0182] In some embodiments, the preset reference can be set at the starting point of the coding pattern, the starting point of the moving object, or any position in the coding pattern or on the moving path of the moving object. Regardless of where it is set, the proportional relationship between the unit width of the coding unit and the actual displacement value of the moving object needs to be calibrated. Figure 15 This is a flowchart of a method for obtaining proportional relationships according to an embodiment of this application, such as... Figure 15 As shown, the method includes the following steps:

[0183] Step S1501: Determine the maximum displacement range of the moving object.

[0184] The maximum displacement range can be determined based on the preset range, factory parameters, or actual needs, and is denoted as s.

[0185] Step S1502: When the moving object is at the starting point of the maximum displacement range, calculate the starting point encoding measurement value of the moving object relative to the preset reference.

[0186] Step S1503: When the moving object is at the end of the maximum displacement range, calculate the end-point encoded measurement value of the moving object relative to the preset reference.

[0187] During calibration, the position of the imaging center of the image acquisition device can be regarded as the current position of the moving object. Then, the starting point code measurement value and the ending point code measurement value are calculated based on the position of the imaging center in the displacement detection image.

[0188] Step S1504: Determine the proportional relationship between the current coded measurement value and the actual displacement value based on the actual length of the maximum displacement range, the starting point coded measurement value, and the ending point coded measurement value.

[0189] Assuming the starting point encoding measurement value is p and the ending point encoding measurement value is q, then the actual displacement value corresponding to the unit width of the encoding unit is s / (qp).

[0190] Furthermore, when the measured current coded measurement value is x, the actual displacement value corresponding to the current coded measurement value is calculated using the following formula 3:

[0191]

[0192] In Formula 3, u is the actual displacement value corresponding to the current coded measurement value x. Specifically, if the coded measurement value obtained by the displacement detection method is 0 when the moving object is at a preset reference, then p = 0.

[0193] Specifically, the current encoded measurement value x is calculated as shown in Formula 4:

[0194] Formula 4: x = x1 + x2

[0195] In Formula 4, x1 represents the first coded measurement value, which can be obtained from the coded value of the target column itself, and x2 represents the second coded measurement value, which is obtained from the lateral coded distance between the imaging center and the target column.

[0196] Through the above steps S1501 to S1504, the calibration between the current coded measurement value and the actual displacement value is realized, which facilitates the real-time calculation of the actual displacement value of the moving object.

[0197] The present embodiment will now be described and illustrated through preferred embodiments.

[0198] Figure 16This is a flowchart of a displacement detection method according to a preferred embodiment of this application, such as... Figure 16 As shown, it includes the following steps:

[0199] Step S1601: Obtain the initial displacement detection image, and determine the positioning area through edge detection and line segment extraction;

[0200] In this embodiment, the positioning areas are located above and below the encoding areas, and each includes multiple positioning sub-regions. These sub-regions are defined by three rows of white and black stripes of equal height to the encoding units, extending outwards from the center of the displacement detection image. During displacement detection, the imaging range of the image acquisition device must at least cover the upper boundary of the second row of black positioning sub-regions and the lower boundary of the penultimate row of black positioning sub-regions.

[0201] Furthermore, the number of positioning sub-regions can be increased or decreased as appropriate, for example, set to 1, 3 or 5, and the arrangement of positioning sub-regions can also be adjusted, such as white-black-white or black-white-black.

[0202] The encoding pattern in this embodiment can be a two-dimensional encoding pattern such as Gray code, or other absolute displacement encoding patterns such as Hamming code, or a hybrid form of characters / symbols and encoding patterns. When a two-dimensional encoding pattern is used, additional check bits can be added to verify the accuracy of the recognition result.

[0203] Step S1602: Determine the position of the coding area based on the positioning area, and determine the perspective transformation matrix based on the image size of the coding area. Crop the coding area on the initial displacement detection image and perform perspective transformation to obtain the final displacement detection image, which is recorded as the effective coding image.

[0204] Optionally, the coordinates (x, y) of the encoded area after perspective transformation ′ The coordinates (x, y) of the encoding region before perspective transformation and (y′) satisfy Formula 5. The perspective transformation matrix can be obtained by solving the following equations simultaneously from the four vertices of the encoding region:

[0205]

[0206] in, This is the perspective transformation matrix.

[0207] Further rewriting formula 5 yields...

[0208]

[0209]

[0210] Substituting the coordinates of the four sets of vertex pairs further yields the perspective transformation matrix.

[0211] Step S1603: Binarize the effective coded image, and project each column of pixels in the row direction based on the binarization to determine the projection curve of all coded columns in the effective coded image.

[0212] Step S1604: Determine the abscissa of each coding column based on the abscissa of the abrupt change in the projection curve; calculate the unit width and second abscissa of the coding column based on the abscissa of each coding column, the second abscissa of the target column in the effective coding image, and the linear relationship between them.

[0213] Step S1605: Determine the first coded measurement value based on the coded value of the target column; calculate the second coded measurement value based on the distance between the imaging center and the target column and the unit width; and determine the current coded measurement value based on the first coded measurement value and the second coded measurement value.

[0214] Step S1606: Calculate the actual displacement value of the moving object relative to the preset reference based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value.

[0215] In calculating the actual displacement value, the length of the code depends on the number of coding units in each coding column along the column direction. The unit width of the coding column should be minimized to maximize the coding length of the displacement detection system, thereby increasing the system's positioning accuracy. Furthermore, the height of the positioning sub-region is proportional to the height of the coding unit, allowing for the determination of the estimated number of pixels corresponding to the height of the coding unit in the displacement detection image during image processing. Based on this, when identifying pixel values ​​in the displacement detection image, the estimated value can be used to eliminate the influence of material shadows, reflections, dirt, or other noise in the displacement detection image. Specifically, the estimated value is obtained in two ways: 1) Pre-determine the ratio of the positioning sub-region height to the coding unit height, and calculate the estimated value based on the height of the positioning sub-region obtained from the displacement detection image and this ratio; 2) Pre-determine the aspect ratio of the coding unit, and calculate the estimated value based on the unit width and aspect ratio of the coding unit calculated in steps S601 to S603.

[0216] In other embodiments, the estimated value can be calculated simultaneously using both methods described above. If the difference between the two estimated values ​​exceeds a specified threshold range, the system can be considered to have detected an anomaly.

[0217] Through the above steps S1601 to S1606, multiple coding columns can be read simultaneously based on image processing, and sub-pixel level positioning can be achieved for each coding column. This enables high-precision measurement of absolute displacement values. When using Gray code as the coding pattern, the displacement detection method also has a certain error correction capability. Even when the barcode pattern is damaged or there are other interference factors, the system can still work normally.

[0218] This system is easy to add to or modify existing systems. By spraying, printing, or etching specific coded patterns onto a moving object and installing an imaging device at an appropriate location, it can achieve real-time measurement of the object's displacement in a single direction. It solves the problems of high process requirements and operational difficulties associated with displacement measurement based on installed moving guide rails in related technologies. This system not only reduces process requirements but also simplifies operation.

[0219] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0220] This embodiment also provides a displacement detection system for implementing the above embodiments and preferred embodiments; details already described will not be repeated. The terms "device," "unit," "subunit," etc., used below refer to combinations of software and / or hardware that perform a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0221] Figure 17 This is a structural block diagram of a displacement detection system according to an embodiment of this application, such as... Figure 17 As shown, the system includes an coded pattern 22, an imaging device 23, and a processor 1701;

[0222] The coding pattern 22 is attached to the surface of the moving object to be displaced and includes multiple regularly arranged coding columns;

[0223] Imaging device 23 is used to acquire a displacement detection image containing at least a portion of a coded pattern; specifically, imaging device 23 performs imaging under preset conditions, for example, capturing light and performing imaging at a preset frequency or capturing light and performing imaging according to an external instruction; wherein, the external instruction may instruct imaging device 23 to capture light and perform imaging continuously or at preset time intervals.

[0224] The processing device 1701 is used to calculate the current coded measurement value of a moving object relative to a preset reference based on the arrangement information of the coded columns in a displacement detection image, and to calculate the actual displacement value of the moving object relative to the preset reference based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value, wherein the current coded measurement value is the displacement value calculated based on the number of coded columns.

[0225] The aforementioned displacement detection system acquires displacement detection images based on the imaging device 23. The processing device 1701 calculates the actual displacement value of the moving object according to the arrangement pattern of the coded columns in the coded pattern 22. No additional moving guide rail is required; the coded pattern 22 is directly attached to the surface of the moving object, allowing for simple and convenient synchronous movement of the coded pattern 22 along with the moving object. Furthermore, as the moving object moves, the coded pattern 22 attached to the object's surface is captured, thus achieving the goal of obtaining the displacement of the moving object based on the coded pattern 22. Based on this, it solves the problem of high process requirements and operational difficulty in related technologies that rely on installed moving guide rails for displacement measurement. In this embodiment, calculating the actual displacement value based on the coded pattern 22 not only reduces process requirements and simplifies operation, but also, due to the higher precision of each coded column, results in higher accuracy in the actual measured value calculation.

[0226] In some embodiments, the imaging device 23 includes a light source, an optical path conversion component, and an image acquisition device; wherein, the imaging light emitted by the light source reaches the coded pattern through the optical path conversion component, the first reflected light after the imaging light is reflected by the coded pattern reaches the optical path conversion component, and the second reflected light after the first reflected light is reflected again by the optical path conversion component reaches the image acquisition device.

[0227] In some embodiments, the light source is a diffused light source. Using a diffused light source can avoid bright spots in the acquired image caused by reflections from the coded pattern, which would affect the imaging effect of the coded pattern and thus the accuracy of determining the displacement based on the coded pattern. Specifically, the diffused light source can consist of multiple LED point light sources and a diffuser plate.

[0228] In some embodiments, the optical path conversion component is a semi-transparent and semi-reflective mirror, based on which the second reflected light entering the image acquisition device is coaxial with the optical axis of the image acquisition device. Figure 18 This is a schematic diagram of the imaging device according to an embodiment of this application, such as... Figure 18As shown, the device comprises a diffused light source 181, a semi-transparent mirror 182, an image acquisition device 183, and a housing 184. The diffused light source 181 utilizes the semi-transparent mirror to form coaxial illumination. Specifically, the diffused light source 181 is diffused through a diffuser plate onto the semi-transparent mirror 182, which reflects the light onto the coded pattern of the moving object. The coded pattern then reflects the light back onto the semi-transparent mirror 182, and subsequently into the image acquisition device 183. Because the second reflected light ray is on the same axis as the image acquisition device 183, this type of light source is called a coaxial light source, ensuring stable imaging and easy, accurate processing and recognition of the coded pattern. Depending on the needs of use, the positions of the image acquisition device 183 and the diffused light source 181 can be interchanged. The semi-transparent mirror 182 is configured to reflect the light emitted by the diffused light source 181 and transmit the light reflected by the surface of the coded pattern after passing through the semi-transparent mirror 182. The diffused light source 181, the semi-transparent mirror 182, and the image acquisition device 183 can be built into a housing. The housing needs to have an opening so that the light emitted by the light source can pass through the opening and propagate to the surface to which the coded pattern is attached.

[0229] In this embodiment, the row direction of the encoding pattern is consistent with the movement direction of the moving object, the column direction of the encoding pattern is perpendicular to the row direction, and the encoding values ​​of two adjacent encoding columns are different; and / or, the encoding pattern includes an encoding area and a positioning area, the positioning area extends along the row direction, and the positioning area and the encoding area are arranged sequentially in the column direction; and / or, the encoding column includes multiple encoding units, and the height of the positioning area and the height of the encoding unit are in a preset ratio; the encoding values ​​of each encoding column in the encoding pattern are all different; or, each encoding column in the encoding pattern cycles according to a preset rule, and there is a displacement marker between two cycles, wherein the displacement marker is used to indicate the order of the cycles.

[0230] Furthermore, the processing device 1701 is also used to determine a first coded measurement value of the target column in the displacement detection image, wherein the first coded measurement value is the absolute coded distance of the target column relative to a preset reference; determine a second coded measurement value based on the lateral coded distance from the imaging center of the image acquisition device to the target column in the displacement detection image, wherein the image acquisition device is used to acquire the displacement detection image; and determine the current coded measurement value of the moving object based on the first coded measurement value and the second coded measurement value.

[0231] Furthermore, the processing device 1701 is also used to determine the first abscissa of the imaging center on the displacement detection image; determine the second abscissa of the target column on the displacement detection image; and calculate the second coded measurement value based on the difference between the first abscissa and the second abscissa, and the unit width of the coded column in the row direction.

[0232] Furthermore, the processing device 1701 is also used to determine the abscissa corresponding to each coded column in the displacement detection image, wherein the distance between the coded column and the target column has a linear relationship with the abscissa of the coded column, and the second abscissa and unit width are parameters of the linear relationship; based on the abscissas of multiple coded columns, the distance between each coded column and the target column, and the linear relationship, a system of linear equations is determined; the system of linear equations is solved to obtain the second abscissa and unit width.

[0233] Furthermore, the processing device 1701 is also used to determine the projection value of each column pixel in the displacement detection image in the row direction based on the pixel value of each pixel in the displacement detection image; to determine the projection curve based on the projection value of each column pixel in the row direction with the row direction as the horizontal axis; and to determine the horizontal coordinate corresponding to each coded column based on the horizontal coordinate of the abrupt change point on the projection curve.

[0234] Furthermore, the processing device 1701 is also used to identify a positioning region in the initial displacement detection image; determine the boundary of the coding region in the initial displacement detection image based on the positioning region; and crop the initial displacement detection image based on the boundary of the coding region to obtain an effective coding image as the final displacement detection image.

[0235] Furthermore, the processing device 1701 is also used to acquire multiple scattered first line segments in the initial displacement detection image, cluster and fuse the multiple first line segments to determine multiple fused second line segments; filter the multiple second line segments according to the filtering conditions determined by the location information of the positioning area to obtain one or more target line segment groups; and determine the positioning area in the initial displacement image according to the location information and size information of at least one target line segment group.

[0236] Furthermore, the processing device 1701 is also used to calculate the height value of the positioning sub-region determined by the target line segment group based on the positioning marks of different line segments in a target line segment group; to translate the positioning mark close to the center of the image in the column direction by a preset distance to obtain the boundary mark of the coding area; and to determine the boundary of the coding area in the initial displacement detection image based on multiple boundary marks.

[0237] Furthermore, the processing device 1701 is also used to use multiple intersection points of the target line segment group and the edge of the initial displacement detection image as positioning markers; to determine the reference height value of the positioning sub-region based on the positioning markers in the same column of the target line segment group; and to determine the height value of the positioning sub-region based on the weighted calculation result of multiple reference height values.

[0238] Furthermore, the processing device 1701 is also used to determine the maximum displacement range of the moving object; when the moving object is at the starting point of the maximum displacement range, calculate the starting point coded measurement value of the moving object relative to a preset reference; when the moving object is at the ending point of the maximum displacement range, calculate the ending point coded measurement value of the moving object relative to the preset reference; and determine the proportional relationship between the current coded measurement value and the actual displacement value based on the actual length of the maximum displacement range, the starting point coded measurement value, and the ending point coded measurement value.

[0239] Furthermore, the processing device 1701 is also used to determine a first reference coding column among multiple coding columns in the displacement detection image, and to determine a coding column in the preset coding sequence whose coding value is the same as that of the first reference coding column as a second reference coding column; to correct the order of the first reference coding column to the order of the second reference coding column in the preset coding sequence, and to determine the order of other coding columns in the displacement detection image in turn according to the corrected order of the first reference coding column; to calculate the difference between two coding columns in the displacement detection image and the preset coding sequence that are in the same order, and to determine the sum of differences corresponding to the first reference coding column based on the differences between all coding columns; to take all coding columns in the displacement detection image as the first reference coding column in turn, to obtain multiple sums of differences, and to determine the minimum sum of differences among the multiple sums of differences; to regard the first reference coding column corresponding to the minimum sum of differences as the true value coding column, and to correct the coding columns in the displacement detection image to the coding columns in the preset coding sequence that are in the same order according to the ordering result determined by the true value coding column.

[0240] This application also provides a displacement detection device. Figure 19 This is a structural block diagram of a displacement detection device according to an embodiment of this application, such as... Figure 19 As shown, the device includes an acquisition module 1901, an encoding calculation module 1902, and a displacement calculation module 1903;

[0241] The acquisition module 1901 is used to acquire a displacement detection image, wherein the displacement detection image contains at least a portion of a coding pattern, the coding pattern is attached to the surface of the moving object to be displaced, and includes multiple regularly arranged coding columns.

[0242] The encoding calculation module 1902 is used to calculate the current encoded measurement value of the moving object relative to a preset reference in the displacement detection image based on the arrangement information of the encoding columns. The current encoded measurement value is the displacement value calculated based on the number of encoding columns.

[0243] The displacement calculation module 1903 is used to calculate the actual displacement value of the moving object relative to a preset reference based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value.

[0244] Using the aforementioned displacement detection device, this embodiment calculates the actual displacement value of the moving object based on the arrangement of the coding columns using the coding calculation module 1902. Since the coding pattern is directly attached to the surface of the moving object, it easily and conveniently achieves the function of the coding pattern moving synchronously with the moving object. Therefore, it eliminates the need for an additional moving guide rail, solving the problem of high process requirements and operational difficulty associated with displacement measurement based on installed moving guide rails in related technologies. In this embodiment, calculating the actual displacement value based on the coding pattern not only reduces process requirements and simplifies operation, but also, due to the higher precision of each coding column, results in higher accuracy in the calculation of the actual measured value.

[0245] Furthermore, the row direction of the coded pattern is consistent with the movement direction of the moving object, the column direction of the coded pattern is perpendicular to the row direction, and the coded values ​​of two adjacent coded columns are different; and / or, the coded pattern includes a coded area and a positioning area, the positioning area extends along the row direction, and the positioning area and the coded area are arranged sequentially in the column direction; and / or, the coded column includes multiple coded units, and the height of the positioning area is in a preset ratio to the height of the coded unit; the coded values ​​of each coded column in the coded pattern are all different; or, each coded column in the coded pattern cycles according to a preset rule, and there is a displacement marker between two cycles, wherein the displacement marker is used to indicate the order of the cycles.

[0246] Furthermore, the encoding calculation module 1902 is also used to determine a first encoded measurement value of the target column in the displacement detection image, wherein the first encoded measurement value is the absolute encoded distance of the target column relative to a preset reference; determine a second encoded measurement value based on the lateral encoded distance from the imaging center of the image acquisition device to the target column in the displacement detection image, wherein the image acquisition device is used to acquire the displacement detection image; and determine the current encoded measurement value of the moving object based on the first encoded measurement value and the second encoded measurement value.

[0247] Furthermore, the encoding calculation module 1902 is also used to determine the first abscissa of the imaging center on the displacement detection image; determine the second abscissa of the target column on the displacement detection image; and calculate the second encoded measurement value based on the difference between the first abscissa and the second abscissa, and the unit width of the encoded column in the row direction.

[0248] Furthermore, the encoding calculation module 1902 is also used to determine the abscissa corresponding to each encoding column in the displacement detection image, wherein the distance between the encoding column and the target column has a linear relationship with the abscissa of the encoding column, and the second abscissa and unit width are parameters of the linear relationship; based on the abscissas of multiple encoding columns, the distance between each encoding column and the target column, and the linear relationship, a system of linear equations is determined; the system of linear equations is solved to obtain the second abscissa and unit width.

[0249] Furthermore, the encoding calculation module 1902 is also used to determine the projection value of each column pixel in the displacement detection image in the row direction based on the pixel value of each pixel in the displacement detection image; to determine the projection curve based on the projection value of each column pixel in the row direction with the row direction as the horizontal axis; and to determine the horizontal coordinate of each encoded column based on the horizontal coordinate of the abrupt change point on the projection curve.

[0250] Furthermore, the acquisition module 1901 is also used to identify the positioning area in the initial displacement detection image; determine the boundary of the coding area in the initial displacement detection image based on the positioning area; and crop the initial displacement detection image based on the boundary of the coding area to obtain an effective coding image as the final displacement detection image.

[0251] Furthermore, the acquisition module 1901 is also used to acquire multiple scattered first line segments in the initial displacement detection image, cluster and fuse the multiple first line segments to determine multiple fused second line segments; filter the multiple second line segments according to the filtering conditions determined by the location information of the positioning area to obtain one or more target line segment groups; and determine the positioning area in the initial displacement image according to the location information and size information of at least one target line segment group.

[0252] Furthermore, the acquisition module 1901 is also used to calculate the height value of the positioning sub-region determined by the target line segment group based on the positioning identifiers of different line segments in a target line segment group; to translate the positioning identifier close to the center of the image in the column direction by a preset distance to obtain the boundary identifier of the coding area; and to determine the boundary of the coding area in the initial displacement detection image based on multiple boundary identifiers.

[0253] Furthermore, the acquisition module 1901 is also used to take multiple intersection points of the target line segment group and the edge of the initial displacement detection image as positioning markers; determine the reference height value of the positioning sub-region based on the positioning markers in the same column of the target line segment group; and determine the height value of the positioning sub-region based on the weighted calculation result of multiple reference height values.

[0254] Furthermore, the displacement calculation module 1903 is also used to determine the maximum displacement range of the moving object; when the moving object is at the starting point of the maximum displacement range, it calculates the starting point coded measurement value of the moving object relative to the preset reference; when the moving object is at the ending point of the maximum displacement range, it calculates the ending point coded measurement value of the moving object relative to the preset reference; and based on the actual length of the maximum displacement range, the starting point coded measurement value, and the ending point coded measurement value, it determines the proportional relationship between the current coded measurement value and the actual displacement value.

[0255] Furthermore, the displacement calculation module 1903 is also used to determine a first reference coding column among multiple coding columns in the displacement detection image, and to determine a coding column in the preset coding sequence whose coding value is the same as that of the first reference coding column as a second reference coding column; to correct the sorting of the first reference coding column to the sorting of the second reference coding column in the preset coding sequence, and to determine the sorting of other coding columns in the displacement detection image in turn according to the corrected sorting of the first reference coding column; to calculate the difference between two coding columns in the displacement detection image and the preset coding sequence with the same sorting, and to determine the sum of differences corresponding to the first reference coding column based on the differences between all coding columns; to take all coding columns in the displacement detection image as the first reference coding column in turn, to obtain multiple sums of differences, and to determine the minimum sum of differences among the multiple sums of differences; to regard the first reference coding column corresponding to the minimum sum of differences as the true value coding column, and to correct the coding columns in the displacement detection image to the coding columns with the same sorting in the preset coding sequence according to the sorting result determined by the true value coding column.

[0256] This embodiment also provides an electronic device including a memory and a processor, the memory being used to store executable instructions of the processor; the processor is configured to perform the steps of the displacement detection method described in any of the above embodiments by executing the executable instructions.

[0257] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0258] This application also provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the displacement detection method described in any of the above embodiments.

[0259] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

Claims

1. A displacement detection method, characterized in that, The method includes: A displacement detection image is acquired, wherein the displacement detection image contains at least a portion of a coding pattern, the coding pattern is attached to the surface of the moving object to be displacement detected, and includes multiple regularly arranged coding columns, each coding column including multiple coding units, each coding unit representing a value, and each column in the coding pattern is a coding column; In the displacement detection image, the current coded measurement value of the moving object relative to a preset reference is calculated based on the arrangement information of the coded columns, wherein the current coded measurement value is the displacement value calculated based on the number of coded columns; Based on the current encoded measurement value and the proportional relationship between the current encoded measurement value and the actual displacement value, the actual displacement value of the moving object relative to the preset reference is calculated.

2. The method according to claim 1, characterized in that, The row direction of the coded pattern is consistent with the movement direction of the moving object, the column direction of the coded pattern is perpendicular to the row direction, and the coded values ​​of two adjacent coded columns are different.

3. The method according to claim 2, characterized in that, The step of calculating the current coded measurement value of the moving object relative to a preset reference based on the arrangement information of the coded columns in the displacement detection image includes: Determine a first coded measurement value for the target column in the displacement detection image, wherein the first coded measurement value is the absolute coded distance of the target column relative to the preset reference; A second coded measurement value is determined based on the lateral coded distance from the imaging center of the image acquisition device to the target column in the displacement detection image, wherein the image acquisition device is used to acquire the displacement detection image; The current coded measurement value of the moving object is determined based on the first coded measurement value and the second coded measurement value.

4. The method according to claim 3, characterized in that, The step of determining the second coded measurement value based on the lateral coded distance from the imaging center of the image acquisition device to the target column in the displacement detection image includes: Determine the first abscissa of the imaging center on the displacement detection image; Determine the second abscissa of the target column on the displacement detection image; The second encoding measurement value is calculated based on the difference between the first and second horizontal coordinates and the unit width of the encoded column in the row direction.

5. The method according to claim 4, characterized in that, The methods for obtaining the second horizontal coordinate and the unit width include: Determine the abscissa corresponding to each coded column in the displacement detection image, wherein the distance between the coded column and the target column has a linear relationship with the abscissa of the coded column, and the second abscissa and the unit width are parameters of the linear relationship; A system of linear equations is determined based on the x-coordinates of the multiple coded columns, the distance between each coded column and the target column, and the linear relationship. Solve the system of linear equations to obtain the second abscissa and the unit width.

6. The method according to claim 5, characterized in that, Determining the horizontal coordinates corresponding to each coded column in the displacement detection image includes: The projection value of each column pixel in the displacement detection image in the row direction is determined based on the pixel value of each pixel in the displacement detection image. Using the row direction as the horizontal axis, the projection curve is determined based on the projection values ​​of each column of pixels in the row direction; The x-coordinates of each coded column are determined based on the x-coordinates of the abrupt changes on the projection curve.

7. The method according to claim 2, characterized in that, The coding pattern includes a coding area and a positioning area, the positioning area extending along the row direction, and the positioning area and the coding area arranged sequentially in the column direction.

8. The method according to claim 7, characterized in that, The coding column includes multiple coding units, and the height of the positioning area is in a preset ratio to the height of the coding unit.

9. The method according to claim 7, characterized in that, The acquisition of the displacement detection image includes: The positioning region is identified in the initial displacement detection image; The boundary of the coded region in the initial displacement detection image is determined based on the positioning region; The initial displacement detection image is cropped according to the boundary of the coded region to obtain an effective coded image as the final displacement detection image.

10. The method according to claim 9, characterized in that, The step of identifying the localization region in the initial displacement detection image includes: Multiple scattered first line segments are obtained from the initial displacement detection image. The multiple first line segments are clustered and fused to determine multiple fused second line segments. Based on the filtering conditions determined by the location information of the positioning area, multiple second line segments are filtered to obtain one or more target line segment groups; The positioning area in the initial displacement image is determined based on the position and size information of at least one of the target line segment groups.

11. The method according to claim 10, characterized in that, The positioning area is divided into multiple positioning sub-regions in the column direction; determining the boundary of the coding region in the initial displacement detection image based on the positioning area includes: Calculate the height value of the positioning sub-region determined by the target line segment group based on the positioning identifiers of different line segments in the target line segment group; The positioning marker of the image near the center of the initial displacement detection image is shifted by a preset distance in the column direction towards the center of the image to obtain the boundary marker of the encoding area; The boundaries of the coded regions in the initial displacement detection image are determined based on multiple boundary identifiers.

12. The method according to claim 11, characterized in that, The step of calculating the height value of the positioning sub-region determined by the target line segment group based on the positioning identifiers of different line segments in the target line segment group includes: The multiple intersection points of the target line segment group and the edge of the initial displacement detection image are all used as the positioning markers; The reference height value of the positioning sub-region is determined based on the positioning identifier in the same column of the target line segment group; The height value of the positioning sub-region is determined based on the weighted calculation result of multiple reference height values.

13. The method according to claim 2, characterized in that, The encoded values ​​of each encoded column in the encoded pattern are all different; or, In the coding pattern, each coding column cycles according to a preset rule, and there is a displacement marker between two cycles, wherein the displacement marker is used to indicate the order of the cycles.

14. The method according to claim 1, characterized in that, The method for obtaining the proportional relationship between the current coded measurement value and the actual displacement value includes: Determine the maximum displacement range of the moving object; When the moving object is at the starting point of the maximum displacement range, calculate the starting point encoded measurement value of the moving object relative to the preset reference. When the moving object is at the end of the maximum displacement range, calculate the end-point encoded measurement value of the moving object relative to the preset reference; Based on the actual length of the maximum displacement range, the starting point coded measurement value, and the ending point coded measurement value, determine the proportional relationship between the current coded measurement value and the actual displacement value.

15. The method according to claim 1, characterized in that, After acquiring the displacement detection image, the method further includes: A first reference coding column is determined from multiple coding columns in the displacement detection image, and a coding column in a preset coding sequence whose coding value is the same as the coding value of the first reference coding column is determined as a second reference coding column; The sorting of the first reference coding column is corrected to the sorting of the second reference coding column in the preset coding sequence, and the sorting of other coding columns in the displacement detection image is determined sequentially according to the sorting of the first reference coding column after correction. Calculate the difference between the displacement detection image and two coded columns with the same order in the preset coding sequence, and determine the sum of differences corresponding to the first reference coded column based on the differences between all coded columns; By sequentially using all the coded columns in the displacement detection image as the first reference coded columns, multiple difference sums are obtained, and the minimum difference sum is determined among the multiple difference sums; The first reference coding column corresponding to the minimum difference is regarded as the true value coding column. Based on the sorting result determined by the true value coding column, the coding column in the displacement detection image is corrected to the coding column with the same sorting in the preset coding sequence.

16. A displacement detection system, characterized in that, The system includes an encoded pattern, an imaging device, and a processor; The coding pattern is attached to the surface of the moving object to be displaced and includes multiple regularly arranged coding columns. Each coding column includes multiple coding units, and each coding unit represents a value. Each column in the coding pattern is a coding column. The imaging device is used to acquire a displacement detection image containing at least a portion of the coded pattern; The processor is configured to calculate, in the displacement detection image, the current coded measurement value of the moving object relative to a preset reference based on the arrangement information of the coded columns, and calculate the actual displacement value of the moving object relative to the preset reference based on the current coded measurement value and the proportional relationship between the current coded measurement value and the actual displacement value, wherein the current coded measurement value is the displacement value calculated based on the number of coded columns.

17. The system according to claim 16, characterized in that, The imaging device includes a light source, an optical path conversion component, and an image acquisition device; The imaging light emitted by the light source reaches the coded pattern through the optical path conversion component. The first reflected ray of the imaging light after being reflected by the coded pattern reaches the optical path conversion component. The second reflected ray of the first reflected ray after being reflected again by the optical path conversion component reaches the image acquisition device.

18. The system according to claim 17, characterized in that, The light source is a diffused light source; and / or, The optical path conversion component is a semi-transparent, semi-reflective mirror; and / or, The optical axis of the image acquisition device is coaxial with the optical axis of the second reflected light.

19. A displacement detection device, characterized in that, It includes an acquisition module, an encoding calculation module, and a displacement calculation module; The acquisition module is used to acquire a displacement detection image, wherein the displacement detection image includes at least a portion of a coding pattern, the coding pattern is attached to the surface of the moving object to be displaced, and includes multiple regularly arranged coding columns, each coding column including multiple coding units, each coding unit representing a value, and each column in the coding pattern is a coding column; The encoding calculation module is used to calculate the current encoded measurement value of the moving object relative to a preset reference in the displacement detection image based on the arrangement information of the encoding columns, wherein the current encoded measurement value is the displacement value calculated based on the number of encoding columns; The displacement calculation module is used to calculate the actual displacement value of the moving object relative to the preset reference based on the current encoded measurement value and the proportional relationship between the current encoded measurement value and the actual displacement value.

20. An electronic device, characterized in that, The device includes a processor and a memory, the memory being used to store executable instructions of the processor; the processor is configured to execute the displacement detection method of any one of claims 1 to 15 by executing the executable instructions.

21. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the method as described in any one of claims 1 to 15.

Citation Information

Patent Citations

  • Position coding-based displacement detection system and detection method

    CN110617770A