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

Add getRGBVector3i() to every point type with RGB #450

Merged

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Jan 17, 2014

Currently only some of the point types with RGB have methods to access their RGB data as an Eigen vector.

This commit moves definitions of getRGBVector3i() and getRGBVector4i() inside PCL_ADD_RGB macro so that every point type with RGB field gets these functions.

It is not a part of this pull request, but I would propose to rename getRGBVector4i() into getRGBAVector4i() to make it clear that it produces a vector where last value is alpha channel. What do you think?

@taketwo
Copy link
Member Author

taketwo commented Jan 20, 2014

By the way, these functions create a copy of the data (unlike e.g. getVector3fMap() for xyz data, which provides a map). I am not sure what was the motivation to have only copying vector access. Should we change them to getRGBVector3iMap()?

@jspricke
Copy link
Member

Hi Sergey, great finding, I would propose a have the RGBA version in the macro (and leaving the RGB version in place, so we are backward compatible) and using the Map style as well, I don't see a reason to return a copy there.

Currently only some of the point types with RGB have methods to access
their RGB data as an Eigen vector.

This commit moves definitions of `getRGBVector3i()` and
`getRGBVector4i()` inside `PCL_ADD_RGB` macro so that every point type
with RGB field gets these functions.
PCL_ADD_POINT4D becomes a composite of two simpler macros:

* PCL_ADD_UNION_POINT4D
* PCL_ADD_EIGEN_MAPS_POINT4D

The former adds a union, and the latter adds a family of Eigen vector
accessors. The same holds for PCL_ADD_NORMAL4D. These splits are not
strictly necessary, as both macros are always used together. However,
this way the style consistent with PCL_ADD_..._RGB macros, which we
ought to have separated.
In some point types the RGB union is a part of a larger struct, so we
can not have Eigen vector accessors in the same macro.
@taketwo
Copy link
Member Author

taketwo commented Jan 21, 2014

To summarize:

  • added getRGBAVector4i() as a synonim for the old getRGBVector4i();
  • added getBGRVector3cMap() and getBGRAVector4cMap() to access as a map. There is no standard typedef in Eigen for vectors of uint8_t, so I adopted Vector3c where 'c' is for 'char'. Additionally, function names reflect the fact, that you get RGB components in reversed order;
  • massaged other macros to give everything a consistent look;
  • added unit test for all combinations of point types and Eigen vector accessors.

jspricke added a commit that referenced this pull request Jan 24, 2014
Add `getRGBVector3i()` to every point type with RGB
@jspricke jspricke merged commit 4e045f9 into PointCloudLibrary:master Jan 24, 2014
@taketwo taketwo deleted the add-getrgbvectori3-to-macro branch January 24, 2014 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants