HomeForum Home → Hardware → Lenses & Optics → Thread

   

How get coordinates (x, y, z) from DUO Dense3D API? 

Rank

Total Posts: 8

Joined 2015-05-16

PM

I used DUO Dense3D Samples with middleware and now I need get coordinates (x, y, z) for next phase my research.
Can you tell me what should I use a specific function, structure or method?
I have finded PDense3DDepth or Dense3DSavePLY but I don’t know how it use.
Thanks

     
Rank

Total Posts: 5

Joined 2014-07-24

PM

look into /Sample-01-Dense3D/Sample.cpp

there you will find a call to “Dense3DGetDepth” function, this feeds the “Mat3f depth3d” matrix with depth points.
simply iterate over the values with HEIGHT x WIDTH and get x,y, z like this:

x = depth3d [ h ] [ w ] [ 0 ]
y = depth3d [ h ] [ w ] [ 1 ]
z = depth3d [ h ] [ w ] [ 2 ]

keep in mind that there are “nan” values inside that matrix. you can check the z-value if its not marked as nan or if its not infinite ( !std::isinf(depth3d[h][w][2] )

     
Rank

Total Posts: 8

Joined 2015-05-16

PM

Thank you, it is good. But I have negative value and causes nonsymmetric 3D images, also. Why?
They should be positive coordinates
See my attached picture.

     

Image Attachments

image.jpg

Click thumbnail to see full-size image

Avatar
RankRank

Total Posts: 37

Joined 2012-06-10

PM

Hi Martin,

The 3D coordinates are centered around the origin at (0, 0, 0). They can be both positive and negative.
You could try and export the .ply file from the DUODashboard running Dense3DApp and view it in a program such as MeshLab (http://meshlab.sourceforge.net/).

     
Rank

Total Posts: 8

Joined 2015-05-16

PM

Thanks AlexP,
I tried it, but this is different output, because Dashboard have other settings such as my code . Now I try run the function Dense3DSavePLY(). Can you write me any basic example to work with her, please.

My code:
char sPly;
Dense3DSavePLY(dense3d, &sPly;);

but something is wrong, because I don’t know save to disk.