API Interface List
Xvisio SDK Documentation Home Page

Plane Detection Interfaces


1. Enable Tof

public static extern void xslam_tof_set_framerate(float framerate);

Input:

"framerate" indicates tof detection speed in one second. Commonly set framerate to 5 which means tof detect once every 5 seconds.

2. Enable Plane Detection

public static extern bool xslam_start_detect_plane_from_tof_nosurface();

3. Data Acquisition Interface of Plane Detection

public static extern bool xslam_get_plane_from_tof(IntPtr data, ref int len);

Input:

data: data address pointer
len: data length

Reference Data Analysis:
public plane[] parsePlane(byte[] rdata, int len)
{
if (len < 4)
return null;
int pos = 0;
int nPlane = System.BitConverter.ToInt32(rdata, pos); pos += 4;
if (nPlane > 0 && len > pos)
{
planes = new plane[nPlane];
for (int i = 0; i < nPlane; i++)
{
if (len <= pos)
break;
planes[i] = new plane();
int nPoint = System.BitConverter.ToInt32(rdata, pos); pos += 4;
planes[i].points = new List();
for (int j = 0; j < nPoint; j++)
{
Vector3D point;
point.X = System.BitConverter.ToDouble(rdata, pos); pos += 8;
point.Y = System.BitConverter.ToDouble(rdata, pos); pos += 8;
point.Z = System.BitConverter.ToDouble(rdata, pos); pos += 8;
planes[i].points.Add(point);
}
planes[i].normal.X = System.BitConverter.ToDouble(rdata, pos); pos += 8;
planes[i].normal.Y = System.BitConverter.ToDouble(rdata, pos); pos += 8;
planes[i].normal.Z = System.BitConverter.ToDouble(rdata, pos); pos += 8;
planes[i].d = System.BitConverter.ToDouble(rdata, pos); pos += 8;
int idLen = System.BitConverter.ToInt32(rdata, pos); pos += 4;
planes[i].id = System.BitConverter.ToString(rdata, pos, idLen); pos += idLen;
}
return planes;
}
return null;
}


API Interface List
Xvisio SDK Documentation Home Page