简体   繁体   English

如何使用MATLAB将2D(x,y)坐标转换为3D(x,y,z)坐标?

[英]How to convert 2D(x,y) coordinates to 3D(x,y,z) coordinates using MATLAB?

I am trying to automate an robotic arm using MATLAB. 我正在尝试使用MATLAB自动执行机械手。 So the thing is, camera will be mounted on the base of robotic arm. 所以问题是,相机将安装在机械臂的基座上。 It will capture the snapshots of the camera frames and do image processing on it and it will detect the target(object) and find the pixel coordinate for it. 它将捕获相机帧的快照并对其进行图像处理,并将检测到目标(对象)并找到其像素坐标。 After it is done, this pixel coordinates should be mapped to real world xyz metric coordinates? 完成后,该像素坐标应映射到现实世界的xyz度量坐标吗? and this real world coordinates(x,y,z) would serve as parameters for inverse kinematics function which would give the value of theta so that servos can move. 并且此现实世界坐标(x,y,z)将用作反向运动学函数的参数,该函数将给出theta值,以便伺服器可以移动。

I'm stuck here, this pixel coordinates should be mapped to real world xyz metric coordinates? 我被困在这里,这个像素坐标应该映射到现实世界的xyz度量坐标吗? i dont know how to do it. 我不知道该怎么做。 nor getting any ideas, how to proceed it? 没有任何想法,如何进行呢? Anyone having any lead, please share it!! 任何有领导的人,请分享!!

PS anyone of you guyz thinks that for automation of robotic arm should i use MATLAB or something else?. PS你们大家都认为,对于机械手臂的自动化,我应该使用MATLAB还是其他工具? Coz this all code would be uploaded on raspberry pi 3 using ROS environment. 因为所有这些代码都将使用ROS环境上传到raspberry pi 3上。

BEST REGARDS 最好的祝福

hitesh kumar Hitesh库马尔

To calculate 3D world point for the given pixel in an image, you need depth information (should use 3D camera like Kinect ..etc). 要计算图像中给定像素的3D世界点,您需要深度信息(应使用3D相机,如Kinect ..etc)。 One you have depth information and camera intrinsics and extrinsics you can convert 2D pixels to 3D world coordinates and vice versa. 您可以拥有深度信息以及相机的内在和外在特性,可以将2D像素转换为3D世界坐标,反之亦然。

Below equation for calcualting X,Y,Z in world coordinates. 下面的公式用于计算世界坐标中的X,Y,Z。

在此处输入图片说明

Technically Perspective projection is what camera does in converting 3D world to 2D and below equation represents this projection. 从技术上讲, Perspective projection是相机将3D世界转换为2D时所做的工作,以下等式表示此投影。

在此处输入图片说明

Above image is from here 上图是从这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM