2015-05-18 34 views
3

我想PCL pointXYZ轉換爲特徵向量轉換PCL點類型XYZ到特徵向量4F

Eigen::Vector4f min (minPnt.x, minPnt.y, minPnt.z); 
Eigen::Vector4f max (maxPnt.x, maxPnt.y, maxPnt.z); 

其中minPnt和maxPnt的類型PCL的:: PointXYZ。 但是,我收到錯誤信息爲「錯誤C2338:THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE」。你能否提出一些其他方法或讓我知道我的方法是否錯誤。

回答

2

我用下面的代碼解決了上述問題。

auto x_min = static_cast<float>(minPnt.x); 
auto y_min = static_cast<float>(minPnt.y); 
auto z_min = static_cast<float>(minPnt.z); 

auto x_max = static_cast<float>(maxPnt.x); 
auto y_max = static_cast<float>(maxPnt.y); 
auto z_max = static_cast<float>(maxPnt.z); 

Eigen::Vector4f min(x_min, y_min, z_min, 0.0); 
Eigen::Vector4f max(x_max, y_max, z_max, 0.0); 

如果有更好的方法,請建議。

1

eigen :: vector4f正在尋找4個花車,但你只給它3(x,y,z)。嘗試在末尾添加0:

Eigen :: Vector4f min(minPnt.x,minPnt.y,minPnt.z,0); Eigen :: Vector4f max(maxPnt.x,maxPnt.y,maxPnt.z,0);

+0

如果您使用(x,y,z,w)座標,則爲1 –