Level bubble zero error adjustment system and method based on machine vision

Through the level bubble zero error adjustment system based on machine vision, the automatic adjustment of the level bubble zero error is realized, the measurement accuracy and adjustment efficiency are improved, and the problems of large errors and low efficiency in manual operations are solved.

CN120403700APending Publication Date: 2025-08-01CHINA JILIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411586047.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, the adjustment of the zero-position error of the level bubble mainly relies on manual operation, the error accuracy and efficiency are not high, and are greatly affected by human factors, which affects production efficiency.

Method used

The level bubble zero-position error adjustment system based on machine vision is adopted, including the level bubble module to be measured, the parameter setting module, the image acquisition module, the image preprocessing module, the bubble position determination module, the zero-position error measurement module and the error adjustment module, and the machine vision and image processing technology are used to achieve automatic adjustment.

Benefits of technology

It improves the measurement accuracy and adjustment efficiency of zero-position error of level bubbles, reduces the influence of human factors, and is suitable for multi-line level bubbles, with good robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120403700A_ABST
    Figure CN120403700A_ABST
Patent Text Reader

Abstract

The invention relates to a level bubble zero error adjusting system and method based on machine vision. The system comprises a measured level bubble module, a parameter setting module, an image acquisition module, an image preprocessing module, a bubble position determination module, a zero error measurement module, a zero error adjustment module and a host. The image preprocessing module and the bubble position judgment module are used for obtaining the position condition of bubbles relative to scribed lines, then the zero error measurement module is selectively used for zero error calculation, and the zero error adjustment module is used for conducting fast coarse adjustment or slow fine adjustment on errors. The method is realized based on the system. According to the invention, the automatic real-time adjustment of the zero error of the level bubble is better realized, and the measurement precision, the automation level and the production efficiency of related equipment are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision measurement, and particularly to a spirit level zero - position error adjustment system and method based on machine vision. Background Art

[0002] A spirit level is a device used to indicate the horizontal state and is widely applied to various optoelectronic instruments such as theodolites, levels, compasses, electronic scales, total stations, etc.

[0003] A spirit level, a tool for indicating the horizontal state, is widely applied to various optoelectronic instruments such as theodolites, levels, compasses, electronic scales, total stations, etc. During use, the inclination of the instrument surface is judged by observing the position relationship between the central bubble of the spirit level and the scale lines on both sides. Therefore, before leaving the factory, it is necessary to adjust the zero - position error of the spirit level in the horizontal state and control the position of the bubble near the center of the spirit level.

[0004] Currently, the adjustment of the spirit level zero - position error is mainly completed by manually knocking on both sides of the bubble seat where the spirit level is installed with a rubber hammer and judging by visual inspection. This method is greatly affected by human factors, and both the error accuracy and the adjustment efficiency are not high, which has a great impact on the production efficiency of enterprises. Therefore, it is particularly important to design a spirit level zero - position error adjustment system and method based on machine vision to realize the automatic adjustment of the spirit level zero - position error. Summary of the Invention

[0005] Aiming at the requirements of the application field and the deficiencies of the background art, the purpose of the present invention is to provide a spirit level zero - position error automatic adjustment system and method based on machine vision technology, improve the measurement accuracy of the spirit level zero - position error and the adjustment efficiency of the zero - position error, and enhance the automation level of the spirit level zero - position error adjustment.

[0006] To achieve the above object, the technical solution adopted by the system of the present invention is as follows: A spirit level zero-position error adjustment system based on machine vision, including a measured spirit level module, a parameter setting module, an image acquisition module, an image preprocessing module, a bubble position determination module, a zero-position error measurement module, a zero-position error adjustment module, and a host computer; the measured spirit level module is used to fix the spirit level to be adjusted for zero-position error; the parameter setting module is used to set parameters related to image acquisition, motion control, and zero-position error range; the image acquisition module is used to collect images of the spirit level fixed in the measured spirit level module in real time; the image preprocessing module is used to obtain the region of interest image, perform threshold segmentation processing, and count the number of non-zero pixels in each column of the image; the bubble position determination module is used to determine the position of the bubble in the spirit level relative to the scale lines; the zero-position error measurement module is used to measure the zero-position error of the spirit level when the bubble position is between the two innermost scale lines; the error adjustment module is used to perform corresponding adjustments on the zero-position error of the spirit level with the bubble in different positions by different strategies; the host computer is the software and hardware control center of the system, and the parameter setting module, the image preprocessing module, the bubble position determination module, the zero-position error measurement module, the image acquisition program in the image acquisition module, and the zero-position error adjustment program in the zero-position error adjustment module are all installed in the host computer; the image acquisition module is connected to the host computer through a network cable; the zero-position error adjustment module is connected to the host computer through a network cable; the image preprocessing module includes: a region of interest image acquisition unit, a threshold segmentation processing unit, and a non-zero pixel number counting unit for each column of the image; the region of interest image acquisition unit extracts the region of interest image from the spirit level image collected by the image acquisition module according to the region of interest set in the parameter setting module; the threshold segmentation processing unit performs threshold segmentation processing on the region of interest image according to the fixed threshold or automatic threshold method set in the parameter setting module; the non-zero pixel number counting unit for each column of the image counts the number of pixels with non-zero gray values in each column in the binary region of interest image bw after threshold segmentation processing in the order from left to right; the bubble position determination module includes: a horizontal position calculation unit for the two innermost scale lines, which is used to determine the horizontal positions of the two innermost scale lines of the spirit level in the binary region of interest image bw; a relative position determination unit for the bubble of the spirit level and the two innermost scale lines, which is used to determine the relative position of the bubble of the spirit level and the two innermost scale lines as three cases: the bubble of the spirit level rides on the left innermost scale line, the bubble of the spirit level rides on the right innermost scale line, and the bubble of the spirit level is between the two innermost scale lines.

[0007] The measured spirit level module includes: a spirit level, a spirit level seat, a bracket, and a scale body; the spirit level is installed in the spirit level seat, the spirit level seat is placed on the bracket, and the bracket is installed on the scale body.

[0008] The parameter setting module includes: an image parameter setting unit, a motion control parameter setting unit, and an error range parameter setting unit; the parameters set by the image parameter setting unit include: region of interest, setting a rectangular area for obtaining the region of interest image from the original spirit level image in the image preprocessing module; threshold segmentation method, used for threshold segmentation processing of the region of interest image in the image preprocessing module, including two methods: fixed threshold and automatic threshold. For the fixed threshold method, an integer value in the range of 0 - 255 needs to be set, and for the automatic threshold method, no threshold needs to be set, and its threshold is automatically determined by the OTSU method in the image preprocessing module; image pixel equivalent, with the unit of mm / px, used for calculating the zero position error in the zero position error measurement module, with the unit of mm; the parameters set by the motion control parameter setting unit include: the fast running speed and slow running speed of the left motion control mechanism and the right motion control mechanism, used to control the running speed of the left motion control mechanism and the right motion control mechanism in the error adjustment module; the error range parameter setting unit is used to set the zero position error range that the final spirit level needs to reach.

[0009] The image acquisition module includes: a camera, a light source, a light source controller, and an image acquisition program; the camera is located in front of the spirit level, the light source is located behind the spirit level, both the camera and the light source are oriented towards the spirit level, the light source is connected to the light source controller, and the camera is connected to the host through a network cable; the image acquisition program is installed in the host, and the spirit level image is acquired by taking pictures of the spirit level through the camera.

[0010] The zero position error measurement module measures the zero position error of the spirit level when the bubble is between the two innermost scale lines. Specifically: First, calculate the abscissa x of the center line of the two innermost scale lines of the spirit level in the binary region of interest image bw line , then obtain the abscissa x of the center of the spirit level bubble in the binary region of interest image bw bub , and finally calculate the zero position error E of the spirit level through the following formula, with the unit of mm:

[0011] E = (x line - x bub ) × b

[0012] where b is the image pixel equivalent set in the parameter setting module, with the unit of mm / px.

[0013] The error adjustment module includes: a left motion control mechanism, a right motion control mechanism, a motion controller and a zero-position error adjustment program; the left motion control mechanism is located above the left side of the bubble seat, and is used to adjust the height of the left side of the bubble seat; the right motion control mechanism is located above the right side of the bubble seat, and is used to adjust the height of the right side of the bubble seat; the left motion control mechanism and the right motion control mechanism are connected to the motion controller through a signal line; the motion controller is connected to the host through a network cable; the zero-position error adjustment program is installed in the host, and the zero-position error of the level bubble is adjusted by adjusting the height of the left and right sides of the bubble seat through the left motion control mechanism and the right motion control mechanism.

[0014] The specific strategy of the error adjustment module for adjusting the zero position error of the vial with the bubble in different positions is as follows: when the bubble of the vial rides on the innermost scale line on the left, the left motion control mechanism is used to roughly adjust the height of the left side of the bubble seat downward; when the bubble of the vial rides on the innermost scale line on the right, the right motion control mechanism is used to roughly adjust the height of the right side of the bubble seat downward; when the bubble of the vial is between the two innermost scale lines, the zero position error E of the vial is calculated, and the left motion control mechanism or the right motion control mechanism is used to fine-tune the height of the left side or the right side of the bubble seat downward.

[0015] The method for adjusting the zero error of a vial using the machine vision-based zero error adjustment system comprises the following steps:

[0016] S1: Set the parameters such as the region of interest, threshold segmentation method, image pixel equivalent, fast running speed and slow running speed of the left motion control mechanism and the right motion control mechanism, and error range through the parameter setting module;

[0017] S2: Install the level bubble to be adjusted into the bubble seat of the level bubble module to be measured;

[0018] S3: using the image acquisition program in the image acquisition module to acquire the level bubble image to obtain the original level bubble image;

[0019] S4: using the region of interest image acquisition unit of the image preprocessing module to intercept an image according to the set region of interest in the original level bubble image to obtain a region of interest image; using the threshold segmentation processing unit to perform binary segmentation processing on the region of interest image according to the set threshold segmentation method to obtain a binary region of interest image; using the image column non-zero pixel number counting unit to obtain a sequence of the number of pixels whose grayscale values are not 0 in each column from left to right in the binary region of interest image;

[0020] S5: using the bubble position determination module to determine the position of the bubble relative to the scribed line in the vial based on the obtained sequence of non-zero pixel numbers;

[0021] S6: Use the zero - position error adjustment program in the error adjustment module to adjust the zero - position error of the spirit level.

[0022] The zero - position error adjustment program in step S6 specifically includes the following steps:

[0023] S61: Obtain the position of the spirit level bubble relative to the scale line obtained by the bubble position determination module.

[0024] S62: If the spirit level bubble rides on the left - most inner scale line, use the motion controller to control the left motion control mechanism to run quickly to reduce the height on the left side of the bubble seat. At the same time, obtain the position of the spirit level bubble relative to the scale line until the spirit level bubble is between the two innermost scale lines, then stop the operation of the left motion control mechanism and go to S64; otherwise, directly proceed to the next step.

[0025] S63: If the spirit level bubble rides on the right - most inner scale line, use the motion controller to control the right motion control mechanism to run quickly to reduce the height on the right side of the bubble seat. At the same time, obtain the position of the spirit level bubble relative to the scale line until the spirit level bubble is between the two innermost scale lines, then stop the operation of the right motion control mechanism and go to S64; otherwise, directly proceed to the next step.

[0026] S64: Use the zero - position error measurement module to calculate the zero - position error of the spirit level.

[0027] S65: If the zero - position error is not within the zero - position error range set by the parameter setting module, then proceed to the next step; otherwise, go to S67.

[0028] S66: If the zero - position error is less than 0, use the motion controller to control the right motion control mechanism to run slowly to reduce the height on the right side of the bubble seat and go to S64; otherwise, use the motion controller to control the left motion control mechanism to run slowly to reduce the height on the left side of the bubble seat and go to S64.

[0029] S67: Stop the slow operation of the left motion control mechanism or the right motion control mechanism, and quickly reset the left motion control mechanism and the right motion control mechanism. The zero - position error adjustment ends.

[0030] Compared with the background technology, the beneficial effects of the present invention are:

[0031] 1. The present invention realizes the automatic adjustment of the zero - position error of the spirit level by using machine vision and image - processing technology. Compared with manual operation, it effectively avoids the influence of human factors and improves the measurement efficiency and calibration accuracy of the zero - position error.

[0032] 2. The present invention can automatically adjust the zero - position error of the spirit level by adopting two adjustment methods, namely coarse adjustment and fine adjustment, according to the relative position of the bubble in the spirit level and the two innermost scale lines, greatly improving the adjustment efficiency of the zero - position error.

[0033] 3. The zero - position error adjustment system and method of the present invention are applicable to spirit levels with two or more scale lines, and have good robustness. Brief Description of the Drawings

[0034] Figure 1 It is a block diagram of the system composition;

[0035] Figure 2 It is a diagram of the hardware composition of the system;

[0036] Figure 3 It is a flowchart of the method;

[0037] Figure 4 It is a flowchart of the zero - position error adjustment program.

[0038] In the figure: 1 spirit level; 2 spirit - level seat; 3 bracket; 4 ruler body; 5 camera; 6 light source; 7 left motion control mechanism; 8 right motion control mechanism; 9 host computer; 10 light - source controller; 11 motion controller. Detailed Embodiment

[0039] In order to make the purpose, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described below with reference to the accompanying drawings.

[0040] As Figure 1 shown, the spirit - level zero - position error adjustment system of the present invention includes eight modules, namely: the measured spirit - level module M1, the parameter - setting module M2, the image - acquisition module M3, the image - pre - processing module M4, the bubble - position determination module M5, the zero - position error measurement module M6, the zero - position error adjustment module M7, and the host computer M8.

[0041] The hardware composition of the spirit - level zero - position error adjustment system of the present invention is as Figure 2 shown, and includes: spirit level 1, spirit - level seat 2, bracket 3, ruler body 4, camera 5, light source 6, left motion control mechanism 7, right motion control mechanism 8, host computer 9, light - source controller 10, and motion controller 11.

[0042] The described measured spirit - level module M1 is used to fix the spirit level to be adjusted for zero - position error, and includes: spirit level 1, spirit - level seat 2, bracket 3, and ruler body 4. The spirit level 1 is installed in the spirit - level seat 2, the spirit - level seat 2 is placed on the bracket 3, and the bracket 3 is installed on the ruler body 4.

[0043] The parameter setting module M2 is used to set parameters related to image acquisition, motion control, and zero - position error range, including: an image parameter setting unit, a motion control parameter setting unit, and an error range parameter setting unit. The parameters set by the image parameter setting unit include: region of interest, threshold segmentation method, and image pixel equivalent. The region of interest roiRect is a rectangular area, which is used in the image pre - processing module M4 to obtain the region - of - interest image roiImg from the original bubble image; the threshold segmentation method is used for threshold segmentation processing of the region - of - interest image in the image pre - processing module M4, including two methods: fixed threshold and automatic threshold. For the fixed threshold method, an integer value in the range of 0 - 255 needs to be set. For the automatic threshold method, no threshold needs to be set, and its threshold is automatically determined by the OTSU method in the image pre - processing module; the image pixel equivalent, with the unit of mm / px, is used in the zero - position error measurement module M6 to calculate the zero - position error, with the unit of mm; the parameters set by the motion control parameter setting unit include: the fast running speed and slow running speed of the left motion control mechanism and the right motion control mechanism, which are used to control the running speed of the left motion control mechanism and the right motion control mechanism in the zero - position error adjustment module M7; the error range parameter setting unit is used to set the zero - position error range that the final bubble 1 needs to reach.

[0044] The image acquisition module M3 is used to collect the image of the bubble 1 fixed in the measured bubble module M1 in real - time, including: a camera 5, a light source 6, a light source controller 10, and an image acquisition program. The camera 5 is located in front of the bubble 1, the light source 6 is located behind the bubble 1, both the camera 5 and the light source 6 are oriented towards the bubble 1, the light source 6 is connected to the light source controller 10, and the camera 5 is connected to the host 9 through a network cable; the image acquisition program is installed in the host 9, and the image of the bubble 1 is captured and collected through the camera 5.

[0045] The image pre - processing module M4 is used to obtain the region - of - interest image, perform threshold segmentation processing, and count the number of non - zero pixels in each column of the image, including: a region - of - interest image acquisition unit, a threshold segmentation processing unit, and a non - zero pixel number counting unit for each column of the image. The region - of - interest image acquisition unit extracts the region - of - interest image roiImg from the image of the bubble 1 collected by the image acquisition module M3 according to the region of interest roiRect set in the parameter setting module M2; the threshold segmentation processing unit performs threshold segmentation processing on the region - of - interest image roiImg according to the fixed threshold or automatic threshold method set in the parameter setting module M2 to obtain a binary region - of - interest image bw; the non - zero pixel number counting unit for each column of the image counts the number of pixels with non - zero gray - scale values in each column in the binary region - of - interest image bw in the order from left to right.

[0046] The described bubble position determination module M5 is used to determine the position of the bubble in the spirit level 1 relative to the graduation lines, including: a horizontal position calculation unit for the two innermost graduation lines, which is used to determine the horizontal positions of the two innermost graduation lines of the spirit level in the binary region of interest image bw. The specific method is as follows: First, find the maximum element amax from the sequence A of the number of non-zero pixels; then search leftward from the middle position of the sequence A of the number of non-zero pixels to find the first element greater than 0.8×amax, and its serial number is the horizontal position Lx of the leftmost innermost graduation line of the spirit level in the binary region of interest image bw. Finally, search rightward from the middle position of the sequence A of the number of non-zero pixels to find the first value greater than 0.8×amax, and its serial number is the horizontal position Rx of the rightmost innermost graduation line of the spirit level in the binary region of interest image bw; a relative position determination unit for the bubble of the spirit level and the two innermost graduation lines, which is used to determine the relative position of the bubble of the spirit level and the two innermost graduation lines as three cases: the bubble of the spirit level rides on the leftmost innermost graduation line, the bubble of the spirit level rides on the rightmost innermost graduation line, and the bubble of the spirit level is between the two innermost graduation lines. The specific determination method is as follows: If there is no element with a value of 0 among the elements of the sequence A of the number of non-zero pixels with serial numbers from Lx to Mx, then the bubble of the spirit level rides on the leftmost innermost graduation line; if there is no element with a value of 0 among the elements of the sequence A of the number of non-zero pixels with serial numbers from Mx to Rx, then the bubble of the spirit level rides on the rightmost innermost graduation line; if there is an element with a value of 0 among the elements of the sequence A of the number of non-zero pixels with serial numbers from Lx to Mx, and there is also an element with a value of 0 among the elements of the sequence A of the number of non-zero pixels with serial numbers from Mx to Rx, then the bubble of the spirit level may ride on the leftmost innermost graduation line, may ride on the rightmost innermost graduation line, or may be between the two innermost graduation lines. At this time, it is necessary to calculate the number n1 of elements from Mx to the first non-zero element when searching leftward in the sequence A of the number of non-zero pixels and the number n2 of elements from Mx to the first non-zero element when searching rightward in the sequence A of the number of non-zero pixels; if n1 < n2, then the bubble of the spirit level rides on the leftmost innermost graduation line; if n1 > n2, then the bubble of the spirit level rides on the rightmost innermost graduation line; if n1 = n2, then the bubble of the spirit level is between the two innermost graduation lines, where Mx = (Lx + Rx) / 2, Lx is the horizontal position of the leftmost innermost graduation line of the spirit level in the binary region of interest image bw, and Rx is the horizontal position of the rightmost innermost graduation line of the spirit level in the binary region of interest image bw.

[0047] The described zero position error measurement module M6 is used to measure the zero position error of the spirit level when the bubble position is between the two innermost graduation lines. Specifically: First, calculate the abscissa x of the center line of the two innermost graduation lines of the spirit level in the binary region of interest image bw line , and then obtain the abscissa x of the center of the bubble of the spirit level in the binary region of interest image bw bub, finally, the zero - position error E of the spirit level is calculated by the following formula, with the unit of mm:

[0048] E=(x line -x bub )×b

[0049] where b is the image pixel equivalent set in the parameter setting module M2, with the unit of mm / px.

[0050] The zero - position error adjustment module M7 is used to make corresponding adjustments to the zero - position errors of spirit levels with the bubble in different positions by different strategies, including: a left motion control mechanism 7, a right motion control mechanism 8, a motion controller 11, and a zero - position error adjustment program. The left motion control mechanism 7 is located above the left side of the bubble seat 2 and is used to adjust the height of the left side of the bubble seat 2; the right motion control mechanism 8 is located above the right side of the bubble seat 2 and is used to adjust the height of the right side of the bubble seat 2; the left motion control mechanism 7 and the right motion control mechanism 8 are connected to the motion controller 11 through signal lines; the motion controller 11 is connected to the host 9 through a network cable; the zero - position error adjustment program is installed in the host 9, and the zero - position error of the spirit level 1 is adjusted by adjusting the heights of the left and right sides of the bubble seat 2 through the left motion control mechanism 7 and the right motion control mechanism 8.

[0051] The host M8 is the software and hardware control center of the system. The parameter setting module M2, the image pre - processing module M4, the bubble position determination module M5, the zero - position error measurement module M6, the image acquisition program in the image acquisition module M3, and the zero - position error adjustment program in the zero - position error adjustment module M7 are all installed in the host 9; the image acquisition module M3 is connected to the host 9 through a network cable; the zero - position error adjustment module M7 is connected to the host through a network cable.

[0052] As Figure 3 shown, the method for the zero - position error of the spirit level of the present invention specifically includes the following steps:

[0053] S1: Set parameters such as the region of interest, threshold segmentation method, image pixel equivalent, fast running speed and slow running speed of the left motion control mechanism and the right motion control mechanism, and error range through the parameter setting module M2;

[0054] S2: Install the spirit level 1 to be adjusted in the bubble seat 2 of the measured spirit level module M1;

[0055] S3: Use the image acquisition program in the image acquisition module M3 to collect the spirit level image and obtain the original spirit level image src;

[0056] S4: Use the region of interest image acquisition unit of the image preprocessing module M4 to intercept an image in the original spirit level image src according to the set region of interest to obtain the region of interest image roiImg; use the threshold segmentation processing unit to perform binary segmentation processing on the region of interest image according to the set threshold segmentation method to obtain the binary region of interest image bw; use the non-zero pixel number statistical unit of the image column to obtain a sequence of the number of pixels with non-zero gray values in each column from left to right in the binary region of interest image bw;

[0057] S5: Use the obtained sequence of non-zero pixel numbers to determine the position of the bubble in spirit level 1 relative to the scale line in spirit level 1 by the bubble position determination module M5. Specifically: First, determine the horizontal positions of the two innermost scale lines of spirit level 1 in the binary region of interest image bw by the horizontal position calculation unit of the two innermost scale lines in the bubble position determination module M5, and then determine the relative position of the spirit level bubble and the two innermost scale lines by the relative position determination unit of the spirit level bubble and the two innermost scale lines in the bubble position determination module M5.

[0058] S6: Use the zero position error adjustment program in the error adjustment module M7 to adjust the zero position error of spirit level 1. The specific process of the zero position error adjustment program is as Figure 4 shown, specifically:

[0059] S61: Obtain the position of the spirit level bubble relative to the scale line obtained by the bubble position determination module M5;

[0060] S62: If the bubble of spirit level 1 straddles the left innermost scale line, use the motion controller 11 to control the left motion control mechanism 7 to run quickly to reduce the height of the left side of the bubble seat 2, and at the same time obtain the position of the bubble of spirit level 1 relative to the scale line until the bubble of spirit level 1 is between the two innermost scale lines, then stop the operation of the left motion control mechanism 7 and go to S64; otherwise, directly proceed to the next step;

[0061] S63: If the bubble of spirit level 1 straddles the right innermost scale line, use the motion controller 11 to control the right motion control mechanism 8 to run quickly to reduce the height of the right side of the bubble seat 2, and at the same time obtain the position of the bubble of spirit level 1 relative to the scale line until the bubble of spirit level 1 is between the two innermost scale lines, then stop the operation of the right motion control mechanism 8 and go to S64; otherwise, directly proceed to the next step;

[0062] S64: Use the zero position error measurement module M6 to calculate the zero position error of the spirit level;

[0063] S65: If the zero position error is not within the zero position error range set by the parameter setting module M2, then proceed to the next step; otherwise, go to S67;

[0064] S66: If the zero - position error is less than 0, use the motion controller 11 to control the right motion control mechanism 8 to run slowly to reduce the height on the right side of the water - bubble seat 2, and go to S64; otherwise, use the motion controller 11 to control the left motion control mechanism 7 to run slowly to reduce the height on the left side of the water - bubble seat 2, and go to S64;

[0065] S67: Stop the slow operation of the left motion control mechanism 7 or the right motion control mechanism 8, and quickly reset the left motion control mechanism 7 and the right motion control mechanism 8. The zero - position error adjustment is completed.

[0066] As described above, it is only the preferred specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any change or replacement that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A spirit level zero position error adjustment system based on machine vision, characterized in that The described system mainly includes: a measured spirit level module, a parameter setting module, an image acquisition module, an image preprocessing module, a bubble position determination module, a zero error measurement module, a zero error adjustment module, and a host computer; The measured spirit level module is used to fix the spirit level to be adjusted for zero error; the parameter setting module is used to set parameters related to image acquisition, motion control, and zero error range; the image acquisition module is used to collect images of the spirit level fixed in the measured spirit level module in real time; the image preprocessing module is used to obtain the region of interest (ROI) image, perform threshold segmentation processing, and count the number of non-zero pixels in each column of the image; the bubble position determination module is used to determine the position of the bubble in the spirit level relative to the graduation lines; the zero error measurement module is used to measure the zero error of the spirit level when the bubble position is between the two innermost graduation lines; the error adjustment module is used to make corresponding adjustments to the zero error of the spirit level with the bubble in different positions using different strategies; the host computer is the software and hardware control center of the system, and the image acquisition program in the parameter setting module, the image preprocessing module, the bubble position determination module, the zero error measurement module, and the image acquisition module, as well as the zero error adjustment program in the zero error adjustment module, are all installed in the host computer; The image acquisition module is connected to the host computer through a network cable; the zero error adjustment module is connected to the host computer through a network cable; The image preprocessing module includes: an ROI image acquisition unit, a threshold segmentation processing unit, and a non-zero pixel count unit for each column of the image; the ROI image acquisition unit extracts the ROI image from the spirit level image collected by the image acquisition module according to the ROI set in the parameter setting module; the threshold segmentation processing unit performs threshold segmentation processing on the ROI image according to the fixed threshold or automatic threshold mode set in the parameter setting module; the non-zero pixel count unit for each column of the image counts the number of pixels with non-zero gray values in each column in the binary ROI image bw after threshold segmentation processing in the order from left to right; The bubble position determination module includes: a horizontal position calculation unit for the two innermost graduation lines, which is used to determine the horizontal positions of the two innermost graduation lines of the spirit level in the binary ROI image bw; a relative position determination unit for the bubble of the spirit level and the two innermost graduation lines, which is used to determine the relative position of the bubble of the spirit level and the two innermost graduation lines as three cases: the bubble of the spirit level rides on the left innermost graduation line, the bubble of the spirit level rides on the right innermost graduation line, and the bubble of the spirit level is between the two innermost graduation lines.

2. The leveling bubble zero error adjustment system based on machine vision according to claim 1, characterized in that, The measured spirit level module includes: a spirit level, a spirit level seat, a bracket, and a ruler body; the spirit level is installed in the spirit level seat, the spirit level seat is placed on the bracket, and the bracket is installed on the ruler body.

3. The zero position error adjustment system of a spirit level based on machine vision according to claim 1, characterized in that, The parameter setting module includes: an image parameter setting unit, a motion control parameter setting unit, and an error range parameter setting unit; The parameters set by the described image parameter setting unit include: Region of Interest (ROI), which sets a rectangular area for the image preprocessing module to obtain the ROI image from the original spirit level image; Threshold segmentation method, which is used for threshold segmentation processing of the ROI image in the image preprocessing module, including two methods: fixed threshold and automatic threshold. For the fixed threshold method, an integer value in the range of 0 - 255 needs to be set. For the automatic threshold method, no threshold needs to be set, and the threshold is automatically determined by the OTSU method in the image preprocessing module; Image pixel equivalent, with the unit of mm / px, which is used in the zero position error measurement module to calculate the zero position error with the unit of mm. The parameters set by the described motion control parameter setting unit include: The fast running speed and slow running speed of the motion control mechanism, which are used to control the running speeds of the left motion control mechanism and the right motion control mechanism in the error adjustment module. The described error range parameter setting unit is used to set the zero position error range that the final spirit level needs to reach.

4. A bubble zero error adjustment system based on machine vision according to claim 1, characterized in that, The described image acquisition module includes: Camera, light source, light source controller, and image acquisition program. The camera is located in front of the spirit level, the light source is located behind the spirit level, both the camera and the light source are oriented towards the spirit level, the light source is connected to the light source controller, and the camera is connected to the host through a network cable; The image acquisition program is installed in the host, and the spirit level image is acquired by taking a picture of the spirit level through the camera.

5. A bubble zero error adjustment system based on machine vision according to claim 1, characterized in that, The described zero position error measurement module measures the zero position error of the spirit level when the bubble is between the two innermost scale lines, specifically: First, calculate the abscissa x of the center line of the two innermost scale lines of the spirit level in the binary region of interest image bw line , and then obtain the abscissa x of the center of the spirit level bubble in the binary region of interest image bw bub , and finally calculate the zero position error E of the spirit level through the following formula, with the unit of mm: E = (x line - x bub ) × b where b is the image pixel equivalent set in the parameter setting module, with the unit of mm / px.

6. The zero position error adjustment system of a spirit level based on machine vision according to claim 1, characterized in that, The described error adjustment module includes: Left motion control mechanism, right motion control mechanism, motion controller, and zero position error adjustment program. The left motion control mechanism is located above the left side of the bubble seat and is used to adjust the height on the left side of the bubble seat; The right motion control mechanism is located above the right side of the bubble seat and is used to adjust the height on the right side of the bubble seat; The left motion control mechanism and the right motion control mechanism are connected to the motion controller through signal lines; The motion controller is connected to the host through a network cable; The zero position error adjustment program is installed in the host, and the zero position error of the spirit level is adjusted by adjusting the heights on the left and right sides of the bubble seat through the left motion control mechanism and the right motion control mechanism.

7. A bubble zero error adjustment system based on machine vision according to claim 1, characterized in that The specific strategy for the described error adjustment module to adjust the zero position error of the spirit level when the bubble is in different positions is: When the bubble of the spirit level rides on the left innermost scale line, use the left motion control mechanism to roughly adjust the height on the left side of the bubble seat downwards; When the bubble of the spirit level rides on the right innermost scale line, use the right motion control mechanism to roughly adjust the height on the right side of the bubble seat downwards; When the bubble of the spirit level is between the two innermost scale lines, by calculating the zero position error E of the spirit level, use the left motion control mechanism or the right motion control mechanism to finely adjust the height on the left side or the right side of the bubble seat downwards.

8. A method for adjusting the zero position error of a spirit level based on machine vision, characterized in that: Use the machine vision - based spirit level zero position error adjustment system according to any one of claims 1 to 7, and perform the following steps: S1: Set parameters such as the region of interest, threshold segmentation method, image pixel equivalent, fast running speed and slow running speed of the left and right motion control mechanisms, and error range through the parameter setting module; S2: Install the leveling bubble to be adjusted in the bubble seat of the measured leveling bubble module; S3: Use the image acquisition program in the image acquisition module to acquire the leveling bubble image and obtain the original leveling bubble image; S4: Use the region of interest image acquisition unit in the image preprocessing module to intercept the image in the original leveling bubble image according to the set region of interest to obtain the region of interest image; use the threshold segmentation processing unit to perform binary segmentation processing on the region of interest image according to the set threshold segmentation method to obtain the binary region of interest image; use the non-zero pixel number statistics unit in the image column to obtain the sequence of the number of pixels with non-zero gray values in each column from left to right in the binary region of interest image; S5: Determine the position of the bubble relative to the scale line in the leveling bubble by using the obtained sequence of non-zero pixel numbers through the bubble position determination module; S6: Use the zero position error adjustment program in the error adjustment module to adjust the zero position error of the leveling bubble.

9. A method for adjusting the zero position error of a spirit level based on machine vision according to claim 8, characterized in that, The zero position error adjustment program in step S6 specifically includes the following steps: S61: Obtain the position of the leveling bubble relative to the scale line obtained by the bubble position determination module; S62: If the leveling bubble rides on the leftmost inner scale line, use the motion controller to control the left motion control mechanism to run quickly to lower the height on the left side of the bubble seat, and at the same time obtain the position of the leveling bubble relative to the scale line until the leveling bubble is between the two innermost scale lines, then stop the operation of the left motion control mechanism and go to S64; otherwise, directly proceed to the next step; S63: If the leveling bubble rides on the rightmost inner scale line, use the motion controller to control the right motion control mechanism to run quickly to lower the height on the right side of the bubble seat, and at the same time obtain the position of the leveling bubble relative to the scale line until the leveling bubble is between the two innermost scale lines, then stop the operation of the right motion control mechanism and go to S64; otherwise, directly proceed to the next step; S64: Use the zero position error measurement module to calculate the zero position error of the leveling bubble; S65: If the zero position error is not within the zero position error range set by the parameter setting module, then proceed to the next step; otherwise, go to S67; S66: If the zero position error is less than 0, use the motion controller to control the right motion control mechanism to run slowly to lower the height on the right side of the bubble seat, and go to S64; otherwise, use the motion controller to control the left motion control mechanism to run slowly to lower the height on the left side of the bubble seat, and go to S64; S67: Stop the slow operation of the left or right motion control mechanism and quickly reset the left and right motion control mechanisms, and the zero position error adjustment ends.