Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify OpenNI 1.x and 2.x grabber data types #670

Closed
kwaegel opened this issue May 14, 2014 · 5 comments
Closed

Unify OpenNI 1.x and 2.x grabber data types #670

kwaegel opened this issue May 14, 2014 · 5 comments

Comments

@kwaegel
Copy link

kwaegel commented May 14, 2014

Right now the two OpenNI grabbers return different image data types, which makes switching between the two difficult.

I propose changing the OpenNI 1.x grabber to use a metadata wrapper and return the same image types as the 2.x grabber (pcl::io::image, etc.). This should make the rest of the processing pipeline source-agnostic, at least between these two grabbers.

Untested example class:

#pragma once
#ifndef __OPENNI_METADATA_WRAPPER__
#define __OPENNI_METADATA_WRAPPER__

#include <pcl/pcl_config.h>

#if defined(HAVE_OPENNI)

#include <pcl/io/image_metadata_wrapper.h>
#include <pcl/io/openni_camera/openni.h>

namespace openni_wrapper
{
  class OpenniFrameWrapper : public pcl::io::FrameWrapper
  {
    public:
      OpenniFrameWrapper(boost::shared_ptr<xn::ImageMetaData> metadata)
        : metadata_(metadata)
      {}

      virtual inline const void* getData() const   { return metadata_->Data();       }
      virtual inline unsigned getDataSize() const  { return metadata_->DataSize ();  }
      virtual inline unsigned getWidth() const     { return metadata_->XRes ();      }
      virtual inline unsigned getHeight() const    { return metadata_->YRes ();      }
      virtual inline unsigned getFrameID() const   { return metadata_->FrameID();    }
      virtual inline uint64_t getTimestamp() const { return metadata_->Timestamp (); }

      const inline boost::shared_ptr<xn::ImageMetaData> getMetaData() const { return metadata_; }

    private:
      boost::shared_ptr<xn::ImageMetaData> metadata_;
  };

} // namespace
#endif // HAVE_OPENNI

#endif // __OPENNI_METADATA_WRAPPER__
@jspricke
Copy link
Member

Sounds good! Do you have time to do it?

@kwaegel
Copy link
Author

kwaegel commented May 15, 2014

Possibly, but I may not have much free time until August.

I don't think this will be a huge code change, but I also don't (currently) have a system that can build and run tests against OpenNI 1.x.

@kwaegel
Copy link
Author

kwaegel commented May 21, 2014

I made a first pass at updating the image classes, available at this branch. It compiles with Clang 3.4, but I have _not_ tested it with hardware.

@stale
Copy link

stale bot commented May 19, 2020

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the status: stale label May 19, 2020
@kunaltyagi
Copy link
Member

@kwaegel if you're still around, you should create a PR when you have the code. I'm closing this since it's been 6 years, but you can reopen if you have interest in upstreaming you patch.

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

No branches or pull requests

3 participants