Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tpanzarella/1975acec9f4bdf5eb21d44a6fc91ce7d to your computer and use it in GitHub Desktop.
Save tpanzarella/1975acec9f4bdf5eb21d44a6fc91ce7d to your computer and use it in GitHub Desktop.
Basic ifm3d usage
#include <iostream>
#include <memory>
#include <opencv2/core/core.hpp>
#include <ifm3d/camera.h>
#include <ifm3d/fg.h>
#include <ifm3d/image.h>
int main(int argc, const char **argv)
{
auto cam = ifm3d::Camera::MakeShared();
auto fg = std::make_shared<ifm3d::FrameGrabber>(cam);
auto im = std::make_shared<ifm3d::ImageBuffer>();
cv::Mat amp;
cv::Mat xyz;
while (true)
{
if (! fg->WaitForFrame(im.get(), 1000))
{
std::cerr << "Timeout waiting for camera!" << std::endl;
return -1;
}
amp = im->AmplitudeImage();
xyz = im->XYZImage();
// now do something with `amp` and `xyz`
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment