我開發一個應用程序:
- 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 –