Hi everybody!
I would like to transform my point cloud 3D coordinates:
pcl::PointCloud<pcl::PointXYZ> point_cloud;
to an OpenCV matrix:
cv::Mat point_cloud_matrix;
I could define a 3 channel float matrix with one row per point in the point cloud, like this:
cv::Mat point_cloud_matrix(point_cloud.points.size(), 1, CV_32FC3);
and then manually copy each point on the point cloud to the matrix. But, it feels like a little bit brute force approach.
Can anyone suggest a more elegant way to do it? My ultimate goal is to apply OpenCV's k-means algorithm to extract clusters of points.
Thanks in advance!