image_framework_ymj/image_framework/algorithm/Libapi3d.h
2024-12-06 16:25:16 +08:00

64 lines
2.2 KiB
C++
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef LIBAPI_3D_H
#define LIBAPI_3D_H
#include "Libapi2D3D.h"
#include <iostream>
#include <vector>
#include <opencv2/opencv.hpp>
#include "open3d/Open3D.h"
using namespace open3d;
class Cal3D
{
public:
// 采集点云数据
static int LibapiCapCloudPoints(std::shared_ptr<geometry::PointCloud>& cloud_ptr);
// 读取点云数据
static int LibapiReadCloudPointsPly(const std::string plyPath, std::shared_ptr<geometry::PointCloud>& cloud_ptr);
// 保存点云数据
static int LibapiSaveCloudPointsPly(std::string savaPath, std::shared_ptr<geometry::PointCloud>& cloud_ptr);
// 点云数据筛选
static int LibapiFilterCloudPointsByDist(std::shared_ptr<geometry::PointCloud>& src_cloud_ptr,
std::shared_ptr<geometry::PointCloud>& dst_cloud_ptr, float minusx, float x, float minusy, float y, float minusz, float z);
// 点云修正
static int LibapiCorrectCloudPoint(std::shared_ptr<geometry::PointCloud>& src_cloud_ptr,
std::shared_ptr<geometry::PointCloud>& dst_cloud_ptr, int node);
// 点云转数组
static int LibapiCloudPointToVec(std::shared_ptr<geometry::PointCloud>& src_cloud_ptr,
std::vector<cv::Point3d>& dst_3d);
// 点云数据转换
static int LibapiRotAndTrans(std::shared_ptr<geometry::PointCloud>& cloud_ptr);
// 点云数据投影
static int LibapiCloudPointsPorject(std::vector<cv::Point3d>& src_points3D,
cv::Mat& cameraMatrix, std::vector<cv::Point2d>& dst_points2D, cv::Mat* im_2D3D, bool doTest, cv::Mat& src_im);
// 点云数据投影按照预埋件区域ROI进行筛选
static int LibapiCloudPointsPorject(
std::vector<cv::Point3d>& src_points3D,
cv::Mat& cameraMatrix,
std::vector <std::vector<cv::Point2f>>& vecConners,
cv::Mat* im2D3D,
std::vector<std::vector<cv::Point2f>>& vecInConners2D,
std::vector<std::vector<cv::Point3f>>& vecInConners3D);
// 用于测试点云数据投影产生的2D3D数据
static int LibapiCloudPointProjectTest(cv::Mat& im_2D3D);
// 点云数据转换为2D3D点对数据
static int LibapiCloudPointsToCMeasureInfo(cv::Mat& im_2D3D, CMeasureInfo& CMeasureInfo);
// 通过H计算2D坐标的3D坐标
static int LibapiCalConner3D(const std::vector<cv::Point2f>& vec2D_2, cv::Mat& H,
std::vector<cv::Point3f> vec3d_n, std::vector<cv::Point3f>& vec3D_4);
};
#endif