24
Field
Button
Description
Save
Saves the network settings�
Cancel
Rejects the network settings�
8 Programming example
Preferably use the ifm3Dlib for access to the device under Linux� The library
has been tested and is the reference implementation for C++�
The library is supported by ifm electronic and the company Lovepark
Robotics� The Apache-2 licence does not allow commercial use�
8.1 ifm3Dlib
Below a short C++ example how to address the device with imf3Dlib�
auto cam = ifm3d::Camera::MakeShared();
auto fg = std::make_shared<ifm3d::FrameGrabber>
↲
(cam,(ifm3d::IMG_AMP|ifm3d::IMG_RDIS|ifm3d::IMG_CART));
auto img = std::make_shared<ifm3d::ImageBuffer>();
if (! fg->WaitForFrame(img.get(), 1000))
{
std::cerr << "Timeout waiting for camera!" << std::endl;
return -1;
}
pcl::io::savePCDFileASCII("point_cloud.pcd", *(img->Cloud()));
imwrite("amplitude.png", img->AmplitudeImage());
imwrite("radial_distance.png", img->DistanceImage());
In the example the device transmits the data set� The amplitude image and the
radial distance from the data set is saved as PNG file� The Cartesian coordinates
are saved as PCL file�
A detailed example is available on the web at:
https://github�com/ifm/ifm3d-
examples/blob/master/file_io/ex-file_io.cpp