A method for measuring angular displacement of a rotary table and a displacement sensor
By setting a special recognition area on the turntable and performing image processing, the angular displacement of the turntable can be obtained, which solves the problems of cumbersome and costly existing measurement methods and realizes efficient and convenient angular displacement measurement.
Patent Information
- Application Number
- CN202511106128.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-08-08
AI Technical Summary
Existing methods for measuring the angular displacement of turntables are cumbersome, have high system costs and low automation. Furthermore, rotary encoders and laser trackers have problems such as high installation accuracy requirements, susceptibility to electromagnetic interference, and high equipment costs.
A special recognition area is set on the turntable. An image is acquired from directly above the turntable, grayscale is processed, a threshold is obtained, and the image is converted into a binary image. The angle change value is obtained using a reference point to calculate the angular displacement.
It enables efficient measurement of turntable angular displacement without the need for precise installation and extensive data calculation, reducing measurement costs and improving convenience and automation.
Smart Images

Figure CN120635210B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of rotary table angle displacement measurement, in particular to a rotary table angle displacement measurement method and a displacement sensor. BACKGROUND
[0002] A rotary table is a kind of precise rotary motion platform, and its core function is to perform accurate angle positioning, continuous rotation or indexing motion around a fixed rotary shaft. Therefore, the data of rotary table rotation is particularly important. For example, rotary table angle displacement measurement is a key technology for realizing high-precision motion control, improving system performance and ensuring safety. Therefore, it is necessary to measure the rotary table angle displacement.
[0003] The existing measurement methods mainly include rotary encoder measurement and laser tracker measurement. The rotary encoder measurement requires installing a rotary encoder on the rotary table shaft to measure the angle displacement, which has high requirements for the installation accuracy of the encoder. In addition, the encoder is easily affected by electromagnetic interference, which affects the stability of the measurement. The laser tracker measurement requires a complex optical system and a high-precision laser tracker, which has high equipment cost. In addition, it has high requirements for the installation accuracy of the mirror. A small displacement or tilt of the mirror will cause measurement error. The measurement process needs to pause the rotary table several times to obtain data, which is low in efficiency. Therefore, an image measurement method is proposed. The image measurement method does not require accurate installation and a large amount of data calculation, and does not affect the normal operation of the rotary table. However, the rotary table is generally symmetrical in shape, and it is difficult to distinguish when it rotates. The existing measurement method in the prior art leads to a complicated measurement process, high system cost and low automation degree. SUMMARY
[0004] The present application aims to at least solve one of the technical problems in the prior art. A special recognition area is set on the rotary table, an image of the rotary table is obtained from directly above the rotary table, a gray-scale image of the rotary table is obtained by performing gray-scale processing on the image of the rotary table, a first threshold value, a second threshold value and a third threshold value are obtained based on a first number of partial images of the rotary table, the gray-scale image of the rotary table is converted into a region binary image based on the first threshold value, the gray-scale image of the rotary table is converted into a rotary table binary image based on the second threshold value and the third threshold value, a first reference point is obtained based on the region binary image, a second reference point is obtained based on the rotary table binary image, an angle change value is obtained based on the first reference point and the second reference point, and an angle displacement amount is obtained based on the angle change value. The present application solves the problem of the existing measurement method in the prior art, which leads to a complicated measurement process, high system cost and low automation degree.
[0005] To achieve the above-mentioned purpose, the present application provides a rotary table angle displacement measurement method, which comprises the following steps:
[0006] A special recognition area is set on the rotary table;
[0007] acquiring a turntable image from a top of the turntable;
[0008] gray processing the turntable image to acquire a turntable gray image;
[0009] acquiring a first threshold value, a second threshold value and a third threshold value based on the first quantity of turntable partial images;
[0010] converting the turntable gray image into a region binary image based on the first threshold value, and converting the turntable gray image into a turntable binary image based on the second threshold value and the third threshold value;
[0011] acquiring a first reference point based on the region binary image;
[0012] acquiring a second reference point based on the turntable binary image;
[0013] acquiring an angle change value based on the first reference point and the second reference point;
[0014] acquiring an angle displacement based on the angle change value.
[0015] Further, the special recognition area is set on the turntable, and includes the following sub-steps:
[0016] two rectangular areas with a side length of a centimeters are acquired, a color of the rectangular area is set as pure black, an interval of the rectangular area is set as c centimeters, and the two rectangular areas are marked as special recognition areas.
[0017] Further, the gray processing the turntable image to acquire a turntable gray image further includes the following sub-steps:
[0018] acquiring R value, G value and B value of each pixel point in the turntable image;
[0019] acquiring a mean value of the R value, the G value and the B value of each pixel point in the turntable image, and marking as a turntable gray value;
[0020] displaying each pixel point in the turntable image using the turntable gray value to obtain the turntable gray image.
[0021] Further, the acquiring a first threshold value, a second threshold value and a third threshold value based on the first quantity of turntable partial images further includes the following sub-steps:
[0022] dividing the gray value from 0 to 255 into e intervals, and marking as equal interval;
[0023] respectively counting a frequency of the turntable gray value in each equal interval, and marking as equal interval frequency;
[0024] drawing a histogram with the turntable gray value as an X axis, the equal interval frequency as a Y axis, and the equal interval as a histogram interval, and marking as a turntable histogram;
[0025] Mark the equal interval frequency greater than the adjacent equal interval frequency on the left and right sides in the turntable histogram as the top peak frequency;
[0026] Mark the equal interval corresponding to the top peak frequency as the top peak interval;
[0027] Obtain the number of top peak intervals, when the number of top peak intervals is less than 3, increase the specific value of e, obtain a new turntable histogram, until the number of top peak intervals is greater than or equal to 3;
[0028] When the number of top peak intervals is greater than or equal to 3, mark the middle value in each equal interval as the interval middle value, mark the top peak interval with the smallest interval middle value as the first interval, mark the top peak interval with the largest interval middle value as the third interval, and mark the top peak interval closest to the middle value of the first interval and the third interval as the second interval;
[0029] In the turntable histogram, obtain the middle value of the equal interval with the minimum equal interval frequency between the first interval and the second interval, and mark it as the first threshold value;
[0030] Obtain the middle value of the equal interval with the minimum equal interval frequency between the second interval and the third interval, and mark it as the second threshold value;
[0031] Determine whether there is an equal interval greater than the third interval, if there is, obtain the middle value of the equal interval with the minimum equal interval frequency greater than the third interval, and mark it as the third threshold value, if there is not, mark the maximum value of the third interval as the third threshold value.
[0032] Further, the turntable gray scale image is converted into a region binary image based on the first threshold value, and the turntable gray scale image is converted into a turntable binary image based on the second threshold value and the third threshold value, including the following sub-steps:
[0033] In the turntable gray scale image, set the turntable gray scale value less than or equal to the first threshold value to 0, and set the gray scale value greater than the first threshold value to 255, to obtain a region binary image;
[0034] In the turntable gray scale image, set the turntable gray scale value greater than or equal to the second threshold value and less than or equal to the third threshold value to 0, and set the turntable gray scale value less than the second threshold value or greater than the third threshold value to 255, to obtain a turntable binary image.
[0035] Further, the first reference point is obtained based on the region binary image, including the following sub-steps:
[0036] Establish a plane rectangular coordinate system, marked as a reference coordinate system;
[0037] Place the region binary image in the first quadrant of the reference coordinate system, while satisfying that the two sides of the region binary image are respectively coincident with the horizontal axis and the vertical axis of the reference coordinate system;
[0038] Marking the pixel point with the gray value of 0 in the region binary image as a region pixel point;
[0039] Obtaining two continuous regions with the largest number of region pixel points, and marking them as special regions;
[0040] Setting the coordinates of a special region as (x i ,y i ), obtaining the maximum value of x i , the minimum value of x i , the maximum value of y i , and the minimum value of y i , and marking them as x max , x min , y max , and y min respectively, drawing the point (x min , y min ) and the point (x max , y max ), connecting the point (x min , y min ) and the point (x max , y max ) to obtain a first line segment, and obtaining the midpoint of the first line segment and marking it as a region midpoint;
[0041] Obtaining the region midpoints of the two special regions, obtaining the midline of the two region midpoints, and marking it as a first reference point.
[0042] Further, obtaining a second reference point based on the turntable binary image includes the following sub-steps:
[0043] Placing the turntable binary image in the first quadrant of the reference coordinate system, while satisfying that two edges of the turntable binary image respectively coincide with the horizontal axis and the vertical axis of the reference coordinate system;
[0044] Marking the pixel point with the gray value of 0 in the turntable binary image as a turntable pixel point;
[0045] Obtaining a continuous region with the largest number of turntable pixel points, and marking it as a turntable region;
[0046] Obtaining the coordinate points of the boundary of the first number of turntable regions, and marking them as boundary coordinate points;
[0047] Setting the boundary fitting equation as: (Kh-f1) 2 + (Kz-f2) 2 =f3; wherein Kh is the horizontal coordinate of the boundary coordinate point, Kz is the vertical coordinate of the boundary coordinate point, f1, f2, and f3 are the coefficients of the boundary fitting equation;
[0048] Fitting the boundary coordinate points with the boundary fitting equation to obtain the specific values of f1, f2, and f3.
[0049] The second reference point is set as (f1, f2).
[0050] Further, the angle change value is obtained based on the first reference point and the second reference point, including the following sub-steps:
[0051] A vector from the second reference point to the first reference point is obtained, which is marked as a reference vector;
[0052] The turntable images are continuously obtained, and the reference vector of each turntable image in the reference coordinate system is obtained, and the time when each turntable image is obtained is recorded, which is marked as an image acquisition time;
[0053] The angle between the reference vector of the real-time turntable image and the reference vector of the first turntable image is obtained, which is marked as an angle change value.
[0054] Further, the angle displacement is obtained based on the angle change value, including the following steps:
[0055] A plane rectangular coordinate system is established with the image acquisition time as the X-axis and the angle change value as the Y-axis, which is marked as an angle coordinate system;
[0056] The image acquisition time and the corresponding angle change value are plotted as the horizontal and vertical coordinates of the function coordinate point in the angle coordinate system to obtain an angle scatter plot;
[0057] The angle scatter plot is fitted to obtain an angle function;
[0058] The corresponding time of the angle displacement to be known is obtained, which is marked as a real-time time;
[0059] The vertical axis data corresponding to the real-time time in the angle function is obtained, which is marked as u;
[0060] The number of closed figures formed by the angle function graph between the horizontal coordinates corresponding to the real-time time and the horizontal axis of the angle coordinate system is obtained, which is marked as h;
[0061] The coordinate point of the corresponding angle function t seconds before the real-time time is obtained, which is marked as a real-time reference coordinate point;
[0062] A straight line is obtained by connecting the real-time reference coordinate point and the point (u, h), which is marked as a function connection straight line;
[0063] If the slope of the function connection straight line is positive, the angle displacement is obtained as h×360°+u; if the slope of the function connection straight line is negative, the angle displacement is obtained as h×360°+360°-u; if the slope of the function connection straight line is 0, the coordinate point of the corresponding angle function t seconds after the real-time time is taken as the real-time reference coordinate point, a new function connection straight line is obtained, and the judgment is repeated until the slope of the new function connection straight line is not 0.
[0064] The application also provides a rotary table angle displacement measurement displacement sensor, comprising: a region setting module, an image acquisition module, a grayscale module, a threshold acquisition module, a binary module, a first reference point acquisition module, a second reference point acquisition module, an included angle acquisition module, and an angle displacement amount acquisition module.
[0065] The region setting module is used to set a special recognition region on the rotary table.
[0066] The image acquisition module is used to acquire a rotary table image from directly above the rotary table.
[0067] The grayscale module is used to perform grayscale processing on the rotary table image to obtain a rotary table grayscale image.
[0068] The threshold acquisition module is used to acquire a first threshold, a second threshold, and a third threshold based on a first number of rotary table partial images.
[0069] The binary module is used to convert the rotary table grayscale image into a region binary image based on the first threshold, and convert the rotary table grayscale image into a rotary table binary image based on the second threshold and the third threshold.
[0070] The first reference point acquisition module is used to acquire a first reference point based on the region binary image.
[0071] The second reference point acquisition module is used to acquire a second reference point based on the rotary table binary image.
[0072] The included angle acquisition module is used to acquire an included angle change value based on the first reference point and the second reference point.
[0073] The angle displacement amount acquisition module is used to acquire an angle displacement amount based on the included angle change value.
[0074] The application has the following advantages: by setting a special recognition region on the rotary table, acquiring a rotary table image from directly above the rotary table, performing grayscale processing on the rotary table image to obtain a rotary table grayscale image, acquiring a first threshold, a second threshold, and a third threshold based on a first number of rotary table partial images, converting the rotary table grayscale image into a region binary image based on the first threshold, converting the rotary table grayscale image into a rotary table binary image based on the second threshold and the third threshold, acquiring a first reference point based on the region binary image, acquiring a second reference point based on the rotary table binary image, acquiring an included angle change value based on the first reference point and the second reference point, and acquiring an angle displacement amount based on the included angle change value, the method has the advantages of not requiring precise installation and a large amount of data calculation, not affecting the normal operation of the rotary table, reducing the measurement cost of rotary table angle displacement measurement, and increasing the measurement convenience compared with rotary encoder measurement and laser tracker measurement.
[0075] The present application has the advantage that the special recognition area is set on the turntable, and the angle displacement of the turntable is measured more accurately. BRIEF DESCRIPTION OF DRAWINGS
[0076] Figure 1 The figure is a principle block diagram of the system of the present application;
[0077] Figure 2 The figure is a schematic diagram of the histogram of the turntable of the present application;
[0078] Figure 3 The figure is a schematic diagram of the first reference point of the present application;
[0079] Figure 4 The figure is a schematic diagram of the second reference point of the present application;
[0080] Figure 5 The figure is a schematic diagram of the reference vector of the present application;
[0081] Figure 6 The figure is a schematic diagram of the included angle function of the present application;
[0082] Figure 7 The figure is a flow chart of the steps of the method of the present application. DETAILED DESCRIPTION
[0083] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0084] Embodiment 1, please refer to Figure 1 The present application provides a displacement sensor for measuring the angle displacement of a turntable, which comprises a region setting module, an image acquisition module, a grayscale module, a threshold acquisition module, a binarization module, a first reference point acquisition module, a second reference point acquisition module, an included angle acquisition module and an angle displacement acquisition module.
[0085] The region setting module is configured to set a special recognition area on the turntable.
[0086] The region setting module is configured with a region setting strategy, and the region setting strategy comprises:
[0087] Two rectangular areas with a side length of a centimeters are obtained, the color of the rectangular areas is set as pure black, the interval of the rectangular areas is set as c centimeters, and the two rectangular areas are marked as special identification areas; because the regular turntable image cannot accurately find the rotation reference point during rotation, the special identification areas are set to facilitate identification, and the special identification areas are larger than the remaining turntable self-provided recesses, but the special identification areas cannot exceed the size of the turntable; for example, a is 20 and c is 10; the square is set, because the self-provided pattern is basically circular, it is convenient to distinguish, and the pure black color is convenient for identification;
[0088] The image acquisition module is used to obtain the turntable image from directly above the turntable;
[0089] The grayscale module is used to perform grayscale processing on the turntable image to obtain a turntable grayscale image;
[0090] The grayscale module is configured with a grayscale strategy, and the grayscale strategy includes:
[0091] The R value, G value and B value of each pixel point in the turntable image are obtained;
[0092] The average value of the R value, G value and B value of each pixel point in the turntable image is calculated and marked as a turntable grayscale value;
[0093] Each pixel point in the turntable image is displayed using the turntable grayscale value to obtain a turntable grayscale image;
[0094] In actual application, for example, the R value, G value and B value of a pixel point are 120, 122 and 124 respectively, and the turntable grayscale value of the pixel point is 122.
[0095] The threshold acquisition module is used to obtain a first threshold, a second threshold and a third threshold based on the first number of turntable partial images;
[0096] The threshold acquisition module is configured with a threshold acquisition strategy, and the threshold acquisition strategy includes:
[0097] The gray values from 0 to 255 are evenly divided into e intervals, marked as equal intervals; e is set to distinguish the distribution of different partial gray values, so the larger e is set, the clearer it is, but if e is set too large, the calculation amount will increase, so e should not be set too large and too small, for example, e is 8;
[0098] The frequency of the turntable grayscale value in each equal interval is counted and marked as an equal frequency;
[0099] A histogram is drawn with the turntable grayscale value as the X axis, the equal frequency as the Y axis, and the equal interval as the histogram interval, and marked as a turntable histogram;
[0100] In the turntable histogram, the equal frequency greater than the adjacent equal frequencies on the left and right sides is marked as a peak frequency;
[0101] The top peak frequency corresponding interval is marked as a top peak interval;
[0102] The number of top peak intervals is obtained, and when the number of top peak intervals is less than 3, the specific value of e is increased, a new turntable histogram is obtained, and the number of top peak intervals is greater than or equal to 3; the material of the turntable itself is stainless steel, that is, the color is silver white, the gray value is high, the special recognition area is black, and the gray value is low, and the background is between the two, so that a three-peak distribution appears, if not, the divided e is too small, that is, the respective gray value distribution range cannot be distinguished;
[0103] When the number of top peak ranges is greater than or equal to 3, the middle value in each interval is marked as an interval middle value; the top peak interval with the smallest interval middle value is marked as a first interval, the top peak interval with the largest interval middle value is marked as a third interval, and a top peak interval closest to the middle value of the first interval and the third interval is marked as a second interval;
[0104] In the turntable histogram, the middle value of the interval with the minimum equal frequency between the first interval and the second interval is obtained, and is marked as a first threshold value;
[0105] The middle value of the interval with the minimum equal frequency between the second interval and the third interval is obtained, and is marked as a second threshold value;
[0106] It is judged whether there is an interval greater than the third interval, if there is, the middle value of the interval with the minimum equal frequency greater than the third interval is obtained, and is marked as a third threshold value, if there is not, the maximum value of the third interval is marked as the third threshold value;
[0107] In actual application, please refer to Figure 2 When the number of top peak ranges is equal to 3, the first interval is 0 to 31, the second interval is 95 to 127, the third interval is 191 to 223, the first threshold value is 79, the second threshold value is 175, there is an interval greater than the third interval, that is, 223 to 255, and the third threshold value is 239;
[0108] The binarization module is configured to convert the turntable gray scale image into a region binary image based on the first threshold value, and convert the turntable gray scale image into a turntable binary image based on the second threshold value and the third threshold value;
[0109] The binarization module is configured with a binarization strategy, and the binarization strategy includes:
[0110] In the turntable gray scale image, the turntable gray scale value less than or equal to the first threshold value is set to 0, and the gray scale value greater than the first threshold value is set to 255, to obtain a region binary image; because the color of the special recognition area is set to black, that is, the distribution range of the gray value is low;
[0111] In the turntable grayscale image, turntable grayscale values greater than or equal to the second threshold and less than or equal to the third threshold are set to 0, and turntable grayscale values less than the second threshold or greater than the third threshold are set to 255 to obtain the turntable binarized image; because the turntable part is silver-white, the grayscale value is relatively high.
[0112] In practical applications, in the turntable grayscale image, turntable grayscale values less than or equal to 79 are set to 0, and grayscale values greater than 79 are set to 255 to obtain a region binarized image; turntable grayscale values greater than or equal to 175 and less than or equal to 239 are set to 0, and turntable grayscale values less than 175 or greater than 235 are set to 255 to obtain a turntable binarized image.
[0113] The first reference point acquisition module is used to acquire the first reference point based on the region binarized map;
[0114] The first reference point acquisition module is configured with a first reference point acquisition strategy, which includes:
[0115] Establish a Cartesian coordinate system and label it as the reference coordinate system;
[0116] Place the binarized region map in the first quadrant of the reference coordinate system, while satisfying that two sides of the binarized region map coincide with the horizontal and vertical axes of the reference coordinate system, respectively.
[0117] Mark the pixels with a gray value of 0 in the region binarized image as region pixels;
[0118] The two contiguous regions with the highest number of pixels are identified and marked as special regions.
[0119] Define the coordinates of a special region as (x i ,y i ), get x i The maximum value of x i minimum value, y i The maximum value and y i The minimum values are denoted as x. max x min y max and y min Draw the point (x) min y min ) and point (x) max y max ), connection point (x) min y min ) and point (x) max y max Obtain the first line segment, and mark the midpoint of the first line segment as the center of the region;
[0120] Obtaining the region center points of the two special regions, obtaining the midline of the two region center points, and marking the midline as a first reference point;
[0121] In practical applications, please refer to Figure 3 as shown in FIG. 1, for example, x max , x min , y max and y min are 119, 93, 136 and 113 respectively, the region center points obtained are the drawing points (93, 113) and (119, 136), one of the region center points is (106, 124.5), and the other region center point obtained is (127, 104.5), and the first reference point is (106.5, 114.5);
[0122] The second reference point acquisition module is configured to acquire a second reference point based on the turntable binary image.
[0123] The second reference point acquisition module is configured with a second reference point acquisition strategy, and the second reference point acquisition strategy comprises:
[0124] The turntable binary image is placed in the first quadrant of the reference coordinate system, and meanwhile, two edges of the turntable binary image are respectively coincident with the horizontal axis and the vertical axis of the reference coordinate system.
[0125] The pixel points with a gray value of 0 in the turntable binary image are marked as turntable pixel points.
[0126] A continuous region with the largest number of turntable pixel points is obtained, and the continuous region is marked as a turntable region.
[0127] The coordinate points of the boundaries of the first number of turntable regions are obtained, and the coordinate points are marked as boundary coordinate points; the first number is 30, that is, the boundary image of the turntable region can be observed.
[0128] The boundary fitting equation is set as: (Kh-f1) 2 + (Kz-f2) 2 =f3; wherein Kh is the horizontal coordinate of the boundary coordinate point, Kz is the vertical coordinate of the boundary coordinate point, f1, f2 and f3 are coefficients of the boundary fitting equation; because the turntable is circular, the center of the circle is better determined based on the circle.
[0129] The boundary coordinate points are fitted by the boundary fitting equation to obtain specific values of f1, f2 and f3.
[0130] The second reference point is set as: (f1, f2).
[0131] In practical applications, please refer to Figure 4 as shown in FIG. 1, for example, the boundary fitting equation is: (Kh-80) 2 + (Kz-80) 2= 5625, i.e. the second reference point is obtained as: (80, 80).
[0132] The included angle obtaining module is configured to obtain an included angle change value based on the first reference point and the second reference point.
[0133] The included angle obtaining module is configured with an included angle obtaining strategy, and the included angle obtaining strategy comprises:
[0134] A vector from the second reference point to the first reference point is obtained, which is marked as a reference vector.
[0135] The turntable images are continuously obtained, and a reference vector of each turntable image in the reference coordinate system is obtained, and the time of obtaining each turntable image is recorded, which is marked as an image acquisition time.
[0136] An included angle between the reference vector of the real-time turntable image and the reference vector of the first turntable image is obtained, which is marked as an included angle change value.
[0137] In actual application, please refer to Figure 5 The reference vector diagram is shown, for example, the included angle change value after 1s is 90°.
[0138] The angle displacement amount obtaining module is configured to obtain an angle displacement amount based on the included angle change value.
[0139] The angle displacement amount module is configured with an angle displacement amount strategy, and the angle displacement amount strategy comprises:
[0140] A plane rectangular coordinate system is established with the image acquisition time as the X axis and the included angle change value as the Y axis, which is marked as an included angle coordinate system.
[0141] The image acquisition time and the corresponding included angle change value are drawn in the included angle coordinate system as the horizontal coordinate and the vertical coordinate of the function coordinate point to obtain an included angle scatter plot.
[0142] The included angle scatter plot is fitted to obtain an included angle function.
[0143] The corresponding time of the angle displacement amount that is wanted to know is obtained, which is marked as a real-time time.
[0144] The vertical axis data corresponding to the real-time time in the included angle function is obtained, which is marked as u.
[0145] The number of closed figures formed by the included angle function graph between the corresponding horizontal coordinates of the real-time time and the horizontal axis of the included angle coordinate system is obtained, which is marked as h; because the turntable rotates, the included angle change value changes between 0° and 180°, and when the turntable rotates 360°, the included angle change value at this time is 0°, so a closed image is formed.
[0146] The coordinate point of the corresponding included angle function t seconds before the real-time time is obtained, which is marked as a real-time reference coordinate point; t should not be too large, for example, t is 0.1s.
[0147] Connect the real-time reference coordinate point with the point (u, h) to obtain a straight line, which is marked as a function connection straight line;
[0148] If the slope of the function connection straight line is not a positive value, the angle displacement amount is h x 360° + u; if the slope of the function connection straight line is not a negative value, the angle displacement amount is h x 360° + 360° - u; if the slope of the function connection straight line is 0, the coordinate point of the corresponding angle function at the real-time time t seconds is taken as the real-time reference coordinate point, a new function connection straight line is obtained, and the judgment is repeated until the slope of the new function connection straight line is not 0;
[0149] In actual application, please refer to Figure 6 It is shown that the obtained angle function is, for example, the real-time time is 9s, and the corresponding function value is 60°, so (u, h) is (9, 60), the real-time reference coordinate point is (8.9, 54), the slope of the function connection straight line is 60, that is, the slope is a positive value, and the obtained h is 2, that is, the angle displacement amount is h x 360° + u = 2 x 360° + 60° = 780°, indicating that 0s to 9s, 780° is rotated.
[0150] Embodiment 2, please refer to Figure 7 It is shown that the present application provides a rotary table angle displacement measurement method, comprising the following steps:
[0151] Step S1, a special identification area is set on the rotary table; step S1 comprises the following substeps:
[0152] Step S101, two rectangular areas with a side length of a centimeters are obtained, the color of the rectangular area is set to pure black, the interval of the rectangular area is c centimeters, and the two rectangular areas are marked as special identification areas;
[0153] Step S2, a rotary table image is obtained from directly above the rotary table;
[0154] Step S3, a rotary table grayscale image is obtained by performing grayscale processing on the rotary table image; step S3 comprises the following substeps:
[0155] Step S301, the R value, the G value and the B value of each pixel point in the rotary table image are obtained;
[0156] Step S302, the average value of the R value, the G value and the B value of each pixel point in the rotary table image is obtained, which is marked as a rotary table grayscale value;
[0157] Step S303, each pixel point in the rotary table image is displayed using the rotary table grayscale value to obtain a rotary table grayscale image.
[0158] Step S4, obtaining a first threshold value, a second threshold value and a third threshold value based on the first quantity of turret part images; step S4 includes the following sub-steps:
[0159] Step S401, dividing the gray value of 0 to 255 into e intervals, marked as equal interval;
[0160] Step S402, respectively counting the frequency of the gray value of the turret in each equal interval, marked as equal frequency;
[0161] Step S403, drawing a histogram with the gray value of the turret as the X axis, the equal frequency as the Y axis, and the equal interval as the histogram interval, marked as the turret histogram;
[0162] Step S404, in the turret histogram, marking the equal frequency greater than the adjacent equal frequency on the left and right sides as the peak frequency;
[0163] Step S405, marking the equal interval corresponding to the peak frequency as the peak interval;
[0164] Step S406, obtaining the number of peak intervals, when the number of peak intervals is less than 3, increasing the specific value of e, obtaining a new turret histogram, until the number of peak intervals is greater than or equal to 3;
[0165] Step S407, when the number of peak ranges is greater than or equal to 3, marking the middle value in each equal interval as the interval middle value; marking the peak interval with the smallest interval middle value as the first interval, marking the peak interval with the largest interval middle value as the third interval, and marking a peak interval closest to the middle value of the first interval and the third interval as the second interval;
[0166] Step S408, in the turret histogram, obtaining the middle value of the equal interval with the minimum equal frequency between the first interval and the second interval, marked as the first threshold value;
[0167] Step S409, obtaining the middle value of the equal interval with the minimum equal frequency between the second interval and the third interval, marked as the second threshold value;
[0168] Step S410, determining whether there is an equal interval greater than the third interval, if there is, obtaining the middle value of the equal interval with the minimum equal frequency greater than the third interval, marked as the third threshold value, if there is not, marking the maximum value of the third interval as the third threshold value.
[0169] Step S5, converting the turret gray scale image into a region binary image based on the first threshold value, and converting the turret gray scale image into a turret binary image based on the second threshold value and the third threshold value; step S5 includes the following sub-steps:
[0170] Step S501: In the turntable grayscale image, set the turntable grayscale values less than or equal to the first threshold to 0, and set the grayscale values greater than the first threshold to 255 to obtain the region binarized image.
[0171] Step S502: In the turntable grayscale image, set the turntable grayscale values that are greater than or equal to the second threshold and less than or equal to the third threshold to 0, and set the turntable grayscale values that are less than the second threshold or greater than the third threshold to 255, to obtain the turntable binarized image.
[0172] Step S6: Obtain the first reference point based on the region binarized map; Step S6 includes the following sub-steps:
[0173] Step S601: Establish a Cartesian coordinate system and mark it as the reference coordinate system;
[0174] Step S602: Place the binarized region map in the first quadrant of the reference coordinate system, while satisfying that two sides of the binarized region map coincide with the horizontal and vertical axes of the reference coordinate system, respectively.
[0175] Step S603: Mark the pixels with a gray value of 0 in the region binarized image as region pixels;
[0176] Step S604: Obtain the two contiguous regions with the most pixels and mark them as special regions;
[0177] Step S605, set the coordinates of a special region as (x i ,y i ), get x i The maximum value of x i minimum value, y i The maximum value and y i The minimum values are denoted as x. max x min y max and y min Draw the point (x) min y min ) and point (x) max y max ), connection point (x) min y min ) and point (x) max y max Obtain the first line segment, and mark the midpoint of the first line segment as the center of the region;
[0178] Step S606: Obtain the midpoint of the two special regions, obtain the midline between the midpoints of the two regions, and mark it as the first reference point.
[0179] Step S7: Obtain the second reference point based on the binarized image of the turntable; Step S7 includes the following sub-steps:
[0180] Step S701, place the turntable binary image in the first quadrant of the reference coordinate system, while satisfying that two edges of the turntable binary image respectively coincide with the horizontal axis and the vertical axis of the reference coordinate system;
[0181] Step S702, mark the pixel points with a gray value of 0 in the turntable binary image as turntable pixel points;
[0182] Step S703, obtain a continuous region with the largest number of turntable pixel points, and mark it as a turntable region;
[0183] Step S704, obtain the coordinate points of the boundaries of the first number of turntable regions, and mark them as boundary coordinate points;
[0184] Step S705, set the boundary fitting equation as: (Kh-f1) 2 + (Kz-f2) 2 =f3; where Kh is the horizontal coordinate of the boundary coordinate point, Kz is the vertical coordinate of the boundary coordinate point, f1, f2 and f3 are coefficients of the boundary fitting equation;
[0185] Step S706, fit the boundary coordinate points with the boundary fitting equation to obtain the specific values of f1, f2 and f3;
[0186] Step S707, set the second reference point as: (f1, f2).
[0187] Step S8, obtain an angle change value based on the first reference point and the second reference point; Step S8 includes the following sub-steps:
[0188] Step S801, obtain a vector from the second reference point to the first reference point, and mark it as a reference vector;
[0189] Step S802, continuously obtain turntable images and obtain the reference vector of each turntable image in the reference coordinate system, and record the time when each turntable image is obtained, and mark it as image acquisition time;
[0190] Step S803, obtain the angle between the reference vector of the real-time turntable image and the reference vector of the first turntable image, and mark it as the angle change value.
[0191] Step S9, obtain an angular displacement based on the angle change value; Step S9 includes the following sub-steps:
[0192] Step S901, establish a plane rectangular coordinate system with the image acquisition time as the X axis and the angle change value as the Y axis, and mark it as the angle coordinate system;
[0193] Step S902, plot the image acquisition time and the corresponding angle change value as the horizontal and vertical coordinates of the function coordinate points in the angle coordinate system to obtain an angle scatter plot;
[0194] Step S903, fit the angle scatter plot to obtain an angle function;
[0195] Step S904, obtain the corresponding time of the angle displacement amount to be known, which is marked as the real-time time;
[0196] Step S905, obtain the vertical axis data corresponding to the real-time time in the angle function, which is marked as u;
[0197] Step S906, obtain the number of closed figures formed by the angle function graph between the horizontal coordinates corresponding to the real-time time and the horizontal axis of the angle coordinate system, which is marked as h;
[0198] Step S907, obtain the coordinate points of the angle function corresponding to the t seconds before the real-time time, which are marked as the real-time reference coordinate points;
[0199] Step S908, connect the real-time reference coordinate points and the point (u, h) to obtain a straight line, which is marked as the function connection straight line;
[0200] Step S909, if the slope of the function connection straight line is positive, obtain the angle displacement amount as h×360°+u; if the slope of the function connection straight line is negative, obtain the angle displacement amount as h×360°+360°-u; if the slope of the function connection straight line is 0, obtain the coordinate points of the angle function corresponding to the t seconds after the real-time time as the real-time reference coordinate points, obtain a new function connection straight line, and repeat the judgment until the slope of the new function connection straight line is not 0.
[0201] Those skilled in the art will appreciate that embodiments of the present application can be readily used as a method, a system or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (or computer- readable storage media) having computer-usable program code embodied in the medium. The medium can be any available storage media that can be accessed by a computer. By way of example, and not limitation, such computer-usable storage media can include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other storage medium that can be used to carry or store desired computer program code in the form of instructions or data structures and that can be accessed by a computer. Also, the present application can be embodied in a computer program product that can be traded as goods or merchandise, through the storage medium described above or any other suitable medium. When the computer program code is executed by a computer, a series of instructions or a series of operations is performed. Also, the present application can be embodied in a computer program product that can be traded as goods or merchandise, through the storage medium described above or any other suitable medium. When the computer program code is executed by a computer, a series of instructions or a series of operations is performed. Figure 1 one or more flows and / or blocks Figure 1 one or more flows and / or blocks
[0202] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, another division manner can be used. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some communication interfaces. The coupling or communication connection can be electrical, mechanical or in other forms.
Claims
1. A method of measuring angular displacement of a turntable, characterized by, The method comprises the following steps: Setting a special identification area on the turntable; Obtaining a turntable image from directly above the turntable; Performing grayscale processing on the turntable image to obtain a turntable grayscale image; Obtaining a first threshold value, a second threshold value and a third threshold value based on the first number of turntable partial images; Converting the turntable grayscale image into a region binary image based on the first threshold value, and converting the turntable grayscale image into a turntable binary image based on the second threshold value and the third threshold value; Obtaining a first reference point based on the region binary image; Obtaining a second reference point based on the turntable binary image; Obtaining an angle change value based on the first reference point and the second reference point; Obtaining an angle displacement based on the angle change value; The step of obtaining a first threshold value, a second threshold value and a third threshold value based on the first number of turntable partial images further comprises the following sub-steps: Dividing the grayscale values from 0 to 255 into e intervals, which are marked as equal intervals; Respectively counting the frequency of the turntable grayscale values in each equal interval, which is marked as equal frequency; Drawing a histogram with the turntable grayscale values as the X axis, the equal frequency as the Y axis and the equal intervals as the histogram intervals, which is marked as a turntable histogram; In the turntable histogram, marking the equal frequency greater than the adjacent equal frequencies on the left and right sides as a peak frequency; Marking the equal interval corresponding to the peak frequency as a peak interval; Obtaining the number of peak intervals, and when the number of peak intervals is less than 3, increasing the specific value of e, obtaining a new turntable histogram, and repeating the process until the number of peak intervals is greater than or equal to 3; When the number of peak intervals is greater than or equal to 3, marking the middle value in each equal interval as an interval middle value, marking the peak interval with the smallest interval middle value as a first interval, marking the peak interval with the largest interval middle value as a third interval, and obtaining a peak interval closest to the middle values of the first interval and the third interval as a second interval; In the turntable histogram, obtaining the middle value of the equal interval with the minimum equal frequency between the first interval and the second interval as a first threshold value; Obtaining the middle value of the equal interval with the minimum equal frequency between the second interval and the third interval as a second threshold value; Determining whether there is an equal interval greater than the third interval, and if there is, obtaining the middle value of the equal interval with the minimum equal frequency greater than the third interval as a third threshold value, or if there is not, marking the maximum value of the third interval as the third threshold value; The steps of converting the turntable grayscale image into a region binary image based on the first threshold value, and converting the turntable grayscale image into a turntable binary image based on the second threshold value and the third threshold value comprise the following sub-steps: In the turntable grayscale image, setting the turntable grayscale values less than or equal to the first threshold value as 0, and setting the grayscale values greater than the first threshold value as 255 to obtain a region binary image; In the turntable grayscale image, setting the turntable grayscale values greater than or equal to the second threshold value and less than or equal to the third threshold value as 0, and setting the turntable grayscale values less than the second threshold value or greater than the third threshold value as 255 to obtain a turntable binary image.
2. The method of claim 1, wherein The step of setting a special identification area on the turntable comprises the following sub-steps: Obtaining two rectangular areas with a side length of a centimeters, setting the color of the rectangular areas as pure black, setting the interval of the rectangular areas as c centimeters, and marking the two rectangular areas as special identification areas.
3. A method of measuring angular displacement of a turntable according to claim 2, wherein The gray processing of the turntable image to obtain the turntable gray image further includes the following sub-steps: The R value, G value and B value of each pixel point in the turntable image are obtained; The average value of the R value, G value and B value of each pixel point in the turntable image is calculated and marked as the turntable gray value; The turntable gray value is used to display each pixel point in the turntable image to obtain the turntable gray image.
4. A method of measuring the angular displacement of a turntable according to claim 3, wherein The first reference point based on the region binary image includes the following sub-steps: A plane rectangular coordinate system is established and marked as a reference coordinate system; The region binary image is placed in the first quadrant of the reference coordinate system, and meanwhile, two edges of the region binary image are respectively coincident with the horizontal axis and the vertical axis of the reference coordinate system; The pixel points with the gray value of 0 in the region binary image are marked as region pixel points; Two continuous regions with the largest number of region pixel points are obtained and marked as special regions; Set a special area of the coordinate marker as (x i ,y i ), get the maximum value of x i , the minimum value of x i , the maximum value of y i , and the minimum value of y i , respectively marked as x max , x min , y max and y min , draw the point (x min , y min ) and the point (x max , y max ), connect the point (x min , y min ) and the point (x max , y max ) to obtain the first line segment, and get the midpoint of the first line segment marked as the area midpoint; The region midpoints of the two special regions are obtained, and the midline of the two region midpoints is obtained and marked as the first reference point.
5. A method of measuring angular displacement of a turntable according to claim 4, wherein, The second reference point based on the turntable binary image includes the following sub-steps: The turntable binary image is placed in the first quadrant of the reference coordinate system, and meanwhile, two edges of the turntable binary image are respectively coincident with the horizontal axis and the vertical axis of the reference coordinate system; The pixel points with the gray value of 0 in the turntable binary image are marked as turntable pixel points; One continuous region with the largest number of turntable pixel points is obtained and marked as a turntable region; The coordinate points of the boundary of the first number of turntable regions are obtained and marked as boundary coordinate points; The boundary fitting equation is set as: (Kh-f1) 2 + (Kz-f2) 2 =f3; wherein Kh is the horizontal coordinate of the boundary coordinate point, Kz is the vertical coordinate of the boundary coordinate point, f1, f2 and f3 are the coefficients of the boundary fitting equation. The boundary coordinate points are fitted by a boundary fitting equation to obtain the specific values of f1, f2 and f3; The second reference point is set as (f1, f2).
6. A method of measuring angular displacement of a turntable according to claim 5, wherein, The included angle change value based on the first reference point and the second reference point includes the following sub-steps: The vector from the second reference point to the first reference point is obtained and marked as a reference vector; The turntable images are continuously obtained, and the reference vector of each turntable image in the reference coordinate system is obtained, and the time of obtaining each turntable image is recorded and marked as an image acquisition time; The included angle between the reference vector of the real-time turntable image and the reference vector of the first turntable image is obtained and marked as an included angle change value.
7. A method of measuring angular displacement of a turntable according to claim 6, wherein The angle displacement amount based on the included angle change value includes the following steps: A plane rectangular coordinate system is established with the image acquisition time as the X axis and the included angle change value as the Y axis, and marked as an included angle coordinate system; The image acquisition time and the corresponding included angle change value are taken as the horizontal coordinate and the vertical coordinate of the function coordinate point to draw an included angle scatter plot in the included angle coordinate system; The included angle function is obtained by fitting the included angle scatter plot; The corresponding time of the angle displacement amount that is wanted to know is obtained and marked as a real-time time; The vertical axis data corresponding to the real-time time in the included angle function is obtained and marked as u; The number of closed figures formed by the included angle function graph between the corresponding horizontal coordinates of the real-time time and the horizontal axis of the included angle coordinate system is obtained and marked as h; The coordinate points of the corresponding included angle function in the t seconds before the real-time time are obtained and marked as real-time reference coordinate points; A straight line is obtained by connecting the real-time reference coordinate points and the point (u, h), and marked as a function connection straight line; If the slope of the function connection straight line is positive, the angle displacement amount is h*360°+u; if the slope of the function connection straight line is negative, the angle displacement amount is h*360°+360°-u; if the slope of the function connection straight line is 0, the coordinate point of the corresponding angle function after t seconds is obtained as the real-time reference coordinate point, a new function connection straight line is obtained, and the judgment is repeated until the slope of the new function connection straight line is not 0.
8. A rotary table angular displacement measuring displacement sensor for implementing the method of any one of claims 1-7, characterized by, The system comprises a region setting module, an image acquisition module, a grayscale module, a threshold acquisition module, a binary module, a first reference point acquisition module, a second reference point acquisition module, an angle acquisition module, and an angle displacement amount acquisition module. The region setting module is configured to set a special recognition region on the turntable. The image acquisition module is configured to acquire a turntable image from directly above the turntable. The grayscale module is configured to perform grayscale processing on the turntable image to obtain a turntable grayscale image. The threshold acquisition module is configured to acquire a first threshold, a second threshold, and a third threshold based on the first number of turntable part images. The binary module is configured to convert the turntable grayscale image into a region binary image based on the first threshold, and convert the turntable grayscale image into a turntable binary image based on the second threshold and the third threshold. The first reference point acquisition module is configured to acquire a first reference point based on the region binary image. The second reference point acquisition module is configured to acquire a second reference point based on the turntable binary image. The angle acquisition module is configured to acquire an angle change value based on the first reference point and the second reference point. The angle displacement amount acquisition module is configured to acquire an angle displacement amount based on the angle change value.
Citation Information
Patent Citations
Turntable leveling method based on image processing
CN103389111A
Joint calibration method for camera and rotary table
CN118429445A