我开发一个应用程序:
- 7个读取模型文件和火车一PPF 3D检测;
- 读取场景文件并尝试与探测器匹配;
- 将结果存储在文件中(可视化检索)。
我是继OpenCV tutorial,但也有我不理解甚至是阅读documentation几件事情:
- 的detector.match()商店上结果的姿势在现场模型。但据我了解,构成是模型的位置和方向,但我怎么知道哪个模型是?
- 当我打印第一个结果的姿势时,它给了我一个4x4的表格,其上有浮点值。我在哪里可以找到他们的意思?
- 仍然在姿势打印,它给了我模型索引这首先,我认为这是我用来训练探测器的模型的数量。问题是:我用7个模型来训练探测器,第一个结果给我“Pose to Model Index 12”。所以我认为这是模型描述索引,因为它在 Drost(2012)。但如果它真的是模型描述索引,我怎么知道这个索引属于哪个模型?
- 根据教程,使用transformPCPose并将其写入PLY文件将给出匹配的视觉结果,但 documentation表示它返回一个4x4姿态矩阵,但我仍在打印它,它会给我一个奇怪的图像超过16个顶点,所以我不明白教程在做什么。我如何将可视化结果写入像教程那样的文件?
我也读过ICP用来纠正任何姿势错误,但是使用没有ICP的PPF会给出可接受的结果。无论如何,我试图使用ICP,但它总是给我“错误的参数错误”。
我使用的代码波纹管写着:
void computer_vision_3d(string in_path)
{
Mat files_clouds[NUM_OF_FILES]; // > Stores the point cloud of all objects
Mat scene_cloud; // > Stores the scene point cloud
ppf_match_3d::PPF3DDetector
detector(RELATIVE_SAMPLING_STEP, RELATIVE_DISTANCE_STEP); // > Matches the model with the scene
vector<Pose3DPtr> results; // > Stores the results of the processing
// ! Phase 1 - Train Model
scene_cloud = loadPLYSimple(DEFAULT_SCENE_PATH.c_str(), PARAM_NORMALS);
for(int i = 0; i < NUM_OF_FILES; i++)
{
// . Init Point Cloud
string file_path = DEFAULT_OBJECT_PATH + to_string(i) + ".ply";
files_clouds[i] = loadPLYSimple(file_path.c_str(), PARAM_NORMALS);
// . Train Model
detector.trainModel(files_clouds[i]);
}
// ! Phase 2 - Detect from scene
detector.match(scene_cloud, results,
RELATIVE_SCENE_SAMPLE_STEP, RELATIVE_SCENE_DISTANCE);
// ! Phase 3 - Results
if(results.size() > 0)
{
Pose3DPtr result = results[0];
result->printPose();
// ! Transforms the point cloud to the model pose
for(int i = 0; i < NUM_OF_FILES; i++)
{
Mat pct = transformPCPose(files_clouds[i], result->pose);
string f_name = "match" + to_string(i) + ".ply";
writePLY(pct, f_name.c_str());
}
}
}
其中一个模型,场景和结果:
图1 - 一个七个模型。
图2场景。
图3 - 奇怪的结果。
谢谢!当我问到这个问题时,我对计算机视觉了解不多,现在我明白了一点,我发现我做了很多错误的事情...... –
您可以扩展“正确面向相机” ?我发现在计算法线之前(在计算法线的示例代码中),您设置了视点,但表面法线如何与相机视点相关? – xmp125a
好问题。检查'理论入门'部分的末尾: http://pointclouds.org/documentation/tutorials/normal_estimation.php –