Skip to content

Instantly share code, notes, and snippets.

@chatchavan
Last active August 27, 2015 14:55
Show Gist options
  • Save chatchavan/c073b8b15e2c17ad1dbc to your computer and use it in GitHub Desktop.
Save chatchavan/c073b8b15e2c17ad1dbc to your computer and use it in GitHub Desktop.
PCL manual settings on Raspberry Pi
# These settings are obtained from
# pkg-config --print-variables pcl_common-1.7
# pkg-config --variable=libdir pcl_common-1.7
PCL_INCLUDE_DIRS=/usr/include/pcl-1.7
PCL_LIBRARY_DIRS=/usr/lib/arm-linux-gnueabihf
@chatchavan
Copy link
Author

also, make the following methods return 0 always.

openni_wrapper::OpenNIDevice::hasImageStream () const throw ()
openni_wrapper::OpenNIDevice::hasIRStream () const throw ()

@chatchavan
Copy link
Author

Also, make these methods return without doing anything:

openni_wrapper::OpenNIDevice::setIROutputMode (const XnMapOutputMode& output_mode)
openni_wrapper::OpenNIDevice::setImageOutputMode (const XnMapOutputMode& output_mode)

@chatchavan
Copy link
Author

in openni_device_primesense.cpp, comment out lines (commenting out the image_generator_ stuff and ensure that status is declared) :

openni_wrapper::DevicePrimesense::DevicePrimesense (
    xn::Context& context, 
    const xn::NodeInfo& device_node, 
    const xn::NodeInfo& image_node, 
    const xn::NodeInfo& depth_node, 
    const xn::NodeInfo& ir_node) : OpenNIDevice (context, device_node, image_node, depth_node, ir_node)
{
  // setup stream modes
  enumAvailableModes ();
  setDepthOutputMode (getDefaultDepthMode ());
  setImageOutputMode (getDefaultImageMode ());
  setIROutputMode (getDefaultIRMode ());

  boost::unique_lock<boost::mutex> image_lock (image_mutex_);
  // XnStatus status = image_generator_.SetIntProperty ("InputFormat", 5);
  // if (status != XN_STATUS_OK)
  //   THROW_OPENNI_EXCEPTION ("Error setting the image input format to Uncompressed YUV422. Reason: %s", xnGetStatusString (status));

  // status = image_generator_.SetPixelFormat (XN_PIXEL_FORMAT_YUV422);
  // if (status != XN_STATUS_OK)
  //   THROW_OPENNI_EXCEPTION ("Failed to set image pixel format to YUV422. Reason: %s", xnGetStatusString (status));

  image_lock.unlock ();

  boost::lock_guard<boost::mutex> depth_lock (depth_mutex_);
  XnStatus status = depth_generator_.SetIntProperty ("RegistrationType", 1);
  if (status != XN_STATUS_OK)
    THROW_OPENNI_EXCEPTION ("Error setting the registration type. Reason: %s", xnGetStatusString (status));
}

@chatchavan
Copy link
Author

In your program, changed the binding function to use only XYZ. Basically, replace everything with XYZRGBA to XYZ

boost::function<void (const PointCloud<PointXYZ>::ConstPtr&)> f =
            boost::bind(&grabberCallback, _1);

@chatchavan
Copy link
Author

The example in pcl/io/tools/openni_grabber_depth_example.cpp may be a better starting point than the one on the website.

@chatchavan
Copy link
Author

Knowledge in this post is captured in this fork of PCL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment