Charging cover pose detection method based on machine vision and storage medium
By using a monocular camera and laser line marking, the problems of large size, high cost, and light interference in charging cover pose detection equipment have been solved, realizing a low-cost, light-interference-resistant, compact detection method, which improves the accuracy and real-time performance of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAANXI GREEN ENERGY ELECTRONIC TECH CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-05
AI Technical Summary
In the existing technology, the 6DOF pose detection method for charging covers relies on stereo vision equipment, which results in large equipment size, high cost and susceptibility to ambient light interference, making it difficult to apply in compact devices.
A method combining a monocular camera and laser line marking is adopted. By taking pictures of unmarked and marked charging covers, edge feature points of the charging covers are extracted, feature point clouds are calculated, and they are matched with pre-acquired target point clouds to determine the pose parameters of the charging covers, thus achieving low-cost detection that is resistant to ambient light interference.
It achieves low-cost, low-hardware-complexity charging cover pose detection in compact devices, has the ability to resist ambient light interference, and improves the accuracy of detection and the real-time performance of data processing.
Smart Images

Figure CN121982102A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for detecting the pose of a charging cover based on machine vision, an electronic device, and a computer-readable storage medium. Background Technology
[0002] The charging cover is a protective component for the charging interface of new energy vehicles, mainly used for dustproofing, waterproofing, and preventing foreign object intrusion to ensure charging safety. Currently, the 6DOF pose of the charging cover is usually determined using stereo vision, such as binocular cameras, structured light cameras, or ToF cameras, to obtain point cloud data of the charging cover and calculate its pose. However, binocular cameras and ToF cameras are sensitive to ambient light and easily affected by light interference. Structured light cameras require an additional integrated light source module, resulting in a larger size, higher cost, and less compact design. Summary of the Invention
[0003] This invention aims to at least partially solve one of the technical problems in related technologies. To this end, this invention proposes a machine vision-based method for detecting the pose of a charging cover and a storage medium, which has the core advantages of low cost, low hardware complexity, and resistance to ambient light interference.
[0004] In a first aspect, embodiments of the present invention provide a charging cover pose detection method based on machine vision, comprising the following steps: Step S1: Take photos of the charging cover with and without marked laser lines using a monocular camera, and record them as the first image and the second image. Step S2: Based on the first image and the second image, extract the laser line, and extract at least three edge feature points of the charging cover from the laser line; Step S3: Calculate the feature point cloud based on each of the edge feature points; Step S4: Match the feature point cloud with the pre-acquired target point cloud to obtain the corresponding homogeneous transformation matrix; Step S5: Determine the pose parameters of the charging cover according to the homogeneous transformation matrix.
[0005] Optionally, in one embodiment of the present invention, step S3 includes the following steps: Step S31: Project the laser line onto the pre-configured checkerboard calibration board and pass through the corner points of the checkerboard calibration board; Step S32: Determine the relative pose of the checkerboard calibration board with respect to the monocular camera based on the corner points of the checkerboard calibration board; Step S33: Based on the relative pose, map the corner points located on the laser line to the coordinate system of the monocular camera to obtain candidate coordinates; Step S34: In the case of obtaining multiple different candidate coordinates, determine the constraint plane corresponding to the laser line based on all the candidate coordinates; Step S35: Determine the feature point cloud based on each of the edge feature points in conjunction with the coordinate system of the constraint plane and the monocular camera.
[0006] Optionally, in one embodiment of the present invention, step S35 includes the following steps: Step S351: For each edge feature point, determine the mapping constraint ray of the edge feature point according to the coordinate system of the edge feature point and the monocular camera; Step S352: Detect the intersection of the mapped constraint ray and the constraint plane, and determine the three-dimensional coordinates of the edge feature points based on the intersection. Step S353: Obtain the set of all the three-dimensional coordinates to obtain the feature point cloud.
[0007] Optionally, in one embodiment of the present invention, step S5 includes the following steps: Step S51: Separate the three-dimensional offset vector and rotation matrix from the homogeneous transformation matrix; Step S52: Convert the rotation matrix into Euler angles, and use the three-dimensional offset vector and the Euler angles as the pose parameters of the charging cover.
[0008] Optionally, in one embodiment of the present invention, step S2, extracting the laser line based on the first image and the second image, includes the following steps: Step S21: Preprocess the first image and the second image respectively to obtain the first intermediate image and the second intermediate image; Step S22: Perform the same Gaussian blur processing on the first intermediate image and the second intermediate image respectively to obtain the first target image and the second target image; Step S23: Subtract the first target image from the second target image to obtain the laser line.
[0009] Optionally, in one embodiment of the present invention, multiple different candidate coordinates are obtained through the following steps: The orientation of the chessboard calibration board is adjusted multiple times, and steps S31 to S33 are repeated multiple times. or, Adjust the degrees of freedom and / or type of the laser source corresponding to the laser line multiple times, and repeat steps S1 to S33 multiple times.
[0010] In a second aspect, embodiments of the present invention provide an electronic device, comprising: At least one processor; At least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the machine vision-based charging cover pose detection method as described in the first aspect is implemented.
[0011] Thirdly, embodiments of the present invention provide a computer-readable storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the machine vision-based charging cover pose detection method as described in the first aspect.
[0012] This invention proposes a machine vision-based method for detecting the pose of a charging cover and a storage medium. It employs a monocular camera and laser line marking for active detection. Based on multiple edge feature points extracted from the laser line, the method reliably calculates the feature point cloud of the charging cover. Then, by matching the feature point cloud with a pre-acquired target point cloud, the pose parameters of the charging cover are accurately determined. Compared to existing stereo vision solutions, detection using laser line marking effectively resists ambient light interference. Furthermore, the use of a monocular camera eliminates the need for an additional light source module, making it easier to integrate and lower in cost. It can be applied to compact, small-device scenarios and possesses the core advantages of low cost, low hardware complexity, and resistance to ambient light interference. Attached Figure Description
[0013] Figure 1 This is a flowchart of a charging cover pose detection method based on machine vision provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the principle of extracting edge feature points of the charging cover from a laser line according to an embodiment of the present invention; Figure 3(a) is a schematic diagram of a feature point cloud provided in an embodiment of the present invention; Figure 3(b) is a schematic diagram of a target point cloud provided in an embodiment of the present invention; Figure 4 yes Figure 1 A partial flowchart of step S2, "Extracting the laser line based on the first and second images"; Figure 5 yes Figure 1 The flowchart for step S3 in the process; Figure 6 yes Figure 5 The flowchart of step S35 in the text; Figure 7 yes Figure 6 A schematic diagram of the principle of steps S351 to S353 in the process; Figure 8 yes Figure 1 The flowchart for step S5 in the process; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0014] like Figure 1 As shown, an embodiment of the present invention provides a charging cover pose detection method based on machine vision, which may include, but is not limited to, steps S1 to S5.
[0015] Step S1: Take photos of the charging cover with unmarked laser lines and marked laser lines respectively using a monocular camera, and record them as the first image and the second image; Step S2: Based on the first image and the second image, extract the laser line, and extract at least three edge feature points of the charging cover from the laser line; Step S3: Calculate the feature point cloud based on each edge feature point; Step S4: Match the feature point cloud with the pre-acquired target point cloud to obtain the corresponding homogeneous transformation matrix; Step S5: Determine the pose parameters of the charging cover based on the homogeneous transformation matrix.
[0016] In this step, active detection is achieved using a monocular camera and laser line marking. Based on multiple edge feature points extracted from the laser line, the feature point cloud of the charging cover can be reliably calculated. Then, by matching the feature point cloud with the pre-acquired target point cloud, the pose parameters of the charging cover can be accurately determined. Compared with the stereo vision solutions in related existing technologies, detection using laser line marking can effectively resist ambient light interference. Furthermore, using a monocular camera eliminates the need for an additional light source module, making it easier to integrate and lower in cost. It can be applied to small device scenarios with compact space and has the core advantages of low cost, low hardware complexity, and resistance to ambient light interference.
[0017] In one embodiment, the laser line in step S1 can be generated by, but is not limited to, a laser source. The degree of freedom of the laser source can be set according to the actual application scenario, and there is no limitation here. For example, the initial position of the laser source can be maintained, or it can be rotated or translated based on the initial position. Then, while keeping the monocular camera stationary, four feature points can be obtained at each laser source position. The density of the feature point cloud can be increased by adjusting the position of the laser source. Alternatively, but not limited to, the type of laser source can be changed, such as a grid-like laser line, which can acquire multiple edge feature points at once.
[0018] In one embodiment, the specific method for extracting at least three edge feature points of the charging cover from the laser line in step S2 can be chosen by those skilled in the art, such as using image exposure for positioning, etc. There are no limitations here. Specifically, refer to... Figure 2As can be seen, when the laser line is extracted, the location where the laser line intersects with the edge of the charging cover can be used as an edge feature point. The principle is to utilize the characteristic that light undergoes abrupt changes (breaks, deflections, bends, etc.) when passing through gaps to mark the edge feature points of the charging cover. These edge feature points are usually breakpoints or points of abrupt curvature change, thus they can be identified. Figure 2 As can be seen from this, unlike the dense point cloud distribution of conventional stereo vision, the feature point cloud in this embodiment only involves 4 edge feature points, which is sufficient to calculate the pose. Relatively speaking, the amount of data is greatly reduced, and the real-time performance of data processing will be greatly improved.
[0019] In one embodiment, the target point cloud in step S4 is the point cloud corresponding to the standard model of the charging cover. It can be obtained according to the actual situation. For example, it can be extracted from the outline of the charging cover based on the front view image of the charging cover, which is mainly applicable to planar charging covers. If it is a three-dimensional cover, it can be obtained by scanning equipment or stereo vision, etc., which will not be elaborated here. Generally speaking, the feature point cloud cannot coincide with the target point cloud. Specifically, referring to Figures 3(a) and 3(b), it can be seen that the feature point cloud shown in Figure 3(a) does not coincide with the target point cloud shown in Figure 3(b). Therefore, to match the feature point cloud to the target point cloud, this process needs to undergo a corresponding transformation. The correlation matrix involved in the transformation process is the homogeneous transformation matrix. Since this matching method is well known to those skilled in the art, it will not be elaborated here.
[0020] like Figure 4 As shown in one embodiment of the present invention, step S2, which involves extracting the laser line based on the first image and the second image, may include, but is not limited to, the following steps: Step S21: Preprocess the first image and the second image respectively to obtain the first intermediate image and the second intermediate image; Step S22: Perform the same Gaussian blur processing on the first intermediate image and the second intermediate image respectively to obtain the first target image and the second target image; Step S23: Subtract the first target image from the second target image to obtain the laser line.
[0021] In this step, the first and second images are preprocessed and subjected to the same Gaussian blurring process in sequence to obtain a clear and distinguishable first and second target images. Based on this, the first target image is subtracted from the second target image to accurately extract the corresponding laser line. The whole process is simple and effective and can stably extract the laser line.
[0022] In one embodiment, the preprocessing method can be various, including but not limited to distortion correction, grayscale processing, and brightness optimization, etc., and there is no limitation here.
[0023] like Figure 5 As shown, in one embodiment of the present invention, step S3 may include, but is not limited to, the following steps: Step S31: Project the laser line onto the pre-configured checkerboard calibration board and pass through the corner points of the checkerboard calibration board; Step S32: Determine the relative pose of the checkerboard calibration board with respect to the monocular camera based on the corner points of the checkerboard calibration board; Step S33: Map the corner points located on the laser line to the coordinate system of the monocular camera according to the relative pose to obtain the candidate coordinates; Step S34: Given multiple different candidate coordinates, determine the constraint plane corresponding to the laser line based on all candidate coordinates; Step S35: Determine the feature point cloud based on the coordinate system of each edge feature point, the constraint plane, and the monocular camera.
[0024] In this step, a laser line is projected onto a pre-configured checkerboard calibration board and passes through its corners. These corners serve as references for calculating the relative pose of the checkerboard calibration board relative to the monocular camera. The corners on the laser line are then further mapped based on this relative pose, normalizing their coordinates from the checkerboard calibration board's coordinate system to the monocular camera's coordinate system. The actual coordinates of these corners in the monocular camera's coordinate system become the corresponding candidate coordinates. Multiple candidate coordinates are obtained from these candidate coordinates. A constraint plane corresponding to the laser line is then determined based on all candidate coordinates, serving as a constraint for edge feature points. Finally, by combining the constraint plane and the monocular camera's coordinate system with each edge feature point, the corresponding feature point cloud is determined. It can be seen that the entire process does not obtain pixel coordinates directly, but rather determines the feature point cloud through the joint determination of the constraint plane and the monocular camera's coordinate system, resulting in more accurate and reliable results with less error.
[0025] In one embodiment, there are various ways to determine the relative pose of the checkerboard calibration board with respect to the monocular camera using the corner points of the checkerboard calibration board, which are well known to those skilled in the art and will not be described in detail here to avoid redundancy.
[0026] like Figure 6 As shown, in one embodiment of the present invention, step S35 may include, but is not limited to, the following steps: Step S351: For each edge feature point, determine the mapping constraint ray of the edge feature point according to the coordinate system of the edge feature point and the monocular camera; Step S352: Detect the intersection of the mapped constraint ray and the constraint plane, and determine the three-dimensional coordinates of the edge feature points based on the intersection. Step S353: Obtain the set of all three-dimensional coordinates to obtain the feature point cloud.
[0027] Specifically, based on the pinhole imaging principle of a camera, the actual physical target represented by a pixel in an image acquired by a monocular camera lies on a ray. This means that the target's depth information cannot be effectively obtained solely from the pixel's coordinates. Therefore, an auxiliary laser line is needed. When a pixel lies on the laser line, the corresponding 3D point is simultaneously constrained by both the monocular camera's ray and the laser plane (which can be represented in the monocular camera's coordinate system as: aX + bY + cZ + d = 0, where X, Y, and Z represent the 3D coordinate system, and a, b, c, and d are the corresponding constraint parameters). This allows for the unique determination of a point in space. Figure 7 As shown, the ray from the camera's optical center to the pixel (i.e., one of the edge feature points) intersects with the laser plane provided by the laser source. This intersection point is the candidate coordinate. Similarly, other edge feature points can also be determined in this way, thus obtaining multiple three-dimensional coordinates. The set of all three-dimensional coordinates is the feature point cloud.
[0028] In one embodiment, multiple different candidate coordinates can be obtained through, but is not limited to, the following steps: Adjust the orientation of the chessboard calibration board multiple times, and repeat steps S31 to S33 multiple times; or, Adjust the degrees of freedom and / or type of the laser source corresponding to the laser line multiple times, and repeat steps S1 to S33 multiple times.
[0029] Specifically, by adjusting the orientation of the checkerboard calibration board, the projection of the laser line onto the checkerboard calibration board and the corner points it passes through will change, thereby changing the relative pose of the checkerboard calibration board with respect to the monocular camera, and the resulting candidate coordinates will also be different. That is, each time the orientation of the checkerboard calibration board is adjusted and steps S31 to S33 are repeated, a new candidate coordinate is obtained. Similarly, the orientation of the checkerboard calibration board can be kept unchanged by adjusting the degree of freedom and / or type of the laser source, which can also achieve the purpose of updating the candidate coordinates. Since the change of the laser line involves changes in the initial monocular camera photo capture and laser line extraction, steps S1, S2 and steps S31 to S33 need to be repeated.
[0030] In one embodiment, the number of candidate coordinates is preferably at least three, and all candidate coordinates are not collinear.
[0031] like Figure 8 As shown, in one embodiment of the present invention, step S5 may include, but is not limited to, the following steps: Step S51: Separate the three-dimensional offset vector and rotation matrix from the homogeneous transformation matrix; Step S52: Convert the rotation matrix into Euler angles, so that the three-dimensional offset vector and Euler angles are used as the pose parameters of the charging cover.
[0032] Specifically, the method of separating the three-dimensional offset vector and rotation matrix from the homogeneous transformation matrix is well known to those skilled in the art and will not be elaborated here. The obtained three-dimensional offset vector represents the offset in three directions on the three-dimensional coordinate system, which is the coordinate pose parameter of the charging cover. The rotation matrix is converted into Euler angles, which is the angular pose parameter of the charging cover. The combination of the two is the 6DOF pose parameter of the charging cover.
[0033] Figure 9 This is a schematic diagram of the structure of an electronic device 1000 provided in an embodiment of the present invention. For example... Figure 9 As shown, the electronic device 1000 includes a memory 1100 and a processor 1200. The number of memories 1100 and processors 1200 can be one or more. Figure 9 Taking a memory 1100 and a processor 1200 as an example; the memory 1100 and the processor 1200 in the device can be connected via a bus or other means. Figure 9 Taking the example of a connection between China and Israel via a bus.
[0034] The memory 1100, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the machine vision-based charging cover pose detection method provided in any embodiment of the present invention. The processor 1200 implements the above-described machine vision-based charging cover pose detection method by running the software programs, instructions, and modules stored in the memory 1100.
[0035] The memory 1100 may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system and application programs required for at least one function. Furthermore, the memory 1100 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 1100 may further include memory remotely located relative to the processor 1200, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0036] An embodiment of the present invention also provides a computer-readable storage medium storing computer-executable instructions for performing a machine vision-based charging cover pose detection method as provided in any embodiment of the present invention.
[0037] An embodiment of the present invention also provides a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions, causing the computer device to perform the charging cover pose detection method based on machine vision as provided in any embodiment of the present invention.
[0038] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0039] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0040] The terms “component,” “module,” “system,” etc., used in this specification are used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, or a computer. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process or execution thread, and components may be located on a single computer or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. Components can communicate, for example, via local or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, or a network, such as the Internet interacting with other systems via signals).
Claims
1. A method for detecting the pose of a charging cover based on machine vision, characterized in that, Includes the following steps: Step S1: Take photos of the charging cover with and without marked laser lines using a monocular camera, and record them as the first image and the second image. Step S2: Based on the first image and the second image, extract the laser line, and extract at least three edge feature points of the charging cover from the laser line; Step S3: Calculate the feature point cloud based on each of the edge feature points; Step S4: Match the feature point cloud with the pre-acquired target point cloud to obtain the corresponding homogeneous transformation matrix; Step S5: Determine the pose parameters of the charging cover according to the homogeneous transformation matrix.
2. The charging cover pose detection method based on machine vision according to claim 1, characterized in that, Step S3 includes the following steps: Step S31: Project the laser line onto the pre-configured checkerboard calibration board and pass through the corner points of the checkerboard calibration board; Step S32: Determine the relative pose of the checkerboard calibration board with respect to the monocular camera based on the corner points of the checkerboard calibration board; Step S33: Based on the relative pose, map the corner points located on the laser line to the coordinate system of the monocular camera to obtain candidate coordinates; Step S34: In the case of obtaining multiple different candidate coordinates, determine the constraint plane corresponding to the laser line based on all the candidate coordinates; Step S35: Determine the feature point cloud based on each of the edge feature points in conjunction with the coordinate system of the constraint plane and the monocular camera.
3. The charging cover pose detection method based on machine vision according to claim 2, characterized in that, Step S35 includes the following steps: Step S351: For each edge feature point, determine the mapping constraint ray of the edge feature point according to the coordinate system of the edge feature point and the monocular camera; Step S352: Detect the intersection of the mapped constraint ray and the constraint plane, and determine the three-dimensional coordinates of the edge feature points based on the intersection. Step S353: Obtain the set of all the three-dimensional coordinates to obtain the feature point cloud.
4. The charging cover pose detection method based on machine vision according to claim 1, characterized in that, Step S5 includes the following steps: Step S51: Separate the three-dimensional offset vector and rotation matrix from the homogeneous transformation matrix; Step S52: Convert the rotation matrix into Euler angles, and use the three-dimensional offset vector and the Euler angles as the pose parameters of the charging cover.
5. The charging cover pose detection method based on machine vision according to claim 1, characterized in that, Step S2, which involves extracting the laser line based on the first image and the second image, includes the following steps: Step S21: Preprocess the first image and the second image respectively to obtain the first intermediate image and the second intermediate image; Step S22: Perform the same Gaussian blur processing on the first intermediate image and the second intermediate image respectively to obtain the first target image and the second target image; Step S23: Subtract the first target image from the second target image to obtain the laser line.
6. The charging cover pose detection method based on machine vision according to claim 2, characterized in that, Multiple different candidate coordinates are obtained through the following steps: The orientation of the chessboard calibration board is adjusted multiple times, and steps S31 to S33 are repeated multiple times. or, Adjust the degrees of freedom and / or type of the laser source corresponding to the laser line multiple times, and repeat steps S1 to S33 multiple times.
7. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; The charging cover pose detection method based on machine vision as described in any one of claims 1 to 6 is implemented when at least one of the programs is executed by at least one of the processors.
8. A computer-readable storage medium, characterized in that, It stores a processor-executable program, which, when executed by the processor, is used to implement the machine vision-based charging cover pose detection method as described in any one of claims 1 to 6.