完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
tify;text-indent: 40px;">嗨,大家好,
我试图从深度图像中找到几个中心像素。 我正在尝试实现分割,我需要找到分割对象的距离。 这就是我的想法,这将是有效的。 当彩色图像用于分割时,全帧深度图像将用于找到距离。 在我的下面的代码中。 我找到了深度图像的对角线,我试图找到3或5个像素。 我不知道如何从数组中找到值。 我只在我的控制台上打印了索引。打印40,35但没有值。 我希望我没有混淆你。 一切对我来说都是新的。 我试过这个; void SampleArrived(对象发送者,SampleArrivedEventArgs args) { if(args.sample.Depth == null) { 返回; } 其他 { var depthImageArray = args.sample.Depth; Debug.Log(“我的深度值是”+ depthImageArray); var diagonal = Math.Sqrt((depthWidth * depthWidth)+(depthHeight * depthHeight))/ 2; texPlugin.UpdateTextureNative(args.sample.Depth,depthTex2DPtr); for(int y = 0; y |
|
相关推荐
11个回答
|
|
下面的链接提供了用于获取图像上特定XY坐标(例如100,100)处的像素深度的代码。
将像素投影到3d点·问题#1413·IntelRealSense / librealsense·GitHub 以上来自于谷歌翻译 以下为原文 The link below provides code for getting the depth of a pixel at a specific XY coordinate on the image (e.g 100, 100). deprojection pixels to 3d point · Issue #1413 · IntelRealSense/librealsense · GitHub |
|
|
|
nywerwer 发表于 2018-11-19 10:30 嗨MartyG, 英特尔实感R3000 SDK的语法看起来并不熟悉。 我真的不明白她是如何获得原始深度值的 以上来自于谷歌翻译 以下为原文 Hi MartyG, The syntax does not look familiar to Intel RealSense R3000 SDK. I really do not understand how she is getting her raw depth value |
|
|
|
我很抱歉,我没有看到您已将您的条目标记为SR300和2016 R3 SDK。 我没有阅读帖子底部的标签。 SR300与当前的RealSense SDK 2.0兼容。 您的项目是否可以使用它而不是R3? 如果不是:我使用R2和R3已经有一段时间了,但我相信将3D深度坐标映射到2D图像坐标的适当指令是ProjectCameraToDepth。 英特尔®实感™SDK 2016 R3文档 以上来自于谷歌翻译 以下为原文 I apologize, I did not see that you had tagged your entry as SR300 and 2016 R3 SDK. I do not read the tags at the bottom of posts. SR300 is compatible with the current RealSense SDK 2.0. Would it be possible for your project to use it instead of R3? If not: it has been a while since I used R2 and R3, but I believe the appropriate instruction for mapping 3D depth coordinates to 2D image coordinates is ProjectCameraToDepth. Intel® RealSense™ SDK 2016 R3 Documentation |
|
|
|
nywerwer 发表于 2018-11-19 10:50 这没问题,我没有自己正确地标记问题。 文档不清楚语法应该如何。 就像展示如何完成的示例代码一样。 我会玩它,看看它会回来。 以上来自于谷歌翻译 以下为原文 That is no problem I did not tag the question properly myself. The documentation is not clear on how the syntax should be. Like with a sample code showing how it is done. I will play around with it and see what it will be returning. |
|
|
|
我找到了一个前面的例子,在这个论坛上讨论了ProjectCameraToDepth。 Re:我想获得对象的真实x,y和z坐标。 在下面的链接(包含示例脚本)中,示例6显示了您要求的内容 - 将深度映射到几个像素。 https://csharp.hotexamples.com/examples/intel.rssdk/PXCMPoint3DF32/-/php-pxcmpoint3df32-class-examples.html 以上来自于谷歌翻译 以下为原文 I located a previous example where ProjectCameraToDepth was discussed on this forum. Re: I want to get the real x, y, and z coordinates of the object. On the link below, which has example scripts, example 6 shows what you were asking for - mapping depth to a few pixels. https://csharp.hotexamples.com/examples/intel.rssdk/PXCMPoint3DF32/-/php-pxcmpoint3df32-class-examples.html |
|
|
|
nywerwer 发表于 2018-11-19 11:23 嗨MartyG, 请问如何使用R2,因为R3与R2兼容? 以上来自于谷歌翻译 以下为原文 Hi MartyG, Please how can I use R2 since R3 is compatible with R2? |
|
|
|
是的,它们是紧密兼容的。 主要区别在于,在'2016 R2'中,您将整个SDK下载为1.8 gb下载,而R3则分为一系列可选模块。 您可以使用以下链接直接在浏览器中启动R2下载。 http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/9078/intel_rs_sdk_offline_package_10.0.26.0396.exe 以上来自于谷歌翻译 以下为原文 Yes, they are closely compatible. The main difference is that in '2016 R2' you download the entire SDK as a 1.8 gb download, whilst R3 was split into a series of optional modules. You can launch a download of R2 directly in your browser by using the link below. http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/9078/intel_rs_sdk_offline_package_10.0.26.0396.exe |
|
|
|
nywerwer 发表于 2018-11-19 11:38 我下载了R2并安装但是它说我已经安装了最新版本但是在visual studio中我无法访问PXCMProjection命名空间。 以上来自于谷歌翻译 以下为原文 I downloaded R2 and installed but it say I have installed the latest version already but in visual studio I can not access PXCMProjection namespace. |
|
|
|
schumi_LYQ 发表于 2018-11-19 11:47 要将Visual Studio与R2或R3一起使用,您应该构建一个“开发环境”。 为此,请根据您是否计划在Visual Studio中使用C ++或C#,选择下面的链接。 C ++ 使用C ++,您可以使用Proert Sheet设置开发环境或直接进行设置。 使用Proerty表 英特尔®实感™SDK 2016 R2文档 直接设置项目设置 英特尔®实感™SDK 2016 R2文档 C# 英特尔®实感™SDK 2016 R2文档 以上来自于谷歌翻译 以下为原文 To use Visual Studio with R2 or R3, you should build a 'development environment'. To do this, please choose a link below depending on whether you plan to use C++ or C# in Visual Studio. C++ With C++ you can set the dev environment up with a Proert Sheet OR do the settings directly. Using a Proerty Sheet Intel® RealSense™ SDK 2016 R2 Documentation Setting the project settings directly Intel® RealSense™ SDK 2016 R2 Documentation C# Intel® RealSense™ SDK 2016 R2 Documentation |
|
|
|
nywerwer 发表于 2018-11-19 11:57 嗨,MartG, 我试图设置R2,但我意识到我在目录“$(RSSDK_DIR)/framework/Unity/UnityCSharp.unitypackage”中没有这样的UnityCSharp.unitypackage,所以我继续使用其他工作的工作示例代码。 请看看我的代码。 我想要获得深度图像的距离。 但无论何时我运行团结,它都会崩溃 void OnSampleArrived(对象发送者,SampleArrivedEventArgs args) { Image image = args.sample.Depth; if(image == null) { Debug.Log(“Null depthImage”); } 其他 { if(image!= null) { ImageInfo cinfo = new ImageInfo(){width = colorWidth,height = colorHeight,format = PixelFormat.PIXEL_FORMAT_BGR} ImageData outBuffer; image.AcquireAccess(ImageAccess.ACCESS_READ,PixelFormat.PIXEL_FORMAT_DEPTH_F32,out outBuffer); var imageHeight = image.Info.height; var imageWidth = image.Info.width; float [] pixel = outBuffer.ToFloatArray(0,imageWidth * imageHeight); image.ReleaseAccess(outBuffer); 投影投影= device.CreateProjection(); PointF32 [] uvmap = new PointF32 [cinfo.height * cinfo.width]; projection.QueryUVMap(image,uvmap); var mappedPixels = new float [cinfo.height * cinfo.width]; for(int i = 0; i = 0&amp;&amp; v> = 0&amp;&amp; u + v * imageWidth 以上来自于谷歌翻译 以下为原文 Hi MartG, I tried to setup R2 but I realized i do not have UnityCSharp.unitypackage like this in the directory " $(RSSDK_DIR)/framework/Unity/UnityCSharp.unitypackage" so I went ahead with the working sample codes others got working. Please have a look at my codes. I am trying to get the distance of the depth image. But anytime I run unity it crashes void OnSampleArrived(object sender, SampleArrivedEventArgs args) { Image image = args.sample.Depth; if (image == null) { Debug.Log("Null depthImage"); } else { if (image != null) { ImageInfo cinfo = new ImageInfo() { width = colorWidth, height = colorHeight, format = PixelFormat.PIXEL_FORMAT_BGR } ImageData outBuffer; image.AcquireAccess(ImageAccess.ACCESS_READ, PixelFormat.PIXEL_FORMAT_DEPTH_F32, out outBuffer); var imageHeight = image.Info.height; var imageWidth = image.Info.width; float[] pixel = outBuffer.ToFloatArray(0, imageWidth * imageHeight); image.ReleaseAccess(outBuffer); Projection projection = device.CreateProjection(); PointF32[] uvmap = new PointF32[cinfo.height * cinfo.width]; projection.QueryUVMap(image, uvmap); var mappedPixels = new float[cinfo.height * cinfo.width]; for (int i = 0; i < uvmap.Length; i++) { int u = (int)(uvmap.x * imageWidth); int v = (int)(uvmap.y * imageHeight); if (u >= 0 && v >= 0 && u + v * imageWidth < pixel.Length) { mappedPixels = pixel[u + v * imageWidth]; Debug.Log("distance is:" + mappedPixels); } } for (int y = 0; y < depthHeight; ++y) { for (int x = 0; x < depthWidth; ++x) { Debug.Log(string.Format("print {0}, {1}", x, y)); int pixelIndex = (y * depthWidth) + x; Debug.Log(pixelIndex); } } // Clean up projection.Dispose(); image.ReleaseAccess(outBuffer); } |
|
|
|
schumi_LYQ 发表于 2018-11-19 12:04 我从来没有必要使用带有R2的Unity_CSharp文件。 我一直在做的是创建一个新的Unity项目,然后在项目开始时打开新场景时,在Unity打开时,在RSSDK框架文件夹中运行UnityToolkit文件并双击左键。 这会将所有RealSense文件和工具导入到项目中。 虽然我在Unity中进行了大量开发,但在使用R2时,我总是使用Unity Toolkit的工具(将预定义的脚本拖放到对象中并在Inspector面板中配置菜单)来创建RealSense控件,而不是编写自己的RealSense 来自new的脚本(我主要根据我的需要编辑Toolkit脚本)。 不幸的是,我在调试脚本方面没有任何帮助。 如果您对使用Toolkit在Unity中安装的RealSense工具感兴趣,我在过去编写了大量非常详细的分步指南。 可以在下面的链接中找到它们的idnex。 Marty G的RealSense Unity操作指南索引 以上来自于谷歌翻译 以下为原文 I've never had to use the Unity_CSharp file with R2. What I have always done is create a new Unity project and then when the new scene is open at the start of the project, run the UnityToolkit file in the RSSDK framework folder with a double-leftclick on it whilst Unity is open. This imports all the RealSense files and tools into the project. Although I do develop extensively in Unity, when I was using R2 I always used the Unity Toolkit's tools (where you drag and drop pre-defined scripts into objects and configure menus in the Inspector panel) to create RealSense controls rather than writing my own RealSense scripts from new (I mostly edited the Toolkit scripts to my needs). So I would be of no help in debugging your script, unfortunately. If you are interested in using the RealSense tools that the Toolkit installs in Unity, I wrote an extensive range of very detailed step by step guides in the past. An idnex of them can be found at the link below. Index of Marty G's RealSense Unity How-To Guides |
|
|
|
只有小组成员才能发言,加入小组>>
466浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 13:40 , Processed in 0.711781 second(s), Total 67, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号