1
Vector3f DrawResult::findPlane(const vector<Vector3f> &point_cloud, vector<Vector3f> &inlier_points)
input: point_cloud
output inlier_points , plane_center
簡單說明: 該函數(shù)主要是通過ransac方法從point_cloud中估計出來平面,然后將距離在一定閾值之內(nèi)的點選出來作為inlier_points,最后返回這些inlier_point的中心點(平均求得的點)
2
Vector4f findPlane(const vector<Vector3f> &point_cloud);
Vector4f DetectPlane(const vector<Vector3f> &points_cloud);
input:inlier_point
output: plane
這兩個函數(shù)都是通過inlier_points來估計平面點 DetectPlane結(jié)果會更好
3
Vector3f findGround(const vector<Vector3f> &point_cloud, vector<Vector3f> &inlier_points);
input:point_cloud
output: inlier_point ,plane_center
該函數(shù)在有imu的情況下使用,很直接的通過z值來劃分區(qū)域得到不同z值所對應的水平面
4
void drawAR(cv::Mat &result, const vector<Vector3f> &point_cloud, Vector3f P_latest, Matrix3f R_latest, bool vins_update, bool has_imu = true);
input: image(result),point_cloud(3D),translation(P_latest),rotation(R_latest)
這個是繪制AR的主要函數(shù),
- 如果有imu直接使用findGround找到水平面和中心點
- 如果沒有imu,篩選調(diào)用findPlane函數(shù)找到平面和中心點
調(diào)用drawGround將篩選出來的點繪制出來
如果之前已經(jīng)有存在的box,調(diào)用drawBox函數(shù)將已有AR物體繪制出來
如果有新的AR物體請求,調(diào)用drawBox繪制,然后保存新的AR物體到GroundPoint里面
5
bool checkBorder(const cv::Point2f &pt)
input: image_point
output:is in image?
6
void DrawResult::drawBox(cv::Mat &result, Vector3f corner_0, Vector3f corner_x, Vector3f corner_y, Vector3f corner_z, float size, Vector3f P_latest, Matrix3f R_latest, bool inAR)
input : image(result) 一些AR物體的三維點,translation(P_latest) rotation(R_latest)