An automatic measurement system for flatness and size of automobile batteries

By combining a line laser industrial camera and point cloud processing algorithm with OpenCV to detect battery flatness and hole spacing, the problems of inconsistent measurement results and high computing resources in existing technologies are solved, and efficient and accurate automated measurement of battery flatness and size is achieved.

CN120627897BActive Publication Date: 2025-10-28CHANGCHUN UNIV OF SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511120853.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-12
Publication Date
2025-10-28
Estimated Expiration
2045-08-12

AI Technical Summary

Technical Problem

In the current technology, the flatness and size measurement of automobile batteries rely on manual operation, which results in poor repeatability and consistency of measurement results, low accuracy, and difficulty in accurate measurement in complex environments. Furthermore, the existing automated systems have high computing resource requirements and are difficult to meet the requirements of real-time performance and high efficiency.

Method used

The battery is scanned and photographed using a line laser industrial camera. The flatness is calculated using a point cloud processing algorithm. The OpenCV algorithm is used to detect the circular holes in the battery and calculate the hole spacing and length. Combined with the Qt dual-thread architecture and PLC communication module, automated control is achieved to ensure real-time performance and high efficiency.

Benefits of technology

It achieves high-precision, automated measurement of automotive batteries, reduces human error, improves testing efficiency and accuracy, adapts to different production environments, and meets the requirements of real-time performance and high efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120627897B_ABST
    Figure CN120627897B_ABST
Patent Text Reader

Abstract

This invention discloses an automated measurement system for the flatness and dimensions of automotive batteries, relating to the field of image processing technology. The system includes: a data acquisition module for scanning and photographing the battery using a line laser industrial camera to obtain a laser image of the battery; a point cloud processing module for converting the laser image into point cloud data, calculating the flatness of the battery surface, converting the point cloud data into a two-dimensional image, detecting battery holes and calculating the hole spacing and battery length; a PLC communication module for determining whether the battery is qualified and sending the determination result to the PLC; an automation control module for executing automated operations of the robotic arm and line laser industrial camera under PLC control; and a front-end display module for displaying the data acquisition status, point cloud image, calculation results, and determination results, and enabling user interaction through a Qt interface. This invention solves the problems of low accuracy, poor efficiency, and difficulty in meeting real-time and high-efficiency requirements of manual battery inspection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an automated measurement system for the flatness and dimensions of automotive batteries. Background Technology

[0002] In existing technologies, the flatness and dimensional measurement of automotive batteries mainly rely on traditional manual measurement or simple optical inspection equipment. These methods measure the battery surface manually or semi-automatically to assess whether its flatness and geometry meet standards. The main advantages of these methods are their simplicity, low cost, and suitability for small-scale production environments.

[0003] However, in practical applications, these methods face significant technical challenges and limitations. First, traditional measurement tools rely on manual operation, making them susceptible to the operator's skill level and resulting in poor repeatability and consistency of measurement results. Second, optical inspection equipment struggles to accurately capture details of the battery surface in complex environments (such as uneven lighting or surface reflection), affecting measurement accuracy. Furthermore, due to the potential for minute variations in the flatness and dimensions of the battery surface, existing methods struggle to achieve high-precision automated measurement, especially in large-scale production environments where efficiency and accuracy are difficult to balance. Existing automated measurement systems often require substantial computing resources. In practical applications, these systems are frequently deployed on production lines with limited computing resources, such as industrial robots or automated equipment. This environment places higher demands on the real-time performance and computational efficiency of algorithms, making it difficult for existing systems to meet the needs of efficient and accurate measurement, severely impacting production efficiency and product quality consistency. Summary of the Invention

[0004] This invention provides an automated measurement system for the flatness and dimensions of automotive batteries, which solves the problems of low accuracy and poor efficiency of manual measurement in the prior art, the need to adjust the algorithm when replacing the battery, the inability to check deviations at fixed positions, and the high computational resource requirements of existing automated measurement systems, making it difficult to meet the requirements of real-time performance and high efficiency.

[0005] According to one aspect of the present invention, an automated measurement system for the flatness and dimensions of an automotive battery is provided, comprising: a data acquisition module for scanning and photographing the battery using a line laser industrial camera to obtain a laser image of the battery; a point cloud processing module connected to the data acquisition module for converting the obtained laser image into point cloud data, processing the point cloud data based on a point cloud processing algorithm to calculate the flatness of the battery surface, converting the point cloud data into a two-dimensional image using an internal algorithm of the line laser industrial camera, and then using an OpenCV algorithm to detect the circular holes of the battery on the two-dimensional image and calculate the hole spacing and battery length; a PLC communication module connected to the point cloud processing module for determining whether the battery is qualified based on the flatness, hole spacing, and length calculated by the point cloud processing module, and sending the determination result to the PLC; an automation control module for reading data from the PLC and executing automated operations of a robotic arm and a line laser industrial camera under the control of the PLC according to the determination result; and a front-end display module connected to the data acquisition module, the point cloud processing module, and the PLC communication module for displaying the data acquisition status, point cloud image, calculation results, and determination results, and realizing user interaction through a Qt interface.

[0006] Optionally, the automation control module is also used to control a robotic arm to pick up batteries from the conveyor belt and place them on the upper layer of the battery scanning rack. The battery scanning rack has a two-layer structure, with the upper layer holding the batteries to be tested and the lower layer integrating a stepper motor and a line laser industrial camera. The line laser industrial camera is mounted on the stepper motor, and the acquisition frequency, installation height, and constant moving speed of the stepper motor are set according to the length and width of the battery. The stepper motor drives the line laser industrial camera to move along the surface of the battery and completely photograph the battery to obtain a laser image.

[0007] Optionally, the point cloud processing module utilizes a Qt dual-thread architecture to separate point cloud data processing from 2D image processing, with each being executed by an independent thread to improve real-time performance and response speed. The dual-thread architecture includes a main thread and a sub-thread. The main thread is responsible for processing point cloud data, including point cloud acquisition, plane fitting, and flatness calculation. It processes the point cloud data using the PCL point cloud library and calculates the flatness of the battery surface in real time. After processing, the main thread sends the flatness result to the front-end interface for display via Qt's signal-slot mechanism. The sub-thread is responsible for 2D image processing. After the point cloud data is converted into a 2D image by a separate program, it is passed to the sub-thread for processing. The sub-thread uses OpenCV algorithms to perform circular hole detection, hole spacing calculation, and battery length measurement on the 2D image. After processing, the sub-thread sends the measurement results to the front-end interface for display via the signal-slot mechanism.

[0008] Optionally, converting the obtained laser image into point cloud data includes: extracting the resolution and offset from the image calibration information of the laser image, wherein the resolution includes... , , The offset includes , , ,in, This represents the actual distance represented by each pixel along the x-axis. This represents the actual distance represented by each pixel along the y-axis. This represents the actual distance that each unit of the depth value represents. This represents the zero-point offset in the x-axis direction. This represents the zero-point offset in the y-axis direction. This represents the zero-point offset in the z-axis direction; the effective row range and shielded area of ​​the laser image are determined according to the predefined upper and lower limits of the filter; within the effective row range, one point is taken every two rows and one point is taken every two columns, and the shielded area is skipped, and the obtained laser data is downsampled to reduce the point cloud density; points with depth values ​​within a preset fixed range are retained and filtered in the z-direction.

[0009] Based on the downsampled and filtered data, the point cloud coordinates of each valid point are calculated using the extracted resolution and offset. The calculation formula is as follows:

[0010] ;

[0011] ;

[0012] ;

[0013] in , , Represents the point cloud coordinates of the valid points after downsampling and filtering; This represents the column index of the point cloud data, corresponding to the x-coordinate calculation in the formula; This represents the row index of the point cloud data, corresponding to the y-coordinate calculation in the formula; This represents the processed 16-bit depth data.

[0014] Optionally, calculating the flatness of the battery surface includes: performing plane fitting on the acquired point cloud data to obtain a plane equation; and calculating the distance from each point in the point cloud data to the fitted plane. The distances are then sorted in descending order. The difference between the 0.001% quantile and the 99.999% quantile is taken to obtain the flatness index, which is used to characterize the flatness of the battery surface.

[0015] Optionally, the step of performing plane fitting on the acquired point cloud data to derive the plane equation includes:

[0016] Calculate the geometric center, or centroid, of the point cloud data:

[0017] ;

[0018] In the formula, , where is the coordinate of the centroid; It refers to the number of points in the point cloud data; The index of the point; , indicating the first The coordinates of the points;

[0019] By subtracting the coordinates of each point from the coordinates of the centroid, the point cloud is translated to a coordinate system with the centroid as the origin, resulting in a centered point cloud:

[0020] ;

[0021] In the formula, Indicates the first A centralized point cloud;

[0022] The covariance matrix is ​​obtained by cloud computing based on the central point:

[0023] ;

[0024] In the formula, The covariance matrix of the centered point cloud;

[0025] Extracting eigenvalues ​​from the covariance matrix:

[0026] ;

[0027] In the formula, It is the eigenvector matrix. It is a diagonal matrix, and the elements on the diagonal are eigenvalues;

[0028] Eigenvector corresponding to the smallest eigenvalue Let be the normal vector of the fitted plane, and the equation of the fitted plane is expressed as:

[0029] ;

[0030] In the formula, These represent the x, y, and z coordinates of any point in the planar space, respectively.

[0031] Optionally, the distance from each point in the calculated point cloud data to the fitting plane is... include:

[0032] Target Its distance to the fitting plane for:

[0033] ;

[0034] Where, Represents the constant term in the plane equation. .

[0035] Optionally, the conversion of point cloud data into a two-dimensional image using the internal algorithm function of the line laser industrial camera includes:

[0036] Point cloud data is processed using the API of a line laser industrial camera, and preprocessed by statistical filtering to remove discrete points.

[0037] Using camera intrinsic matrix and extrinsic parameter matrix Project the processed point cloud onto the image plane:

[0038] ;

[0039] in, These are the processed 3D point cloud coordinates; These are the projected two-dimensional coordinates;

[0040] For each pixel, find the nearest projection point and assign the pixel grayscale value of the nearest projection point to that pixel, thus obtaining a preliminary two-dimensional image;

[0041] The initially obtained two-dimensional image is then normalized and Gaussian filtered to obtain the final two-dimensional image. The Gaussian filtering formula can be expressed as:

[0042] ;

[0043] ;

[0044] in, This represents the filtered image; Represents the original two-dimensional image; Indicates a Gaussian filter; The standard deviation is used to determine the filtering strength. This indicates the horizontal offset relative to the center pixel. This represents the offset in the vertical direction relative to the center pixel.

[0045] Optionally, preprocessing can be performed using statistical filtering to remove discrete points, including:

[0046] Target Calculate the average distance from it to its neighboring points:

[0047] ;

[0048] in, Point Average distance to neighboring points; Indicates the number of neighboring points; Indicates the index of the nearest point; It is the current point; It is a point The A nearby point;

[0049] Calculate all points mean and standard deviation Set threshold :

[0050] ;

[0051] in, A multiplier defined according to the circumstances;

[0052] Remove from point.

[0053] Optionally, the step of detecting battery circular holes and calculating the hole distance and battery length on a two-dimensional image using the OpenCV algorithm includes: checking whether the converted two-dimensional image is empty and whether its size meets the requirements, and converting the grayscale image to a color image for visualization; defining and occluding specific regions in the image, and preprocessing the image using mean filtering, binarization, and opening operations; identifying circular markers in the image using the Hough circle detection method, and calculating the average grayscale value of the pixels in the circular markers, wherein the formula for calculating the average grayscale value of pixels is:

[0054] ;

[0055] Where, Represents the average grayscale value of a pixel. It is the sum of the pixel values ​​in the circular area. It is the area of ​​the circular region;

[0056] Valid circular markers are selected based on the average pixel grayscale value and the y-coordinate. Valid circular markers are those whose average pixel grayscale value within their area is below a preset threshold and whose y-coordinate falls within one of the three predefined y-coordinate regions.

[0057] The detected valid circular markers are sorted and labeled in ascending order of their vertical coordinates, and their coordinates are recorded.

[0058] Calculate the horizontal and vertical distances between the center marks of the circles in each region to derive the width and length of the battery and the hole spacing.

[0059] The beneficial effects of this invention are:

[0060] 1. This invention uses a line laser industrial camera to scan and photograph the battery, and processes the point cloud data based on a point cloud processing algorithm to calculate the flatness of the battery surface. It uses the OpenCV algorithm to detect the circular holes in the battery and calculate the hole spacing and battery length. The entire process is automated, realizing real-time detection, avoiding the subjective error of manual detection, and improving detection efficiency and accuracy.

[0061] 2. By adopting Qt dual-thread technology, point cloud processing and 2D image processing are performed separately. This multi-threaded design significantly improves the system's display efficiency and ensures that a smooth user interface and real-time display effect can still be maintained when processing large amounts of data.

[0062] 3. This invention uses a line laser industrial camera to acquire high-precision laser image data of the battery surface. The camera's high resolution and laser scanning technology ensure the clarity of the image data and the ability to capture details. Especially in complex lighting or reflective environments, it can still maintain high measurement accuracy, accurately acquire the geometric features of the battery, eliminate human error, ensure accurate detection of key dimensions, and improve the stability of feature positioning of the battery during dynamic shooting.

[0063] 4. This invention solves the problem of combining manual debugging with automated operation, ensuring efficient and accurate identification in automated testing scenarios and improving the system's flexibility and adaptability. The invention uses a point cloud to dynamically fit a plane in real time, and statistical indicators support dynamically adjusted thresholds, improving the measurement capability for batteries of different shapes and sizes. This significantly enhances the system's adaptability in various production scenarios, enabling measurements at different point cloud resolutions, ensuring that battery features at different locations are correctly identified. This greatly improves the system's real-time performance and response speed, and allows for fast and accurate completion of measurement tasks even on resource-constrained production lines. It solves the problems of low accuracy and efficiency in existing manual measurements, the need to adjust algorithms when changing batteries, the limitation to checking deviations at fixed locations, and the high computational resource requirements of existing automated measurement systems, which struggle to meet real-time and efficiency requirements. Attached Figure Description

[0064] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0065] Figure 1 This is a schematic diagram of an automated measurement system architecture for the flatness and dimensions of an automotive battery according to an embodiment of the present invention;

[0066] Figure 2 This is a schematic diagram illustrating the battery loading and unloading process implemented by the automated control module in an embodiment of the present invention.

[0067] Figure 3 This is a schematic diagram of the front-end display module interface of the present invention. Detailed Implementation

[0068] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.

[0069] The terms “comprising” and “having”, and any variations thereof, in the specification and claims of this application are intended to cover non-exclusive inclusion, for example, a process, method, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or apparatus.

[0070] This invention provides a schematic diagram of an automated measurement system for the flatness and dimensions of automotive batteries, as shown in the embodiment of the invention. Figure 1 As shown, the system includes:

[0071] Data acquisition module: used to scan and photograph the battery using a line laser industrial camera to obtain a laser image of the battery;

[0072] Point cloud processing module: Connected to the data acquisition module, it is used to convert the acquired laser image into point cloud data, process the point cloud data based on the point cloud processing algorithm, calculate the flatness of the battery surface, and convert the point cloud data into a two-dimensional image through the internal algorithm function of the line laser industrial camera. Then, the OpenCV algorithm is used to detect the battery circular holes on the two-dimensional image and calculate the hole distance and battery length.

[0073] PLC communication module: Connected to the point cloud processing module, it is used to determine whether the battery is qualified based on the flatness, hole spacing and length calculated by the point cloud processing module, and send the judgment result to the PLC;

[0074] Automation control module: Used to read data from the PLC and, based on the judgment results, execute automated operations of the robotic arm and line laser industrial camera under the control of the PLC, such as... Figure 2 The automation control module controls the robotic gripper (i.e., the robotic arm) to pick up batteries from the conveyor belt and place them on the upper layer of the battery scanning rack; after the battery inspection is completed, the robotic gripper is controlled to further process the batteries according to their qualification.

[0075] Front-end display module: Connects to the data acquisition module, point cloud processing module, and PLC communication module, such as... Figure 3 As shown, it is used to display the data acquisition status, point cloud image, calculation results and judgment results, and realizes user interaction through the Qt interface.

[0076] In the specific implementation of the data acquisition module, the line laser industrial camera is first installed on the stepper motor on the battery scanning rack (the battery scanning rack is divided into upper and lower layers, with the battery to be tested placed on the upper layer and the stepper motor and line laser industrial camera integrated on the lower layer). The acquisition frequency, installation height and constant speed of the line laser industrial camera are set according to the approximate length and width of the battery. The stepper motor drives the line laser industrial camera to move under the battery and completely photograph the battery to acquire laser image data.

[0077] When automatic data acquisition is started, the automation control module sends instructions to the data acquisition module and the stepper motor of the battery scanning frame. The line laser industrial camera begins to acquire laser images, and at the same time, the stepper motor moves the camera at a constant speed to obtain complete laser image data.

[0078] A line laser industrial camera can acquire high-precision laser image data of the battery surface. The camera's high resolution and laser scanning technology ensure the clarity and detail capture of the image data, maintaining high measurement accuracy even in complex lighting or reflective environments, eliminating human error. Similarly, the data acquisition module reduces the computational burden of subsequent processing by optimizing the data acquisition process and automating control, ensuring efficient system operation even in resource-constrained environments. The acquired laser image data is transmitted to the point cloud processing module via a wired network. The point cloud processing module converts the acquired laser image into point cloud data and processes it based on point cloud processing algorithms to calculate dimensions such as the flatness of the battery surface, the spacing between battery holes, and the battery length. The PLC communication module then uses this data to determine and send data to the automation control module, which controls the robotic arm to automatically load and unload HEV car batteries and the line laser industrial camera based on the determination results. During the process, the data acquisition module, point cloud processing module, and PLC communication module display the acquisition status, point cloud image, measurement data, and determination results to the front-end display module. The front-end display module uses a Qt interface to visualize the data and facilitate user interaction.

[0079] This invention employs Qt dual-threading technology to separate point cloud processing and 2D image processing. This multi-threaded design significantly improves the system's display efficiency, ensuring a smooth user interface and real-time display even when processing large amounts of data. A user-friendly interactive design is implemented through the Qt interface, intuitively displaying the acquisition status, point cloud image, measurement data, and judgment results. Users can view the measurement results of key dimensions such as battery flatness, hole spacing, and length in real time through the interface, facilitating rapid decision-making and greatly improving the system's debuggability and maintainability. Furthermore, users can select automatic or manual modes according to actual needs, flexibly adapting to different production environments and measurement requirements.

[0080] In a dual-threaded architecture:

[0081] Main thread: Responsible for processing point cloud data, including point cloud acquisition, plane fitting, and flatness calculation. The main thread processes the point cloud data using the PCL point cloud library and calculates the flatness of the battery surface in real time. After processing, the main thread sends the flatness result to the front-end interface for display via Qt's signal-slot mechanism.

[0082] Sub-thread: Responsible for processing 2D images. Point cloud data is converted into 2D images by a separate program and then passed to the sub-thread for processing. The sub-thread uses OpenCV algorithms to perform operations such as hole detection, hole spacing calculation, and measurement of dimensions such as battery length on the 2D image. After processing, the sub-thread sends the measurement results to the front-end interface for display via a signal-slot mechanism.

[0083] Qt's dual-threaded design separates point cloud data processing from 2D image processing, each executed by an independent thread. This allows point cloud data processing and UI rendering to run in parallel, avoiding UI lag issues caused by mutual blocking between data processing and UI rendering in single-threaded mode. This significantly improves system real-time performance and response speed, enhancing system efficiency and user experience. The dual-threaded design fully utilizes the computing power of multi-core CPUs, improving overall system efficiency, especially when processing large-scale point cloud data. The main thread focuses on UI rendering and user interaction, ensuring users can view measurement results and perform operations in real time, improving the user experience. The dual-threaded architecture separates data processing from UI display, facilitating subsequent feature expansion and maintenance. Qt's dual-threaded design also supports joint debugging with PLC communication modules. Users can manually control the data acquisition and measurement process through the front-end interface, observe the system status in real time, and quickly locate and resolve potential problems through the dual-thread mechanism, further enhancing system operability and debugging efficiency.

[0084] In this invention, the PLC communication is specifically implemented as follows: the program uses the snap7 library to communicate with the PLC, thereby modifying the db block data in the PLC for specific operations; and it uses Siemens S7-PLCSIM Advanced V6.0 technology to connect with the PLC communication module.

[0085] The point cloud processing module of this invention, based on the acquired laser image and algorithm, accurately and effectively calculates flatness and detects battery holes, calculating hole spacing and battery length, among other dimensions. The processing mainly includes several aspects: converting the laser image into a point cloud, plane fitting of the point cloud data, calculating flatness, two-dimensionalizing the point cloud, detecting battery holes, and calculating hole spacing and battery length. Specifically:

[0086] S1, laser image converted into point cloud:

[0087] When processing the acquired battery laser image, it needs to be converted into a point cloud. The point cloudification process includes:

[0088] S11, extract the resolution from the image calibration information of the laser image ( , , ) and offset ( , , ),in, This represents the actual distance represented by each pixel in the x-axis direction. This indicates the actual distance represented by each pixel in the y-axis direction. This represents the actual distance that each unit of depth value represents (conversion factor). Represents the zero-point offset in the x-axis direction. Indicates the zero-point offset in the y-axis direction. This represents the zero-point offset along the z-axis.

[0089] In this embodiment of the invention, a line laser camera is used to acquire depth information. The depth value (Z value) of each point is directly obtained by measuring the laser reflection time or phase difference, rather than being generated through a pixel grid. The resulting point cloud data is unstructured, and the Z values ​​may come from a non-uniformly sampled depth sensor, differing from the regular pixel grid (X / Y values) of an image. Therefore, in this step… The concept of "pixel" is not involved. That is to say, in the depth map, the Z value is indeed stored in the form of pixels, but its physical meaning is still the depth value output by the sensor, not the pixel pitch. The concept of "pixel" is used after it is converted into a two-dimensional image.

[0090] S12, based on the predefined upper and lower limits of filtering ( )and Calculate the effective range of the rows to be processed in the laser image ( ), From the camera image calibration data, obtain the regions of interest used to define them, where, Used to define the valid row range ( ), Used to define the shielding area ( );

[0091] It should be noted that the reason for defining only the effective row range in this step is that the line laser camera used in this embodiment of the invention typically scans the surface of an object by emitting a laser line (within a single column or narrow band). The generated point cloud data naturally has continuity in the column direction (X-axis), while the depth information changes more significantly in the row direction (Y-axis) (such as the position of a circular hole). Therefore, the x-area (column area) covered by the laser line is usually fully effective (unless there is occlusion) and no additional restrictions are required.

[0092] in, The calculation formula is as follows:

[0093] subscript ;

[0094] S13, the depth data is downsampled according to the defined effective row range and the masking area, reducing the point cloud density through interval sampling. Specifically, according to... Starting from the starting point, take one point every two rows and one point every two columns. For example, in a 6x6 matrix, take points at positions (1,1), (4,1), (1,4), and (4,4). During the sampling process, skip the defined... Shielded areas further reduce the processing of invalid data;

[0095] S14. Based on the actual situation of the battery height range, define a preset fixed range, retain only the points with depth values ​​(z direction) within this preset fixed range, remove interference points in the background or irrelevant areas, and perform z-direction filtering.

[0096] S15, based on the downsampled and filtered data, calculate the three-dimensional spatial coordinates of each valid point using the extracted resolution and offset:

[0097] ;

[0098] ;

[0099] ;

[0100] in , , These represent the point cloud coordinates of the effective points after downsampling and filtering, respectively; The column index (X-axis direction) represents the point cloud data, corresponding to the x-coordinate calculation in the formula; This represents the row index (Y-axis direction) of the point cloud data, corresponding to the y-coordinate calculation in the formula; This represents the processed 16-bit depth data.

[0101] Through the above steps, the input laser image is converted into a 3D point cloud dataset that has been downsampled and depth filtered.

[0102] S2, Plane fitting of point cloud data:

[0103] Plane fitting methods include the RANSAC (RANSAC Simple Consensus) algorithm or the least squares method. In this embodiment of the invention, plane fitting includes the following steps:

[0104] S21, calculate the centroid (i.e. the geometric center of the point cloud data) of the point cloud data obtained after processing S1.

[0105] S22, by subtracting the coordinates of each point from the coordinates of the centroid, the point cloud is translated to a coordinate system with the centroid as the origin, thus obtaining a centered point cloud;

[0106] S23, then calculate the covariance matrix, extract the eigenvalues ​​from the matrix, and the eigenvector corresponding to the smallest eigenvalue is the normal vector of the fitted plane;

[0107] The formula for the above plane fitting process is expressed as follows:

[0108] ;

[0109] ;

[0110] ;

[0111] ;

[0112] Where, , where is the coordinate of the centroid; It refers to the number of points in the point cloud data; The index of the point; , indicating the The coordinates of the points; Indicates the first A centralized point cloud; The covariance matrix of the centered point cloud; It is the eigenvector matrix. It is a diagonal matrix, and the elements on the diagonal are eigenvalues;

[0113] Eigenvector corresponding to the smallest eigenvalue Let be the normal vector of the fitted plane. The equation of the fitted plane is expressed as:

[0114] ;

[0115] Where, These represent the x, y, and z coordinates of any point in the planar space, respectively.

[0116] S3, calculate flatness:

[0117] Based on the fitted plane, the distance from all points to the plane is calculated, and the smoothness of the battery surface is evaluated using statistics (such as maximum value, standard deviation, peak and valley values). In this embodiment of the invention, the difference between the maximum and minimum distances is used to evaluate the smoothness of the battery surface. Specifically, S3 includes:

[0118] S31, Calculate the distance from each point in the point cloud data to the fitting plane. The distances obtained are then sorted in descending order of magnitude.

[0119] S32, the flatness index is obtained by subtracting the 0.001% quantile (the extreme value of the maximum distance, reflecting surface protrusion) and the 99.999% quantile (the extreme value of the minimum distance, reflecting surface depression) after sorting. This flatness index characterizes the flatness of the battery surface; the smaller the value, the smoother the surface; the larger the value, the more significant the surface unevenness. The calculation formula is as follows:

[0120] ;

[0121] Where, Let represent the constant term of the plane equation, which is equal to the negative of the dot product of the normal vector and a point on the plane, i.e.:

[0122] .

[0123] S4, Point Cloud 2D Conversion:

[0124] Projecting the 3D point cloud onto a 2D coordinate system associated with the fitted plane simplifies subsequent circular hole detection and size measurement.

[0125] In this embodiment of the invention, the point cloud data obtained is processed using the API of a line laser industrial camera. First, it is preprocessed by statistical filtering to remove discrete points.

[0126] The filtering process includes:

[0127] Calculation points To its neighboring points (referring to points within its neighborhood) The average distance to all other points within a certain range centered on the center:

[0128] ;

[0129] in, Point Average distance to neighboring points; Indicates the number of neighboring points; Indicates the index of the nearest point; It is the current point; yes The A nearby point;

[0130] Among them, the neighborhood point refers to the target point in three-dimensional space. All other points within a certain range of the center are calculated using the K-nearest neighbor method in this invention, i.e., selecting points with a certain distance from the center. Recent Each point is considered a neighboring point.

[0131] Then calculate all points of mean and standard deviation Set threshold Remove all that meet the criteria. Points (discrete points), threshold The calculation is as follows:

[0132] ;

[0133] in, The multiplier is defined according to the circumstances.

[0134] After discrete point filtering, the camera intrinsic parameter matrix is ​​used. and extrinsic parameter matrix Projecting the point cloud onto the image plane:

[0135] ;

[0136] in, These are the coordinates of the three-dimensional point cloud after filtering. These are the projected two-dimensional coordinates;

[0137] For each pixel, find the nearest projection point and assign the pixel grayscale value of the nearest projection point to that pixel, thus obtaining a preliminary two-dimensional image;

[0138] The initially obtained two-dimensional image is then normalized and Gaussian filtered to obtain the final two-dimensional image. The Gaussian filtering formula can be expressed as:

[0139] ;

[0140] ;

[0141] in, This represents the filtered image; Represents the original two-dimensional image; Indicates a Gaussian filter; Indicates the standard deviation (which determines the filter strength); This represents the horizontal (column) offset relative to the center pixel (negative for left, positive for right). This represents the vertical (row) offset relative to the center pixel (negative for top, positive for bottom).

[0142] S5, Detect the battery holes and calculate the hole spacing and battery length:

[0143] This algorithm uses OpenCV to process 2D images, detects circular holes in batteries, and calculates the hole spacing and battery length. The code checks if the input image is empty and if the dimensions meet requirements, and converts the grayscale image to color for visualization. Specific regions in the image are defined and occluded, and the image is preprocessed using mean filtering, binarization, and opening operations. Circular markers in the image are identified using the Hough circle detection method, and valid circular markers are filtered based on the average pixel grayscale value and the ordinate. The formula for calculating the average pixel value is:

[0144] ;

[0145] In the formula, Represents the average grayscale value of a pixel. It is the sum of the pixel values ​​in the circular area. It is the area of ​​the circular region (i.e., the number of pixels).

[0146] A circular marker is considered valid if its average pixel grayscale value within the marked area is below a preset threshold (to exclude the influence of highlights) and it is located within one of the three predefined y-coordinate regions. These three regions include the top, middle, and bottom areas; only circles matching the region's location are retained. Valid circular markers are sorted and labeled in ascending order of their y-coordinates, and their coordinates are recorded. The horizontal and vertical distances between the center markers of each region are calculated, and the battery's width, length, and aperture spacing are calculated based on these distances. The processed image is then scaled to a specified size and the result is output. Finally, the output result is compared to a standard size to determine if the battery size is acceptable. If it falls within the preset standard range, it is considered acceptable; otherwise, it is considered unacceptable.

[0147] In actual production, ambient lighting may affect the quality of camera scanning. Therefore, for undetected circular marks, performing Hough circle detection again in a predefined local area and correcting their coordinates can solve potential problems. Specifically, for images with multiple detected circular marks, performing Hough circle detection again in a predefined local area and obtaining the average center coordinates is done using the following code:

[0148] circles_part[0][0]=circles_part[0][0]+circle_local[i].x−100;

[0149] circles_part[0][1]=circles_part[0][1]+circle_local[i].y−100;

[0150] circles_part[0][0] / = circle_local.size();

[0151] circles_part[0][1] / = circle_local.size();

[0152] Where circles_part[0][0] and circles_part[0][1] represent the created circular containers, with an initial value of 0; circle_local[i].x and circle_local[i].y represent the x and y coordinates of the centers of multiple circles extracted; the latter two formulas represent the calculation of the average center coordinates.

[0153] This invention provides a highly efficient and accurate automated measurement system for the flatness and dimensions of automotive batteries by combining advanced point cloud imaging technology and automated measurement algorithms. The system employs a multi-module architecture, including data acquisition, point cloud processing, automated control, PLC communication, and front-end display modules. Each module plays a crucial role in the battery measurement process. In particular, the use of a PCL point cloud library, least squares method, OpenCV algorithm, and Qt dual-thread technology ensures efficient and accurate battery measurements in various production environments. By combining parallel computing and real-time data processing, the system meets the high precision and efficiency requirements of large-scale production. The final measurement results are not only visualized on the front-end interface but can also automatically trigger subsequent automated operations via the PLC communication module, further enhancing the system's applicability and flexibility. Through these technological innovations, this battery measurement system significantly improves production efficiency and measurement accuracy, reduces labor costs and error rates, and has broad application prospects, especially in the large-scale production of HEV automotive batteries.

[0154] 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 principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. An automated measurement system for the flatness and dimensions of an automotive battery, characterized in that, include: The data acquisition module is used to scan and photograph the battery using a line laser industrial camera to obtain a laser image of the battery. The point cloud processing module, connected to the data acquisition module, is used to convert the acquired laser image into point cloud data. Based on the point cloud processing algorithm, the point cloud data is processed to calculate the flatness of the battery surface. The point cloud data is converted into a two-dimensional image through the internal algorithm of the line laser industrial camera. Then, the OpenCV algorithm is used to detect the battery holes on the two-dimensional image and calculate the hole distance and battery length. The PLC communication module is connected to the point cloud processing module. It is used to determine whether the battery is qualified based on the flatness, hole spacing and length calculated by the point cloud processing module, and send the judgment result to the PLC. The automation control module is used to read data from the PLC and, based on the judgment results, executes automated operations of the robotic arm and the line laser industrial camera under the control of the PLC. The front-end display module is connected to the data acquisition module, point cloud processing module and PLC communication module. It is used to display the data acquisition status, point cloud image, calculation results and judgment results, and realize user interaction through Qt interface. The effective row range and shielding area of ​​the laser pattern are determined based on predefined upper and lower filter limits. The method of using the OpenCV algorithm to detect battery holes in a two-dimensional image and calculate the hole distance and battery length includes: Check if the converted 2D image is empty and if its size meets the requirements, and convert the grayscale image to a color image for visualization; Define and occlude specific regions in an image, and preprocess the image using mean filtering, binarization, and opening operations; Circular markers in an image are identified using the Hough circle detection method, and the average grayscale value of pixels within the circular marker is calculated. The formula for calculating the average grayscale value is as follows: ; In the formula, Represents the average grayscale value of a pixel. It is the sum of the pixel values ​​in the circular area. It is the area of ​​the circular region; Valid circular markers are selected based on the average pixel grayscale value and the y-coordinate. Valid circular markers are those whose average pixel grayscale value within their area is below a preset threshold and whose y-coordinate falls within one of the three predefined y-coordinate regions. The detected valid circular markers are sorted and labeled in ascending order of their vertical coordinates, and their coordinates are recorded. Calculate the horizontal and vertical distances between the center marks of the circles in each region to derive the width and length of the battery and the hole spacing.

2. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 1, characterized in that, The automated control module is also used to control a robotic arm to pick up batteries from the conveyor belt and place them on the upper layer of the battery scanning rack. The battery scanning rack has a two-layer structure. The upper layer holds the batteries to be tested, and the lower layer integrates a stepper motor and a line laser industrial camera. The line laser industrial camera is mounted on the stepper motor, and the acquisition frequency, installation height, and constant moving speed of the stepper motor are set according to the length and width of the battery. The stepper motor drives the line laser industrial camera to move along the surface of the battery and completely photograph the battery to obtain a laser image.

3. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 1, characterized in that, The point cloud processing module utilizes a Qt dual-thread architecture to separate point cloud data processing from 2D image processing, with each being executed by an independent thread to improve real-time performance and response speed. This dual-thread architecture includes a main thread and a sub-thread. in, Main thread: Responsible for processing point cloud data, including point cloud acquisition, plane fitting, and flatness calculation. It processes point cloud data through the PCL point cloud library and calculates the flatness of the battery surface in real time. After processing, the main thread sends the flatness result to the front-end interface for display through Qt's signal slot mechanism. Sub-thread: Responsible for processing 2D images. Point cloud data is converted into 2D images by a separate program and then passed to the sub-thread for processing. The sub-thread uses OpenCV algorithms to perform circular hole detection, hole distance calculation, and battery length measurement on the 2D image. After processing, the sub-thread sends the measurement results to the front-end interface for display through a signal slot mechanism.

4. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 1, characterized in that, The process of converting the obtained laser image into point cloud data includes: The resolution and offset are extracted from the image calibration information of the laser image, where the resolution includes... , , The offset includes , , ,in, This represents the actual distance represented by each pixel along the x-axis. This represents the actual distance represented by each pixel along the y-axis. This represents the actual distance that each unit of the depth value represents. This represents the zero-point offset in the x-axis direction. This represents the zero-point offset in the y-axis direction. This represents the zero-point offset along the z-axis. Within the effective row range, a point is taken every two rows and a point is taken every two columns, and the shielded area is skipped. The obtained laser data is downsampled to reduce the point cloud density. Points with depth values ​​within a preset fixed range are retained and filtered in the z-direction; Based on the downsampled and filtered data, the point cloud coordinates of each valid point are calculated using the extracted resolution and offset. The calculation formula is as follows: ; ; ; in , , Represents the point cloud coordinates of the valid points after downsampling and filtering; This represents the column index of the point cloud data, corresponding to the x-coordinate calculation in the formula; This represents the row index of the point cloud data, corresponding to the y-coordinate calculation in the formula; This represents the processed 16-bit depth data.

5. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 1, characterized in that, The calculation of the flatness of the battery surface includes: The acquired point cloud data is fitted to a plane to derive the plane equation; Calculate the distance from each point in the point cloud data to the fitted plane. Then sort the obtained distances in descending order; The flatness index is obtained by taking the difference between the 0.001% quantile and the 99.999% quantile after sorting. The flatness index is used to characterize the flatness of the battery surface.

6. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 5, characterized in that, The process of performing plane fitting on the acquired point cloud data to derive the plane equation includes: Calculate the geometric center, or centroid, of the point cloud data: ; In the formula, , where is the coordinate of the centroid; It refers to the number of points in the point cloud data; The index of the point; , indicating the first The coordinates of the points; By subtracting the coordinates of each point from the coordinates of the centroid, the point cloud is translated to a coordinate system with the centroid as the origin, resulting in a decentralized point cloud: ; In the formula, Indicates the first A decentralized point cloud; The covariance matrix is ​​obtained from the decentralized point cloud computing: ; In the formula, For decentralized point cloud covariance matrix; Extracting eigenvalues ​​from the covariance matrix: ; In the formula, It is the eigenvector matrix. It is a diagonal matrix, and the elements on the diagonal are eigenvalues; Eigenvector corresponding to the smallest eigenvalue Let be the normal vector of the fitted plane, and the equation of the fitted plane is expressed as: ; In the formula, These represent the x, y, and z coordinates of any point in the planar space, respectively.

7. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 6, characterized in that, The distance from each point in the calculated point cloud data to the fitting plane is... include: Target Its distance to the fitting plane for: ; In the formula, Represents the constant term in the plane equation. .

8. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 1, characterized in that, The process of converting point cloud data into a two-dimensional image using the internal algorithm function of the line laser industrial camera includes: Point cloud data is processed using the API of a line laser industrial camera, and preprocessed by statistical filtering to remove discrete points. Using camera intrinsic matrix and extrinsic parameter matrix Project the processed point cloud onto the image plane: ; in, These are the processed 3D point cloud coordinates; These are the projected two-dimensional coordinates; For each pixel, find the nearest projection point and assign the pixel grayscale value of the nearest projection point to that pixel, thus obtaining a preliminary two-dimensional image; The initially obtained two-dimensional image is then normalized and Gaussian filtered to obtain the final two-dimensional image. The Gaussian filtering formula can be expressed as: ; ; in, This represents the filtered image; Represents the original two-dimensional image; Indicates a Gaussian filter; The standard deviation is used to determine the filtering strength. This indicates the horizontal offset relative to the center pixel. This represents the offset in the vertical direction relative to the center pixel.

9. The automated measurement system for the flatness and dimensions of automotive batteries according to claim 8, characterized in that, Preprocessing using statistical filtering removes discrete points, including: Target Calculate the average distance from it to its neighboring points: ; in, Point Average distance to neighboring points; Indicates the number of neighboring points; Indicates the index of the nearest point; It is the current point; Yes The A nearby point; Calculate all points The mean and standard deviation Set threshold : ; in, A multiplier defined according to the circumstances; Remove from point.

Citation Information

Patent Citations

  • Laser radar point cloud and image real-time fusion method for target detection

    CN118096549A