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

problem with the conditional_euclidean_clustering #2127

Closed
YongWangNJ opened this issue Dec 7, 2017 · 5 comments
Closed

problem with the conditional_euclidean_clustering #2127

YongWangNJ opened this issue Dec 7, 2017 · 5 comments
Labels
kind: bug Type of issue

Comments

@YongWangNJ
Copy link

  • Operating System and version: windows 7
  • Compiler: VS2015
  • PCL Version: 1.8.1

problem with the example "conditional_euclidean_clustering"

Eigen::Map point_a_normal = point_a.normal, point_b_normal = point_b.normal;

conditional_euclidean_clustering.cpp(24): error C2440: “初始化”: 无法从“const float [3]”转换为“Eigen::Map<const Eigen::Vector3f,0,Eigen::Stride<0,0>>”

@SergioRAgostinho SergioRAgostinho added the needs: code review Specify why not closed/merged yet label Dec 7, 2017
@SergioRAgostinho
Copy link
Member

@UnaNancyOwen can you give it a try?

It's this example.

@UnaNancyOwen
Copy link
Member

UnaNancyOwen commented Dec 7, 2017

Same compiler error occurs in #L24 and #L35.

Error	E0415	no suitable constructor exists to convert from "const float [3]" to "Eigen::Map<const Eigen::Vector3f, 0, Eigen::Stride<0, 0>>"	conditional_euclidean_clustering	c:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	24
Error	E0415	no suitable constructor exists to convert from "const float [3]" to "Eigen::Map<const Eigen::Vector3f, 0, Eigen::Stride<0, 0>>"	conditional_euclidean_clustering	c:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	24
Error	E0415	no suitable constructor exists to convert from "const float [3]" to "Eigen::Map<const Eigen::Vector3f, 0, Eigen::Stride<0, 0>>"	conditional_euclidean_clustering	c:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	35
Error	E0415	no suitable constructor exists to convert from "const float [3]" to "Eigen::Map<const Eigen::Vector3f, 0, Eigen::Stride<0, 0>>"	conditional_euclidean_clustering	c:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	35
Error	C2440	'initializing': cannot convert from 'const float [3]' to 'Eigen::Map<const Eigen::Vector3f,0,Eigen::Stride<0,0>>'		conditional_euclidean_clustering	C:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	24
Error	C2440	'initializing': cannot convert from 'const float [3]' to 'Eigen::Map<const Eigen::Vector3f,0,Eigen::Stride<0,0>>'		conditional_euclidean_clustering	C:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	24
Error	C2440	'initializing': cannot convert from 'const float [3]' to 'Eigen::Map<const Eigen::Vector3f,0,Eigen::Stride<0,0>>'		conditional_euclidean_clustering	c:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	35
Error	C2440	'initializing': cannot convert from 'const float [3]' to 'Eigen::Map<const Eigen::Vector3f,0,Eigen::Stride<0,0>>'		conditional_euclidean_clustering	c:\conditional_euclidean_clustering\conditional_euclidean_clustering.cpp	35

If fix as follows, this example can build successfully.
(If you use PCL that installed using PCL All-in-one Installer, You need to define PCL_NO_PRECOMPILE in preprocessor definitions for pcl::NormalEstimation<pcl::PointXYZI, pcl::PointXYZINormal>.)

- Eigen::Map<const Eigen::Vector3f> point_a_normal = point_a.normal, point_b_normal = point_b.normal;
+ Eigen::Map<const Eigen::Vector3f> point_a_normal (point_a.normal), point_b_normal (point_b.normal);

@SergioRAgostinho
Copy link
Member

Can you quickly submit a fix for it?

Using getNormalVector3fMap() should do the trick

#define PCL_ADD_EIGEN_MAPS_NORMAL4D \
inline pcl::Vector3fMap getNormalVector3fMap () { return (pcl::Vector3fMap (data_n)); } \
inline pcl::Vector3fMapConst getNormalVector3fMap () const { return (pcl::Vector3fMapConst (data_n)); } \
inline pcl::Vector4fMap getNormalVector4fMap () { return (pcl::Vector4fMap (data_n)); } \
inline pcl::Vector4fMapConst getNormalVector4fMap () const { return (pcl::Vector4fMapConst (data_n)); }

@SergioRAgostinho SergioRAgostinho added kind: bug Type of issue and removed needs: code review Specify why not closed/merged yet labels Dec 7, 2017
@UnaNancyOwen
Copy link
Member

It can build successfully. I will send pull request right away.

- Eigen::Map<const Eigen::Vector3f> point_a_normal = point_a.normal, point_b_normal = point_b.normal;
+ Eigen::Map<const Eigen::Vector3f> point_a_normal = point_a.getNormalVector3fMap (), point_b_normal = point_b.getNormalVector3fMap ();

@YongWangNJ
Copy link
Author

It can build successfully now, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue
Projects
None yet
Development

No branches or pull requests

3 participants