Battery pack mounting hole positioning method and electronic equipment
By using multi-angle shooting and identification code matching, a transformation relationship between the local and world coordinate systems is established, solving the problem of insufficient coverage of the single-camera vision system. This enables precise positioning of the battery pack mounting holes and accurate output of the tightening sequence, improving the installation efficiency and assembly quality of the battery pack.
Patent Information
- Application Number
- CN202511025653.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-10-28
AI Technical Summary
In the existing technology, single-camera vision systems are difficult to cover large-size battery packs, resulting in incomplete bolt hole positioning or cumulative positioning errors, which affect the airtightness and assembly quality of the battery pack.
Multiple imaging devices are used to photograph the battery pack from different angles. By matching the identification code with the template code, the transformation relationship between the local coordinate system and the world coordinate system is determined. The position of the mounting hole in the world coordinate system is output, and multiple transformation parameters are fused to improve positioning accuracy.
It enables precise positioning of battery pack mounting holes and accurate output of tightening sequence, improving battery pack installation efficiency and assembly quality.
Smart Images

Figure CN120846196A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of batteries, and more particularly to a method for positioning battery pack mounting holes and an electronic device. Background Technology
[0002] In vehicle manufacturing, the bolt tightening process of the power battery pack (including tightening sequence and torque compliance) directly affects the battery pack's airtightness, safety, and overall assembly quality. Common bolt tightening solutions typically use a single-camera vision system to locate bolt holes. However, single-camera vision systems struggle to cover large battery packs, leading to incomplete bolt hole positioning or accumulated positioning errors. Furthermore, single-point measurement lacks a global error correction mechanism, causing coordinate deviations to accumulate along the tightening path, ultimately resulting in disordered sequence or missed bolt holes, impacting the battery pack's airtightness and assembly quality. Summary of the Invention
[0003] This application discloses a method and electronic device for positioning mounting holes in a battery pack, which solves the technical problem that the positioning accuracy of mounting holes in related battery packs is low, resulting in low assembly accuracy of the battery pack.
[0004] This application provides a method for locating mounting holes in a battery pack. The method includes: capturing images of the battery pack from different angles using multiple imaging devices to obtain multiple images, each image including an identification code; obtaining matching point pairs based on the correspondence between the identification code of each image and multiple preset template codes; wherein the matching point pair includes the coordinates of the marker area corresponding to each identification code in the pixel coordinate system and the coordinates of the template area corresponding to the multiple template codes in the local coordinate system corresponding to the battery pack; determining multiple first transformation parameters based on the matching point pairs, each first transformation parameter representing the transformation relationship between the local coordinate system and the camera coordinate system corresponding to each imaging device; fusing the multiple first transformation parameters to obtain a second transformation parameter, the second transformation parameter representing the transformation relationship between the local coordinate system and the world coordinate system; and outputting the position of the mounting hole in the world coordinate system using the second transformation parameter based on a preset assembly sequence and the position of the mounting hole in the local coordinate system.
[0005] In some embodiments of this application, the method further includes: identifying an identifier code corresponding to each image, including: detecting edge features corresponding to a battery pack in each image; determining a target contour based on the edge features; determining the marker region based on the target contour; performing binarization processing on the local image corresponding to the marker region to obtain multiple binarized images; and identifying the multiple binarized images to obtain an identifier code corresponding to each image.
[0006] In some embodiments of this application, obtaining matching point pairs based on the correspondence between the identifier code of each image and a plurality of preset template codes includes: if there is a template code among the plurality of template codes that matches any identifier code, then obtaining the first coordinate of the marker region corresponding to any identifier code in the pixel coordinate system, and obtaining the second coordinate of the template region corresponding to the matching template code in the local coordinate system; and obtaining the matching point pair based on the first coordinate and the second coordinate.
[0007] In some embodiments of this application, determining multiple first transformation parameters based on the matching point pairs includes: performing a linear transformation on the matching point pairs using a preset algorithm to obtain multiple first candidate parameters; constructing a cost function based on the multiple first candidate parameters; and optimizing the multiple first candidate parameters using the cost function to obtain the multiple first transformation parameters.
[0008] In some embodiments of this application, the step of fusing the plurality of first transformation parameters to obtain second transformation parameters includes: determining a reference transformation parameter for each camera coordinate system relative to the world coordinate system based on the extrinsic parameters of each imaging device; performing parameter transformation on each first transformation parameter using the reference transformation parameter to obtain a plurality of second candidate parameters; determining a candidate rotation matrix and a candidate translation vector corresponding to each second candidate parameter; calculating a first difference between any two candidate rotation matrices and a second difference between any two candidate translation vectors; filtering out abnormal data in the plurality of second candidate parameters based on the first difference and the second difference to obtain a plurality of third candidate parameters; and fusing the plurality of third candidate parameters to obtain the second transformation parameter.
[0009] In some embodiments of this application, the step of filtering out abnormal data in the first transformation parameter based on the first difference and the second difference includes: if the first difference between the i-th candidate rotation matrix and the j-th candidate rotation matrix, and the first difference between the i-th candidate rotation matrix and the k-th candidate rotation matrix are both greater than a preset angle difference, and the first difference between the j-th candidate rotation matrix and the k-th candidate rotation matrix is less than or equal to the angle difference, then the i-th candidate rotation matrix is filtered out; where i, j, and k are all positive integers; if the second difference between the i-th candidate translation vector and the j-th candidate translation vector, and the second difference between the i-th candidate translation vector and the k-th candidate translation vector are both greater than a preset position difference, and the second difference between the j-th candidate translation vector and the k-th candidate translation vector is less than or equal to the preset position difference, then the i-th candidate translation vector is filtered out.
[0010] In some embodiments of this application, fusing the plurality of third candidate parameters to obtain the second transformation parameter includes: determining the rotation matrix to be fused and the translation vector to be fused in each third candidate parameter; fusing all translation vectors to be fused based on the observation weights corresponding to each imaging device to obtain the target translation vector in the second transformation parameter; performing a quaternion transformation on each rotation matrix to be fused to obtain a transformed rotation matrix; fusing the transformed rotation matrix based on the observation weights and performing a matrix transformation to obtain the target rotation matrix in the second transformation parameter.
[0011] In some embodiments of this application, the method further includes: dynamically adjusting the observation weights, including: determining the observation confidence level of each imaging device within a preset time period; increasing the observation weight corresponding to any imaging device if the observation confidence level of any imaging device meets a preset condition; and decreasing the observation weight corresponding to any imaging device if the observation confidence level of any imaging device does not meet the preset condition.
[0012] In some embodiments of this application, the method further includes: if the number of the plurality of third candidate parameters is less than or equal to a preset number threshold, performing parameter compensation using a preset Kalman filter algorithm to obtain compensated third candidate parameters; correspondingly, fusing the plurality of third candidate parameters to obtain the second conversion parameter includes: fusing the compensated third candidate parameters to obtain the second conversion parameter.
[0013] This application also provides an electronic device, which includes a processor and a memory, wherein the processor is used to implement the battery pack mounting hole positioning method when executing a computer program stored in the memory.
[0014] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for positioning the battery pack mounting holes.
[0015] In the battery pack mounting hole positioning method provided in this application, multiple imaging devices are used to capture images of the battery pack from different angles, enabling comprehensive image acquisition from various perspectives and avoiding the viewpoint limitations of a single-camera vision system. Based on the correspondence between the identifier code of each image and a preset template code, matching point pairs are obtained. These matching point pairs are then used to determine the transformation relationship between the camera coordinate system and the local coordinate system corresponding to each imaging device, denoted as multiple first transformation parameters. By fusing these multiple first transformation parameters, the transformation relationship between the local coordinate system and the world coordinate system is obtained, denoted as second transformation parameters. With the second transformation parameters determined, the position of the battery pack mounting hole in the world coordinate system can be output based on a preset assembly sequence, thereby achieving the positioning of the battery pack mounting hole. Through the above embodiments, not only can the position of the mounting hole be accurately located, but the position of the mounting hole can also be output according to the assembly sequence, thereby determining the tightening sequence of the mounting hole. This improves the installation efficiency and accuracy of the battery pack mounting holes to a certain extent, ensuring the airtightness and assembly quality of the battery pack. Attached Figure Description
[0016] Figure 1 This is a schematic diagram illustrating an application scenario of the battery pack mounting hole positioning method provided in the embodiments of this application.
[0017] Figure 2 This is a flowchart of the battery pack mounting hole positioning method provided in the embodiments of this application.
[0018] Figure 3 This is a schematic diagram illustrating the determination of matching point pairs provided in an embodiment of this application.
[0019] Figure 4 This is a schematic diagram illustrating the determination of the second conversion parameter provided in an embodiment of this application.
[0020] Figure 5 This is a schematic diagram illustrating the determination of the second conversion parameter provided in another embodiment of this application.
[0021] Figure 6 This is a flowchart illustrating the determination of the second conversion parameter provided in an embodiment of this application.
[0022] Figure 7 This is a schematic diagram illustrating the determination of the second conversion parameter provided in another embodiment of this application.
[0023] Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0024] For ease of understanding, some concepts related to the embodiments of this application are illustrated and explained by way of example for reference.
[0025] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.
[0026] In the vehicle production process, the power battery pack must first complete assembly and functional configuration before being installed in the designated compartment of the vehicle body in strict accordance with process specifications. During the assembly of the power battery pack, the bolt tightening process (including tightening sequence and torque compliance) directly affects the airtightness, safety, and overall assembly quality of the battery pack. Common bolt tightening solutions typically use a single-camera vision system to locate bolt holes. However, the field of view of a single-camera vision system is limited and cannot cover large-sized battery packs, leading to incomplete bolt hole positioning or cumulative positioning errors. Single-point measurement methods lack a global error correction mechanism, causing coordinate deviations to accumulate continuously along the tightening path, eventually resulting in disordered sequence or missed bolt holes, affecting the airtightness and assembly quality of the battery pack. Furthermore, related positioning methods based on template matching or feature point detection have poor adaptability to changes in battery pack model and viewing angle.
[0027] To address the technical problem of low assembly accuracy in battery packs, this application proposes a method and electronic device for locating battery pack mounting holes. Based on the identification code on the battery pack, a transformation relationship is established between the local coordinate system and the world coordinate system of the battery pack. Then, based on a preset assembly sequence and the position of the mounting holes in the local coordinate system, the position of the mounting holes in the world coordinate system is output, improving the positioning accuracy of the mounting holes and thus increasing the assembly efficiency of the battery pack. The application scenarios of the battery pack mounting hole positioning method of this application are described below.
[0028] Figure 1 This is a schematic diagram illustrating an application scenario of the battery pack mounting hole positioning method provided in this application embodiment. The battery pack mounting hole positioning method is applied in electronic device 10, such as... Figure 1 As shown, the electronic device 10 is communicatively connected to multiple imaging devices 20, and is used to receive data from the battery pack (e.g., ...) collected by each imaging device 20. Figure 1 The image shown in A) is analyzed.
[0029] The communication connection methods can include wired and wireless communication connections. Wired communication connections can include one or more of the following: Universal Serial Bus (USB), Controller Area Network (CAN), etc. Wireless communication connections can include one or more of the following: Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication networks, Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), etc.
[0030] Electronic device 10 can be a mobile phone, tablet computer, smart wearable device, augmented reality (AR) / virtual reality (VR) device, laptop computer, netbook, in-vehicle device, etc. This application embodiment does not limit the specific type of electronic device.
[0031] Each shooting device 20 can be a shooting device (such as a camera), a webcam, or an electronic device with shooting capabilities. Multiple shooting devices 20 can be detachable shooting components built into the electronic device 10, or they can be independent shooting devices external to the electronic device 10. This application does not limit the form of the electronic device 10 and the multiple shooting devices 20.
[0032] like Figure 1 As shown, the positions of each imaging device 20 can be random or pre-set, allowing multiple imaging devices 20 to capture images of the battery pack from different perspectives. This application does not limit the number or position of the multiple imaging devices 20, but the image set captured by the multiple imaging devices 20 must cover all surfaces of the battery pack.
[0033] Figure 1 This is merely an example of an application scenario and does not constitute a limitation on the application scenario. It may include more or fewer components than illustrated, or a combination of certain components, or different devices, for example, in Figure 1 Based on the application scenario shown, a display device may also be included. This display device can be used to display images captured by multiple imaging devices, or to display the position of the mounting holes in a world coordinate system. Furthermore, a robotic arm may be included for installation. Based on the assembly sequence and the position of the mounting holes in the world coordinate system, the robotic arm sequentially performs installation operations on the mounting holes until the battery pack assembly is complete.
[0034] Figure 2 This is a flowchart of a battery pack mounting hole positioning method provided in an embodiment of this application, which is applied in electronic devices (e.g., Figure 1 In electronic device 10). Depending on different needs, the order of steps in this flowchart can be changed, and some steps can be omitted.
[0035] Step S201: Use multiple imaging devices to photograph the battery pack from different angles to obtain multiple images.
[0036] In some embodiments of this application, multiple imaging devices are deployed at different locations, allowing each device to acquire images of the battery pack from different angles. Before acquiring images of the battery pack, each imaging device can undergo intrinsic and extrinsic calibration. Intrinsic parameters characterize the inherent geometric properties of the sensor and optical system, including core parameters such as principal point coordinates (cx, cy), focal length (fx, fy), and distortion coefficients (k1, k2, p1, p2, [k3...]). Extrinsic parameters describe the pose of the device in a specific world coordinate system, including its position (translation vector T) and orientation (rotation matrix R). Furthermore, the imaging resolution, as a system parameter, also needs to be explicitly set.
[0037] Furthermore, to differentiate between different shooting locations on the battery pack, multiple marking areas can be set on the surface of the battery pack before shooting. Each marking area can contain markers, multiple marker points, etc. Identifying the marking areas allows for the acquisition of corresponding identification codes to distinguish different locations. This application does not limit the type of markers and marker points; for example, markers can be barcodes, and marker points can be specially shaped dots, etc.
[0038] After each imaging device completes its internal and external parameter calibration, the electronic device can send a shooting command to each imaging device, causing each imaging device to capture images of the battery pack. In another embodiment, each imaging device can be activated to capture images in response to a user's touch operation of a physical button. After capturing an image, each imaging device transmits the captured image to the electronic device. Therefore, the electronic device receives the image carrying an identification code sent by each imaging device.
[0039] In this application embodiment, there is no limit to the number of images captured by each imaging device. To improve the efficiency and accuracy of subsequent image analysis, each imaging device may acquire at least two images, or the electronic device may select at least two images corresponding to each imaging device from the image set acquired by each imaging device based on image quality parameters such as image resolution.
[0040] Step S202: Based on the correspondence between the identifier code of each image and multiple preset template codes, a matching point pair is obtained.
[0041] In some embodiments of this application, after receiving the image set captured by each imaging device, the electronic device can perform coarse detection and fine detection on each image. The coarse detection is used to locate the marker region of the identification code in the image, while the fine detection is used to identify the identification code within the marker region.
[0042] In the coarse detection stage, each image is processed using a Gaussian pyramid or Laplacian pyramid to generate a multi-scale image (e.g., a 5-layer pyramid with a scaling factor of 1.2) for each image. Edge detection algorithms (e.g., the Canny operator) are used to extract edge features from the multi-scale images. Based on the edge features, closed contours that are approximately rectangular are selected through connected component analysis and denoted as target contours. Further optimization is performed based on rotation invariance. The gradient direction histogram corresponding to the region within each target contour is calculated, and the principal direction (e.g., the angle corresponding to the peak of the gradient histogram) is selected to align the directions of the regions within each target contour, thereby obtaining direction-normalized image patches. Based on preset shape constraints (e.g., aspect ratio, rectangularity, area range, etc.), the direction-normalized image patches are filtered to obtain the local image of the marker region corresponding to the identification code.
[0043] In the fine detection stage, the local image corresponding to the marked region is binarized to obtain multiple binarized images. Each binarized image is identified, and the encoded content corresponding to the identifier code in the binarized image (such as Aruco code, AprilTag code, or custom code) is parsed to obtain the identifier code.
[0044] In some embodiments of this application, after determining the identifier code, the identifier code corresponding to each image can be matched with a plurality of preset template codes. The template code can be the identifier code corresponding to a template region on the 3D model corresponding to the battery pack. If a template code exists among the plurality of template codes that matches any identifier code, then the first coordinates of the identifier region corresponding to any identifier code in the pixel coordinate system are obtained, and the second coordinates of the template region corresponding to the matching template code in the local coordinate system are obtained. This local coordinate system is the 3D coordinate system corresponding to the battery pack.
[0045] In one example, if identifier A matches template code A, then the first coordinates of identifier A in the pixel coordinate system are obtained. This includes: obtaining the four corner vertices or the center point of the marker region corresponding to identifier A, and extracting the coordinates of the four corner vertices or the center point in the pixel coordinate system to obtain the first coordinates. Taking the extraction of the four corner vertices as an example, the first coordinates may include... Obtain the second coordinate of template code A in the local coordinate system, including... .
[0046] After determining the first and second coordinates, matching point pairs can be obtained based on the first and second coordinates. Continuing with the example above, the matching point pairs are: The following is combined with Figure 3 Describe the process of generating matching point pairs.
[0047] like Figure 3 The process involves extracting the identifier code corresponding to each image, such as... Figure 3 The identifiers A, ..., N are shown. Find the corresponding template codes for identifiers A, ..., N, such as... Figure 3 The template codes A, ..., N are shown. The first coordinates corresponding to each identifier code in the identifier codes A, ..., N are obtained from the pixel coordinate system, such as... Figure 3 The first coordinates A,…,N are shown. The second coordinates corresponding to each template code in the local coordinate system A,…,N are obtained, as shown below. Figure 3 The second coordinates A, ..., N are shown. Combining the first and second coordinates, as shown... Figure 3 The first coordinate A + the second coordinate A shown above are used to obtain a matching point pair.
[0048] Step S203: Determine multiple first transformation parameters based on the matching point pairs.
[0049] In some embodiments of this application, after determining the matching point pairs, all matching point pairs can be jointly solved to improve estimation accuracy. A preset algorithm is used to perform a linear transformation on the matching point pairs to obtain multiple first candidate parameters. Each first candidate parameter represents the transformation relationship between the local coordinate system and the camera coordinate system corresponding to each shooting device. The preset algorithm can be the Efficient Perspective-n-Point (EPNP) algorithm, which works by parameterizing control points, representing all 3D points in the scene as a combination of the centroid coordinates of four non-coplanar control points. Utilizing the invariance of weights in the camera coordinate system, the high-dimensional pose estimation problem is compressed to a 12-dimensional space, thereby reducing the complexity to linear (O(n)).
[0050] A linear transformation is performed on the matching point pairs using a preset algorithm, as shown in the following formula: ; in, K represents the projection function; K represents the intrinsic parameter matrix of the imaging device. , This represents the i-th first candidate parameter.
[0051] Using the output of the preset algorithm (multiple first candidate parameters) as initial values, the reprojection error is minimized using the Levenberg-Marquardt algorithm. A cost function is then constructed based on these first candidate parameters, and this cost function is used to optimize the multiple first candidate parameters, thus obtaining multiple first transformation parameters. The cost function is expressed by the following formula: ; Where E represents the cost function; This represents the projection scale factor. Furthermore, Huber Loss can be introduced into the cost function to enhance its ability to detect outliers.
[0052] The first candidate parameters are updated iteratively by minimizing E, and data with residuals greater than a preset value are dynamically removed during the iteration process to avoid position shifts caused by single-point false detections, thus obtaining the first transformation parameters. The first transformation parameters represent the transformation relationship between the local coordinate system and the camera coordinate system corresponding to each imaging device.
[0053] Step S204: Merge multiple first transformation parameters to obtain second transformation parameters.
[0054] In some embodiments of this application, the first transformation parameter represents the transformation relationship between the local coordinate system and the camera coordinate system corresponding to each imaging device, and the second transformation parameter represents the transformation relationship between the local coordinate system and the world coordinate system. To obtain the second transformation parameter from the first transformation parameter, the camera coordinate system can be used as a medium to establish the transformation relationship between the local coordinate system and the world coordinate system.
[0055] In some embodiments of this application, each imaging device has its extrinsic parameters pre-set during deployment. These extrinsic parameters can then be used to obtain the reference transformation parameters of each imaging device's camera coordinate system relative to the world coordinate system. Each first transformation parameter is then transformed using these reference transformation parameters to obtain multiple second candidate parameters. Each second candidate parameter represents the transformation relationship between the camera coordinate system and the world coordinate system of each imaging device.
[0056] To improve the accuracy of subsequent fusion, outlier data is detected among the multiple second candidate parameters. If no outlier parameters are found, the multiple second candidate parameters are fused to obtain the second transformation parameter. For example... Figure 4 As shown, there are imaging devices A, ..., N. After the above series of processing, the corresponding second candidate parameters A, ..., N are obtained. In the absence of abnormal data, the second candidate parameters A, ..., N are fused to obtain the second conversion parameters.
[0057] If outlier data is identified, outlier data from multiple second candidate parameters is filtered out, resulting in multiple third candidate parameters. The second transformation parameter is then obtained by fusing these multiple third candidate parameters. For example... Figure 5 As shown, there are imaging devices A, ..., N. After the above series of processes, corresponding second candidate parameters A, ..., N are obtained. If there is abnormal data in the second candidate parameter B corresponding to imaging device B, the second candidate parameter B is filtered out. The remaining second candidate parameters A, C, ..., N after filtering out the second candidate parameter B are fused to obtain the second conversion parameters.
[0058] For a detailed description of how the second transformation parameter is obtained by fusing the first transformation parameter, please refer to the following: Figure 6 The illustrated embodiment.
[0059] Step S205: Based on the preset assembly sequence and the position of the battery pack mounting holes in the local coordinate system, the position of the mounting holes in the world coordinate system is output using the second transformation parameter.
[0060] In some embodiments of this application, the battery pack has multiple mounting holes, and the assembly sequence can be the installation sequence corresponding to each mounting hole, which can be set according to the actual situation. This application does not limit this. If the positions of multiple mounting holes are pre-marked on the local coordinate system, then after determining the second transformation parameter between the local coordinate system and the world coordinate system, the positions of the mounting holes of the battery pack in the local coordinate system can be converted to their positions in the world coordinate system.
[0061] The position of the mounting hole in the world coordinate system can be displayed on the electronic device's display device, or the position of the mounting hole in the world coordinate system can be output to the robot, so that the robot can install each mounting hole based on the position of the mounting hole in the world coordinate system and the assembly sequence, avoiding the situation of incorrect tightening sequence or missing tightening.
[0062] Through the above embodiments, multiple imaging devices are used to capture images of the battery pack from different angles, enabling comprehensive image acquisition from various perspectives and avoiding the viewpoint limitations of a single-camera vision system. Based on the correspondence between the identifier code of each image and a preset template code, matching point pairs are obtained. These matching point pairs are then used to determine the transformation relationship between the camera coordinate system and the local coordinate system corresponding to each imaging device, denoted as multiple first transformation parameters. By fusing these multiple first transformation parameters, the transformation relationship between the local coordinate system and the world coordinate system is obtained, denoted as second transformation parameters. With the second transformation parameters determined, the positions of the battery pack's mounting holes in the world coordinate system can be output based on a preset assembly sequence, thereby achieving the positioning of the battery pack's mounting holes. Through these embodiments, not only can the positions of the mounting holes be accurately located, but the positions can also be output according to the assembly sequence, thus obtaining the tightening sequence of the mounting holes sequentially, improving the installation efficiency and accuracy of the battery pack's mounting holes. This, to a certain extent, ensures the airtightness and assembly quality of the battery pack.
[0063] Figure 6 This is a flowchart illustrating the determination of the second conversion parameter provided in an embodiment of this application. For example... Figure 6 As shown, after determining the first transformation parameter, the second transformation parameter representing the transformation relationship between the local coordinate system and the world coordinate system can be obtained through parameter transformation and removal of outlier data, including the following steps.
[0064] Step S601: Based on the extrinsic parameters of each shooting device, determine the reference transformation parameters of each camera coordinate system relative to the world coordinate system.
[0065] In some embodiments of this application, each imaging device is pre-calibrated for its extrinsic parameters during deployment. During calibration, a multi-view consistency optimization algorithm (such as BA Bundle Adjudication) can be used to jointly solve for the extrinsic parameters of each imaging device. The extrinsic parameter errors after calibration are within a preset range; for example, the angle error is within 0.5°, and the position error is less than 2mm. Furthermore, after extrinsic parameter calibration, the extrinsic parameters can be adaptively adjusted according to the environment in which the imaging device is located. For example, if a positional shift of an imaging device is detected due to mechanical loosening, the extrinsic parameters can be adaptively adjusted based on the observation residuals without requiring recalibration.
[0066] Using the extrinsic parameters of each imaging device, the reference transformation parameters of the camera coordinate system relative to the world coordinate system of each imaging device are obtained. For example, the reference transformation parameters of the i-th camera coordinate system relative to the world coordinate system w are denoted as... , .
[0067] Step S602: Perform parameter transformation on each first transformation parameter using reference transformation parameters to obtain multiple second candidate parameters.
[0068] In some embodiments of this application, reference transformation parameters are used to transform each first transformation parameter, performing local pose transformation first and then translation transformation. This can be expressed by the following formula: ; ; in, , This represents the second candidate parameter obtained after the i-th camera coordinate system is transformed based on the reference transformation parameters.
[0069] All first transformation parameters are uniformly mapped to the world coordinate system by referencing the transformation parameters.
[0070] Step S603: Determine the candidate rotation matrix and candidate translation vector corresponding to each second candidate parameter.
[0071] In some embodiments of this application, in order to improve the accuracy of candidate positioning, the candidate rotation matrix and candidate translation vector corresponding to each second candidate parameter are obtained for subsequent anomaly detection.
[0072] Step S604: Calculate the first difference between any two candidate rotation matrices and the second difference between any two candidate translation vectors.
[0073] In some embodiments of this application, the difference in rotation angle between any two candidate rotation matrices is calculated and denoted as the first difference. For example, the first difference between the i-th candidate rotation matrix and the j-th candidate rotation matrix, the first difference between the i-th candidate rotation matrix and the k-th candidate rotation matrix, and the first difference between the j-th candidate rotation matrix and the k-th candidate rotation matrix are calculated.
[0074] Calculate the positional difference between any two candidate translation vectors, denoted as the second difference. For example, calculate the second difference between the i-th and j-th candidate translation vectors, the second difference between the i-th and k-th candidate translation vectors, and the second difference between the j-th and k-th candidate translation vectors.
[0075] Step S605: Based on the first difference and the second difference, filter out abnormal data in multiple second candidate parameters to obtain multiple third candidate parameters.
[0076] In some embodiments of this application, if the first difference between the i-th candidate rotation matrix and the j-th candidate rotation matrix, and the first difference between the i-th candidate rotation matrix and the k-th candidate rotation matrix are both greater than a preset angle difference, and the first difference between the j-th candidate rotation matrix and the k-th candidate rotation matrix is less than or equal to the angle difference, the i-th candidate rotation matrix is filtered out, where i, j, and k are all positive integers. The preset angle difference can be 8°.
[0077] If the second difference between the i-th candidate translation vector and the j-th candidate translation vector, and the second difference between the i-th candidate translation vector and the k-th candidate translation vector are both greater than a preset position difference, and the second difference between the j-th candidate translation vector and the k-th candidate translation vector is less than or equal to the preset position difference, then the i-th candidate translation vector is filtered out. The preset position difference can be 20mm.
[0078] By using multiple second candidate parameters after removing outliers as multiple third candidate parameters, the accuracy of subsequent calculations can be improved by removing abnormal outliers.
[0079] In other embodiments of this application, after abnormal data is determined, the abnormal imaging device is located, the cause of the abnormality is detected, and repair is performed based on the cause of the abnormality.
[0080] Step S606: Merge multiple third candidate parameters to obtain the second transformation parameters.
[0081] In some embodiments of this application, the rotation matrix to be fused and the translation vector to be fused in each third candidate parameter are determined. For example, if there are N third candidate parameters, the corresponding rotation matrix to be fused and translation vector to be fused are denoted as... Each imaging device has a corresponding observation weight. The observation weight for the i-th imaging device is expressed by the following formula: ; in, This represents the observation weight corresponding to the i-th imaging device; This represents the number of marker points within the marked area corresponding to the image captured by the i-th imaging device; This represents the reprojection error; the smaller the better. This represents the (positive) angle of view of the i-th imaging device; It is a constant, used to avoid division by zero.
[0082] In some embodiments of this application, the observation weights can be dynamically adjusted based on the observation confidence level, which represents the stability of the imaging device. If the observation confidence level of an imaging device meets a preset condition, the observation weight corresponding to any imaging device is increased. For example, if the imaging device does not exhibit any observation anomalies within a certain period of time. If the observation confidence level of an imaging device does not meet the preset condition, the observation weight corresponding to any imaging device is decreased. For example, if the imaging device has exhibited observation anomalies within a certain period of time, it is considered an unstable observation device, and its observation weight is reduced to avoid affecting the accuracy of subsequent analysis.
[0083] In some embodiments of this application, all translation vectors to be fused are fused according to the observation weights corresponding to each imaging device to obtain the target translation vector in the second transformation parameter, which is expressed by the following formula: ; Each rotation matrix to be merged is transformed using quaternions to obtain the transformed rotation matrix. For example, ... Convert to quaternion .
[0084] Based on the rotation matrix after observation weight fusion and transformation, the target rotation matrix in the second transformation parameter is obtained by matrix transformation, which is expressed by the following formula: ; Will Convert to target rotation matrix .
[0085] In other embodiments of this application, parameter compensation can be determined based on the number of third candidate parameters. If the number of multiple third candidate parameters is less than or equal to a preset threshold, parameter compensation is performed using a preset Kalman filter algorithm to obtain compensated third candidate parameters. Specifically, a Kalman filter state vector is defined, containing the battery pack's position and attitude in the world coordinate system. Based on historical pose trajectories and a uniform motion model, the expected position and attitude of the battery pack at the current moment are predicted. Non-abnormal data (non-abnormal third candidate parameters) are fused to obtain fused data. The predicted expected position and attitude are compared with the position and attitude in the fused data, and the observation residual is calculated. The Kalman gain is dynamically adjusted based on the observation residual to output the compensated third candidate parameters.
[0086] After obtaining the compensated third candidate parameters, the second transformation parameters are obtained by fusing the compensated third candidate parameters. For example... Figure 7 As shown, if the second candidate parameter B is abnormal, then the second candidate parameter B is filtered out and parameter compensation is performed using the Kalman filter algorithm. The third candidate parameter after fusion compensation is then obtained as the second transformation parameter.
[0087] Through the above embodiments, the accuracy, robustness, and fault tolerance of the overall battery pack positioning are improved by filtering out abnormal data. Furthermore, using a Kalman filter for parameter compensation avoids the need for fusion with insufficient observations, thereby outputting more robust second transformation parameters.
[0088] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 10 can be a mobile phone, tablet computer, smart wearable device, augmented reality (AR) / virtual reality (VR) device, laptop computer, netbook, in-vehicle device, etc. This embodiment of the application does not impose any restrictions on the specific type of electronic device. like Figure 8 As shown, the electronic device 10 may include a display device 100, a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104, and a bus 105. The processor 103 is coupled to the display device 100, the communication interface 101, the memory 102, and the I / O interface 104 via the bus 105.
[0089] The display device 100 may be a touch screen, specifically a touch-sensitive liquid crystal display device. Alternatively, the display device 100 may be a non-touch screen. The display device 100 is used to display images captured by multiple imaging devices, and may also be used to display the position of the mounting holes in a world coordinate system.
[0090] Communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more wired communication solutions such as Universal Serial Bus (USB) and Controller Area Network (CAN). The wireless communication module may provide one or more wireless communication solutions such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication networks, Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR). The memory 102 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 103, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.
[0091] Random access memory can include static random-access memory (SRAM), dynamic random-access memory (DRAM), synchronous dynamic random-access memory (SDRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.
[0092] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 103. Non-volatile memory can include disk storage devices and flash memory.
[0093] The memory 102 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 103. The one or more computer programs include multiple instructions that, when executed by the processor 103, enable a method for positioning battery pack mounting holes on the electronic device 10.
[0094] In other embodiments, the electronic device 10 also includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10.
[0095] Processor 103 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0096] The processor 103 provides computing and control capabilities. For example, the processor 103 is used to execute computer programs stored in the memory 102 to implement the above-described method for positioning the battery pack mounting holes.
[0097] I / O interface 104 is used to provide a channel for user input or output. For example, I / O interface 104 can be used to connect various input and output devices, such as mouse, keyboard, touch device, display device, etc., so that users can enter information or visualize information.
[0098] Bus 105 is used at least to provide a channel for communication between communication modules 101, memory 102, processor 103, and I / O interface 104 in electronic device 10.
[0099] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0100] This application also provides a computer-readable storage medium storing a computer program, which includes program instructions. When the program instructions are executed, the method implemented can refer to the methods in the above embodiments of this application.
[0101] The computer-readable storage medium can be the internal memory of the electronic device described in the above embodiments, such as the hard disk or memory of the electronic device. Alternatively, the computer-readable storage medium can be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., provided on the electronic device.
[0102] In some embodiments, a computer-readable storage medium may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of the electronic device, etc.
[0103] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0104] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0105] In the embodiments provided in this application, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for positioning mounting holes in a battery pack, used to position the mounting holes in a battery pack, characterized in that, The method includes: Multiple images of the battery pack were captured from different angles using multiple imaging devices, and each image included an identification code. Based on the correspondence between the identifier code of each image and multiple preset template codes, matching point pairs are obtained; wherein, the matching point pairs include the coordinates of the marker region corresponding to each identifier code in the pixel coordinate system and the coordinates of the template region corresponding to the multiple template codes in the local coordinate system corresponding to the battery pack. Based on the matching point pairs, multiple first transformation parameters are determined, each first transformation parameter representing the transformation relationship between the local coordinate system and the camera coordinate system corresponding to each shooting device; The second transformation parameter is obtained by fusing the multiple first transformation parameters, and the second transformation parameter represents the transformation relationship between the local coordinate system and the world coordinate system; Based on the preset assembly sequence and the position of the mounting holes of the battery pack in the local coordinate system, the position of the mounting holes in the world coordinate system is output using the second transformation parameter.
2. The method for positioning battery pack mounting holes according to claim 1, characterized in that, The method further includes: identifying the identifier code corresponding to each image, including: Detect the edge features corresponding to the battery pack in each image; The target contour is determined based on the edge features; The marker region is determined based on the target contour; The local image corresponding to the marked region is binarized to obtain multiple binarized images; Identify the multiple binarized images to obtain the identification code corresponding to each image.
3. The method for positioning battery pack mounting holes according to claim 1, characterized in that, The matching point pairs are obtained based on the correspondence between the identifier code of each image and multiple preset template codes, including: If there is a template code among the plurality of template codes that matches any identifier code, then the first coordinate of the marker region corresponding to the identifier code in the pixel coordinate system is obtained, and the second coordinate of the template region corresponding to the matching template code in the local coordinate system is obtained. The matching point pair is obtained based on the first coordinate and the second coordinate.
4. The method for positioning battery pack mounting holes according to claim 1, characterized in that, The determination of multiple first transformation parameters based on the matching point pairs includes: A preset algorithm is used to perform a linear transformation on the matching point pairs to obtain multiple first candidate parameters; A cost function is constructed based on the plurality of first candidate parameters; The multiple first candidate parameters are optimized using the cost function to obtain the multiple first transformation parameters.
5. The method for positioning battery pack mounting holes according to claim 1, characterized in that, The process of fusing the multiple first transformation parameters to obtain the second transformation parameters includes: Based on the extrinsic parameters of each imaging device, the reference transformation parameters of each camera coordinate system relative to the world coordinate system are determined; The reference transformation parameters are used to transform each first transformation parameter to obtain multiple second candidate parameters; Determine the candidate rotation matrix and candidate translation vector corresponding to each second candidate parameter; Calculate the first difference between any two candidate rotation matrices and the second difference between any two candidate translation vectors; Based on the first difference and the second difference, abnormal data in the plurality of second candidate parameters are filtered out to obtain a plurality of third candidate parameters; The second transformation parameter is obtained by fusing the multiple third candidate parameters.
6. The method for positioning battery pack mounting holes according to claim 5, characterized in that, The step of filtering out abnormal data in the first conversion parameters based on the first difference and the second difference includes: If the first difference between the i-th candidate rotation matrix and the j-th candidate rotation matrix, and the first difference between the i-th candidate rotation matrix and the k-th candidate rotation matrix are both greater than a preset angle difference, and the first difference between the j-th candidate rotation matrix and the k-th candidate rotation matrix is less than or equal to the angle difference, then the i-th candidate rotation matrix is filtered out; where i, j, and k are all positive integers. If the second difference between the i-th candidate translation vector and the j-th candidate translation vector, and the second difference between the i-th candidate translation vector and the k-th candidate translation vector are both greater than the preset position difference, and the second difference between the j-th candidate translation vector and the k-th candidate translation vector is less than or equal to the preset position difference, then the i-th candidate translation vector is filtered out.
7. The method for positioning battery pack mounting holes according to claim 5, characterized in that, The process of fusing the multiple third candidate parameters to obtain the second transformation parameter includes: Determine the rotation matrix and translation vector to be fused in each third candidate parameter; Based on the observation weights corresponding to each imaging device, all translation vectors to be fused are fused to obtain the target translation vector in the second transformation parameter; Each rotation matrix to be merged is transformed using quaternions to obtain the transformed rotation matrix; The transformed rotation matrix is fused based on the observation weights, and matrix transformation is performed to obtain the target rotation matrix in the second transformation parameters.
8. The method for positioning battery pack mounting holes according to claim 7, characterized in that, The method further includes: dynamically adjusting the observation weights, including: Determine the observation confidence level of each imaging device within a preset time period; If the observation confidence of any imaging device meets the preset condition, the observation weight corresponding to that imaging device is increased. If the observation confidence of any imaging device does not meet the preset conditions, the observation weight corresponding to that imaging device will be reduced.
9. The method for positioning battery pack mounting holes according to claim 5, characterized in that, The method further includes: If the number of the plurality of third candidate parameters is less than or equal to a preset number threshold, parameter compensation is performed using a preset Kalman filter algorithm to obtain the compensated third candidate parameters; Accordingly, the process of fusing the plurality of third candidate parameters to obtain the second transformation parameter includes: The second conversion parameter is obtained by integrating the compensated third candidate parameter.
10. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing a computer program, and the processor, when executing the computer program, implements the battery pack mounting hole positioning method as described in any one of claims 1 to 9.