我正在处理从两幅图像中获取的深度图。 来自opencv StereoBM。 现在需要在它们中找到集群
决定使用pcl地区的增长阶段
33558 www.point clouds.org/documentation/tutorials/region _ growing _ segmentation.PHP .正在阅读本文
在3358 blog.martinperis.com/2012/01/3d-re construction-with-opencv-and-point.html之后将cv : Mat转换为点云
这是
3359 gist.github.com/daiver/5586252在此工作
我想使用这些索引在StereoBM(cv:3360mat )的深度地图中显示群集
我在尝试这个,但对结果不满意
PCL : point cloud : pointxyzrgb : ptr cloud; //cloud from depth map and rgb image
STD : vector : pointindicesclusters; //clusters inices,extracted before
for(intj=0; j clusters.size (; j )
{
cv :3360 matto _ show=cv :3360 mat 33603360 zeros (288、384、cv33603360datatype33603360type; //imagehassizethatequalsizeofrgbimageanddepthmap
for(intI=0; i clusters[j].indices.size (; I )
{
to _ show.data [ clusters [ j ].indices [ I ]=200; //regionsinthismatmustbeequalwithregionsfromdepthmap
}
cv:imshow (',to_show );
cv :等待密钥(;
}
结果
几个集群
另一个集群
可视化的云
如何将集群投影到cv : Mat上?
PS对不起我写错了。 英语不是我的母语
UPD
试图在mat_to_cloud函数中使用循环“恢复”深度贴图
int counter=0;
cv :3360 matto _ show=cv :3360 mat 33603360 zeros (288、384、cv33603360datatype33603360type;
for(intI=0; i cloud-height; I )
{
for(intj=0; j云宽; j )
{
to_show.at(I,j )=cloud-at ) counter ).z;
柜台;
}
}
还有一个循环顺序
int counter=0;
cv :3360 matto _ show=cv :3360 mat 33603360 zeros (288、384、cv33603360datatype33603360type;
for(intj=0; j云宽; j )
{
for(intI=0; i cloud- height; I )
{
to_show.at(I,j )=cloud-at ) counter ).z;
反抗
}
}
我不知道这些图像为什么很像
我以前没有用PCL,但是这个工作可能错了:
//regionsinthismatmustbeequalwithregionsfromdepthmap
to _ show.data [ clusters [ j ].indices [ I ]=200;
to_show是opencv矩阵,但使用点云中的索引。 首先需要将索引转换为像素坐标。