- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi ,
i want make something like that with intel real sense F200 https://software.intel.com/en-us/articles/tanked-by-design-mill-a-4d-video-game-using-intel-realsense-technology https://software.intel.com/en-us/articles/tanked-by-design-mill-a-4d-video-game-using-intel-realsense-technology
my solution it was to transfrom Image DEPth to Point3DF32 with QueryVertices , but i don't get good values:
uv = new Point3DF32[dinfo.width * dinfo.height];
projection.QueryVertices(args.sample.Depth,uv);
......
n = new float[512, 512];
for (int x = 0; x <512 ; x++)
{
for (int y = 0; y < 512; y++)
{
terrain.terrainData.SetHeights(0, 0, uv );
n[x, y] = 1 = uv[x * y].y
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
QueryVertices should give you the float depth values so you shouldn't have any problems there (I needed to get them aligned to the colour image so that's where my complication was).
It looks like the problem is with how you're getting values out of the vertices array. Also, you're looping from 0 to 512 in x and y, but the largest depth image you can get is 640*480, so you'll get overrun there. I'd imagine you want to do something like this:
for(int x = 0; x < dinfo.width; x++)
{
for(int y = 0; y < dinfo.height; y++
{
var vertex = uv[x + y * dinfo.width];//world coordinates for (x,y)th pixel in depth image
//do stuff
}
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Contributor JB455 recently provided a script that works with SR-300 to return a float value instead of an int (though it does not work with R200 cameras). As the F200 though is the predecessor of the SR-300, maybe JB's script will work for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
QueryVertices should give you the float depth values so you shouldn't have any problems there (I needed to get them aligned to the colour image so that's where my complication was).
It looks like the problem is with how you're getting values out of the vertices array. Also, you're looping from 0 to 512 in x and y, but the largest depth image you can get is 640*480, so you'll get overrun there. I'd imagine you want to do something like this:
for(int x = 0; x < dinfo.width; x++)
{
for(int y = 0; y < dinfo.height; y++
{
var vertex = uv[x + y * dinfo.width];//world coordinates for (x,y)th pixel in depth image
//do stuff
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, if you only need depth values, not the full world coordinates (x,y,z in millimetres), you can use the following to get the depth data out of the image:
- PXCMImage.ImageData ddata;
- args.sample.depth.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_DEPTH_F32, out ddata);
- var dwidth = depth.info.width;
- var dheight = depth.info.height;
- var dPixels = ddata.ToFloatArray(0, dwidth * dheight);
- depth.ReleaseAccess(ddata);
Then in your loop you'll have var z = dPixels[x + y * dwidth] to get the depth in mm for that pixel. If you're doing this each frame while streaming it'll likely be much more efficient than using QueryVertices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page