Spatial positioning methods, biochip mobility methods and related equipment
By constructing a set of positioning equations using computer vision technology, the problems of low spatial positioning accuracy and high cost in existing technologies have been solved, achieving efficient and low-cost precise positioning.
Patent Information
- Application Number
- CN202311555314.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-11-20
AI Technical Summary
In existing technologies, spatial positioning methods are characterized by low accuracy and high cost in complex environments. In particular, the positioning accuracy of inertial sensors is insufficient, making it difficult to meet the high positioning requirements.
Using computer vision technology, a circular marker on the target object is photographed by a camera to obtain the target image. The positioning equations are constructed using the camera intrinsic parameters and the diameter of the marker to solve the position of the marker in the camera coordinate system, thereby achieving precise positioning.
It reduces positioning costs, improves the accuracy and efficiency of spatial positioning, avoids distortion caused by pose changes, and provides a high-precision spatial positioning solution.
Smart Images

Figure CN120020880B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of positioning technology, and in particular to a spatial positioning method, a biochip movement method based on a robotic arm, and related equipment. Background Technology
[0002] With the development of industrial technology, the demand for spatial positioning has received increasing attention in many fields such as manufacturing, aerospace, and navigation. Common technologies used for spatial positioning include Bluetooth, ultrasonic, infrared, laser, and WiFi. However, these methods require active transmitters, which are difficult and costly to deploy and susceptible to interference in complex environments. Inertial sensors are also used for positioning; however, inertial sensors suffer from low positioning accuracy. Summary of the Invention
[0003] In view of the above, it is necessary to propose a spatial positioning method, a biochip movement method based on a robotic arm, and related equipment to solve the technical problem of low accuracy in spatial positioning. The related equipment includes a spatial positioning device, electronic equipment, and storage medium.
[0004] This application provides a spatial positioning method applied to an electronic device. The electronic device is communicatively connected to a camera, which is used to photograph a target object to be positioned. The target object has a circular marker. The method includes: acquiring a target image of the marker captured by the camera, wherein the marker includes a center, a first target point, and a second target point; acquiring the number of target pixels occupied by the diameter of the marker in the target image; determining a first distance between the center and the origin of the camera coordinate system based on the number of target pixels, the camera's intrinsic parameters, and a pre-stored length parameter; and determining a first preset point located on the line connecting the origin and the first target point. The distance between the first preset point and the origin is equal to the first distance; a second preset point is determined on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance; the coordinate representations of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system are determined; a set of positioning equations is constructed based on the first distance, the diameter of the marker, and the coordinate representations; the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system are determined based on the set of positioning equations; and the position of the target object to be positioned in the camera coordinate system is determined based on the coordinates.
[0005] In some embodiments, the method for determining the pre-stored pixel length parameter includes: acquiring a test image of the marker captured by the camera, wherein the distance between the center of the marker and the origin of the camera coordinate system is equal to the test distance; determining the number of test pixels occupied by the diameter of the marker in the test image; calculating the length represented by each pixel in the test image in the camera coordinate system based on the camera's intrinsic parameters, the test distance, and the number of test pixels, to obtain the pre-stored length parameter.
[0006] In some embodiments, determining the first distance between the center of the circle and the origin of the camera coordinate system based on the number of target pixels, the camera's intrinsic parameters, and pre-stored pixel length parameters includes: calculating the product of the pixel length parameters and the number of target pixels to obtain the virtual diameter of the marker in the target image; calculating the ratio between the diameter and the virtual diameter; and obtaining the first distance by calculating the product of the ratio and the camera's intrinsic parameters.
[0007] In some embodiments, the positioning equation set includes a first equation set, and the method for determining the first equation set includes: determining a first vector based on the coordinate representation of the center of the circle and the coordinate representation of the first target point; determining a second vector based on the coordinate representation of the center of the circle and the coordinate representation of the second target point; determining a third vector based on the coordinate representation of the center of the circle and the coordinates of the origin of the camera coordinate system; determining a fourth vector based on the coordinate representation of the first preset point and the coordinates of the origin of the camera coordinate system; determining a fifth vector based on the coordinate representation of the second preset point and the coordinates of the origin of the camera coordinate system; and determining the first equation set by calculating the magnitudes of the first vector, the second vector, the third vector, the fourth vector, and the fifth vector.
[0008] In some embodiments, the first vector is perpendicular to the second vector, and the set of positioning equations further includes a first positioning equation. The method for determining the first positioning equation includes: determining the first positioning equation based on the dot product of the first vector and the second vector.
[0009] In some embodiments, the positioning equation set further includes a second equation set, and the method for determining the second equation set includes: determining a sixth vector based on the coordinate representation of the center of the circle and the coordinate representation of the first preset point; determining a seventh vector based on the coordinate representation of the center of the circle and the coordinate representation of the second preset point; and determining the second equation set based on the sixth vector and the seventh vector.
[0010] In some embodiments, the target image further includes a first line connecting the center of the circle and the first target point, and a second line connecting the center of the circle and the second target point. The positioning equation set includes a second positioning equation. The method for determining the second positioning equation includes: identifying a first line segment corresponding to the first line in the target image, and identifying a second line segment corresponding to the second line in the target image; obtaining the cosine value of the angle between the first line segment and the second line segment in the target image by identifying the angle between them; and constructing the second positioning equation based on the coordinate representation of the center of the circle, the coordinate representation of the first preset point, the coordinate representation of the second preset point, and the cosine value.
[0011] This application embodiment also provides a spatial positioning device, the device comprising: an acquisition module, configured to acquire a target image obtained by a camera capturing an image of a marker, wherein the marker includes a center, a first target point, and a second target point; an identification module, configured to acquire the number of target pixels occupied by the diameter of the marker in the target image; a calculation module, configured to determine a first distance between the center and the origin of the camera coordinate system based on the number of target pixels, the camera's intrinsic parameters, and a pre-stored length parameter; and a determination module, configured to determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance; the determination module is further configured to determine a point located on the line connecting the origin and the first target point. The determining module is further configured to determine the coordinate representations of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system; the determining module is further configured to construct a set of positioning equations based on the first distance, the diameter of the marker, and the coordinate representations; the determining module is further configured to determine the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system based on the set of positioning equations; the determining module is further configured to determine the position of the target object to be located in the camera coordinate system based on the coordinates.
[0012] This application also provides an electronic device, which includes: a memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the spatial positioning method.
[0013] This application also provides a computer-readable storage medium storing at least one instruction, which is executed by a processor in an electronic device to implement the spatial positioning method.
[0014] This application embodiment also provides a posture control mechanism for a robotic arm, wherein a camera is mounted on the robotic arm, and the posture control mechanism includes the electronic device.
[0015] This application embodiment also provides a biochip movement method based on a robotic arm. The robotic arm is equipped with a monocular camera, and the biochip is associated with a marker. The biochip movement method includes: using the monocular camera to capture an image of the marker to obtain a target image, wherein the marker includes a center, a first target point, and a second target point; obtaining the number of target pixels occupied by the diameter of the marker in the target image; determining a first distance between the center and the origin of the camera coordinate system based on the number of target pixels, the intrinsic parameters of the monocular camera, and pre-stored length parameters; determining a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance; and determining a point located on the line connecting the origin and the first target point. A second preset point is established on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance; the coordinates of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system are determined; a set of positioning equations is constructed based on the first distance, the diameter of the marker, and the coordinates; the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system are determined based on the set of positioning equations; the position of the biochip in the camera coordinate system is determined based on the coordinates; and the posture of the robotic arm is adjusted to grasp the biochip based on the position of the biochip in the camera coordinate system.
[0016] As can be seen from the above technical solutions, the embodiments of this application can obtain a target image containing the marker by taking a picture of a circular marker placed on the target object to be located. The distance between the marker and the camera is determined based on the camera's intrinsic parameters and the marker's diameter. A positioning equation is constructed based on this distance and the coordinates of multiple target points on the marker in the camera coordinate system. By solving the positioning equation, the position of the marker in the camera coordinate system is obtained, thereby determining the position of the target object to be located in the camera coordinate system. The spatial positioning method provided by this application only uses computer vision assistance and does not require the deployment of high-cost positioning equipment such as LiDAR to complete the spatial positioning of the target object, thus reducing positioning costs and improving spatial positioning efficiency. Furthermore, the circular shape of the marker can avoid distortion caused by pose changes, thereby improving the accuracy of spatial positioning. Attached Figure Description
[0017] Figure 1 This is a schematic diagram illustrating an application scenario of the spatial positioning method provided in an embodiment of this application.
[0018] Figure 2 This is a flowchart of a spatial positioning method provided in an embodiment of this application.
[0019] Figure 3 This is a flowchart of a method for determining control intent provided in an embodiment of this application.
[0020] Figure 4 This is a flowchart of a method for determining target control instructions provided in an embodiment of this application.
[0021] Figure 5 This is a schematic diagram of the markers in the camera coordinate system provided in one embodiment of this application.
[0022] Figure 6 This is a flowchart of a method for determining a first set of equations provided in an embodiment of this application.
[0023] Figure 7 This is a flowchart of a method for determining a second set of equations provided in an embodiment of this application.
[0024] Figure 8 This is a schematic diagram showing the positional relationship between the first and second preset points and the marker provided in an embodiment of this application.
[0025] Figure 9 This is a flowchart of a method for determining a second positioning equation provided in an embodiment of this application.
[0026] Figure 10 This is a functional block diagram of a spatial positioning device provided in an embodiment of this application.
[0027] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0028] Figure 12 This is a robotic arm posture control mechanism provided in one embodiment of this application.
[0029] Figure 13 This is a flowchart of a biochip movement method based on a robotic arm provided in one embodiment of this application. Detailed Implementation
[0030] To better understand the purpose, features, and advantages of this application, a detailed description of the application is provided below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this application can be combined with each other. Numerous specific details are set forth in the following description to provide a thorough understanding of this application; the described embodiments are only a part of the embodiments of this application, and not all of them.
[0031] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0033] This application provides a spatial positioning method that can be applied to one or more electronic devices. An electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0034] Electronic devices can be any electronic product that allows human-computer interaction with a customer, such as personal computers, tablets, smartphones, personal digital assistants (PDAs), game consoles, interactive network television (IPTV), smart wearable devices, etc.
[0035] Electronic devices may also include network devices and / or client devices. The network devices include, but are not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.
[0036] The networks in which electronic devices are located include, but are not limited to, the Internet, wide area networks, metropolitan area networks, local area networks, and virtual private networks (VPNs).
[0037] like Figure 1As shown, the spatial positioning method provided in this application can be applied to an electronic device 100, which is communicatively connected to a camera 200. The camera 200 receives a shooting command sent by the electronic device 100, and according to the shooting command, captures a picture of the target object 400 to be located, which is equipped with a marker 300, thus obtaining a target image including the marker 300.
[0038] In one embodiment of this application, the electronic device 100 may be a processor in the camera 200, or it may be a device with data processing function that is communicatively connected to the camera 200. This application does not limit this aspect.
[0039] For example, when the spatial positioning method is applied to an industrial production line, the camera 200 can be a camera set on a robotic arm on the production line, the target object 400 to be positioned can be a jig to be grasped on the production line, and the marker 300 can be a circular sticker pasted on the jig; when the spatial positioning method is applied to an engineering construction scenario, the camera 200 can be a camera set at the end of a tower crane, the target object 400 to be positioned can be building materials, and the marker 300 can be any circular marker set on the building materials (e.g., a circular sticker pasted on the building materials, or a circular iron piece embedded in the building materials).
[0040] In one embodiment of this application, a first target point (not shown) and a second target point (not shown) are provided on the marker 300. When spatially locating the target object 400, the marker 300 can be photographed by the camera 200 to obtain a target image. A first distance between the marker 300 and the camera 200 is determined based on the image information corresponding to the marker 300 in the target image and the intrinsic parameters of the camera 200. A set of positioning equations is constructed based on the first distance, the coordinates of the marker's center in the camera coordinate system, the coordinates of the first target point in the camera coordinate system, and the coordinates of the second target point in the camera coordinate system. By solving this set of positioning equations, each of the aforementioned coordinate representations is obtained, the position of the marker in the camera coordinate system is determined, and thus the position of the target object to be located in the camera coordinate system is determined.
[0041] like Figure 2 The diagram shown is a flowchart of a spatial positioning method provided in an embodiment of this application. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The spatial positioning method provided in this embodiment includes the following steps.
[0042] S20, acquire the target image obtained by the camera capturing the marker, wherein the marker includes a center, a first target point, and a second target point.
[0043] In one embodiment of this application, in order to locate the object to be located using computer vision technology, a target image obtained by a camera capturing a marker can first be acquired. Since the marker is placed on the target object to be located, the position of the target object can be represented by the position of the marker after the marker is located.
[0044] In one embodiment of this application, the marker is circular. For example, the marker can be a circular sticker, or a piece of iron embedded in the surface of the target object to be positioned. This application embodiment does not limit the specific type of the marker. The marker includes a center, a first target point, and a second target point. The distance between the first target point and the center is equal to the distance between the second target point and the center, and a first line connecting the first target point and the center is perpendicular to a second line connecting the second target point and the center. For example, when the marker is a circular sticker, the center is the center of the sticker, and the first and second target points can be pre-set points on the edge of the sticker.
[0045] S21, obtain the number of target pixels occupied by the diameter of the marker in the target image.
[0046] In one embodiment of this application, in order to determine the position of the marker in the camera coordinate system, the number of target pixels occupied by the diameter of the marker in the target image can be determined first, and then the distance between the center of the target and the origin of the camera coordinate system can be determined based on the number of target pixels and the camera intrinsic parameters.
[0047] In one embodiment of this application, obtaining the number of target pixels occupied by the diameter of the marker in the target image includes: determining the number of pixels occupied by the marker in the target image using a preset target detection algorithm; and determining the widest point among the pixels as the target pixel. The preset target detection algorithm can be a region growing algorithm, watershed algorithm, VGGNet, residual neural network, or other algorithms with target detection capabilities. This embodiment of the application does not limit the specific type of target detection algorithm.
[0048] In one embodiment of this application, after determining the pixel point of the marker in the target image, all pixels at the widest point are queried among the pixels to determine the target pixel point corresponding to the diameter of the marker in the target image.
[0049] S22, determine the first distance between the center of the circle and the origin of the camera coordinate system based on the number of target pixels, the intrinsic parameters of the camera, and the pre-stored length parameters.
[0050] In one embodiment of this application, a pre-stored length parameter is used to characterize the distance in the camera coordinate system represented by each pixel in the target image when the camera captures the target object at that focal length. To obtain the pre-stored length parameter, a marker can be pre-set at a test position, and a test image obtained by the camera capturing the marker at the test position can be acquired. The test position is a preset test distance from the origin of the camera coordinate system. The pre-stored length parameter is determined based on the test distance, camera intrinsic parameters, and the number of test pixels occupied by the diameter of the marker in the test image. Specifically, for the method of determining the pre-stored length parameter, please refer to [link to relevant documentation]. Figure 3 The corresponding explanation.
[0051] In one embodiment of this application, to determine the position of a marker in the camera coordinate system, a first distance between the center of the marker and the origin of the camera coordinate system can be determined based on the number of target pixels, the camera's intrinsic parameters, and pre-stored length parameters. The camera's intrinsic parameters can be the focal length when the camera captures the target image. For a specific method for determining the first distance, please refer to [link to relevant documentation]. Figure 4 The corresponding explanation.
[0052] S23, determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance.
[0053] In one embodiment of this application, to determine the position of a marker in the camera coordinate system, a first preset point can be determined in the camera coordinate system. This first preset point is located on the line connecting the origin of the camera coordinate system and a first target point, and the distance between the first preset point and the origin is equal to a first distance. Subsequently, the position of the marker in the camera coordinate system can be determined based on the positional relationship between the first preset point and the center of the circle, the origin of the camera coordinate system, and the first target point.
[0054] S24, determine a second preset point located on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance.
[0055] In one embodiment of this application, to determine the position of the marker in the camera coordinate system, a second preset point can be determined in the camera coordinate system. This second preset point is located on the line connecting the origin of the camera coordinate system and the second target point, and the distance between the second preset point and the origin is also equal to the first distance. Subsequently, the position of the marker in the camera coordinate system can be determined based on the positional relationship between the second preset point and the center of the circle, the origin of the camera coordinate system, and the second target point.
[0056] S25, determine the coordinate representation of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system.
[0057] In one embodiment of this application, in order to determine the position of the marker in the camera coordinate system based on the relative positional relationship between the center of the circle, the first target point, the second target point, the first preset point, and the second preset point, the coordinate representation of the center of the marker, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system can first be determined.
[0058] In one embodiment of this application, the coordinates of the origin O of the camera coordinate system can be represented as (0,0,0); the coordinates of the center A can be represented as (u,v,w); the coordinates of the first target point B can be represented as (l,m,n); and the coordinates of the second target point C can be represented as (i,j,k).
[0059] In one embodiment of this application, since the first preset point lies on the line connecting the origin and the first target point, and the second preset point lies on the line connecting the origin and the second target point, the coordinate representation of the first preset point can be determined based on the coordinate representation of the first target point, and the coordinate representation of the second preset point can be determined based on the coordinate representation of the second target point. Therefore, the coordinate representation of the first preset point B' can be (l*t, m*t, n*t), where t represents a preset first proportional variable; the coordinate representation of the second preset point C' can be (i*T, j*T, k*T), where T represents a preset second proportional variable.
[0060] In one embodiment of this application, the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system can be determined based on the above coordinate representation and the relative positional relationship between each point, and then the position of the marker in the camera coordinate system can be determined based on the center of the circle, the first target point, and the second target point.
[0061] S26, construct a set of positioning equations based on the first distance, the diameter of the marker, and the coordinate representation.
[0062] In one embodiment of this application, to obtain the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system, and to determine the position of the marker in the camera coordinate system, a set of positioning equations can be constructed based on the first distance, the diameter of the marker, and all coordinate representations. The set of positioning equations characterizes the relative positional relationships between the center of the circle, the first target point, the second target point, the first preset point, and the second preset point. For a specific method for determining the set of positioning equations, please refer to [link to relevant documentation]. Figure 3 , Figure 4 , Figure 6 , Figure 7 as well as Figure 9 The corresponding explanation.
[0063] S27. Based on the positioning equations, determine the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system.
[0064] In one embodiment of this application, the positioning equations are used to characterize the relative positional relationship between the coordinate representations of each point. Based on the known distance from the center of the marker circle to the origin of the camera coordinate system, the positioning equations are solved to obtain the positions of the center, the first target point, and the second target point in the camera coordinate system.
[0065] S28, determine the position of the target object to be located in the camera coordinate system based on the coordinates.
[0066] In one embodiment of this application, since a plane can be determined using three points, after obtaining the coordinates of the center of the circle, the first target point, and the second target point, the position and orientation of the marker in the camera coordinate system can be determined based on the above coordinates, thereby determining the position and orientation of the target object to be located in the camera coordinate system.
[0067] As can be seen from the above technical solutions, the embodiments of this application can obtain a target image containing the marker by taking a picture of a circular marker placed on the target object to be located. The distance between the marker and the camera is determined based on the camera's intrinsic parameters and the marker's diameter. A positioning equation is constructed based on this distance and the coordinates of multiple target points on the marker in the camera coordinate system. By solving the positioning equation, the position of the marker in the camera coordinate system is obtained, thereby determining the position of the target object to be located in the camera coordinate system. The spatial positioning method provided by this application only uses computer vision assistance and does not require the deployment of high-cost positioning equipment such as LiDAR to complete the spatial positioning of the target object, thus reducing positioning costs and improving spatial positioning efficiency. Furthermore, the circular shape of the marker can avoid distortion caused by pose changes, thereby improving the accuracy of spatial positioning.
[0068] like Figure 3 The diagram shown is a flowchart of a method for determining a pre-stored length parameter according to an embodiment of this application. The order of steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The method for determining a pre-stored length parameter provided in this embodiment includes the following steps.
[0069] S30, acquire a test image of the marker captured by the camera, wherein the distance between the center of the marker and the origin of the camera coordinate system is equal to the test distance.
[0070] In one embodiment of this application, in order to determine the pre-stored length parameter, a test image of the marker located at the test position can first be acquired by the camera. The distance between the test position of the marker and the origin of the camera coordinate system is equal to the test distance; that is, the distance between the center of the marker and the origin of the camera coordinate system is equal to the test distance.
[0071] S31, determine the number of test pixels occupied by the diameter of the marker in the test image.
[0072] In one embodiment of this application, determining the number of test pixels occupied by the diameter of the marker in the test image includes: determining the number of pixels occupied by the marker in the test image using a preset target detection algorithm; and determining the widest point among the pixels as the test pixel. The preset target detection algorithm can be an algorithm with target detection capabilities, such as region growing, watershed algorithm, VGGNet, or residual neural network. This embodiment of the application does not limit the specific type of target detection algorithm.
[0073] S32, calculate the length represented by each pixel in the test image in the camera coordinate system based on the camera's intrinsic parameters, the test distance, and the number of test pixels, and obtain the pre-stored length parameter.
[0074] In one embodiment of this application, the camera's intrinsic parameter refers to the focal length used by the camera when photographing the marker at the test position, and the method for determining the pre-stored length parameter satisfies the following relationship:
[0075]
[0076] Where l represents the pre-stored length parameter; d represents the diameter of the marker; f 测试 This represents the focal length used by the camera when photographing the representation at the test position; p 测试 Represents the number of test pixels; r 测试 The test distance between the center of the marker and the origin of the camera coordinate system.
[0077] like Figure 4 The diagram shown is a flowchart of a method for determining a first distance according to an embodiment of this application. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The method for determining a first distance provided in this embodiment includes the following steps.
[0078] S40, calculate the product of the pixel length parameter and the number of target pixels to obtain the virtual diameter of the marker in the target image.
[0079] In one embodiment of this application, the virtual diameter of the marker in the target image is obtained by calculating the product between the length parameter and the number of target pixels. The virtual diameter characterizes the length of the marker's diameter in the target image, corresponding to the number of pixels in the camera coordinate system.
[0080] For example, such as Figure 5The diagram shown is a schematic representation of an identifier mapped onto a target image according to an embodiment of this application. The identifier 51 corresponds to a circle 52 in the target image. The line segment 54 between the center of the identifier 51 and the origin 53 of the camera coordinate system represents the distance from the center of the identifier to the origin 53. The line segment 55 between the center of the circle 52 and the origin 53 of the camera coordinate system represents the focal length of the camera (hereinafter referred to as focal length 55). The diameter of the identifier 51 is represented by a dashed line segment 56, and the diameter of the circle 52 is represented by a dashed line segment 57. The dashed line segment 57 represents the virtual diameter of the identifier 51 in the target image.
[0081] S41, calculate the ratio between the diameter and the virtual diameter.
[0082] In one embodiment of this application, the ratio between the distance between the center of the marker and the origin of the camera coordinate system and the camera's intrinsic parameter (focal length) is equal to the ratio between the diameter of the marker and the virtual diameter. Therefore, the ratio between the diameter of the marker and the virtual diameter can be calculated first, and then the first distance between the center of the marker and the origin of the camera coordinate system can be determined based on this ratio and the camera's focal length.
[0083] For example, such as Figure 5 As shown, the ratio between line segment 54 and focal length 55 is equal to the ratio between dashed line segments 56 and 57. Therefore, the ratio between dashed line segments 56 and 57 can be determined first, and then the length of line segment 54 can be determined based on this ratio and focal length 55 to obtain the distance between marker 51 and origin 53.
[0084] S42, the first distance is obtained by calculating the product of the ratio and the camera intrinsic parameters.
[0085] In one embodiment of this application, the method for obtaining the first distance by calculating the product of the ratio and the camera intrinsic parameters satisfies the following relationship:
[0086]
[0087] Where r represents the first distance between the center of the marker and the origin of the camera coordinate system; d represents the diameter of the marker; f represents the focal length of the camera; p represents the number of target pixels; and l represents the pre-stored length parameter.
[0088] For example, when the target object has a diameter of 200 mm, the camera focal length is 3.5 mm, the number of target pixels is 1000, and the pre-stored length parameter is 0.1 mm, the first distance between the center of the marker and the origin of the camera coordinate system is calculated as follows:
[0089]
[0090] like Figure 6 The diagram shown is a flowchart of a method for determining a first set of equations according to an embodiment of this application. The order of steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The method for determining a first set of equations provided in this embodiment includes the following steps.
[0091] S50, determine a first vector based on the coordinate representation of the center of the circle and the coordinate representation of the first target point; determine a second vector based on the coordinate representation of the center of the circle and the coordinate representation of the second target point.
[0092] In one embodiment of this application, the coordinates of the center of the marker are (u,v,w), the coordinates of the first target point B are (l,m,n), and the first vector is [lu,mv,nw]; the coordinates of the second target point C are (i,j,k), and the second vector is [iu,jv,kw].
[0093] S51, determine the third vector based on the coordinate representation of the center of the circle and the coordinates of the origin of the camera coordinate system.
[0094] In one embodiment of this application, the coordinates of the center A of the marker are represented as (u,v,w), and the third vector is [u,v,w].
[0095] S52, determine the fourth vector based on the coordinate representation of the first preset point and the coordinates of the origin of the camera coordinate system.
[0096] In one embodiment of this application, the coordinates of the first preset point are represented as (l*t, m*t, n*t), and the fourth vector is [l*t, m*t, n*t]. Here, t represents the preset first multiplier.
[0097] S53, determine the fifth vector based on the coordinate representation of the second preset point and the coordinates of the origin of the camera coordinate system.
[0098] In one embodiment of this application, the coordinates of the second preset point are represented as (i*T, j*T, k*T), and the fifth vector is [i*T, j*T, k*T]. Here, T represents the preset second multiplier.
[0099] S54, the first set of equations is determined by calculating the magnitudes of the first vector, the second vector, the third vector, the fourth vector, and the fifth vector.
[0100] In one embodiment of this application, the magnitude of the first vector is used to characterize the distance between the first target point and the center of the marker, and the distance is a preset distance. For example, when the first target point is a point on the edge of the marker, the magnitude of the first vector is the radius of the marker; the magnitude of the second vector is used to characterize the distance between the second target point and the origin of the camera coordinate system.
[0101] In one embodiment of this application, the magnitude of the third vector is used to represent the distance between the center of the marker circle and the origin of the camera coordinate system; the magnitude of the fourth vector is used to represent the distance between the first preset point and the origin of the camera coordinate system; the magnitude of the fifth vector is used to represent the distance between the second preset point and the origin of the camera coordinate system; and the magnitudes of the third vector, the fourth vector, and the fifth vector are all equal.
[0102] In one embodiment of this application, the methods for calculating the magnitude of the first vector and the magnitude of the second vector satisfy the following relationship:
[0103]
[0104]
[0105] Wherein, the magnitude of the first vector and the magnitude of the second vector are both equal to a preset distance. For example, when the first target point and the second target point are on the edge of the marker, the magnitude of the first vector and the magnitude of the second vector are both equal to the radius of the marker.
[0106] In one embodiment of this application, the methods for calculating the magnitudes of the third, fourth, and fifth vectors satisfy the following relationship:
[0107]
[0108]
[0109]
[0110] Among them, the magnitudes of the third vector, the fourth vector, and the fifth vector are all distances between the center of the marker circle and the origin of the camera coordinate system, calculated in the aforementioned steps.
[0111] In one embodiment of this application, since the first vector is used to characterize the position of the line connecting the center of the circle and the first target point in the camera coordinate system, and the second vector is used to characterize the position between the center of the circle and the second target point, the first vector and the second vector are perpendicular. The positioning equation set also includes a first positioning equation, and the method for determining the first positioning equation includes: determining the first positioning equation based on the dot product of the first vector and the second vector. Specifically, since the first vector and the second vector are perpendicular, the dot product of the first vector and the second vector is 0, and the method for determining the first positioning equation satisfies the following relationship:
[0112] 0=(lu)o(iu)+(mv)o(jv)+(nw)o(kw)
[0113] like Figure 7The diagram shown is a flowchart of a method for determining a second set of equations according to an embodiment of this application. The order of steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The method for determining a second set of equations provided in this embodiment includes the following steps.
[0114] S60, determine the sixth vector based on the coordinate representation of the center of the circle and the coordinate representation of the first preset point.
[0115] In one embodiment of this application, the sixth vector is obtained by subtracting the coordinate representation of the center of the circle from the coordinate representation of the first preset point by the same dimension: [l*tu,m*tv,n*tw].
[0116] S61, determine the seventh vector based on the coordinate representation of the center of the circle and the coordinate representation of the second preset point.
[0117] In one embodiment of this application, the coordinates of the center of the circle are represented as (u,v,w), and the coordinates of the second preset point are represented as ((i*T,j*T,k*T). Therefore, the seventh vector is: [i*Tu,j*Tv,k*Tw].
[0118] S63, determine the second set of equations based on the sixth vector and the seventh vector.
[0119] In one embodiment of this application, a second system of equations can be constructed based on the positions of the sixth and seventh vectors in the camera coordinate system. See also... Figure 8 The camera coordinate system has its origin at O, the center of the marker circle at A, the first target point at B, the second target point at C, the first preset point at B', and the second preset point at C'. The sixth vector represents the position of line segment AB' in the camera coordinate system, and the seventh vector represents the position of line segment AC' in the camera coordinate system. The distance from the camera coordinate system origin O to line segment AB' is equal to the height of triangle AOB'. Figure 8 Given line segment 81, the area S of triangle AOB' is... AOB This can be represented as half the product of the distance of line segment AB' and the length of line segment 81, specifically, satisfying the following relationship:
[0120]
[0121] S AOB It can also be represented as: half the product of the magnitude of the third vector, the magnitude of the fourth vector, and the cosine of the angle between the third and fourth vectors, specifically satisfying the following relationship:
[0122]
[0123] and The magnitudes of the third and fourth vectors are both the distance r from the center of the circle to the origin.
[0124] Therefore, combining the two formulas above, we can obtain:
[0125]
[0126] but
[0127]
[0128] Where r represents the distance from the center of the marker to the origin of the camera coordinate system.
[0129] In one embodiment of this application, it can also be determined according to the Pythagorean theorem. Figure 8 The length of line segment 81 shown is determined using the Pythagorean theorem, which satisfies the following relationship:
[0130]
[0131] Where r represents the distance from the center of the marker to the origin of the camera coordinate system.
[0132] In one embodiment of this application, the distance can also be determined based on the camera focal length and line segment. Figure 8 The length of line segment 81 shown is determined using the Pythagorean theorem, which satisfies the following relationship:
[0133]
[0134] Where p*l represents the product of the number of pixels occupied by line segment AB in the target image and the length parameter; f represents the focal length.
[0135] In one embodiment of this application, it can be understood that the height of triangle AOC' can also be determined in the manner described above. Specifically, the height of triangle AOC' satisfies the following relationship:
[0136]
[0137]
[0138]
[0139] Where r represents; p*l is used to characterize the product between the number of pixels occupied by line segment AC in the target image and the length parameter; f represents the focal length.
[0140] In one embodiment of this application, the target image further includes a first line connecting the center of the circle to the first target point, and a second line connecting the center of the circle to the second target point; the positioning equation set further includes a second positioning equation. For example... Figure 9 The diagram shown is a flowchart of a method for determining a second positioning equation according to an embodiment of this application. The order of steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The method for determining a second positioning equation provided in this embodiment includes the following steps.
[0141] S70, identify the first line segment corresponding to the first connecting line in the target image, and identify the second line segment corresponding to the second connecting line in the target image.
[0142] In one embodiment of this application, a target recognition model pre-trained to a converged state can be used to identify a first line segment in the target image corresponding to a first connecting line, and a second line segment in the target image corresponding to a second connecting line. The target recognition model can be VGGNet.
[0143] S71, by identifying the angle between the first line segment and the second line segment in the target image, the cosine value of the angle is obtained.
[0144] In one embodiment of this application, a pre-written software package can be used to identify the cosine value of the angle between the first line segment and the second line segment. For example, the software package can be OpenCV.
[0145] In one embodiment of this application, the cosine value of the angle between the first line segment and the second line segment can be denoted as COS(B′AC′).
[0146] S72, construct the second positioning equation based on the coordinate representation of the center of the circle, the coordinate representation of the first preset point, the coordinate representation of the second preset point, and the cosine value.
[0147] In one embodiment of this application, since the first line segment is the line segment corresponding to the first connecting line in the target image, and the first connecting line is the line connecting the center of the circle and the first target point, the coordinate representation of the first line segment in the camera coordinate system is the first vector [lu,mv,nw]; the second line segment is the line segment corresponding to the second connecting line in the target image, and the coordinate representation of the second line segment in the camera coordinate system is the second vector [iu,jv,kw].
[0148] In one embodiment of this application, the second positioning equation satisfies the following relationship:
[0149]
[0150] Please see Figure 10 , Figure 10This is a functional block diagram of a spatial positioning device provided in one embodiment of this application. The spatial positioning device 81 includes an acquisition module 810, an identification module 811, a calculation module 812, and a determination module 813. The module / unit referred to in this application refers to a series of computer-readable instruction segments that can be executed by the processor 13 and perform a fixed function, and which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0151] The acquisition module 810 is used to acquire a target image obtained by the camera shooting the marker, wherein the marker includes a center, a first target point, and a second target point;
[0152] The identification module 811 is used to obtain the number of target pixels occupied by the diameter of the marker in the target image;
[0153] The calculation module 812 is used to determine the first distance between the center of the circle and the origin of the camera coordinate system based on the number of target pixels, the intrinsic parameters of the camera, and the pre-stored length parameters.
[0154] The determining module 813 is used to determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance;
[0155] The determining module 813 is further configured to determine a second preset point located on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance;
[0156] The determining module 813 is further configured to determine the coordinate representation of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system;
[0157] The determining module 813 is further configured to construct a set of positioning equations based on the first distance, the diameter of the marker, and the coordinate representation;
[0158] The determining module 813 is further configured to determine the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system based on the positioning equation set;
[0159] The determining module 813 is further configured to determine the position of the target object to be located in the camera coordinate system based on the coordinates.
[0160] In one embodiment of this application, the determining module 813 is further configured to: acquire a test image of the marker captured by the camera, wherein the distance between the center of the marker and the origin of the camera coordinate system is equal to the test distance; determine the number of test pixels occupied by the diameter of the marker in the test image; calculate the length represented by each pixel in the test image in the camera coordinate system based on the camera's intrinsic parameters, the test distance, and the number of test pixels, and obtain the pre-stored length parameter.
[0161] In one embodiment of this application, the determining module 813 is specifically used to: calculate the product of the pixel length parameter and the number of target pixels to obtain the virtual diameter of the marker in the target image; calculate the ratio between the diameter and the virtual diameter; and obtain the first distance by calculating the product of the ratio and the camera intrinsic parameters.
[0162] In one embodiment of this application, the positioning equation set includes a first equation set, and the determining module 813 is specifically used to: determine a first vector based on the coordinate representation of the center of the circle and the coordinate representation of the first target point; determine a second vector based on the coordinate representation of the center of the circle and the coordinate representation of the second target point; determine a third vector based on the coordinate representation of the center of the circle and the coordinates of the origin of the camera coordinate system; determine a fourth vector based on the coordinate representation of the first preset point and the coordinates of the origin of the camera coordinate system; determine a fifth vector based on the coordinate representation of the second preset point and the coordinates of the origin of the camera coordinate system; and determine the first equation set by calculating the magnitudes of the first vector, the second vector, the third vector, the fourth vector, and the fifth vector.
[0163] In one embodiment of this application, the first vector is perpendicular to the second vector, the positioning equation set further includes a first positioning equation, and the determining module 813 is further configured to: determine the first positioning equation based on the dot product of the first vector and the second vector.
[0164] In one embodiment of this application, the positioning equation set further includes a second equation set, and the determining module 813 is specifically used to: determine a sixth vector based on the coordinate representation of the center of the circle and the coordinate representation of the first preset point; determine a seventh vector based on the coordinate representation of the center of the circle and the coordinate representation of the second preset point; and determine the second equation set based on the sixth vector and the seventh vector.
[0165] In one embodiment of this application, the target image further includes a first line connecting the center of the circle and the first target point, and a second line connecting the center of the circle and the second target point. The positioning equation set includes a second positioning equation. The determining module 813 is specifically used to: identify a first line segment corresponding to the first line in the target image, and identify a second line segment corresponding to the second line in the target image; obtain the cosine value of the angle between the first line segment and the second line segment in the target image by identifying the angle between them; and construct the second positioning equation based on the coordinate representation of the center of the circle, the coordinate representation of the first preset point, the coordinate representation of the second preset point, and the cosine value.
[0166] As can be seen from the above technical solutions, the embodiments of this application can obtain a target image containing the marker by taking a picture of a circular marker placed on the target object to be located. The distance between the marker and the camera is determined based on the camera's intrinsic parameters and the marker's diameter. A positioning equation is constructed based on this distance and the coordinates of multiple target points on the marker in the camera coordinate system. By solving the positioning equation, the position of the marker in the camera coordinate system is obtained, thereby determining the position of the target object to be located in the camera coordinate system. The spatial positioning method provided by this application only uses computer vision assistance and does not require the deployment of high-cost positioning equipment such as LiDAR to complete the spatial positioning of the target object, thus reducing positioning costs and improving spatial positioning efficiency. Furthermore, the circular shape of the marker can avoid distortion caused by pose changes, thereby improving the accuracy of spatial positioning.
[0167] Please see Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 1 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 executes the computer-readable instructions stored in the memory to implement the spatial positioning method described in any of the above embodiments.
[0168] In one embodiment of this application, the electronic device 1 further includes a bus and a computer program, such as a spatial positioning program, stored in the memory 12 and executable on the processor 13.
[0169] Figure 11 Only electronic device 1 with memory 12 and processor 13 is shown. It will be understood by those skilled in the art that... Figure 11 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0170] Combination Figure 2The memory 12 in the electronic device 1 stores a plurality of computer-readable instructions to implement a spatial positioning method. The processor 13 can execute the plurality of instructions to achieve: acquiring a target image obtained by the camera from the marker, wherein the marker includes a center, a first target point, and a second target point; acquiring the number of target pixels occupied by the diameter of the marker in the target image; determining a first distance between the center and the origin of the camera coordinate system based on the number of target pixels, the camera's intrinsic parameters, and a pre-stored length parameter; and determining a first preset point located on the line connecting the origin and the first target point, wherein the first preset point and the origin are... The distance between the origin and the second target point is equal to the first distance; a second preset point is determined on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance; the coordinate representations of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system are determined; a set of positioning equations is constructed based on the first distance, the diameter of the marker, and the coordinate representations; the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system are determined based on the set of positioning equations; and the position of the target object to be located in the camera coordinate system is determined based on the coordinates.
[0171] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 2 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0172] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 1 and does not constitute a limitation on electronic device 1. Electronic device 1 can be a bus-type structure or a star-type structure. Electronic device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, electronic device 1 may also include input / output devices, network access devices, etc.
[0173] It should be noted that electronic device 1 is only an example. Other existing or future electronic products that are suitable for this application should also be included within the scope of protection of this application and are incorporated herein by reference.
[0174] The memory 12 includes at least one type of readable storage medium, which can be non-volatile or volatile. The readable storage medium includes flash memory, portable hard drives, multimedia cards, card-type memory (e.g., SD or DX memory), magnetic storage, magnetic disks, optical disks, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a portable hard drive of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 1. The memory 12 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of a spatial positioning program, but also to temporarily store data that has been output or will be output.
[0175] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core of the electronic device 1, connecting various components of the electronic device 1 through various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing spatial positioning programs) and calls data stored in the memory 12 to perform various functions and process data of the electronic device 1.
[0176] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the various spatial positioning method embodiments described above, for example... Figure 2 The steps are shown.
[0177] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete this application. The one or more modules / units may be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into an acquisition module 810, an identification module 811, a calculation module 812, and a determination module 813.
[0178] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the spatial positioning methods described in the various embodiments of this application.
[0179] If the modules / units integrated in electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0180] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, and other memory.
[0181] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the 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 blockchain nodes, etc.
[0182] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 8 The symbol is represented by only one arrow, but this does not indicate that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.
[0183] This application also provides a computer-readable storage medium (not shown) storing computer-readable instructions, which are executed by a processor in an electronic device to implement the spatial positioning method described in any of the above embodiments.
[0184] This application also provides a posture control mechanism for a robotic arm. For example... Figure 12 As shown, a camera 600 is mounted on the robotic arm 500, and an attitude control mechanism 700 is connected to the robotic arm 500 to control the attitude of the robotic arm 500. The attitude control mechanism 700 includes, as shown in the figure... Figure 11 Electronic device 1 shown.
[0185] This application also provides a method for moving a biochip based on a robotic arm, wherein a monocular camera is mounted on the robotic arm, and the biochip is associated with a marker. For example... Figure 13 The diagram shows a flowchart of a biochip movement method based on a robotic arm, according to an embodiment of this application. The order of steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements. The biochip movement method based on a robotic arm provided in this embodiment includes the following steps.
[0186] S80, using the monocular camera to capture the marker to obtain a target image, wherein the marker includes a center, a first target point, and a second target point.
[0187] In one embodiment of this application, the method of acquiring a target image by photographing the marker using the monocular camera is the same as the detailed description in step S20, and will not be repeated here.
[0188] S81, obtain the number of target pixels occupied by the diameter of the marker in the target image.
[0189] In one embodiment of this application, the method for obtaining the number of target pixels occupied by the diameter of the marker in the target image is the same as that in step S21, and will not be repeated here.
[0190] S82, based on the number of target pixels, the intrinsic parameters of the monocular camera, and the pre-stored length parameters, determine the first distance between the center of the circle and the origin of the camera coordinate system.
[0191] In one embodiment of this application, the step of determining the first distance between the center of the circle and the origin of the camera coordinate system based on the number of target pixels, the intrinsic parameters of the monocular camera, and the pre-stored length parameters is the same as the detailed description in step S22, and will not be repeated here.
[0192] S83, determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance.
[0193] In one embodiment of this application, the method for determining the first preset point located on the line connecting the origin and the first target point is the same as the detailed description in step S23, and will not be repeated here.
[0194] S84, determine a second preset point located on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance.
[0195] In one embodiment of this application, the determination of the second preset point located on the line connecting the origin and the second target point is the same as the detailed description in step S24, and will not be repeated here.
[0196] S85, determine the coordinate representation of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system.
[0197] In one embodiment of this application, the coordinate representation of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system is the same as the detailed description in step S25, and will not be repeated here.
[0198] S86, construct a set of positioning equations based on the first distance, the diameter of the marker, and the coordinate representation.
[0199] In one embodiment of this application, the construction of a set of positioning equations based on the first distance, the diameter of the marker, and the coordinates is the same as the detailed description in step S26, and will not be repeated here.
[0200] S87, Based on the positioning equations, determine the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system.
[0201] In one embodiment of this application, the step of determining the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system based on the positioning equation set is the same as the detailed description in step S27, and will not be repeated here.
[0202] S88, determine the position of the biochip in the camera coordinate system based on the coordinates.
[0203] In one embodiment of this application, the step of determining the position of the biochip in the camera coordinate system based on the coordinates is the same as the detailed description in step S28, and will not be repeated here.
[0204] S89, based on the position of the biochip in the camera coordinate system, adjust the posture of the robotic arm to grasp the biochip.
[0205] In one embodiment of this application, after determining the position of the biochip in the camera coordinate system, the posture of the robotic arm can be adjusted according to the position of the biochip in the camera coordinate system so that the robotic arm can grasp the biochip.
[0206] For example, when the position of the biochip in the camera coordinate system is (x, y, z), the position information of the robotic arm can be constructed based on this coordinate using a pre-stored position construction program. This positional information is used to characterize the robotic arm's posture. The first three dimensions characterize the position of the robotic arm's gripper in the camera coordinate system, while the latter three dimensions characterize the angles between the gripper and the X, Y, and Z axes. In one embodiment of this application, the electronic device in the robotic arm's posture control mechanism receives this positional information and adjusts the robotic arm's posture accordingly, enabling the robotic arm to grasp the biochip.
[0207] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0208] The modules described as separate components may or may not be physically separate. The components shown as modules 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 modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0209] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0210] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in the specification may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0211] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.
Claims
1. A spatial positioning method applied to electronic devices, characterized in that, The electronic device is communicatively connected to a camera, which is used to photograph the target object to be located. The target object has a circular marker. The method includes: Acquire a target image of the marker captured by the camera, wherein the marker includes a center point, a first target point, and a second target point; The number of target pixels occupied by the diameter of the marker in the target image is obtained; Based on the number of target pixels, the camera's intrinsic parameters, and the pre-stored length parameters, determine the first distance between the center of the circle and the origin of the camera coordinate system; Determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance; Determine a second preset point located on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance; Determine the coordinate representations of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system; A set of positioning equations is constructed based on the first distance, the diameter of the marker, and the coordinate representation; Based on the positioning equations, the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system are determined. The position of the target object to be located in the camera coordinate system is determined based on the coordinates.
2. The spatial positioning method as described in claim 1, characterized in that, The method for determining the pre-stored pixel length parameter includes: Acquire a test image of the marker captured by the camera, wherein the distance between the center of the marker and the origin of the camera coordinate system is equal to the test distance; Determine the number of test pixels occupied by the diameter of the marker in the test image; The length represented by each pixel in the test image in the camera coordinate system is calculated based on the camera's intrinsic parameters, the test distance, and the number of test pixels to obtain the pre-stored length parameter.
3. The spatial positioning method as described in claim 1, characterized in that, Determining the first distance between the center of the circle and the origin of the camera coordinate system based on the number of target pixels, the camera's intrinsic parameters, and pre-stored pixel length parameters includes: Calculate the product of the pixel length parameter and the number of target pixels to obtain the virtual diameter of the marker in the target image; Calculate the ratio between the stated diameter and the virtual diameter; The first distance is obtained by calculating the product of the ratio and the camera intrinsic parameters.
4. The spatial positioning method as described in claim 1, characterized in that, The positioning equation set includes a first equation set, and the method for determining the first equation set includes: A first vector is determined based on the coordinates of the center of the circle and the coordinates of the first target point; a second vector is determined based on the coordinates of the center of the circle and the coordinates of the second target point. The third vector is determined based on the coordinates of the center of the circle and the coordinates of the origin of the camera coordinate system; The fourth vector is determined based on the coordinate representation of the first preset point and the coordinates of the origin of the camera coordinate system. The fifth vector is determined based on the coordinate representation of the second preset point and the coordinates of the origin of the camera coordinate system. The first set of equations is determined by calculating the magnitudes of the first vector, the second vector, the third vector, the fourth vector, and the fifth vector.
5. The spatial positioning method as described in claim 4, characterized in that, The first vector is perpendicular to the second vector, and the positioning equation set further includes a first positioning equation. The method for determining the first positioning equation includes: The first positioning equation is determined based on the dot product of the first vector and the second vector.
6. The spatial positioning method as described in claim 1, characterized in that, The positioning equation set further includes a second equation set, and the method for determining the second equation set includes: The sixth vector is determined based on the coordinate representation of the center of the circle and the coordinate representation of the first preset point; The seventh vector is determined based on the coordinate representation of the center of the circle and the coordinate representation of the second preset point; The second set of equations is determined based on the sixth vector and the seventh vector.
7. The spatial positioning method as described in claim 6, characterized in that, The target image further includes a first line connecting the center of the circle and the first target point, and a second line connecting the center of the circle and the second target point. The positioning equation set includes a second positioning equation, and the method for determining the second positioning equation includes: Identify the first line segment corresponding to the first connecting line in the target image, and identify the second line segment corresponding to the second connecting line in the target image; The cosine value of the angle is obtained by identifying the angle between the first line segment and the second line segment in the target image; The second positioning equation is constructed based on the coordinate representation of the center of the circle, the coordinate representation of the first preset point, the coordinate representation of the second preset point, and the cosine value.
8. A spatial positioning device, characterized in that, The apparatus includes a module that implements the spatial positioning method as described in any one of claims 1 to 7, and the apparatus includes: An acquisition module is used to acquire a target image obtained by a camera capturing a marker, wherein the marker includes a center point, a first target point, and a second target point; The identification module is used to obtain the number of target pixels occupied by the diameter of the marker in the target image; The calculation module is used to determine the first distance between the center of the circle and the origin of the camera coordinate system based on the number of target pixels, the camera's intrinsic parameters, and the pre-stored length parameters. The determining module is used to determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance; The determining module is further configured to determine a second preset point located on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance; The determining module is further configured to determine the coordinate representation of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system; The determining module is further configured to construct a set of positioning equations based on the first distance, the diameter of the marker, and the coordinate representation; The determining module is further configured to determine the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system based on the positioning equations. The determining module is further configured to determine the position of the target object to be located in the camera coordinate system based on the coordinates.
9. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer-readable instructions; and The processor executes computer-readable instructions stored in the memory to implement the spatial positioning method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the spatial positioning method as described in any one of claims 1 to 7.
11. A posture control mechanism for a robotic arm, wherein a camera is mounted on the robotic arm, characterized in that, The attitude control mechanism includes the electronic device as described in claim 9.
12. A method for moving a biochip based on a robotic arm, characterized in that, A monocular camera is mounted on the robotic arm, the biochip is associated with a marker, and the method for moving the biochip includes: The target image is obtained by capturing the marker with the monocular camera, wherein the marker includes a center point, a first target point, and a second target point; The number of target pixels occupied by the diameter of the marker in the target image is obtained; Based on the number of target pixels, the intrinsic parameters of the monocular camera, and the pre-stored length parameters, determine the first distance between the center of the circle and the origin of the camera coordinate system; Determine a first preset point located on the line connecting the origin and the first target point, wherein the distance between the first preset point and the origin is equal to the first distance; Determine a second preset point located on the line connecting the origin and the second target point, wherein the distance between the second preset point and the origin is equal to the first distance; Determine the coordinate representations of the center of the circle, the first target point, the second target point, the first preset point, and the second preset point in the camera coordinate system; A set of positioning equations is constructed based on the first distance, the diameter of the marker, and the coordinate representation; Based on the positioning equations, the coordinates of the center of the circle, the first target point, and the second target point in the camera coordinate system are determined. The position of the biochip in the camera coordinate system is determined based on the coordinates; and Based on the position of the biochip in the camera coordinate system, the posture of the robotic arm is adjusted to grasp the biochip.
Citation Information
Patent Citations
Large-size circular ring target structured light measurement method for automatic capture of manipulator
CN111288888A
Method for accurately locating card issuing point
CN111899366A