Rotary table angle displacement measuring method and displacement sensor
By setting a special recognition area on the turntable and performing image processing to obtain the turntable angular displacement, the problems of the existing method being cumbersome and costly are solved, and efficient and convenient angular displacement measurement is achieved.
Patent Information
- Application Number
- CN202511106128.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-08-08
AI Technical Summary
The existing methods for measuring turntable angular displacement are cumbersome, with high system costs and low automation. In addition, the measurement of rotary encoders and laser trackers has problems such as high installation accuracy requirements, susceptibility to electromagnetic interference and high equipment costs.
A special recognition area is set on the turntable, and an image is acquired from directly above the turntable. The image is grayscaled, a threshold is obtained, and the image is converted into a binary image. The angle change value is obtained based on the reference point to calculate the angular displacement.
It realizes efficient and convenient angular displacement measurement without the need for precise installation and large-scale data calculation, reducing measurement costs and improving the degree of automation.
Smart Images

Figure CN120635210A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of turntable angular displacement measurement, and in particular to a turntable angular displacement measurement method and a displacement sensor. Background Art
[0002] A turntable is a precision rotary motion platform whose core function is to perform precise angular positioning, continuous rotation, or indexing around a fixed axis of rotation. Therefore, turntable rotation data is particularly important. For example, measuring turntable angular displacement is a key technology for achieving high-precision motion control, improving system performance, and ensuring safety. Therefore, it is necessary to measure turntable angular displacement. Existing measurement methods are mainly rotary encoder measurement and laser tracker measurement. Among them, rotary encoder measurement requires the installation of a rotary encoder on the turntable shaft to measure the angular displacement, so the installation accuracy of the encoder is high. At the same time, the encoder is easily affected by electromagnetic interference, which affects the stability of the measurement; among them, laser tracker measurement requires a complex optical system and a high-precision laser tracker, and the equipment cost is relatively high. At the same time, the installation accuracy of the reflector is high. A small displacement or tilt of the reflector will cause measurement errors. The turntable needs to be paused multiple times to obtain data during the measurement process, which is inefficient; therefore, an image-based measurement method is proposed. The image measurement method does not require precise installation and large-scale data calculation, and does not affect the normal operation of the turntable. However, the turntable generally has a symmetrical shape, and the symmetrical shape is difficult to distinguish when it rotates, that is, the existing measurement method in the prior art, resulting in a cumbersome measurement process, high system cost and low degree of automation. Summary of the Invention
[0003] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent, by setting a special identification area on the turntable, obtaining a turntable image from directly above the turntable, grayscale processing the turntable image to obtain a turntable grayscale map, obtaining a first threshold, a second threshold and a third threshold based on a first number of partial images of the turntable, converting the turntable grayscale map into a regional binary map based on the first threshold, converting the turntable grayscale map into a turntable binary map based on the second threshold and the third threshold, obtaining a first reference point based on the regional binary map, obtaining a second reference point based on the turntable binary map, obtaining an angle change value based on the first reference point and the second reference point, and obtaining an angular displacement based on the angle change value, so as to solve the problems of the existing measurement methods in the prior art, which result in a cumbersome measurement process, high system cost and low degree of automation.
[0004] To achieve the above objectives, the present application provides a method for measuring the angular displacement of a turntable, comprising the following steps: Set up special identification areas on the turntable; Acquire the turntable image from directly above the turntable; Performing grayscale processing on the turntable image to obtain a turntable grayscale image; acquiring a first threshold, a second threshold, and a third threshold based on a first number of partial images of the turntable; Converting the turntable grayscale image into a region binary image based on a first threshold, and converting the turntable grayscale image into a turntable binary image based on a second threshold and a third threshold; Obtaining a first reference point based on the region binarization image; Acquire a second reference point based on the turntable binarization image; Obtaining an angle change value based on the first reference point and the second reference point; The angular displacement is obtained based on the angle change value.
[0005] Furthermore, setting a special recognition area on the turntable includes the following sub-steps: Get two rectangular areas with a side length of a centimeters, set the color of the rectangular areas to pure black, the interval between the rectangular areas to c centimeters, and mark the two rectangular areas as special recognition areas.
[0006] Furthermore, grayscale processing of the turntable image to obtain a turntable grayscale image further includes the following sub-steps: Get the R value, G value, and B value of each pixel in the turntable image; Calculate the mean of the R value, G value, and B value of each pixel in the turntable image and mark it as the turntable grayscale value; Each pixel in the turntable image is displayed using the turntable grayscale value to obtain a turntable grayscale image.
[0007] Furthermore, acquiring the first threshold, the second threshold, and the third threshold based on the first number of partial images of the turntable further includes the following sub-steps: Divide the grayscale values from 0 to 255 into e intervals, marked as equal intervals; Count the frequency of the turntable grayscale value in each equally divided interval respectively, and mark it as the equally divided frequency; Draw a histogram with the turntable grayscale value as the X-axis, the equally divided frequency as the Y-axis, and the equally divided interval as the histogram interval, and mark it as the turntable histogram; In the turntable histogram, the frequency that is greater than the adjacent equal division frequencies on the left and right sides is marked as the peak frequency; Mark the equal intervals corresponding to the peak frequency as peak intervals; Obtain the number of peak intervals. When the number of peak intervals is less than 3, increase the specific value of e and obtain a new turntable histogram until the number of peak intervals is greater than or equal to 3. When the number of peak ranges is greater than or equal to 3, mark the middle value in each equally divided interval as the interval median; mark the peak interval with the smallest interval median as the first interval, mark the peak interval with the largest interval median as the third interval, and obtain the peak interval closest to the middle value of the first and third intervals as the second interval; In the turntable histogram, obtain the median value of the equal-division interval with the smallest equal-division frequency between the first interval and the second interval, and mark it as the first threshold; Obtain the median value of the equal-division interval with the smallest equal-division frequency between the second interval and the third interval, and mark it as the second threshold; Determine whether there is an equal-division interval greater than the third interval. If so, obtain the median of the equal-division interval with the smallest equal-division frequency greater than the third interval and mark it as the third threshold. If not, mark the maximum value of the third interval as the third threshold.
[0008] Furthermore, converting the turntable grayscale image into a region binary image based on the first threshold, and converting the turntable grayscale image into a turntable binary image based on the second threshold and the third threshold includes the following sub-steps: In the turntable grayscale image, the turntable grayscale values less than or equal to the first threshold are set to 0, and the grayscale values greater than the first threshold are set to 255, to obtain a region binarization image; 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 a turntable binary image.
[0009] Furthermore, obtaining the first reference point based on the region binarization image includes the following sub-steps: Establish a plane rectangular coordinate system and mark it as the reference coordinate system; Place the regional binary graph in the first quadrant of the reference coordinate system, and at the same time satisfy the requirement that the two sides of the regional binary graph coincide with the horizontal axis and vertical axis of the reference coordinate system respectively; Mark the pixels with gray value 0 in the region binarization image as region pixels; Get the two consecutive regions with the largest number of regional pixels and mark them as special regions; Set the coordinates of a special area to be marked as (x i ,y i ), get x i The maximum value of x i The minimum value of y i The maximum value of y i The minimum value of max 、x min 、y max and y min , plot the point (x min,y min ) and point (x max ,y max ), connecting the points (x min ,y min ) and point (x max ,y max ) obtain a first line segment, obtain the midpoint of the first line segment and mark it as the midpoint of the region; Get the midpoints of the two special areas, get the midline of the midpoints of the two areas, and mark them as the first reference point.
[0010] Furthermore, obtaining the second reference point based on the turntable binarization image includes the following sub-steps: Place the turntable binary graph in the first quadrant of the reference coordinate system, and at the same time, satisfy the requirement that the two sides of the turntable binary graph coincide with the horizontal axis and the vertical axis of the reference coordinate system respectively; Mark the pixels with gray value 0 in the turntable binary image as turntable pixels; Get a coherent area with the largest number of turntable pixels and mark it as the turntable area; Obtaining coordinate points of the boundaries of a first number of turntable areas and marking them as boundary coordinate points; Set the boundary fitting equation to: (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, and f1, f2 and f3 are the coefficients of the boundary fitting equation; Fit the boundary coordinate points with the boundary fitting equation to obtain the specific values of f1, f2 and f3; Set the second reference point to: (f1, f2).
[0011] Furthermore, obtaining the angle change value based on the first reference point and the second reference point includes the following sub-steps: Get the vector from the second reference point to the first reference point, marked as the reference vector; Continuously acquire turntable images and obtain the reference vector of each turntable image in the reference coordinate system, and record the time of each turntable image acquisition, which is marked as image acquisition time; The 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 the angle change value.
[0012] Furthermore, obtaining the angular displacement based on the angle change value includes the following steps: With the image acquisition time as the X-axis and the angle change value as the Y-axis, a plane rectangular coordinate system is established, which is marked as the angle coordinate system; The image acquisition time and the corresponding angle change value are used as the horizontal coordinate and vertical coordinate of the function coordinate point to be plotted in the angle coordinate system to obtain an angle scatter plot; Fit the angle scatter plot to obtain the angle function; Get the time corresponding to the desired angular displacement, marked as real time; Get the vertical axis data corresponding to the real time in the angle function, marked as u; Get the number of closed figures formed by the angle function graph between the real-time corresponding horizontal coordinate and the horizontal axis of the angle coordinate system, marked as h; Get the coordinate point of the angle function corresponding to t seconds before the real time, and mark it as the real-time reference coordinate point; Connect the real-time reference coordinate point and the point (u, h) to obtain a straight line, which is marked as the function connecting line; If the slope of the function connecting straight line is positive, the angular displacement is obtained as: h×360°+u; if the slope of the function connecting straight line is negative, the angular displacement is obtained as: h×360°+360°-u; if the slope of the function connecting straight line is 0, the coordinate point of the corresponding angle function t seconds after the real-time time is obtained as the real-time reference coordinate point, and a new function connecting straight line is obtained. Repeat the judgment until the slope of the new function connecting straight line is not 0.
[0013] The present application also provides a turntable angular displacement measurement displacement sensor, comprising: an area 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 angle acquisition module, and an angular displacement acquisition module; The area setting module is used to set a special identification area on the turntable; The image acquisition module is used to acquire the turntable image from directly above the turntable; The grayscale module is used to perform grayscale processing on the turntable image to obtain a turntable grayscale image; The threshold acquisition module is used to acquire a first threshold, a second threshold, and a third threshold based on a first number of turntable partial images; The binarization module is used to convert the turntable grayscale image into a region binarization image based on a first threshold value, and to convert the turntable grayscale image into a turntable binarization image based on a second threshold value and a third threshold value; The first reference point acquisition module is used to acquire a first reference point based on the region binarization image; The second reference point acquisition module is used to acquire a second reference point based on the turntable binarization image; The angle acquisition module is used to acquire the angle change value based on the first reference point and the second reference point; The angular displacement acquisition module is used to acquire the angular displacement based on the angle change value.
[0014] Beneficial effects of the present invention: The present invention sets a special identification area on the turntable, obtains a turntable image from directly above the turntable, grayscales the turntable image to obtain a turntable grayscale map, obtains a first threshold, a second threshold and a third threshold based on a first number of partial images of the turntable, converts the turntable grayscale map into a regional binary map based on the first threshold, converts the turntable grayscale map into a turntable binary map based on the second threshold and the third threshold, obtains a first reference point based on the regional binary map, obtains a second reference point based on the turntable binary map, obtains an angle change value based on the first reference point and the second reference point, and obtains an angular displacement based on the angle change value. The advantage of this method is that, compared with rotary encoder measurement and laser tracker measurement, this method does not require precise installation and large-scale data calculation, and does not affect the normal operation of the turntable, that is, the measurement cost of the turntable angular displacement measurement is reduced and the measurement convenience is increased; The present invention sets a special recognition area on the turntable. The advantage is that since it is difficult for the turntable itself to distinguish images, it is necessary to set a special recognition area to make the measurement of the turntable angle displacement more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a functional block diagram of the system of the present invention; Figure 2 is a schematic diagram of a turntable histogram of the present invention; Figure 3 is a schematic diagram of a first reference point of the present invention; Figure 4 is a schematic diagram of a second reference point of the present invention; Figure 5 is a schematic diagram of a reference vector of the present invention; Figure 6 Schematic diagram of the angle function of the present invention; Figure 7 Flow chart of the steps of the method of the present invention. DETAILED DESCRIPTION
[0016] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0017] Example 1, please refer to Figure 1As shown, the present application provides a turntable angular displacement measurement displacement sensor, including an area 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 angle acquisition module, and an angular displacement acquisition module; The area setting module is used to set special recognition areas on the turntable; The region setting module is configured with a region setting strategy, which includes: Get two rectangular areas with a side length of a centimeters, set the color of the rectangular areas to pure black, and the distance between the rectangular areas to c centimeters. Mark these two rectangular areas as special recognition areas. Because the regular turntable image cannot accurately find the rotation reference point during rotation, setting special recognition areas is convenient for recognition. At the same time, the special recognition areas are larger than the other turntable recesses, but the special recognition areas cannot exceed the size of the turntable. For example, a is 20 and c is 10. Set it to square because the inherent graphics are basically circular, which is easy to distinguish. At the same time, pure black is easy to recognize. The image acquisition module is used to acquire the turntable image from directly above the turntable; The grayscale module is used to grayscale the turntable image to obtain a turntable grayscale image; The grayscale module is configured with a grayscale strategy, which includes: Get the R value, G value, and B value of each pixel in the turntable image; Calculate the mean of the R value, G value, and B value of each pixel in the turntable image and mark it as the turntable grayscale value; Display each pixel in the turntable image using the turntable grayscale value to obtain a turntable grayscale image; In practical applications, for example, if the R value, G value, and B value of a pixel are 120, 122, and 124 respectively, the turntable grayscale value of the pixel is 122.
[0018] The threshold acquisition module is used to acquire a first threshold, a second threshold, and a third threshold based on a first number of partial images of the turntable; The threshold acquisition module is configured with a threshold acquisition strategy, which includes: Divide the grayscale values from 0 to 255 into e intervals, marked as equal intervals. The setting of e is to distinguish the distribution of grayscale values in different parts. Therefore, the larger the setting of e, the clearer it is. However, if the setting of e is too large, the amount of calculation will increase. Therefore, the setting of e should not be too large or too small, for example, e is 8. Count the frequency of the turntable grayscale value in each equally divided interval respectively, and mark it as the equally divided frequency; Draw a histogram with the turntable grayscale value as the X-axis, the equally divided frequency as the Y-axis, and the equally divided interval as the histogram interval, and mark it as the turntable histogram; In the turntable histogram, the frequency that is greater than the adjacent equal division frequencies on the left and right sides is marked as the peak frequency; Mark the equal intervals corresponding to the peak frequency as peak intervals; Get the number of peak intervals. When the number of peak intervals is less than 3, increase the specific value of e and obtain a new turntable histogram until the number of peak intervals is greater than or equal to 3. Because the turntable itself is made of stainless steel, that is, the color is silvery white with a high grayscale value, the special recognition area is black with a low grayscale value, and the background is between the two, a trimodal distribution occurs. If this does not occur, the division e is too small, that is, it is impossible to distinguish the respective grayscale value distribution ranges. When the number of peak ranges is greater than or equal to 3, mark the middle value in each equally divided interval as the interval median; mark the peak interval with the smallest interval median as the first interval, mark the peak interval with the largest interval median as the third interval, and obtain the peak interval closest to the middle value of the first and third intervals as the second interval; In the turntable histogram, obtain the median value of the equal-division interval with the smallest equal-division frequency between the first interval and the second interval, and mark it as the first threshold; Obtain the median value of the equal-division interval with the smallest equal-division frequency between the second interval and the third interval, and mark it as the second threshold; Determine whether there is an equal-division interval greater than the third interval. If so, obtain the median of the equal-division interval with the smallest equal-division frequency greater than the third interval and mark it as the third threshold. If not, mark the maximum value of the third interval as the third threshold. In practical applications, please refer to Figure 2 As shown, when the number of 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 is 79, the second threshold is 175, and there is an equally divided interval of 223 to 255 that is larger than the third interval, then the third threshold is 239; The binarization module is used to convert the turntable grayscale image into a region binarization image based on a first threshold value, and to convert the turntable grayscale image into a turntable binarization image based on a second threshold value and a third threshold value; The binarization module is configured with a binarization strategy, which includes: In the turntable grayscale image, the turntable grayscale values less than or equal to the first threshold are set to 0, and the grayscale values greater than the first threshold are set to 255 to obtain a regional binary image; because the color of the special recognition area is set to black, the distribution range of the grayscale value is relatively low; In the turntable grayscale image, the 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 the turntable grayscale values less than the second threshold or greater than the third threshold are set to 255 to obtain the turntable binary image; because the turntable part is silvery white, the grayscale value is higher; In practical applications, in the turntable grayscale map, the turntable grayscale values less than or equal to 79 are set to 0, and the grayscale values greater than 79 are set to 255 to obtain a regional binary map; the turntable grayscale values greater than or equal to 175 and less than or equal to 239 are set to 0, and the turntable grayscale values less than 175 or greater than 235 are set to 255 to obtain a turntable binary map.
[0019] The first reference point acquisition module is used to acquire the first reference point based on the regional binarization image; The first reference point acquisition module is configured with a first reference point acquisition strategy, which includes: Establish a plane rectangular coordinate system and mark it as the reference coordinate system; Place the regional binary graph in the first quadrant of the reference coordinate system, and at the same time satisfy the requirement that the two sides of the regional binary graph coincide with the horizontal axis and vertical axis of the reference coordinate system respectively; Mark the pixels with gray value 0 in the region binarization image as region pixels; Get the two consecutive regions with the largest number of regional pixels and mark them as special regions; Set the coordinates of a special area to be marked as (x i ,y i ), get x i The maximum value of x i The minimum value of y i The maximum value of y i The minimum value of max 、x min 、y max and y min , plot the point (x min ,y min ) and point (x max ,y max ), connecting the points (x min ,y min ) and point (x max ,y max ) obtain a first line segment, obtain the midpoint of the first line segment and mark it as the midpoint of the region; Get the midpoints of the two special areas, get the midline between the midpoints of the two areas, and mark them as the first reference point; In practical applications, please refer to Figure 3 As shown, for example, x max 、x min 、y max and y minThey are: 119, 93, 136 and 113 respectively. The midpoints of the regions obtained are the plotted points (93, 113) and (119, 136). Then the midpoint of one region is (106, 124.5). At the same time, the midpoint of the other region is (127, 104.5). Then the first reference point is (106.5, 114.5). The second reference point acquisition module is used to acquire the second reference point based on the turntable binarization image; The second reference point acquisition module is configured with a second reference point acquisition strategy, and the second reference point acquisition strategy includes: Place the turntable binary graph in the first quadrant of the reference coordinate system, and at the same time, satisfy the requirement that the two sides of the turntable binary graph coincide with the horizontal axis and the vertical axis of the reference coordinate system respectively; Mark the pixels with gray value 0 in the turntable binary image as turntable pixels; Get a coherent area with the largest number of turntable pixels and mark it as the turntable area; Obtain a first number of coordinate points of the turntable region's boundary, marking them as boundary coordinate points; the first number is 30, which means that the boundary image of the turntable region can be observed; Set the boundary fitting equation to: (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 the coefficients of the boundary fitting equation; because the turntable is circular, the center of the circle is better determined based on the circle; Fit the boundary coordinate points with the boundary fitting equation to obtain the specific values of f1, f2 and f3; Set the second reference point to: (f1, f2); In practical applications, please refer to Figure 4 As shown, for example, the boundary fitting equation is: (Kh-80) 2 + (Kz-80) 2 =5625, that is, the second reference point is: (80, 80).
[0020] The angle acquisition module is used to acquire the angle change value based on the first reference point and the second reference point; The angle acquisition module is configured with an angle acquisition strategy, which includes: Get the vector from the second reference point to the first reference point, marked as the reference vector; Continuously acquire turntable images and obtain the reference vector of each turntable image in the reference coordinate system, and record the time of each turntable image acquisition, which is marked as image acquisition time; 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; In practical applications, please refer to Figure 5 As shown, referring to the vector diagram, for example, the angle change value after 1 second is 90°.
[0021] The angular displacement acquisition module is used to acquire the angular displacement based on the angle change value; The angular displacement module is configured with an angular displacement strategy, which includes: With the image acquisition time as the X-axis and the angle change value as the Y-axis, a plane rectangular coordinate system is established, which is marked as the angle coordinate system; The image acquisition time and the corresponding angle change value are used as the horizontal coordinate and vertical coordinate of the function coordinate point to be plotted in the angle coordinate system to obtain an angle scatter plot; Fit the angle scatter plot to obtain the angle function; Get the time corresponding to the desired angular displacement, marked as real time; Get the vertical axis data corresponding to the real time in the angle function, marked as u; Obtain the number of closed figures formed by the angle function graph between the real-time corresponding horizontal coordinate and the horizontal axis of the angle coordinate system, marked as h; as the turntable rotates, the angle change value varies between 0° and 180°. When the turntable rotates 360°, the angle change value is 0°, thus forming a closed figure; Get the coordinate point of the angle function corresponding to t seconds before the real time, and mark it as the real-time reference coordinate point; t should not be set too large, for example, t is 0.1s; Connect the real-time reference coordinate point and the point (u, h) to obtain a straight line, which is marked as the function connecting line; If the slope of the function connecting line is positive, the angular displacement is obtained as: h×360°+u; if the slope of the function connecting line is negative, the angular displacement is obtained as: h×360°+360°-u; if the slope of the function connecting line is 0, the coordinate point of the corresponding angle function t seconds after the real-time time is obtained as the real-time reference coordinate point, and a new function connecting line is obtained. Repeat the judgment until the slope of the new function connecting line is not 0; In practical applications, please refer to Figure 6 As shown, the obtained angle function, for example, the real-time time is 9s, the corresponding function value is 60°, then (u, h) is (9, 60), the connected real-time reference coordinate point is (8.9, 54), the slope of the function connection line is 60, that is, the slope is a positive value, the obtained h is 2, that is, the obtained angular displacement is: h×360°+u=2×360°+60°=780°, indicating that from 0s to 9s, it rotates 780°.
[0022] Example 2, please refer to Figure 7As shown, the present application provides a method for measuring the angular displacement of a turntable, comprising the following steps: Step S1: Setting a special recognition area on the turntable; Step S1 includes the following sub-steps: Step S101: Obtain two rectangular areas with a side length of a centimeters, set the color of the rectangular areas to pure black, set the distance between the rectangular areas to c centimeters, and mark the two rectangular areas as special recognition areas; Step S2, acquiring a turntable image from directly above the turntable; Step S3, grayscale processing is performed on the turntable image to obtain a turntable grayscale image; Step S3 includes the following sub-steps: Step S301, obtaining the R value, G value, and B value of each pixel in the turntable image; Step S302, obtaining the average of the R value, G value, and B value of each pixel in the turntable image, and marking it as the turntable grayscale value; Step S303 : Display each pixel in the turntable image using the turntable grayscale value to obtain a turntable grayscale image.
[0023] Step S4, obtaining a first threshold, a second threshold, and a third threshold based on a first number of partial images of the turntable; Step S4 includes the following sub-steps: Step S401, divide the grayscale values from 0 to 255 into e intervals, marked as equal intervals; Step S402, counting the frequency of the turntable grayscale value in each equally divided interval, and marking it as the equally divided frequency; Step S403, draw a histogram with the turntable grayscale value as the X-axis, the equally divided frequency as the Y-axis, and the equally divided intervals as the histogram intervals, and mark it as the turntable histogram; Step S404: Mark the frequency that is greater than the adjacent equal-division frequencies on the left and right sides as the peak frequency in the turntable histogram; Step S405, marking the equally divided intervals corresponding to the peak frequencies as peak intervals; Step S406, obtaining the number of peak intervals. If the number of peak intervals is less than 3, increase the specific value of e and obtain a new turntable histogram until the number of peak intervals is greater than or equal to 3. Step S407: When the number of peak ranges is greater than or equal to 3, mark the middle value in each equally divided interval as the interval median; mark the peak interval with the smallest interval median as the first interval, mark the peak interval with the largest interval median as the third interval, and obtain a peak interval closest to the middle value of the first and third intervals as the second interval; Step S408: in the turntable histogram, obtain the median of the equal-division interval with the smallest equal-division frequency between the first interval and the second interval, and mark it as the first threshold; Step S409: obtaining the median value of the equal-division interval with the smallest equal-division frequency between the second interval and the third interval, and marking it as the second threshold value; Step S410, determine whether there is an equal-division interval greater than the third interval. If so, obtain the median of the equal-division interval with the smallest equal-division frequency greater than the third interval and mark it as the third threshold. If not, mark the maximum value of the third interval as the third threshold.
[0024] Step S5, converting the turntable grayscale image into a region binary image based on the first threshold, and converting the turntable grayscale image into a turntable binary image based on the second threshold and the third threshold; Step S5 includes the following sub-steps: Step S501: In the turntable grayscale image, grayscale values of the turntable that are less than or equal to a first threshold are set to 0, and grayscale values that are greater than the first threshold are set to 255, thereby obtaining a region binary image. Step S502 : In the turntable grayscale image, set the turntable grayscale values 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 less than the second threshold or greater than the third threshold to 255, to obtain a turntable binary image.
[0025] Step S6, obtaining a first reference point based on the region binarization image; Step S6 includes the following sub-steps: Step S601, establishing a plane rectangular coordinate system, marked as a reference coordinate system; Step S602: Place the regional binary image in the first quadrant of the reference coordinate system, and ensure that two sides of the regional binary image coincide with the horizontal axis and the vertical axis of the reference coordinate system respectively. Step S603, marking the pixels with a gray value of 0 in the region binarization image as region pixels; Step S604: obtaining two consecutive regions with the largest number of regional pixels and marking them as special regions; Step S605: Set the coordinates of a special area as (x i ,y i ), get x i The maximum value of x i The minimum value of y i The maximum value of y i The minimum value of max 、x min 、y max and y min , plot the point (x min ,y min ) and point (x max ,y max ), connecting the points (x min ,y min ) and point (x max ,ymax ) obtain a first line segment, obtain the midpoint of the first line segment and mark it as the midpoint of the region; Step S606: Obtain the midpoints of the two special areas, obtain the midline between the midpoints of the two areas, and mark them as the first reference point.
[0026] Step S7, obtaining a second reference point based on the turntable binarized image; Step S7 includes the following sub-steps: Step S701: Place the turntable binary image in the first quadrant of the reference coordinate system, and at the same time, satisfy the requirement that two edges of the turntable binary image coincide with the horizontal axis and the vertical axis of the reference coordinate system respectively. Step S702, marking pixels with a grayscale value of 0 in the turntable binary image as turntable pixels; Step S703, obtaining a continuous area with the largest number of turntable pixels, and marking it as the turntable area; Step S704, obtaining coordinate points of the boundaries of a first number of turntable areas and marking them as boundary coordinate points; Step S705: Set the boundary fitting equation to: (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, and f1, f2 and f3 are the coefficients of the boundary fitting equation; Step S706, fitting the boundary coordinate points with the boundary fitting equation to obtain specific values of f1, f2 and f3; Step S707, setting the second reference point to: (f1, f2).
[0027] Step S8, obtaining an angle change value based on the first reference point and the second reference point; Step S8 includes the following sub-steps: Step S801, obtaining a vector from the second reference point to the first reference point, marked as a reference vector; Step S802 , continuously acquiring turntable images and obtaining a reference vector of each turntable image in a reference coordinate system, and recording the time of each turntable image acquisition, which is marked as image acquisition time; Step S803 : obtaining the angle between the reference vector of the real-time turntable image and the reference vector of the first turntable image, and marking it as the angle change value.
[0028] Step S9, obtaining the angular displacement based on the angle change value; Step S9 includes the following sub-steps: Step S901, establishing a plane rectangular coordinate system with the image acquisition time as the X-axis and the angle change value as the Y-axis, marked as the angle coordinate system; Step S902, the image acquisition time and the corresponding angle change value are used as the horizontal coordinate and the vertical coordinate of the function coordinate point to be plotted in the angle coordinate system to obtain an angle scatter plot; Step S903, fitting the angle scatter plot to obtain an angle function; Step S904, obtaining the time corresponding to the desired angular displacement, marked as real time; Step S905, obtaining the vertical axis data corresponding to the real time in the angle function, marked as u; Step S906, obtaining the number of closed figures formed by the angle function graph between the horizontal coordinate corresponding to the real time and the horizontal axis of the angle coordinate system, marked as h; Step S907, obtaining the coordinate point of the angle function corresponding to t seconds before the real time, and marking it as the real-time reference coordinate point; Step S908 , connecting the real-time reference coordinate point and the point (u, h) to obtain a straight line, which is marked as a function connection line; Step S909, if the slope of the function connecting straight line is a positive value, the angular displacement is obtained as: h×360°+u; if the slope of the function connecting straight line is a negative value, the angular displacement is obtained as: h×360°+360°-u; if the slope of the function connecting straight line is 0, the coordinate point of the corresponding angle function t seconds after the real-time time is obtained as the real-time reference coordinate point, and a new function connecting straight line is obtained, and the judgment is repeated until the slope of the new function connecting straight line is not 0.
[0029] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The storage medium may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0030] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
Claims
1. A method for measuring the angular displacement of a turntable, characterized in that: The steps include: Set up special identification areas on the turntable; Acquire the turntable image from directly above the turntable; Performing grayscale processing on the turntable image to obtain a turntable grayscale image; acquiring a first threshold, a second threshold, and a third threshold based on a first number of partial images of the turntable; Converting the turntable grayscale image into a region binary image based on a first threshold, and converting the turntable grayscale image into a turntable binary image based on a second threshold and a third threshold; Obtaining a first reference point based on the region binarization image; Acquire a second reference point based on the turntable binarization image; Obtaining an angle change value based on the first reference point and the second reference point; The angular displacement is obtained based on the angle change value.
2. A method for measuring the angular displacement of a turntable according to claim 1, characterized in that: Setting up special recognition areas on the turntable includes the following sub-steps: Get two rectangular areas with a side length of a centimeters, set the color of the rectangular areas to pure black, the interval between the rectangular areas to c centimeters, and mark the two rectangular areas as special recognition areas.
3. The method for measuring the angular displacement of a turntable according to claim 2, wherein: Grayscale processing of the turntable image to obtain a turntable grayscale image also includes the following sub-steps: Get the R value, G value, and B value of each pixel in the turntable image; Calculate the mean of the R value, G value, and B value of each pixel in the turntable image and mark it as the turntable grayscale value; Each pixel in the turntable image is displayed using the turntable grayscale value to obtain a turntable grayscale image.
4. The method for measuring the angular displacement of a turntable according to claim 3, wherein: Acquiring the first threshold, the second threshold, and the third threshold based on the first number of turntable partial images further includes the following sub-steps: Divide the grayscale values from 0 to 255 into e intervals, marked as equal intervals; Count the frequency of the turntable grayscale value in each equally divided interval respectively, and mark it as the equally divided frequency; Draw a histogram with the turntable grayscale value as the X-axis, the equally divided frequency as the Y-axis, and the equally divided interval as the histogram interval, and mark it as the turntable histogram; In the turntable histogram, the frequency that is greater than the adjacent equal division frequencies on the left and right sides is marked as the peak frequency; Mark the equal intervals corresponding to the peak frequency as peak intervals; Obtain the number of peak intervals. When the number of peak intervals is less than 3, increase the specific value of e and obtain a new turntable histogram until the number of peak intervals is greater than or equal to 3. When the number of peak ranges is greater than or equal to 3, mark the middle value in each equally divided interval as the interval median; mark the peak interval with the smallest interval median as the first interval, mark the peak interval with the largest interval median as the third interval, and obtain the peak interval closest to the middle value of the first and third intervals as the second interval; In the turntable histogram, obtain the median value of the equal-division interval with the smallest equal-division frequency between the first interval and the second interval, and mark it as the first threshold; Obtain the median value of the equal-division interval with the smallest equal-division frequency between the second interval and the third interval, and mark it as the second threshold; Determine whether there is an equal-division interval greater than the third interval. If so, obtain the median of the equal-division interval with the smallest equal-division frequency greater than the third interval and mark it as the third threshold. If not, mark the maximum value of the third interval as the third threshold.
5. The method for measuring the angular displacement of a turntable according to claim 4, wherein: Converting the turntable grayscale image into a region binary image based on the first threshold, and converting the turntable grayscale image into a turntable binary image based on the second threshold and the third threshold includes the following sub-steps: In the turntable grayscale image, the turntable grayscale values less than or equal to the first threshold are set to 0, and the grayscale values greater than the first threshold are set to 255, to obtain a region binarization image; 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 a turntable binary image.
6. The method for measuring the angular displacement of a turntable according to claim 5, wherein: Acquiring the first reference point based on the region binarization image includes the following sub-steps: Establish a plane rectangular coordinate system and mark it as the reference coordinate system; Place the regional binary graph in the first quadrant of the reference coordinate system, and at the same time satisfy the requirement that the two sides of the regional binary graph coincide with the horizontal axis and vertical axis of the reference coordinate system respectively; Mark the pixels with gray value 0 in the region binarization image as region pixels; Get the two consecutive regions with the largest number of regional pixels and mark them as special regions; Set the coordinates of a special area to be marked as (x i ,y i ), get x i The maximum value of x i The minimum value of y i The maximum value of y i The minimum value of max 、x min 、y max and y min , plot the point (x min ,y min ) and point (x max ,y max ), connecting the points (x min ,y min ) and point (x max ,y max ) obtain a first line segment, obtain the midpoint of the first line segment and mark it as the midpoint of the region; Get the midpoints of the two special areas, get the midline of the midpoints of the two areas, and mark them as the first reference point.
7. A method for measuring the angular displacement of a turntable according to claim 6, characterized in that: Acquiring the second reference point based on the turntable binary image includes the following sub-steps: Place the turntable binary graph in the first quadrant of the reference coordinate system, and at the same time, satisfy the requirement that the two sides of the turntable binary graph coincide with the horizontal axis and the vertical axis of the reference coordinate system respectively; Mark the pixels with gray value 0 in the turntable binary image as turntable pixels; Get a coherent area with the largest number of turntable pixels and mark it as the turntable area; Obtaining coordinate points of the boundaries of a first number of turntable areas and marking them as boundary coordinate points; Set the boundary fitting equation to: (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, and f1, f2 and f3 are the coefficients of the boundary fitting equation; Fit the boundary coordinate points with the boundary fitting equation to obtain the specific values of f1, f2 and f3; Set the second reference point to: (f1, f2).
8. The method for measuring the angular displacement of a turntable according to claim 7, wherein: Acquiring the angle change value based on the first reference point and the second reference point includes the following sub-steps: Get the vector from the second reference point to the first reference point, marked as the reference vector; Continuously acquire turntable images and obtain the reference vector of each turntable image in the reference coordinate system, and record the time of each turntable image acquisition, which is marked as image acquisition time; The 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 the angle change value.
9. The method for measuring the angular displacement of a turntable according to claim 8, wherein: Obtaining the angular displacement based on the angle change value includes the following steps: With the image acquisition time as the X-axis and the angle change value as the Y-axis, a plane rectangular coordinate system is established, which is marked as the angle coordinate system; The image acquisition time and the corresponding angle change value are used as the horizontal coordinate and vertical coordinate of the function coordinate point to be plotted in the angle coordinate system to obtain an angle scatter plot; Fit the angle scatter plot to obtain the angle function; Get the time corresponding to the desired angular displacement, marked as real time; Get the vertical axis data corresponding to the real time in the angle function, marked as u; Get the number of closed figures formed by the angle function graph between the real-time corresponding horizontal coordinate and the horizontal axis of the angle coordinate system, marked as h; Get the coordinate point of the angle function corresponding to t seconds before the real time, and mark it as the real-time reference coordinate point; Connect the real-time reference coordinate point and the point (u, h) to obtain a straight line, which is marked as the function connecting line; If the slope of the function connecting straight line is positive, the angular displacement is obtained as: h×360°+u; if the slope of the function connecting straight line is negative, the angular displacement is obtained as: h×360°+360°-u; if the slope of the function connecting straight line is 0, the coordinate point of the corresponding angle function t seconds after the real-time time is obtained as the real-time reference coordinate point, and a new function connecting straight line is obtained. Repeat the judgment until the slope of the new function connecting straight line is not 0.
10. A turntable angular displacement measurement displacement sensor, used to implement a turntable angular displacement measurement method according to any one of claims 1 to 9, characterized in that: It includes an area 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 angle acquisition module, and an angular displacement acquisition module; The area setting module is used to set a special identification area on the turntable; The image acquisition module is used to acquire the turntable image from directly above the turntable; The grayscale module is used to perform grayscale processing on the turntable image to obtain a turntable grayscale image; The threshold acquisition module is used to acquire a first threshold, a second threshold, and a third threshold based on a first number of turntable partial images; The binarization module is used to convert the turntable grayscale image into a region binarization image based on a first threshold value, and to convert the turntable grayscale image into a turntable binarization image based on a second threshold value and a third threshold value; The first reference point acquisition module is used to acquire a first reference point based on the region binarization image; The second reference point acquisition module is used to acquire a second reference point based on the turntable binarization image; The angle acquisition module is used to acquire the angle change value based on the first reference point and the second reference point; The angular displacement acquisition module is used to acquire the angular displacement based on the angle change value.
Citation Information
Patent Citations
Turntable leveling method based on image processing
CN103389111A
Method, device and system for reading measured value of pointer type instrument
CN114693705A
Joint calibration method for camera and rotary table
CN118429445A
Measuring surface geometry using illumination direction coding
US20170131091A1
Cited By
Vehicle-mounted HUD image shake difference value stable correction method
CN121147073A