Ranging method and device, robot control method and computer equipment
By combining the camera image coordinate information and the distance measurement method of the rotation matrix, the problem of low installation efficiency of photovoltaic workpieces in photovoltaic power stations is solved, and accurate distance measurement and automated installation in complex environments are achieved.
Patent Information
- Application Number
- CN202410604119.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-23
Smart Images

Figure CN118533067A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of photovoltaic workpiece installation, and in particular to a distance measurement method and device thereof, a robot control method and a computer device. Background Art
[0002] As the global demand for energy continues to increase, photovoltaic power generation is gradually becoming one of the world's major clean energy sources. However, photovoltaic power stations are large in scale, and the installation of photovoltaic workpieces usually requires manual operation, which is inefficient, labor-intensive, and has a poor working environment. With the emergence of some equipment for installing photovoltaic workpieces, although these equipment help solve the construction of centralized photovoltaic power stations, when installing photovoltaic workpieces on photovoltaic workpiece brackets, it is necessary to manually lift the photovoltaic workpieces one by one and install them on the photovoltaic workpiece brackets, which requires at least two workers to cooperate in the construction. In addition, due to the dense arrangement of pipe piles, the process of workers carrying photovoltaic workpieces is inconvenient, resulting in low installation efficiency.
[0003] Although the use of machines can solve the above problems to a certain extent, the installation of machines is mainly based on teaching and reproduction. This method has great limitations. The starting and ending positions of the robot are strictly limited. It can only complete specific point-to-point actions and cannot complete operation tasks with constantly changing target points. The grasping method based on sensor technology may face problems such as lighting and occlusion in complex or changing environments, resulting in inaccurate recognition of target objects. In addition, visual perception may also be affected for some transparent or reflective objects. Summary of the invention
[0004] Based on this, it is necessary to provide a distance measurement method and device, a robot control method and a computer device that can accurately obtain the distance to the target photovoltaic workpiece in order to solve the above technical problems.
[0005] In a first aspect, the present application provides a ranging method, comprising:
[0006] Obtain image coordinate information of the target photovoltaic workpiece captured by the camera;
[0007] Get the rotation matrix of the camera;
[0008] A target distance is acquired based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix; the target distance is the distance between the camera and the target photovoltaic workpiece.
[0009] In one embodiment, obtaining the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix includes:
[0010] Based on the focal length and the image coordinate information, a first ratio and a second ratio of multiple reference points are respectively obtained; the first ratio is a ratio of a first distance to a second distance, and the second ratio is a ratio of a third distance to the second distance; the first distance is a distance from an optical center to a first intersection point, the first intersection point is an intersection point of a vertical line and an optical axis of the camera, the vertical line is perpendicular to the optical axis and the reference point is located on the vertical line; the second distance is a distance from the reference point to the optical center; the third distance is a distance from the reference point to the optical axis of the camera;
[0011] Acquire angle information between the optical axis of the camera and the target photovoltaic workpiece based on the rotation matrix;
[0012] The target distance is acquired based on the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information.
[0013] In one embodiment, acquiring the target distance based on the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information includes:
[0014] A world rectangular coordinate system is established with the optical center of the camera as the origin and the direction of gravity as the Z axis;
[0015] Acquire the reference coordinates and the fourth distance of the target reference point in the world rectangular coordinate system according to the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information; the target reference point is any one of the multiple reference points; the fourth distance is the distance from the optical center of the camera to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece;
[0016] The target distance is acquired according to the size information, the angle information, the reference coordinates and the fourth distance.
[0017] In one embodiment, obtaining the reference coordinates and the fourth distance of the target reference point in the world rectangular coordinate system according to the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information includes:
[0018] Acquire a pixel height of the target photovoltaic workpiece based on the image coordinate information;
[0019] Acquire a reference distance according to the size information of the target photovoltaic workpiece, the focal length, the pixel height, and a pinhole imaging distance measurement formula;
[0020] Establishing an acquisition model according to the image coordinate information, the size information, the first ratio, the second ratio and the angle information;
[0021] The reference distance is used as an initial fourth distance, and the initial fourth distance is substituted into the acquisition model through the damped Newton method to acquire the reference coordinates and the fourth distance.
[0022] In one embodiment, obtaining a first ratio of a reference point of the target photovoltaic workpiece based on the focal length and the image coordinate information includes:
[0023] Acquire a first imaging distance according to the image coordinate information; the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera;
[0024] The first ratio is obtained according to the ratio of the focal length to the first imaging distance based on the principle of similar triangles.
[0025] In one embodiment, obtaining a second ratio of a reference point of the target photovoltaic workpiece based on the focal length and the image coordinate information includes:
[0026] Acquire a first imaging distance and a second imaging distance according to the image coordinate information; the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera, the second imaging distance is the distance between the imaging point corresponding to the reference point and the imaging point corresponding to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece;
[0027] The second ratio is obtained according to the ratio of the second imaging distance to the first imaging distance based on the principle of similar triangles.
[0028] In a second aspect, the present application also provides a robot control method, comprising:
[0029] As the distance measurement method mentioned above;
[0030] The robot is controlled to grab the target photovoltaic workpiece according to the target distance obtained by the distance measurement method.
[0031] In a third aspect, the present application further provides a distance measuring device, the distance measuring device comprising:
[0032] An image processing module, used for acquiring image coordinate information of a target photovoltaic workpiece collected by a camera;
[0033] A data processing module, used to obtain the rotation matrix of the camera;
[0034] The distance measuring module is used to obtain the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix; the target distance is the distance between the camera and the target photovoltaic workpiece.
[0035] In a fourth aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0036] In a fifth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps of the above method when executed by a processor.
[0037] The above-mentioned distance measurement method and its device, robot control method and computer equipment combine the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix. According to the rotation matrix of the camera, the position information of the camera at the moment and the relative orientation relationship and angle between the camera and the target photovoltaic workpiece can be obtained. Therefore, the target distance finally obtained will be more accurate, and the influence of factors such as light refraction and reflection, and the size difference of different target photovoltaic workpieces can be reduced. In addition, the traditional distance measurement formula needs to keep the camera viewing angle unchanged, but in the actual application of installing the robot, the viewing angle may change. The distance measurement method of the present application, because it combines the camera rotation matrix, can overcome the influence of different influencing factors on the distance measurement by considering the positional relationship between the camera and the target. Even when the relative position between the camera and the target photovoltaic workpiece changes, the accurate target distance can be obtained, and the scope of application is wider. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A grasping robot mechanical arm in one embodiment;
[0039] Figure 2 is a flow chart of a distance measurement method in one embodiment;
[0040] Figure 3 A schematic diagram of Euler angles of a camera in one embodiment;
[0041] Figure 4 A schematic diagram of the geometric relationship between a target photovoltaic workpiece and a target photovoltaic workpiece image in one embodiment;
[0042] Figure 5 is a schematic diagram of ranging including camera posture in one embodiment;
[0043] Figure 6 A schematic diagram of a process for obtaining a target distance based on size information of a target photovoltaic workpiece, a focal length of a camera, image coordinate information, and a rotation matrix in one embodiment;
[0044] Figure 7 A schematic diagram of a process for obtaining a first ratio of a reference point of a target photovoltaic workpiece in one embodiment;
[0045] Figure 8 A schematic diagram of a process of acquiring focal length and image coordinate information to acquire a second ratio of a reference point of a target photovoltaic workpiece in one embodiment;
[0046] Fig. 9 It is a schematic diagram of a process of obtaining a target distance based on image coordinate information, size information, focal length, first ratio, second ratio and angle information in one embodiment;
[0047] Fig.10 is a structural block diagram of a distance measuring device in one embodiment;
[0048] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] The distance measurement method in the present application is based on visual distance measurement technology to obtain the target distance between the camera and the target photovoltaic workpiece, so that the robot control system can further control the robot according to the target distance, thereby realizing the grasping method of the target photovoltaic workpiece. Among them, visual distance measurement technology can be divided into two categories: multi-eye distance measurement and monocular distance measurement. Multi-eye distance measurement obtains parallax information through feature extraction and stereo matching, and further obtains the distance information of all objects in the view based on the parallax information. Compared with multi-eye distance measurement, monocular distance measurement has the characteristics of low alignment and installation requirements, simple operation and wide application range. The distance measurement method of the present application is suitable for a monocular vision photovoltaic component installation robot grasping system 10, such as Figure 1 As shown in the structural schematic diagram of the grasping robot arm 100, a camera 110 and a grasping actuator 120 are arranged on the grasping robot arm 100, and the camera 110 is arranged close to the grasping actuator 120, so that the distance between the camera 110 and the target photovoltaic workpiece 200 is obtained, that is, the distance between the grasping actuator 120 and the target photovoltaic workpiece 200 is obtained.
[0051] In one embodiment, the present application provides a ranging method. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Figure 2The flow chart of the ranging method shown in FIG. 1 shows, the ranging method in this embodiment includes the following steps 201 to 203.
[0052] Step S201, obtaining image coordinate information of a target photovoltaic workpiece captured by a camera.
[0053] The target photovoltaic workpiece refers to the photovoltaic panel to be grasped at the specified position. The image coordinate information refers to the coordinates of the reference point in the target photovoltaic workpiece in the image coordinate system. The reference point can be a corner point, center point or other point on the surface of the target photovoltaic workpiece. The image coordinate system is established based on the target photovoltaic workpiece image captured by the camera.
[0054] Specifically, when it is detected that the target photovoltaic workpiece is placed at the designated position, it is considered that the photovoltaic workpiece is in place at this time, and the camera shoots the designated position to collect the target photovoltaic workpiece image, and further processes the target photovoltaic workpiece image to obtain image coordinate information. Exemplarily, the target photovoltaic workpiece image is segmented using the built image processing model to obtain the contour information of the target photovoltaic workpiece, and the contour information is further analyzed and processed to obtain image coordinate information. For example, a mask image of the target photovoltaic workpiece is obtained according to the target photovoltaic workpiece image, and the mask image is a binary image, and the target photovoltaic workpiece area in the mask image is white and the background area is black. A plane rectangular coordinate system is established based on any corner point of the target photovoltaic workpiece in the mask image as the origin, and the coordinates of the preset reference point in the target photovoltaic workpiece in the plane rectangular coordinate system are obtained, thereby obtaining image coordinate information. It can be understood that there are multiple ways to obtain the mask image of the target photovoltaic workpiece, such as a pre-trained Yolov8-seg model, a neighborhood operation on each pixel of the target photovoltaic workpiece image, and an image database such as OpenCV, etc., but not limited to this.
[0055] Step S202, obtaining the rotation matrix of the camera.
[0056] A rotation matrix is a matrix used to describe a linear transformation that rotates around an axis in a two-dimensional or three-dimensional space. It can change the direction of a vector without changing its magnitude and maintain the chirality of the vector (i.e., maintain the consistency of the right-handed coordinate system or the left-handed coordinate system). The rotation matrix of the camera obtained in this embodiment is a three-dimensional rotation matrix.
[0057] Specifically, Figure 3 The camera Euler angle diagram shown in the figure, the camera rotates the preset Euler angle around its own X-axis, Y-axis, and Z-axis in a preset rotation order to obtain a rotation matrix, such as rotating in an inward rotation manner in the rotation order of Z-axis-Y-axis-X-axis to obtain the first matrix , the second matrix and the third matrix , that is, the camera rotates around its own Z axis first Get the first matrix , and then rotate around its own Y axis Get the second matrix , and finally rotate around its own X axis Get the third matrix , since the rotation is performed inward, the first matrix is multiplied on the right , the second matrix and the third matrix Multiply to get the camera's rotation matrix R:
[0058] .
[0059] Step S203 , acquiring the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix.
[0060] The size information of the target photovoltaic workpiece includes the actual height and width of the target photovoltaic workpiece. The target distance is the distance between the camera and the target photovoltaic workpiece. In this embodiment, the target distance is further defined as the distance between the optical center of the camera and the center point of the target photovoltaic workpiece. The center point of the target photovoltaic workpiece can be understood as the intersection of the diagonal lines of the target photovoltaic workpiece.
[0061] Specifically, the geometric relationship between the target photovoltaic workpiece and the target photovoltaic workpiece image can be obtained according to the imaging principle, such as Figure 4 The schematic diagram of the geometric relationship between the target photovoltaic workpiece 200 and the target photovoltaic workpiece image 300 is shown in FIG. Figure 5 The distance measurement schematic diagram including the camera posture is shown, wherein A, B, C, and D are the four corner points of the target photovoltaic workpiece 200, point O is the optical center of the camera, point M is the intersection of the optical axis of the camera and the target photovoltaic workpiece 200, point E is the center point of the target photovoltaic workpiece 200, the line segment formed by point I and point D is perpendicular to the optical axis, and D' is the imaging point corresponding to point D on the imaging plane of the target photovoltaic workpiece 200 (i.e., the target photovoltaic workpiece image 300). Similarly, M' is the imaging point corresponding to point M on the imaging plane of the target photovoltaic workpiece 200 (i.e., the target photovoltaic workpiece image 300). The geometric relationship includes similar triangles formed by the first triangle and the second triangle, the first triangle is formed by the optical center point O and the imaging point D' and the imaging point M', and the second triangle is a triangle formed by the optical center point O and the points I and D. It can be understood that point D can also be any other reference point on the target photovoltaic workpiece 200, without limitation thereto. Based on this geometric relationship, the distance from the optical center to any point on the photovoltaic workpiece can be obtained. The Z axis of the camera after rotation can be obtained according to the rotation matrix, thereby obtaining the angle between the optical axis and the target photovoltaic workpiece 200 (as shown in the attached figure). Figure 5The angle α in the figure) and the reference angle related to the optical center point O and point M (as shown in the attached figure) Figure 5 ), thereby combining the Pythagorean theorem, the target distance can be obtained according to the distance from the optical center to any point on the photovoltaic workpiece, the size information of the target photovoltaic workpiece 200, the angle between the optical axis and the target photovoltaic workpiece 200, and the reference angle related to the optical center point O and point M.
[0062] For example, Figure 6 The flowchart shown is for obtaining the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix. The flowchart shown is for obtaining the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix, including the following steps S601 to S603.
[0063] Step S601: acquiring first ratios and second ratios of a plurality of reference points based on the focal length and image coordinate information.
[0064] Wherein, the first ratio is the ratio of the first distance to the second distance, and the second ratio is the ratio of the third distance to the second distance; Figure 4 , attached Figure 4 The case where the reference point is point D is shown. Taking point D as an example for explanation, the first distance is the distance OI from the optical center O to the first intersection I, the first intersection I is the intersection of the vertical line DI and the optical axis of the camera, the vertical line DI is perpendicular to the optical axis and the reference point D is located on the vertical line DI; the second distance is the distance DO from the reference point D to the optical center O; the third distance is the distance from the reference point D to the optical axis of the camera. It can be understood that in other cases, the reference point can be other points on the target photovoltaic workpiece 200, not limited to the attached Figure 4 Point D in .
[0065] For example, Figure 7 The flowchart of obtaining a first ratio of a reference point of a target photovoltaic workpiece is shown. Obtaining the first ratio of a reference point of a target photovoltaic workpiece includes the following steps S6011 and S6012.
[0066] Step S6011, obtaining a first imaging distance according to image coordinate information.
[0067] The first imaging distance is the distance between the imaging point corresponding to the reference point and the imaging point corresponding to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece.
[0068] See attached Figure 4, take the reference point D as an example for explanation, the imaging point corresponding to the above reference point is D', the second intersection point is M, the imaging point corresponding to the second intersection point is M', that is, the first imaging distance is D'M'. A plane image rectangular coordinate system is established with a corner point of the target photovoltaic workpiece in the target photovoltaic workpiece image 300 as the origin, wherein the image coordinate information refers to the coordinates of the imaging points D' and M'. It can be understood that OM' is the focal length, and D'M' can be obtained based on the coordinates of D' and M', and the first imaging distance OD' can be obtained based on the Pythagorean theorem.
[0069] Step S6012: Obtain a first ratio based on the ratio of the focal length to the first imaging distance based on the principle of similar triangles.
[0070] Specifically, according to similar triangles, OI / DO=OM' / OD', so the first ratio can be obtained.
[0071] Similarly, if Figure 8 The flowchart of obtaining focal length and image coordinate information to obtain a second ratio of a reference point of a target photovoltaic workpiece is shown. Obtaining focal length and image coordinate information to obtain a second ratio of a reference point of a target photovoltaic workpiece includes the following steps S6013 to S6014.
[0072] Step S6013, acquiring the first imaging distance and the second imaging distance according to the image coordinate information.
[0073] Among them, the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera, the second imaging distance is the distance between the imaging point corresponding to the reference point and the imaging point corresponding to the second intersection point, and the second intersection point is the intersection of the optical axis of the camera and the target photovoltaic workpiece.
[0074] See attached Figure 4 , take the reference point D as an example for explanation, the imaging point corresponding to the above reference point is D', the second intersection point is M, the imaging point corresponding to the second intersection point is M', that is, the first imaging distance is D'M'. A plane image rectangular coordinate system is established with a corner point of the target photovoltaic workpiece in the target photovoltaic workpiece image as the origin, wherein the image coordinate information refers to the coordinates of the imaging points D' and M'. It can be understood that OM' is the focal length, and the second imaging distance D'M' can be obtained based on the coordinates of D' and M'. Based on the Pythagorean theorem, the first imaging distance OD' can be obtained when OM' and D'M' are known.
[0075] Step S6014: obtaining a second ratio based on the ratio of the second imaging distance to the first imaging distance based on the principle of similar triangles.
[0076] Specifically, based on the principle of similar triangles, DI / DO=D'M' / OD', so the second ratio can be obtained.
[0077] Step S602: acquiring angle information between the optical axis of the camera and the target photovoltaic workpiece based on the rotation matrix.
[0078] Specifically, get the Z axis of the camera after rotation according to the rotation matrix:
[0079] .
[0080] Reference Figure 5 , where the angle information includes the angle α and angle β between the optical axis and the target photovoltaic workpiece, and the angle information angle α and angle β of the target photovoltaic workpiece are further obtained according to the following formula:
[0081] .
[0082] Step S603, acquiring the target distance based on the image coordinate information, size information, focal length, first ratio, second ratio and angle information.
[0083] Specifically, Fig. 9 The flowchart shown is for obtaining the target distance based on image coordinate information, size information, focal length, first ratio, second ratio and angle information. The process of obtaining the target distance based on image coordinate information, size information, focal length, first ratio, second ratio and angle information includes the following steps S6031 to S6033.
[0084] Step S6031, establish a world rectangular coordinate system with the optical center of the camera as the origin and the direction of gravity as the Z axis.
[0085] For details, please refer to the attached Figure 4 , where the world rectangular coordinate system is O-X0Y0Z0.
[0086] Step S6032, obtaining the reference coordinates and the fourth distance of the target reference point in the world rectangular coordinate system according to the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information.
[0087] The target reference point is any one of the multiple reference points; the fourth distance is the distance from the optical center of the camera to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece.
[0088] Reference Figure 4 , taking the target reference point as point D as an example for explanation, the fourth distance in this embodiment is OM. OM=OI+IM= Similarly, taking the other two reference points as point A and point E as an example, there exists OM= , OM= , based on this, construct the equation system in the world coordinate system:
[0089] ; Wherein, i1=OI / DO, i2=DI / DO, j1=OI / AO, j2=AI / AO, k1=OE / EO, K2=EI / EO, W is the width of the target photovoltaic workpiece, H is the height of the target photovoltaic workpiece, x=OM, a and b are the coordinates of the target reference point D in the world rectangular coordinate system.
[0090] It is understandable that the above equation group can be solved to obtain the coordinates (a, b) of the target reference point D and the fourth distance x, or the above equation group can be solved by the damped Newton method.
[0091] For example, by solving the damped Newton method, based on the pinhole imaging principle: f / d=h / H, the distance d=Hf / h between the plane where the target photovoltaic workpiece is located and the plane where the optical center of the camera is located can be obtained, where f is the focal length and h is the pixel height of the target photovoltaic workpiece image. Take d as the approximate x, and take d as the initial value to iterate through the damped Newton method to obtain the coordinates (a, b) of the target reference point D and the fourth distance x.
[0092] Step S6033, obtaining the target distance according to the size information, the angle information, the reference coordinates and the fourth distance.
[0093] Specifically, the formula for obtaining the target distance according to the size information, the angle information, the reference coordinates and the fourth distance is: , where |OE| is the target distance.
[0094] It is understandable that, since the relative orientation relationship and angle between the camera and the target photovoltaic workpiece will change with the posture of the camera, the distance measurement method in this embodiment combines the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix. According to the rotation matrix of the camera, the position information of the camera at this moment and the relative orientation relationship and angle between the camera and the target photovoltaic workpiece can be obtained. Therefore, the target distance finally obtained will be more accurate, and the influence of factors such as light refraction and reflection, and the size difference of different target photovoltaic workpieces can be reduced. In addition, the traditional distance measurement formula needs to keep the camera viewing angle unchanged, but in the actual application of the robot installation, the viewing angle may change. The distance measurement method of the present application, because it combines the camera rotation matrix, can overcome the influence of different influencing factors on the distance measurement by considering the position relationship between the camera and the target, and can obtain accurate target distance even when the relative position between the camera and the target photovoltaic workpiece changes, and has a wider range of application.
[0095] In one embodiment, the present application further provides a robot control method, including the distance measurement method in any of the above embodiments, and controlling the robot to grasp the target photovoltaic workpiece according to the target distance obtained by the distance measurement method.
[0096] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0097] In one embodiment, the present application also provides a photovoltaic workpiece grasping system, including a control device and a grasping robot arm, the grasping robot arm is provided with a camera and a grasping actuator, the camera is arranged close to the grasping actuator, the control device is used to execute the distance measurement acquisition method in any of the above embodiments, and control the grasping actuator in the grasping robot arm to grasp and install the target photovoltaic workpiece according to the acquired target distance.
[0098] Based on the same inventive concept, the embodiment of the present application also provides a distance measuring device for implementing the distance measuring method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more distance measuring device embodiments provided below can refer to the limitations on the distance measuring method above, and will not be repeated here.
[0099] In one embodiment, a distance measuring device 1000 is provided, such as Fig.10 The structural schematic block diagram of the ranging device 1000 shown in the figure, the ranging device 1000 in this embodiment includes an image processing module 1100, a data processing module 1200 and a ranging module 1300, the image processing module 1100 is used to obtain the image coordinate information of the target photovoltaic workpiece collected by the camera; the data processing module 1200 is used to obtain the rotation matrix of the camera; the ranging module 1300 is used to obtain the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix; the target distance is the distance between the camera and the target photovoltaic workpiece.
[0100] In one embodiment, the ranging module is also used to obtain the first ratio and the second ratio of multiple reference points respectively based on the focal length and image coordinate information; the first ratio is the ratio of the first distance to the second distance, and the second ratio is the ratio of the third distance to the second distance; the first distance is the distance from the optical center to the first intersection point, the first intersection point is the intersection of the vertical line and the optical axis of the camera, the vertical line is perpendicular to the optical axis and the reference point is located on the vertical line; the second distance is the distance from the reference point to the optical center; the third distance is the distance from the reference point to the optical axis of the camera; the angle information of the optical axis of the camera and the target photovoltaic workpiece is obtained based on the rotation matrix; the target distance is obtained based on the image coordinate information, size information, focal length, first ratio, second ratio and angle information.
[0101] In one embodiment, the ranging module is also used to establish a world rectangular coordinate system with the optical center of the camera as the origin and the direction of gravity as the Z axis; obtain the reference coordinates and the fourth distance of the target reference point in the world rectangular coordinate system according to the image coordinate information, size information, focal length, first ratio, second ratio and angle information; the target reference point is any one of multiple reference points; the fourth distance is the distance from the optical center of the camera to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece; obtain the target distance according to the size information, angle information, reference coordinates and the fourth distance.
[0102] In one embodiment, the ranging module is also used to obtain the pixel height of the target photovoltaic workpiece based on the image coordinate information; obtain the reference distance according to the size information, focal length, pixel height and pinhole imaging ranging formula of the target photovoltaic workpiece; establish an acquisition model according to the image coordinate information, size information, first ratio, second ratio and angle information; use the reference distance as the initial fourth distance, and substitute the initial fourth distance into the acquisition model through the damped Newton method to obtain the reference coordinates and the fourth distance.
[0103] In one embodiment, the ranging module is also used to obtain a first imaging distance based on image coordinate information; the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera; based on the principle of similar triangles, the first ratio is obtained according to the ratio of the focal length to the first imaging distance.
[0104] In one embodiment, the ranging module is also used to obtain a first imaging distance and a second imaging distance based on the image coordinate information; the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera, and the second imaging distance is the distance between the imaging point corresponding to the reference point and the imaging point corresponding to the second intersection point, and the second intersection point is the intersection of the optical axis of the camera and the target photovoltaic workpiece; based on the principle of similar triangles, the second ratio is obtained according to the ratio of the second imaging distance to the first imaging distance.
[0105] Each module in the above-mentioned distance measuring device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0106] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a distance measurement method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.
[0107] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0108] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0109] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0110] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are performed.
[0111] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0112] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0113] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A distance measurement method, characterized in that: include: Obtain image coordinate information of the target photovoltaic workpiece captured by the camera; Get the rotation matrix of the camera; A target distance is acquired based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix; the target distance is the distance between the camera and the target photovoltaic workpiece.
2. The distance measurement method according to claim 1, characterized in that: Acquiring a target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix includes: Based on the focal length and the image coordinate information, a first ratio and a second ratio of multiple reference points are respectively obtained; the first ratio is a ratio of a first distance to a second distance, and the second ratio is a ratio of a third distance to the second distance; the first distance is a distance from an optical center to a first intersection point, the first intersection point is an intersection point of a vertical line and an optical axis of the camera, the vertical line is perpendicular to the optical axis and the reference point is located on the vertical line; the second distance is a distance from the reference point to the optical center; the third distance is a distance from the reference point to the optical axis of the camera; Acquire angle information between the optical axis of the camera and the target photovoltaic workpiece based on the rotation matrix; The target distance is acquired based on the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information.
3. The distance measurement method according to claim 2, characterized in that: Acquiring the target distance based on the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information includes: A world rectangular coordinate system is established with the optical center of the camera as the origin and the direction of gravity as the Z axis; Acquire the reference coordinates and the fourth distance of the target reference point in the world rectangular coordinate system according to the image coordinate information, the size information, the focal length, the first ratio, the second ratio and the angle information; the target reference point is any one of the multiple reference points; the fourth distance is the distance from the optical center of the camera to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece; The target distance is acquired according to the size information, the angle information, the reference coordinates and the fourth distance.
4. The distance measurement method according to claim 3, characterized in that: Acquiring a reference coordinate and a fourth distance of a target reference point in the world rectangular coordinate system according to the image coordinate information, the size information, the focal length, the first ratio, the second ratio, and the angle information, including: Acquire a pixel height of the target photovoltaic workpiece based on the image coordinate information; Acquire a reference distance according to the size information of the target photovoltaic workpiece, the focal length, the pixel height, and a pinhole imaging distance measurement formula; Establishing an acquisition model according to the image coordinate information, the size information, the first ratio, the second ratio and the angle information; The reference distance is used as an initial fourth distance, and the initial fourth distance is substituted into the acquisition model through the damped Newton method to acquire the reference coordinates and the fourth distance.
5. The distance measurement method according to claim 2, characterized in that: Acquiring a first ratio of a reference point of the target photovoltaic workpiece based on the focal length and the image coordinate information includes: Acquire a first imaging distance according to the image coordinate information; the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera; The first ratio is obtained according to the ratio of the focal length to the first imaging distance based on the principle of similar triangles.
6. The distance measurement method according to claim 2, characterized in that: Acquiring a second ratio of a reference point of the target photovoltaic workpiece based on the focal length and the image coordinate information, comprising: Acquire a first imaging distance and a second imaging distance according to the image coordinate information; the first imaging distance is the distance between the imaging point corresponding to the reference point and the optical center of the camera, the second imaging distance is the distance between the imaging point corresponding to the reference point and the imaging point corresponding to the second intersection point, and the second intersection point is the intersection point of the optical axis of the camera and the target photovoltaic workpiece; The second ratio is obtained according to the ratio of the second imaging distance to the first imaging distance based on the principle of similar triangles.
7. A robot control method, characterized in that: include: The distance measurement method according to any one of claims 1 to 6; The robot is controlled to grab the target photovoltaic workpiece according to the target distance obtained by the distance measurement method.
8. A distance measuring device, characterized in that: The distance measuring device comprises: An image processing module, used for acquiring image coordinate information of a target photovoltaic workpiece collected by a camera; A data processing module, used to obtain the rotation matrix of the camera; The distance measuring module is used to obtain the target distance based on the size information of the target photovoltaic workpiece, the focal length of the camera, the image coordinate information and the rotation matrix; the target distance is the distance between the camera and the target photovoltaic workpiece.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Hand-eye calibration method and device and movement mechanism system
CN119887940A
Hand-eye calibration method and device and motion mechanism system
CN119887940B
