[OpenNI-dev] Redefining pcl::PointXYZRGB for the openni_kinect driver

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Redefining pcl::PointXYZRGB for the openni_kinect driver

Ivan Dryanovski
Hi everyone,

This topic (http://answers.ros.org/question/889/) discusses in some
detail the size of a pcl::PointXYZRGB cloud produced by the
openni_kinect driver. It also describes a way to reduce it from 8
floats to 4 floats, by transmitting the rgb data in the 4th field of
the float[4] array reserved for xyz data. I tried patching the
point_types.hpp in perception_pcl (downloaded from svn) to implement
that. I tried several ways, like this for example:

struct _PointXYZRGB
{
  inline Eigen::Map<Eigen::Vector3f> getNormalVector3fMap () { return
(Eigen::Vector3f::Map (data_n)); }
  inline const Eigen::Map<const Eigen::Vector3f> getNormalVector3fMap
() const { return (Eigen::Vector3f::Map (data_n)); }
  inline Eigen::Map<Eigen::Vector4f, Eigen::Aligned>
getNormalVector4fMap () { return (Eigen::Vector4f::MapAligned
(data_n)); }
  inline const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned>
getNormalVector4fMap () const { return (Eigen::Vector4f::MapAligned
(data_n)); }

  union {
    float data[4];
    struct {
      float x;
      float y;
      float z;

      union
      {
        struct
        {
          uint8_t b;
          uint8_t g;
          uint8_t r;
          uint8_t _unused;
        };
        float rgb;
        uint32_t rgba;
      };
    };
  } EIGEN_ALIGN16;
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;

What this is supposed to do is create a union where the data[3] can
either be a union of 4 uint8's, or a float, or a uint32.

This compiled successfully, however, when I actually run the
openni_camera driver, I get the following message:

[ INFO] [1308363046.837610407]: [/openni_node1] Number devices connected: 1
[ INFO] [1308363046.837790331]: [/openni_node1] 1. device on bus
002:06 is a Xbox NUI Camera (2ae) from Microsoft (45e) with serial id
'B00365604849043B'
[ INFO] [1308363046.841128918]: [/openni_node1] searching for device
with index = 1
[ INFO] [1308363046.920465898]: [/openni_node1] Opened 'Xbox NUI
Camera' on bus 2:6 with serial number 'B00365604849043B'
[ INFO] [1308363046.945645316]: rgb_frame_id = '/openni_rgb_optical_frame'
[ INFO] [1308363046.949330496]: depth_frame_id = '/openni_depth_optical_frame'
terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  virtual void
openni_wrapper::DeviceKinect::setSynchronization(bool) @
/home/idryanov/ros/perception_pcl/pcl/build/pcl_trunk/io/src/openni_camera/openni_device_kinect.cpp
@ 123 : Microsoft Kinect does not support Hardware synchronization.
[openni_node1-2] process has died [pid 3756, exit code -6].
log files: /home/idryanov/.ros/log/2c898d46-9950-11e0-911b-8ca98268e16c/openni_node1-2*.log

This occurs when the first subscriber (like rviz or rostopic echo)
attaches itself to the /camera/depth/points topic. If I subscribe to
the /camera/rgb/points topic, I get a slightly different error:

terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  virtual void
openni_wrapper::DeviceKinect::setDepthCropping(unsigned int, unsigned
int, unsigned int, unsigned int) @
/home/idryanov/ros/perception_pcl/pcl/build/pcl_trunk/io/src/openni_camera/openni_device_kinect.cpp
@ 144 : Microsoft Kinect does not support cropping for the depth
stream.

I looked in the openni drvier for where setDepthCropping is called,
and I couldn't find it anywhere.

I'm not sure what the problem is - any help would be appreciated.

Thank you,
Ivan Dryanovski

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Re: [PCL-users] Redefining pcl::PointXYZRGB for the openni_kinect driver

rusu
Administrator
Ivan,

Sending RGB as the fourth dimension is a bad idea if you care about SSE-enabled computation afterwards. If sending less data over the wire is important, try using our point cloud compression routines which go down to as less as 0.4 bytes per point.

Cheers,
Radu.

On Jun 17, 2011, at 19:26, Ivan Dryanovski <[hidden email]> wrote:

> Hi everyone,
>
> This topic (http://answers.ros.org/question/889/) discusses in some
> detail the size of a pcl::PointXYZRGB cloud produced by the
> openni_kinect driver. It also describes a way to reduce it from 8
> floats to 4 floats, by transmitting the rgb data in the 4th field of
> the float[4] array reserved for xyz data. I tried patching the
> point_types.hpp in perception_pcl (downloaded from svn) to implement
> that. I tried several ways, like this for example:
>
> struct _PointXYZRGB
> {
>  inline Eigen::Map<Eigen::Vector3f> getNormalVector3fMap () { return
> (Eigen::Vector3f::Map (data_n)); }
>  inline const Eigen::Map<const Eigen::Vector3f> getNormalVector3fMap
> () const { return (Eigen::Vector3f::Map (data_n)); }
>  inline Eigen::Map<Eigen::Vector4f, Eigen::Aligned>
> getNormalVector4fMap () { return (Eigen::Vector4f::MapAligned
> (data_n)); }
>  inline const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned>
> getNormalVector4fMap () const { return (Eigen::Vector4f::MapAligned
> (data_n)); }
>
>  union {
>    float data[4];
>    struct {
>      float x;
>      float y;
>      float z;
>
>      union
>      {
>        struct
>        {
>          uint8_t b;
>          uint8_t g;
>          uint8_t r;
>          uint8_t _unused;
>        };
>        float rgb;
>        uint32_t rgba;
>      };
>    };
>  } EIGEN_ALIGN16;
>  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
> } EIGEN_ALIGN16;
>
> What this is supposed to do is create a union where the data[3] can
> either be a union of 4 uint8's, or a float, or a uint32.
>
> This compiled successfully, however, when I actually run the
> openni_camera driver, I get the following message:
>
> [ INFO] [1308363046.837610407]: [/openni_node1] Number devices connected: 1
> [ INFO] [1308363046.837790331]: [/openni_node1] 1. device on bus
> 002:06 is a Xbox NUI Camera (2ae) from Microsoft (45e) with serial id
> 'B00365604849043B'
> [ INFO] [1308363046.841128918]: [/openni_node1] searching for device
> with index = 1
> [ INFO] [1308363046.920465898]: [/openni_node1] Opened 'Xbox NUI
> Camera' on bus 2:6 with serial number 'B00365604849043B'
> [ INFO] [1308363046.945645316]: rgb_frame_id = '/openni_rgb_optical_frame'
> [ INFO] [1308363046.949330496]: depth_frame_id = '/openni_depth_optical_frame'
> terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
>  what():  virtual void
> openni_wrapper::DeviceKinect::setSynchronization(bool) @
> /home/idryanov/ros/perception_pcl/pcl/build/pcl_trunk/io/src/openni_camera/openni_device_kinect.cpp
> @ 123 : Microsoft Kinect does not support Hardware synchronization.
> [openni_node1-2] process has died [pid 3756, exit code -6].
> log files: /home/idryanov/.ros/log/2c898d46-9950-11e0-911b-8ca98268e16c/openni_node1-2*.log
>
> This occurs when the first subscriber (like rviz or rostopic echo)
> attaches itself to the /camera/depth/points topic. If I subscribe to
> the /camera/rgb/points topic, I get a slightly different error:
>
> terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
>  what():  virtual void
> openni_wrapper::DeviceKinect::setDepthCropping(unsigned int, unsigned
> int, unsigned int, unsigned int) @
> /home/idryanov/ros/perception_pcl/pcl/build/pcl_trunk/io/src/openni_camera/openni_device_kinect.cpp
> @ 144 : Microsoft Kinect does not support cropping for the depth
> stream.
>
> I looked in the openni drvier for where setDepthCropping is called,
> and I couldn't find it anywhere.
>
> I'm not sure what the problem is - any help would be appreciated.
>
> Thank you,
> Ivan Dryanovski
> _______________________________________________
> [hidden email] / http://pointclouds.org
> https://code.ros.org/mailman/listinfo/pcl-users

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: [OpenNI-dev] Re: [PCL-users] Redefining pcl::PointXYZRGB for the openni_kinect driver

Ivan Dryanovski
> Sending RGB as the fourth dimension is a bad idea if you care about SSE-enabled computation afterwards.

I see - thanks for the reply. Is there a straightforward reason for
this? As far as I can tell, the difference is between performing
operations on [x, y, z, 0] vs performing operations on [x, y, z,
arbitrary float]

Ivan

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.