← Xvisio SDK Depth
← Xvisio Features and Quick Start
← Xvisio SDK Documentation Home Page
SONY TOF Camera is applicated in Xvisio SeerSense™ DS80 series products. Refer to the corresponding datasheet of other products to confirm the type of TOF camera. SONY TOF camera also uses the iTOF algorithm, with a wavelength of 940nm.
SONY TOF Camera supports multiple working modes to cope with different host processing capabilities and application scenarios:
Work Mode | Description |
---|---|
IQ | Only IQ calculation is done in Xvisio device, the other algorithm processing is completed in the host Xvisio SDK. The frame rate in this mode depends on the performance of the host. |
M2 | IQ calculation and iq_to_depth algorithm are done in Xviso device. (including some filters: space filter, time filter, epsilion IQ filter ), the other algorithm processing is completed in the host Xvisio SDK. |
Labelize | Almost the complete "raw to depth" processing is completed on the Xvisio device side, and the host Xvisio SDK only does labelize processing. |
Work mode definition:
enum class SonyTofLibMode { IQMIX_DF ,IQMIX_SF, LABELIZE_DF ,LABELIZE_SF ,M2MIX_DF ,M2MIX_SF };
Support single frequency 60MHz or dual frequency 20MHz/120MHz. All the working modes support these two modulation frequencies. Generally, it is recommended to use single frequency mode within 2 meters of working distance. Dual frequency mode is recommended for working distance greater than 2 meters. For dual frequency, the distance is longer and the accuracy is higher. The data bandwidth and load of single frequency are lower. Please refer to the product datasheet for specific parameters.
Definition of modulation frequency:
enum class SonyTofLibMode { IQMIX_DF ,IQMIX_SF, LABELIZE_DF ,LABELIZE_SF ,M2MIX_DF ,M2MIX_SF };
Modulation frequency mode and working mode share the same type.
Support two resolutions:
All the work mode support these two resolutions.
Resolution definition:
enum class Resolution{ Unknown = -1,VGA = 0 ,QVGA ,HQVGA};
Note: SONY TOF doesn't support HQVGA.
TOF Frame rate can be set from 5FPS to 30FPS. Due to the load limit of computing power bandwidth under different working modes, the setting takes effect only when the corresponding frame rate can meet the setting requirements. Please see the table below for the corresponding frame rate:
Work Mode | Modulation Frequency Mode | Resolution | Frame Rate(fps) | USB Bandwidth(Max) |
---|---|---|---|---|
IQ | Dual frequency | VGA | 20-30 | 1132Mbps |
IQ | Single frequency | VGA | 30 | 566Mbps |
M2 | Dual frequency | VGA | 5 | 264Mbps |
M2 | Single frequency | VGA | 13 | 245Mbps |
Labelize | Dual frequency | VGA | 7 | 33Mbps |
Labelize | Single frequency | VGA | 3 | 14Mbps |
IQ | Dual frequency | QVGA | 30 | 285Mbps |
IQ | Single frequency | QVGA | 30 | 143Mbps |
M2 | Dual frequency | QVGA | 16 | 76Mbps |
M2 | Single frequency | QVGA | 30 | 143Mbps |
Labelize | Dual frequency | QVGA | 13 | 15.2Mbps |
Labelize | Single frequency | QVGA | 23 | 27Mbps |
Users can choose different modes and settings according to usage scenarios and requirements.
Frame rate definition:
enum class Framerate{ FPS_5 ,FPS_10 ,FPS_15 ,FPS_20 ,FPS_25 ,FPS_30 };
Xvisio SDK provides an API which can set "work mode","modulation frequency","resolution" and "frame rate" simultaneously:
device->tofCamera()->setSonyTofSetting(xv::TofCamera::SonyTofLibMode::IQMIX_DF,
xv::TofCamera::Resolution::VGA,
xv::TofCamera::Framerate::FPS_30);
Refer to demo-api.cpp(case 11)for detail code information. demo-api
Xvisio SDK provides a filter setting file that can replace the current TOF algorithm library. If you want to use this function, you need to have a certain understanding of the filter format and functions of the TOF algorithm library.
Interface prototype:
void setFilterFile(std::string filePath)
Call example:
device->tofCamera()->setSonyTofSettingsetFilterFile("filterfile.bin");
SONY TOF depth data format supports 16-bit depth data with a unit of millimeter which also support IR gray data.
/**
* @brief An image provided by a TOF camera.
* @note There are two manufacturers of TOF camera, Pmd and sony.
* Pmd TOF depth type is Depth_32,sony TOF depth type is Depth_16.
* Cloud type just use for Pmd point cloud,the coordinate system of the point cloud is the camera coordinate system, and the data unit is meters.
* Length, width and depth are in meters use Pmd TOF.
* Length, width and depth are in metmillimeterers use sony TOF.
*/
struct DepthImage {
enum class Type { Depth_16 = 0, Depth_32, IR, Cloud, Raw, Eeprom, IQ };
Type type = Type::Depth_32;
std::size_t width = 0; //!< width of the image (in pixel)
std::size_t height = 0; //!< height of the image (in pixel)
double confidence = 0.0; //!< confidence of depth [0.0,1.0]
std::shared_ptr<const std::uint8_t> data = nullptr; //! image of depth
unsigned int dataSize = 0;
double hostTimestamp = std::numeric_limits<double>::infinity(); //!< host timestamp of the physical measurement (in second based on the `std::chrono::steady_clock`).
std::int64_t edgeTimestampUs = (std::numeric_limits<std::int64_t>::min)(); //!< timestamp of the physical measurement (in microsecond based on edge clock).
/**
* @brief Convert to a #xv::RgbImage
*/
RgbImage toRgb() const;
};
Notes:
Get DepthImage by register callback way. The interface call process is as follows:
Xvisio SDK provides API which can convert depth data to point cloud data format.
/**
* @brief A point cloud of 3D points.
*/
struct PointCloud {
double hostTimestamp = std::numeric_limits<double>::infinity(); //!< host timestamp of ? (in second based on the `std::chrono::steady_clock`).
std::int64_t edgeTimestampUs = (std::numeric_limits<std::int64_t>::min)(); //!< timestamp of ? (in microsecond based on edge clock).
std::vector<Vector3f> points;
};
Notes:
To get Pointcloud, firstly you should obtain the DepthImage, and then call the interface for conversion. The process is as follows:
device->tofCamera()->depthImageToPointCloud(tofDepthImage)
std::shared_ptr<xv::Device> device = nullptr;
auto device_list = xv::getDevices(10., "");
if (device_list.empty())`
{
LOG(LOG_Function,"initDevice faiiled:Timeout for device detection.");
return false;
}
device = device_list.begin()->second;
bool ret = m_xvDevice->tofCamera()->setSonyTofSetting(xv::TofCamera::SonyTofLibMode::IQMIX_SF,
xv::TofCamera::Resolution::VGA,
xv::TofCamera::Framerate::FPS_30);
if(!ret)
{
std::cout<<"set TOF Setting failed"<<std::endl;
}
int tofId = -1;
tofId = device->tofCamera()->registerCallback([&](xv::DepthImage const & tofDepthImage){
if (tof.type == xv::DepthImage::Type::Depth_16 ) {
//Operation on tofDepthImage
//...
//point cloud process
if(enableDevMap["tof_point_cloud"])
{
auto points = device->tofCamera()->depthImageToPointCloud(tofDepthImage)->points;
for (auto iter = points.begin(); iter != points.end();iter++)
{
auto point = *iter;
printf(buff, "x=%f ,y=%f ,z=%f\n", point[0], point[1], point[2]);
//...
}
}
}
else if(tof.type == xv::DepthImage::Type::IR )
{
//Operation on tofDepthImage
//...
}
});
//start tof
device->tofCamera()->start();
device->tofCamera()->unregisterCallback(tofId);
device->tofCamera()->stop();
← Xvisio SDK Depth
← Xvisio Features and Quick Start
← Xvisio SDK Documentation Home Page