Automatic geometric level measuring method and system based on CCD (charge coupled device) encoding and decoding
By using CCD encoding and decoding technology, a barcode scale is constructed and subpixel linear interpolation and centroid algorithm correction are performed, which solves the problem of CCD signals being susceptible to interference and achieves high precision and stability in geometric leveling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTH SURVEYING & MAPPING INSTR
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies for automatic geometric leveling, CCD signal processing is easily affected by factors such as changes in ambient light, reflections on the scale surface, dust and dirt, and lens defocus, leading to inaccurate measurement results.
A CCD-based encoding and decoding method is adopted. A barcode scale is constructed by a preset pseudo-random code encoding algorithm, the barcode digital signal is acquired, subpixel linear interpolation is performed, peaks and valleys are extracted, peak data that meets the conditions are selected, and barcode matching and correction are performed using a preset matching algorithm and centroid algorithm to obtain the geometric leveling measurement results.
It improves the accuracy of geometric leveling, provides sub-pixel level positioning accuracy, and enhances the environmental adaptability of barcode recognition and the stability of measurement results.
Smart Images

Figure CN121898334A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CCD encoding and decoding technology, and in particular to an automatic geometric leveling measurement method and system based on CCD encoding and decoding. Background Technology
[0002] A CCD, or Charge-Coupled Device, is widely used in various detection systems. Typically, CCDs are used for image acquisition, and their output signals are usually directly used for image processing or simple threshold judgment. However, in geometric leveling scenarios such as position detection in industrial automated production lines and tracking of high-speed moving objects, encoding and decoding technologies are required to process the CCD signal. Therefore, how to accurately process CCD signals to improve the accuracy of automatic geometric leveling measurement results has become a technical problem that needs to be addressed.
[0003] Currently, existing technologies for automatic geometric leveling CCD signal processing mainly rely on edge detection algorithms to locate the edges of the acquired digital signals and calculate position information. However, in actual engineering environments, changes in ambient light, reflections on the scale surface, dust and dirt, and slight lens defocusing or shaking can all cause barcode edges to blur, interfering with the accuracy of edge detection algorithms. It is evident that existing technologies are susceptible to interference from external factors and cannot meet measurement requirements, resulting in inaccurate geometric leveling measurement results. Summary of the Invention
[0004] To address the aforementioned issues, this invention proposes an automatic geometric leveling measurement method and system based on CCD encoding and decoding, which achieves sub-pixel-level positioning accuracy through barcode matching, thereby improving the accuracy of geometric leveling measurement results.
[0005] To achieve the above objectives, embodiments of the present invention provide an automatic geometric leveling measurement method based on CCD encoding and decoding, comprising: scanning a pre-constructed barcode scale with a CCD sensor to acquire barcode digital signals; acquiring the current measurement distance to generate a corresponding interpolation step size, and performing sub-pixel linear interpolation on the barcode digital signals using the interpolation step size to obtain interpolated barcode digital signals; extracting the peaks and troughs of the interpolated barcode digital signals, and filtering peak data that meet preset matching conditions based on preset peak intervals to obtain peak segments; performing barcode matching based on peak segments, troughs, and preset standard barcodes using a preset matching algorithm to obtain an initial barcode sequence; correcting the initial barcode sequence based on a preset centroid algorithm to obtain a target barcode sequence; and decoding the target barcode sequence based on preset encoding rules to obtain geometric leveling measurement results to complete the automatic geometric leveling measurement.
[0006] This invention proposes an automatic geometric leveling measurement method based on CCD encoding and decoding. The method obtains barcode digital signals from a pre-constructed barcode scale by scanning. Sub-pixel linear interpolation is performed using an adaptive matching interpolation step size based on the current measurement distance, providing a reliable data foundation. Then, through a screening and matching process between peaks and troughs and preset standard barcodes, defects in edge recognition are avoided, improving the environmental adaptability of barcode recognition. Finally, a preset centroid algorithm is used to correct and decode the barcode sequence to obtain the geometric leveling measurement result, thus completing the automatic geometric leveling measurement. Therefore, using barcode matching provides sub-pixel level positioning accuracy, improving the accuracy of the geometric leveling measurement results.
[0007] Furthermore, the barcode digital signal is obtained by scanning a pre-constructed barcode scale using a CCD sensor, including: constructing a barcode scale based on a preset pseudo-random code encoding algorithm; scanning the barcode scale using a CCD sensor to obtain a barcode optical signal; performing photoelectric conversion on the barcode optical signal to obtain a barcode electrical signal; and performing digital signal conversion on the barcode electrical signal to obtain a barcode digital signal.
[0008] In the above scheme, a pre-set pseudo-random code encoding algorithm is used to construct a barcode scale to ensure that the barcode sequence is unique within a sufficient length. Then, the signal is converted into a photoelectric signal and a digital signal to provide a processable digital signal for subsequent algorithm processing, thereby ensuring the reliability of data processing and helping to improve the accuracy of geometric leveling measurement results.
[0009] Furthermore, the process involves obtaining the current measured distance to generate a corresponding interpolation step size, and performing sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain an interpolated barcode digital signal. This includes: generating a first interpolation step size if the current measured distance meets a first preset distance threshold; generating a second interpolation step size if the current measured distance meets a second preset distance threshold; performing sub-pixel linear interpolation within the adjacent pixel intervals of the barcode digital signal based on the first or second interpolation step size to obtain an initial interpolated signal; traversing the initial interpolated signal through a preset sliding window, and obtaining a stable region label and an edge region label by calculating the variance value within the preset sliding window; and setting the stable region label and the edge region label on their respective pixel points to obtain the interpolated barcode digital signal.
[0010] In the above scheme, the interpolation step size is dynamically selected based on the current measurement distance. Then, sub-pixel linear interpolation is performed within the interval between adjacent pixels of the barcode digital signal to provide a reliable data foundation for subsequent data processing. Then, variance analysis is performed on the initial interpolation signal through a preset sliding window to set corresponding area labels for each pixel, thereby improving the accuracy of signal features and helping to improve the accuracy of geometric leveling measurement results.
[0011] Furthermore, the peaks and troughs of the interpolated barcode digital signal are extracted, and peak data that meets the preset matching conditions are filtered based on the preset peak interval to obtain peak segments. This includes: identifying the rising and falling edges of the interpolated barcode digital signal; extracting the peaks and troughs of the interpolated barcode digital signal based on the rising and falling edges; and filtering peak data that meets the preset matching conditions from the peaks of the interpolated barcode digital signal through the preset peak interval to obtain peak segments. The preset matching condition is uniform peak data that meets the preset peak interval.
[0012] In the above scheme, the rising and falling edges of the interpolated barcode digital signal are identified to extract the peaks and troughs of the interpolated barcode digital signal. Then, peak segments are filtered from the peaks of the interpolated barcode digital signal using preset peak intervals and preset matching conditions. This reduces the possibility of subsequent matching algorithms performing calculations on invalid data and quickly eliminates false peaks or distorted waveforms caused by external factors such as image blurring, partial occlusion, or severe noise, thus helping to improve the accuracy of geometric leveling measurement results.
[0013] Furthermore, based on peak segments, troughs, and a preset standard barcode, barcode matching is performed using a preset matching algorithm to obtain an initial barcode sequence. This includes: calculating the image-to-object ratio based on the peak segments, where the image-to-object ratio is the ratio of pixels to the actual physical length; selecting a preset number of peak data from the peak segments and calculating the distance between adjacent peaks and troughs in the preset number of peak data to obtain measured distance values; if the measured distance values are equal to the preset peak intervals, then dividing the preset number of peak data into several data segments of different lengths according to the same pixel starting point; and matching the several data segments of different lengths with the preset standard barcode using the preset matching algorithm based on the image-to-object ratio to obtain the initial barcode sequence.
[0014] In the above scheme, the image-to-object ratio is calculated using the peak segment, providing a conversion ratio between pixels and physical length, and providing a scale benchmark for data processing. Then, the measured distance between adjacent peaks and valleys is calculated from a preset number of peak data. The preset number of peak data is then divided into several data segments of different lengths according to the same pixel starting point, providing multiple possible search paths for the subsequent matching algorithm. This enhances the algorithm's fault tolerance to local occlusion or edge truncation. Even if some barcode information is incomplete, the correct result can be obtained through successful matching of other lengths, thereby improving the accuracy of geometric leveling measurement results.
[0015] Furthermore, based on the image-to-object ratio, a preset matching algorithm is used to match several data segments of different lengths with a preset standard barcode to obtain an initial barcode sequence. This includes: calculating the distance between adjacent peaks and troughs in data segments of each length to obtain the measured distance values corresponding to data segments of different lengths; based on the image-to-object ratio, calculating the slope variance and variance sum of the measured distance values corresponding to data segments of different lengths and the preset standard barcode using the preset matching algorithm; and based on the slope variance and variance sum, selecting matching positions in data segments of different lengths that meet the preset matching requirements to obtain the initial barcode sequence.
[0016] In the above scheme, the measured distance between adjacent peaks and troughs in each data segment of length is calculated, and the corresponding slope variance and variance sum are calculated in combination with the preset standard barcode. The slope variance and variance sum are used as the selection criteria to select the matching position that meets the preset matching requirements, ensuring that the final output matching position is not an accidental local optimum, thus ensuring the data reliability of the initial barcode sequence and improving the accuracy of the geometric leveling measurement results.
[0017] Furthermore, based on a preset centroid algorithm, the initial barcode sequence is corrected to obtain the target barcode sequence, including: obtaining the gradient weight, edge weight, and Gaussian weight of the pixels based on the stable region label and edge region label on the pixels; calculating the total weight of the pixels based on the gradient weight, edge weight, and Gaussian weight using the preset centroid algorithm; and correcting the initial barcode sequence based on the total weight of the pixels to obtain the target barcode sequence.
[0018] In the above scheme, stable region labels and edge region labels on pixels are used to assign a total weight consisting of gradient weight, edge weight, and Gaussian weight to each pixel. This effectively resists local signal distortion caused by slight stains on the barcode surface and uneven illumination, thereby outputting stable and accurate sub-pixel-level centroid coordinates to obtain the target barcode sequence. This provides sub-pixel-level positioning accuracy and improves the accuracy of geometric leveling measurement results.
[0019] This invention also provides an automatic geometric leveling measurement system based on CCD encoding and decoding, comprising: a first digital signal acquisition module for scanning a pre-constructed barcode scale using a CCD sensor to acquire barcode digital signals; a second digital signal acquisition module for acquiring the current measurement distance to generate a corresponding interpolation step size, and performing sub-pixel linear interpolation on the barcode digital signals using the interpolation step size to obtain interpolated barcode digital signals; a peak segment extraction module for extracting peaks and troughs of the interpolated barcode digital signals, and filtering peak data that meet preset matching conditions based on preset peak intervals to obtain peak segments; an initial barcode sequence acquisition module for performing barcode matching based on peak segments, troughs, and preset standard barcodes using a preset matching algorithm to obtain an initial barcode sequence; a barcode sequence correction module for correcting the initial barcode sequence based on a preset centroid algorithm to obtain a target barcode sequence; and an automatic geometric leveling measurement module for decoding the target barcode sequence based on preset encoding rules to obtain geometric leveling measurement results to complete the automatic geometric leveling measurement.
[0020] This invention proposes an automatic geometric leveling system based on CCD encoding and decoding. It obtains barcode digital signals from a pre-constructed barcode scale by scanning, and performs sub-pixel linear interpolation using an adaptive matching interpolation step size based on the current measurement distance, providing a reliable data foundation. Then, through a screening and matching process between peaks and troughs and preset standard barcodes, it avoids the defects of edge recognition and improves the environmental adaptability of barcode recognition. Finally, it corrects and decodes the barcode sequence using a preset centroid algorithm to obtain the geometric leveling measurement results, thus completing the automatic geometric leveling measurement. Therefore, the use of barcode matching provides sub-pixel level positioning accuracy, improving the accuracy of the geometric leveling measurement results.
[0021] Furthermore, the first digital signal acquisition module is used to acquire barcode digital signals by scanning a pre-constructed barcode scale using a CCD sensor, and includes: a barcode scale construction unit for constructing a barcode scale based on a preset pseudo-random code encoding algorithm; an optical signal acquisition unit for scanning the barcode scale using a CCD sensor to obtain barcode optical signals; a photoelectric conversion unit for performing photoelectric conversion on the barcode optical signals to obtain barcode electrical signals; and a digital signal conversion unit for performing digital signal conversion on the barcode electrical signals to obtain barcode digital signals.
[0022] Furthermore, the second digital signal acquisition module is used to acquire the current measurement distance to generate the corresponding interpolation step size, and to perform sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain the interpolated barcode digital signal. This includes: a first interpolation step size generation unit, used to generate a first interpolation step size if the current measurement distance meets a first preset distance threshold; a second interpolation step size generation unit, used to generate a second interpolation step size if the current measurement distance meets a second preset distance threshold; an interpolation unit, used to perform sub-pixel linear interpolation within the adjacent pixel interval of the barcode digital signal based on the first or second interpolation step size to obtain an initial interpolated signal; a label analysis unit, used to traverse the initial interpolated signal through a preset sliding window, and obtain stable region labels and edge region labels by calculating the variance value within the preset sliding window; and a label setting unit, used to set the stable region labels and edge region labels on their respective pixel points to obtain the interpolated barcode digital signal. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating the steps of an automatic geometric leveling method based on CCD encoding and decoding, provided in a certain embodiment of the present invention. Figure 2 A schematic diagram of the digital signal conversion correspondence of an automatic geometric leveling measurement method based on CCD encoding and decoding provided in a certain embodiment of the present invention; Figure 3 A schematic diagram of long-distance peaks and valleys for an automatic geometric leveling method based on CCD encoding and decoding, provided in a certain embodiment of the present invention; wherein, Figure 3 (a) is a schematic diagram of the overall waveform of the peaks and troughs at a distance; Figure 3 (b) is a magnified schematic diagram of a distant peak and trough; Figure 3 (c) is a schematic diagram of setting up long-distance peak and trough indexes; Figure 4 A close-range peak and valley diagram of an automatic geometric leveling method based on CCD encoding and decoding provided in a certain embodiment of the present invention; Figure 5 A schematic diagram of the barcode matching steps in an automatic geometric leveling measurement method based on CCD encoding and decoding, provided for a certain embodiment of the present invention; Figure 6 A schematic diagram of the centroid position of an automatic geometric leveling method based on CCD encoding and decoding provided in a certain embodiment of the present invention; Figure 7 This is a schematic diagram of the module structure of an automatic geometric leveling system based on CCD encoding and decoding, provided in one embodiment of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] Example 1 See Figure 1 , Figure 1 This is a flowchart illustrating the steps of an automatic geometric leveling method based on CCD encoding and decoding, provided in one embodiment of the present invention. Figure 1 As shown in the figure, this embodiment of the invention proposes an automatic geometric leveling measurement method based on CCD encoding and decoding, including steps 101 to 106, each step of which is as follows: Step 101: Scan the pre-constructed barcode scale with a CCD sensor to obtain the barcode digital signal; Step 102: Obtain the current measurement distance, generate the corresponding interpolation step size, and perform sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain the interpolated barcode digital signal; Step 103: Extract the peaks and troughs of the interpolated barcode digital signal, and filter the peak data that meet the preset matching conditions based on the preset peak interval to obtain the peak segment; Step 104: Based on the peaks, troughs and preset standard barcodes, perform barcode matching using a preset matching algorithm to obtain an initial barcode sequence; Step 105: Based on the preset centroid algorithm, the initial barcode sequence is corrected to obtain the target barcode sequence; Step 106: Based on the preset encoding rules, decode the target barcode sequence to obtain the geometric leveling measurement result and complete the automatic geometric leveling measurement.
[0026] One specific implementation method involves using a linear image sensor to scan a pre-constructed barcode scale, obtaining a light intensity signal. This signal is then converted to a barcode digital signal. In this embodiment, the barcode scale uses a barcode composed of black and white bars. The current measurement distance is then obtained based on the signal characteristics, and an interpolation step size is adaptively generated. Sub-pixel linear interpolation is performed between adjacent pixels of the barcode digital signal based on the interpolation step size to obtain an interpolated barcode digital signal. Peaks and troughs are then extracted from the interpolated barcode digital signal. In this embodiment, peaks correspond to the center of the black barcode, and troughs correspond to the center of the white barcode. Peak data that meets preset matching conditions is then filtered through a preset peak interval to obtain peak segments. In this embodiment, the preset peak interval can be 15 mm, and the preset matching condition can be uniform peak data segments with a 15 mm interval. Then, the barcode sequence is filtered according to the peaks and troughs, and matched with the preset standard barcode using a preset matching algorithm to obtain the initial barcode sequence. In this embodiment, the preset matching algorithm can be interpreted as a peak-trough matching algorithm. After obtaining the initial barcode sequence, a preset centroid algorithm is used to assign a weight value to each pixel of the initial barcode sequence, thereby correcting the pixel positioning of the initial barcode sequence to obtain the target barcode sequence. Finally, the target barcode sequence is decoded using a preset encoding rule to obtain the geometric leveling measurement result to complete the automatic geometric leveling measurement. In this embodiment, the preset encoding rule is the same scale encoding rule used when pre-constructing the barcode scale. Through this encoding rule, the height information stored in the target barcode sequence can be calculated to obtain the geometric leveling measurement result.
[0027] This invention proposes an automatic geometric leveling measurement method based on CCD encoding and decoding. The method obtains barcode digital signals from a pre-constructed barcode scale by scanning. Sub-pixel linear interpolation is performed using an adaptive matching interpolation step size based on the current measurement distance, providing a reliable data foundation. Then, through a screening and matching process between peaks and troughs and preset standard barcodes, defects in edge recognition are avoided, improving the environmental adaptability of barcode recognition. Finally, a preset centroid algorithm is used to correct and decode the barcode sequence to obtain the geometric leveling measurement result, thus completing the automatic geometric leveling measurement. Therefore, using barcode matching provides sub-pixel level positioning accuracy, improving the accuracy of the geometric leveling measurement results.
[0028] A preferred embodiment involves scanning a pre-constructed barcode scale with a CCD sensor to obtain a barcode digital signal, including: constructing a barcode scale based on a preset pseudo-random code encoding algorithm; scanning the barcode scale with a CCD sensor to obtain a barcode optical signal; performing photoelectric conversion on the barcode optical signal to obtain a barcode electrical signal; and performing digital signal conversion on the barcode electrical signal to obtain a barcode digital signal.
[0029] One preferred implementation method is described in [reference]. Figure 2 , Figure 2 A schematic diagram illustrating the digital signal conversion correspondence of an automatic geometric leveling measurement method based on CCD encoding and decoding, provided for a certain embodiment of the present invention; as shown. Figure 2 As shown, a preset pseudo-random code encoding algorithm is used to construct a barcode scale by alternating between black and white codes. In this embodiment, the spacing between the black codes is 15 mm, and the width of the black codes is 4 mm, 6 mm, 9 mm, and 11 mm. Each barcode is unique; the unique height of the barcode can be determined when at least six consecutive barcodes are used for measurement. Notably, the black centers of the barcodes are evenly spaced, which in this embodiment is represented by a fixed distance of 15 mm between peaks. Then, the barcode optical signal is converted into a barcode electrical signal using existing mature methods. The photoelectric converted electrical signal is then amplified by an operational amplifier, and the amplified signal is converted into a barcode digital signal by an AD converter. In this embodiment, after each digital signal conversion of the barcode optical signal, the signal size and quality can be checked. If the requirements are not met, the exposure time or gain of the CCD is dynamically adjusted, and the scale image is re-acquired.
[0030] In the above scheme, a pre-set pseudo-random code encoding algorithm is used to construct a barcode scale to ensure that the barcode sequence is unique within a sufficient length. Then, the signal is converted into a photoelectric signal and a digital signal to provide a processable digital signal for subsequent algorithm processing, thereby ensuring the reliability of data processing and helping to improve the accuracy of geometric leveling measurement results.
[0031] A preferred embodiment involves obtaining the current measurement distance to generate a corresponding interpolation step size, and performing sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain an interpolated barcode digital signal. This includes: generating a first interpolation step size if the current measurement distance meets a first preset distance threshold; generating a second interpolation step size if the current measurement distance meets a second preset distance threshold; performing sub-pixel linear interpolation within the adjacent pixel intervals of the barcode digital signal based on the first or second interpolation step size to obtain an initial interpolated signal; traversing the initial interpolated signal through a preset sliding window, and obtaining a stable region label and an edge region label by calculating the variance value within the preset sliding window; and setting the stable region label and the edge region label on their respective pixel points to obtain the interpolated barcode digital signal.
[0032] In one preferred implementation, based on the signal characteristics of the barcode digital signal, the current measurement distance is obtained. If the current measurement distance meets a first preset distance threshold, a first interpolation step size is generated; if the current measurement distance meets a second preset distance threshold, a second interpolation step size is generated. In this embodiment, the current measurement distance meeting the first preset distance threshold can be characterized as the current measurement distance being greater than 30 meters, in which case a smaller interpolation step size, such as 0.2 pixels, is used. The current measurement distance meeting the second preset distance threshold can be characterized as the current measurement distance being less than or equal to 30 meters, in which case a larger interpolation step size, such as 0.4 pixels, is used. Then, subpixel linear interpolation is performed within the adjacent pixel intervals of the barcode digital signal according to the corresponding interpolation step size to obtain an initial interpolated signal. Then, the initial interpolated signal is traversed through a preset sliding window, and variance analysis is performed within each sliding window to calculate the variance value within the window, distinguishing stable regions and edge regions, obtaining stable region labels and edge region labels, and setting the labels on the corresponding pixels to obtain the interpolated barcode digital signal.
[0033] In the above scheme, the interpolation step size is dynamically selected based on the current measurement distance. Then, sub-pixel linear interpolation is performed within the interval between adjacent pixels of the barcode digital signal to provide a reliable data foundation for subsequent data processing. Then, variance analysis is performed on the initial interpolation signal through a preset sliding window to set corresponding area labels for each pixel, thereby improving the accuracy of signal features and helping to improve the accuracy of geometric leveling measurement results.
[0034] A preferred embodiment involves extracting the peaks and troughs of the interpolated barcode digital signal and filtering peak data that meet preset matching conditions based on a preset peak interval to obtain peak segments. This includes: identifying the rising and falling edges of the interpolated barcode digital signal; extracting the peaks and troughs of the interpolated barcode digital signal based on the rising and falling edges; and filtering peak data that meet preset matching conditions from the peaks of the interpolated barcode digital signal through a preset peak interval to obtain peak segments. The preset matching condition is uniform peak data that meets the preset peak interval.
[0035] One preferred implementation method is described in [reference]. Figure 3 , Figure 3 A schematic diagram of long-distance peaks and valleys for an automatic geometric leveling method based on CCD encoding and decoding, provided in a certain embodiment of the present invention; wherein, Figure 3 (a) is a schematic diagram of the overall waveform of the peaks and troughs at a distance; Figure 3 (b) is a magnified schematic diagram of a distant peak and trough; Figure 3 (c) is a schematic diagram of setting up long-distance peak and trough indexes; as shown Figure 3 As shown in (a), for long-distance interpolated barcode digital signals, in order to more accurately identify peaks and troughs, such as Figure 3As shown in (b), a local magnified analysis is performed on the overall waveform diagram within the red box. The rising and falling edges are identified from the interpolated barcode digital signal. Then, the peaks and troughs of the interpolated barcode digital signal are extracted, and the index of the peaks is increased while the index of the troughs is decreased. The waveform within the red box in the magnified diagram is used as an example for explanation. The peak and trough index settings are as follows: Figure 3 As shown in (c), this is for subsequent calculations. Then, the spacing between the peaks is calculated from the peaks of the interpolated barcode digital signal, and continuous segments with a peak spacing close to 15 mm are selected as peak segments. In this embodiment, the preset peak spacing can be selected as 15 mm, and the preset matching condition can be uniform peak data segments with a spacing of 15 mm.
[0036] See also Figure 4 , Figure 4 A close-range peak and trough diagram of an automatic geometric leveling method based on CCD encoding and decoding, provided for a certain embodiment of the present invention; as shown. Figure 4 As shown, for interpolated barcode digital signals at close range, rising and falling edges are identified from the interpolated barcode digital signals. Then, the peaks and troughs of the interpolated barcode digital signals are extracted, and the index of the peaks is increased while the index of the troughs is decreased for subsequent calculations. Then, based on the index of the peaks and troughs, the spacing between the peaks is calculated from the peaks of the interpolated barcode digital signals. Continuous segments with a peak spacing close to 15 mm are selected as peak segments. In this embodiment, the preset peak spacing can be selected as 15 mm, and the preset matching condition can be uniform peak data segments with a spacing of 15 mm. If there are no continuous segments with a peak spacing of 15 mm, the next frame of data measurement is performed.
[0037] It is worth mentioning that if no uniform interval is found during the screening process, the current CCD sensor scan image frame matching will be exited and the next frame data measurement will be performed.
[0038] In the above scheme, the rising and falling edges of the interpolated barcode digital signal are identified to extract the peaks and troughs of the interpolated barcode digital signal. Then, peak segments are filtered from the peaks of the interpolated barcode digital signal using preset peak intervals and preset matching conditions. This reduces the possibility of subsequent matching algorithms performing calculations on invalid data and quickly eliminates false peaks or distorted waveforms caused by external factors such as image blurring, partial occlusion, or severe noise, thus helping to improve the accuracy of geometric leveling measurement results.
[0039] A preferred embodiment involves matching barcodes using a preset matching algorithm based on peak segments, trough segments, and a preset standard barcode to obtain an initial barcode sequence. This includes: calculating the image-to-object ratio based on the peak segments, where the image-to-object ratio is the ratio of pixels to the actual physical length; selecting a preset number of peak data points from the peak segments and calculating the distance between adjacent peaks and troughs within the preset number of peak data points to obtain measured distance values; if the measured distance values are equal to the preset peak intervals, dividing the preset number of peak data points into several data segments of different lengths based on the same pixel starting point; and matching the several data segments of different lengths with the preset standard barcode using the preset matching algorithm based on the image-to-object ratio to obtain the initial barcode sequence.
[0040] One preferred implementation method is described in [reference]. Figure 5 , Figure 5 A schematic diagram of the barcode matching steps in an automatic geometric leveling measurement method based on CCD encoding and decoding, provided for one embodiment of the present invention; as shown. Figure 5 As shown, the spacing between peaks in the interpolated barcode digital signal is calculated through the above steps. A continuous segment with a peak spacing close to 15 mm is selected as the peak segment. The image-to-object ratio of the selected uniformly spaced peak segments is calculated. The image-to-object ratio represents the ratio of pixels to actual physical length, which can be understood as a scale for restoring all pixels to their real-world size. Then, the 10 peak data with the best uniformity are selected from the uniform peak segments, and the peak-to-trough distance and the distance between the trough and the next peak are calculated to obtain the measured distance value. If the measured distance value is equal to 15 mm, the ten peak data are divided into data segments of various lengths according to the same starting point. In this embodiment, they are divided into data segments of 7, 8, and 9 data lengths from the same starting point. Then, according to the image-to-object ratio, a matching operation is performed using a preset matching algorithm to obtain the initial barcode sequence. If the measured distance value is not equal to 15 mm, the barcode matching step is exited, and the next frame data measurement is initiated.
[0041] In the above scheme, the image-to-object ratio is calculated using the peak segment, providing a conversion ratio between pixels and physical length, and providing a scale benchmark for data processing. Then, the measured distance between adjacent peaks and valleys is calculated from a preset number of peak data. The preset number of peak data is then divided into several data segments of different lengths according to the same pixel starting point, providing multiple possible search paths for the subsequent matching algorithm. This enhances the algorithm's fault tolerance to local occlusion or edge truncation. Even if some barcode information is incomplete, the correct result can be obtained through successful matching of other lengths, thereby improving the accuracy of geometric leveling measurement results.
[0042] A preferred embodiment involves matching several data segments of different lengths with a preset standard barcode based on the image-to-object ratio using a preset matching algorithm to obtain an initial barcode sequence. This includes: calculating the distances between adjacent peaks and troughs in each data segment of different lengths to obtain measured distance values corresponding to different data segments; calculating the slope variance and sum of variances of the measured distance values corresponding to different data segments and the preset standard barcode based on the image-to-object ratio using the preset matching algorithm; and selecting matching positions in the data segments of different lengths that meet the preset matching requirements based on the slope variance and sum of variances to obtain the initial barcode sequence.
[0043] One preferred implementation method is described in [reference]. Figure 5 , Figure 5 A schematic diagram of the barcode matching steps in an automatic geometric leveling measurement method based on CCD encoding and decoding, provided for one embodiment of the present invention; as shown. Figure 5 As shown, for each segment, the distance between adjacent peaks and troughs in each data segment of length is calculated to obtain the measured distance values corresponding to data segments of 7, 8, and 9 data lengths. The slope variance and sum of variances of the measured distance values corresponding to the 7, 8, and 9 data lengths of the data segment are then calculated relative to the preset standard barcode. In this embodiment, a smaller slope variance indicates a higher trend matching degree. The smaller the sum of variances, the higher the matching degree. Then, based on the slope variance and the sum of variances, a comprehensive score is used to select the position with the smallest comprehensive score as the best matching position. It is worth mentioning that if the comprehensive score is greater than 1, the data is considered poor and cannot be matched. In addition, if the best matching positions output by data segments of 7, 8, and 9 lengths do not overlap or are not adjacent, the matching of the current frame ends and the next frame begins. If the best matching positions output by data segments of 7, 8, and 9 lengths overlap or are adjacent, the best matching position is used as the initial barcode sequence, and the initial barcode height is calculated. In this embodiment, the preset matching requirement is represented by the smallest comprehensive score.
[0044] In the above scheme, the measured distance between adjacent peaks and troughs in each data segment of length is calculated, and the corresponding slope variance and variance sum are calculated in combination with the preset standard barcode. The slope variance and variance sum are used as the selection criteria to select the matching position that meets the preset matching requirements, ensuring that the final output matching position is not an accidental local optimum, thus ensuring the data reliability of the initial barcode sequence and improving the accuracy of the geometric leveling measurement results.
[0045] A preferred embodiment involves correcting an initial barcode sequence based on a preset centroid algorithm to obtain a target barcode sequence, including: obtaining the gradient weight, edge weight, and Gaussian weight of a pixel based on stable region labels and edge region labels on the pixel; calculating the total weight of the pixel using the preset centroid algorithm based on the gradient weight, edge weight, and Gaussian weight of the pixel; and correcting the initial barcode sequence based on the total weight of the pixel to obtain the target barcode sequence.
[0046] One preferred implementation involves obtaining the gradient weights, edge weights, and Gaussian weights of a pixel using existing, mature methods, based on the stable region labels and edge region labels on the pixel. The total weight is then calculated and expressed as follows: Total weight = Gradient weight × Marginal weight × Gaussian weight; In the formula, the gradient weight calculation is divided into sub-scenarios. The edge pixels of the array, the boundary pixels of the detection window, and the middle pixels are calculated by forward difference, backward difference, and center difference, respectively. The edge weight is set according to the gradient weight. The larger the gradient weight, the higher the proportion of the edge weight. The Gaussian weight is generally taken as the average value of the pixels in the region.
[0047] Finally, see Figure 6 , Figure 6 A schematic diagram of the centroid position of an automatic geometric leveling method based on CCD encoding and decoding, provided in a certain embodiment of the present invention; as shown. Figure 6 As shown, the centroid position of the initial barcode sequence is corrected by the total weight of the pixels, so that the peaks and troughs coincide with the centroid, thus obtaining the target barcode sequence.
[0048] In the above scheme, stable region labels and edge region labels on pixels are used to assign a total weight consisting of gradient weight, edge weight, and Gaussian weight to each pixel. This effectively resists local signal distortion caused by slight stains on the barcode surface and uneven illumination, thereby outputting stable and accurate sub-pixel-level centroid coordinates to obtain the target barcode sequence. This provides sub-pixel-level positioning accuracy and improves the accuracy of geometric leveling measurement results.
[0049] Example 2 See Figure 7 , Figure 7 This is a schematic diagram of the module structure of an automatic geometric leveling system based on CCD encoding and decoding, provided in one embodiment of the present invention. Figure 7As shown, this embodiment of the invention also provides an automatic geometric leveling measurement system based on CCD encoding and decoding, including: a first digital signal acquisition module 201, used to scan a pre-constructed barcode scale using a CCD sensor to acquire barcode digital signals; a second digital signal acquisition module 202, used to acquire the current measurement distance to generate a corresponding interpolation step size, and perform sub-pixel linear interpolation on the barcode digital signals using the interpolation step size to obtain interpolated barcode digital signals; and a peak segment extraction module 203, used to extract the peaks and troughs of the interpolated barcode digital signals, and based on a preset... The peak interval is filtered to obtain peak data that meets the preset matching conditions to obtain peak segments; the initial barcode sequence acquisition module 204 is used to perform barcode matching based on peak segments, troughs and preset standard barcodes through a preset matching algorithm to obtain an initial barcode sequence; the barcode sequence correction module 205 is used to correct the initial barcode sequence based on a preset centroid algorithm to obtain a target barcode sequence; the geometric leveling automatic measurement module 206 is used to decode the target barcode sequence based on preset encoding rules to obtain geometric leveling measurement results to complete the geometric leveling automatic measurement.
[0050] This invention proposes an automatic geometric leveling system based on CCD encoding and decoding. It obtains barcode digital signals from a pre-constructed barcode scale by scanning, and performs sub-pixel linear interpolation using an adaptive matching interpolation step size based on the current measurement distance, providing a reliable data foundation. Then, through a screening and matching process between peaks and troughs and preset standard barcodes, it avoids the defects of edge recognition and improves the environmental adaptability of barcode recognition. Finally, it corrects and decodes the barcode sequence using a preset centroid algorithm to obtain the geometric leveling measurement results, thus completing the automatic geometric leveling measurement. Therefore, the use of barcode matching provides sub-pixel level positioning accuracy, improving the accuracy of the geometric leveling measurement results.
[0051] Furthermore, the first digital signal acquisition module 201 is used to acquire barcode digital signals by scanning a pre-constructed barcode scale using a CCD sensor, including: a barcode scale construction unit 301, used to construct a barcode scale based on a preset pseudo-random code encoding algorithm; an optical signal acquisition unit 302, used to scan the barcode scale using a CCD sensor to obtain barcode optical signals; a photoelectric conversion unit 303, used to perform photoelectric conversion on the barcode optical signals to obtain barcode electrical signals; and a digital signal conversion unit 304, used to perform digital signal conversion on the barcode electrical signals to obtain barcode digital signals.
[0052] Furthermore, the second digital signal acquisition module 202 is used to acquire the current measurement distance to generate the corresponding interpolation step size, and to perform sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain the interpolated barcode digital signal. This includes: a first interpolation step size generation unit 401, used to generate a first interpolation step size if the current measurement distance meets a first preset distance threshold; a second interpolation step size generation unit 402, used to generate a second interpolation step size if the current measurement distance meets a second preset distance threshold; an interpolation unit 403, used to perform sub-pixel linear interpolation within the adjacent pixel interval of the barcode digital signal based on the first or second interpolation step size to obtain an initial interpolated signal; a label analysis unit 404, used to traverse the initial interpolated signal through a preset sliding window, and obtain stable region labels and edge region labels by calculating the variance value within the preset sliding window; and a label setting unit 405, used to set the stable region labels and edge region labels on their respective pixel points to obtain the interpolated barcode digital signal.
[0053] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
[0054] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the described specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0055] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
Claims
1. An automatic geometric leveling measurement method based on CCD encoding and decoding, characterized in that, include: The barcode digital signal is obtained by scanning a pre-built barcode scale using a CCD sensor; The current measurement distance is obtained to generate the corresponding interpolation step size, and the barcode digital signal is subjected to subpixel linear interpolation using the interpolation step size to obtain the interpolated barcode digital signal; Extract the peaks and troughs of the interpolated barcode digital signal, and filter the peak data that meet the preset matching conditions based on the preset peak interval to obtain the peak segment; Based on the peak segment, the trough segment, and the preset standard barcode, barcode matching is performed using a preset matching algorithm to obtain an initial barcode sequence; Based on a preset centroid algorithm, the initial barcode sequence is corrected to obtain the target barcode sequence; Based on preset encoding rules, the target barcode sequence is decoded to obtain the geometric leveling measurement result, thereby completing the automatic geometric leveling measurement.
2. The automatic geometric leveling method based on CCD encoding and decoding as described in claim 1, characterized in that, The step of scanning a pre-constructed barcode scale with a CCD sensor to obtain barcode digital signals includes: A barcode scale is constructed based on a pre-defined pseudo-random code encoding algorithm. The barcode scale is scanned by a CCD sensor to obtain the barcode light signal; The optical signal of the barcode is converted into an electrical signal by photoelectric conversion. The barcode electrical signal is converted into a digital signal to obtain a barcode digital signal.
3. The automatic geometric leveling method based on CCD encoding and decoding as described in claim 1, characterized in that, The step of obtaining the current measurement distance to generate the corresponding interpolation step size, and performing sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain the interpolated barcode digital signal includes: If the current measured distance meets the first preset distance threshold, then a first interpolation step size is generated; If the current measured distance meets the second preset distance threshold, then a second interpolation step size is generated; Based on the first interpolation step size or the second interpolation step size, sub-pixel linear interpolation is performed within the adjacent pixel interval of the barcode digital signal to obtain an initial interpolation signal; The initial interpolation signal is traversed through a preset sliding window, and the stable region label and edge region label are obtained by calculating the variance value within the preset sliding window. The stable region label and the edge region label are respectively set on the corresponding pixel points to obtain the interpolated barcode digital signal.
4. The automatic geometric leveling method based on CCD encoding and decoding as described in claim 1, characterized in that, The process of extracting the peaks and troughs of the interpolated barcode digital signal and filtering peak data that meet preset matching conditions based on preset peak intervals to obtain peak segments includes: Identify the rising and falling edges of the interpolated barcode digital signal, and extract the peaks and troughs of the interpolated barcode digital signal based on the rising and falling edges; Peak segments are obtained by filtering peak data that meet preset matching conditions from the peaks of the interpolated barcode digital signal by a preset peak interval, wherein the preset matching condition is uniform peak data that meets the preset peak interval.
5. The automatic geometric leveling method based on CCD encoding and decoding as described in claim 1, characterized in that, Based on the peak segment, the trough segment, and the preset standard barcode, barcode matching is performed using a preset matching algorithm to obtain an initial barcode sequence, including: The image-to-object ratio is calculated based on the peak segment, wherein the image-to-object ratio is the ratio of pixels to actual physical length; Select a preset number of peak data from the peak segment, and calculate the distance between adjacent peaks and troughs in the preset number of peak data to obtain the measured distance value; If the measured distance value is equal to the preset peak interval, then the preset number of peak data is divided into several data segments of different lengths according to the same pixel starting point; Based on the image-to-object ratio, a preset matching algorithm is used to match several data segments of different lengths with a preset standard barcode to obtain an initial barcode sequence.
6. The automatic geometric leveling method based on CCD encoding and decoding as described in claim 5, characterized in that, Based on the image-to-object ratio, a preset matching algorithm is used to match several data segments of different lengths with a preset standard barcode to obtain an initial barcode sequence, including: Calculate the distance between adjacent peaks and troughs in data segments of different lengths to obtain the measured distance values corresponding to data segments of different lengths; Based on the image-to-object ratio, the measured distance value corresponding to data segments of different lengths and the slope variance and variance sum of the preset standard barcode are calculated using a preset matching algorithm; Based on the slope variance and the sum of variances, matching positions that meet the preset matching requirements are selected from data segments of different lengths to obtain the initial barcode sequence.
7. The automatic geometric leveling method based on CCD encoding and decoding as described in claim 3, characterized in that, The step of correcting the initial barcode sequence based on a preset centroid algorithm to obtain the target barcode sequence includes: Based on the stable region label and edge region label on the pixel, obtain the gradient weight, edge weight and Gaussian weight of the pixel; Based on the gradient weight, edge weight, and Gaussian weight of the pixel, the total weight of the pixel is calculated using a preset centroid algorithm. The initial barcode sequence is corrected based on the total weight of the pixels to obtain the target barcode sequence.
8. An automatic geometric leveling measurement system based on CCD encoding and decoding, characterized in that, Performing the automatic geometric leveling method based on CCD encoding and decoding as described in any one of claims 1 to 7, comprising: The first digital signal acquisition module is used to acquire barcode digital signals by scanning a pre-built barcode scale with a CCD sensor; The second digital signal acquisition module is used to acquire the current measurement distance to generate the corresponding interpolation step size, and to perform sub-pixel linear interpolation on the barcode digital signal through the interpolation step size to obtain the interpolated barcode digital signal; The peak segment extraction module is used to extract the peaks and troughs of the interpolated barcode digital signal, and filter the peak data that meet the preset matching conditions based on the preset peak interval to obtain the peak segment. The initial barcode sequence acquisition module is used to perform barcode matching based on the peak segment, the trough segment and the preset standard barcode, and to obtain the initial barcode sequence by using a preset matching algorithm. The barcode sequence correction module is used to correct the initial barcode sequence based on a preset centroid algorithm to obtain the target barcode sequence. The automatic geometric leveling module is used to decode the target barcode sequence based on preset encoding rules to obtain the geometric leveling measurement result and complete the automatic geometric leveling measurement.
9. The automatic geometric leveling system based on CCD encoding and decoding as described in claim 8, characterized in that, The first digital signal acquisition module is used to acquire barcode digital signals by scanning a pre-constructed barcode scale using a CCD sensor, including: The barcode scale construction unit is used to construct a barcode scale based on a preset pseudo-random code encoding algorithm. The optical signal acquisition unit is used to scan the barcode scale using a CCD sensor to obtain the barcode optical signal; A photoelectric conversion unit is used to perform photoelectric conversion on the barcode optical signal to obtain a barcode electrical signal; A digital signal conversion unit is used to convert the barcode electrical signal into a digital signal to obtain a barcode digital signal.
10. The automatic geometric leveling system based on CCD encoding and decoding as described in claim 8, characterized in that, The second digital signal acquisition module is used to acquire the current measurement distance to generate the corresponding interpolation step size, and to perform sub-pixel linear interpolation on the barcode digital signal using the interpolation step size to obtain the interpolated barcode digital signal, including: The first interpolation step size generation unit is used to generate a first interpolation step size if the current measured distance meets a first preset distance threshold. The second interpolation step size generation unit is used to generate a second interpolation step size if the current measured distance meets a second preset distance threshold. An interpolation unit is used to perform sub-pixel linear interpolation within the adjacent pixel interval of the barcode digital signal based on the first interpolation step size or the second interpolation step size to obtain an initial interpolated signal. The label analysis unit is used to traverse the initial interpolation signal through a preset sliding window and obtain stable region labels and edge region labels by calculating the variance value within the preset sliding window; The label setting unit is used to set the stable region label and the edge region label on the corresponding pixel points respectively to obtain the interpolated barcode digital signal.