|
@@ -5,6 +5,10 @@
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
#include <pcl/point_types.h>
|
|
|
#include <pcl/point_cloud.h>
|
|
|
+#include <pcl/filters/statistical_outlier_removal.h>
|
|
|
+#include <pcl/filters/approximate_voxel_grid.h>
|
|
|
+#include <pcl/filters/voxel_grid.h>
|
|
|
+#include <pcl/common/transforms.h>
|
|
|
|
|
|
#include "error_code/error_code.hpp"
|
|
|
#include "VzenseNebula_api.h"
|
|
@@ -16,6 +20,9 @@
|
|
|
#include "pcl/trans_coor.hpp"
|
|
|
#include "pcl/point3D_tool.h"
|
|
|
#include "tof3d_config.pb.h"
|
|
|
+#include <Eigen/Core>
|
|
|
+#include <Eigen/Geometry>
|
|
|
+#include <pcl/visualization/pcl_visualizer.h>
|
|
|
|
|
|
#ifdef ENABLE_TENSORRT_DETECT
|
|
|
#include "detect/tensorrt/wheel-detector.h"
|
|
@@ -24,54 +31,14 @@
|
|
|
#include "detect/onnx/wheel-detector.h"
|
|
|
|
|
|
#endif
|
|
|
-
|
|
|
+#include "ceres_detect/car_pose_detector.h"
|
|
|
+#include "ceres_detect/wheel_detector.h"
|
|
|
|
|
|
class DeviceTof3D {
|
|
|
public:
|
|
|
- struct WheelDetectResult {
|
|
|
- bool haveCloud = false;
|
|
|
- bool segmentOk = false;
|
|
|
- bool detectOk = false;
|
|
|
- pcl::PointXYZ center;
|
|
|
- float confidence = 0;
|
|
|
-
|
|
|
- void reset() {
|
|
|
- haveCloud = false;
|
|
|
- segmentOk = false;
|
|
|
- detectOk = false;
|
|
|
- center.x = 0;
|
|
|
- center.y = 0;
|
|
|
- center.z = 0;
|
|
|
- confidence = 0;
|
|
|
- }
|
|
|
- };
|
|
|
- struct CarDetectResult {
|
|
|
- float wheels_center_x;
|
|
|
- float wheels_center_y;
|
|
|
- float width;
|
|
|
- float wheel_width;
|
|
|
- float length;
|
|
|
- float wheel_length;
|
|
|
- float front_wheels_theta;
|
|
|
- float theta;
|
|
|
- float wheel_base;
|
|
|
-
|
|
|
- void reset() {
|
|
|
- wheels_center_x = 0;
|
|
|
- wheels_center_y = 0;
|
|
|
- width = 0;
|
|
|
- wheel_width = 0;
|
|
|
- length = 0;
|
|
|
- wheel_length = 0;
|
|
|
- front_wheels_theta = 0;
|
|
|
- theta = 0;
|
|
|
- wheel_base = 0;
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
struct DetectResult {
|
|
|
- WheelDetectResult wheel[DeviceAzimuth::MAX];
|
|
|
- CarDetectResult car;
|
|
|
+ singleWheelDetector::WheelDetectResult wheel[DeviceAzimuth::MAX];
|
|
|
+ Car_pose_detector::CarDetectResult car;
|
|
|
|
|
|
void reset() {
|
|
|
for (int i = 0; i < DeviceAzimuth::MAX; i++) {
|
|
@@ -79,6 +46,11 @@ public:
|
|
|
}
|
|
|
car.reset();
|
|
|
}
|
|
|
+
|
|
|
+ std::string info() {
|
|
|
+ std::string str = car.info();
|
|
|
+ return str;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
struct tof3dVzenseInfo {
|
|
@@ -102,9 +74,6 @@ public:
|
|
|
|
|
|
~DeviceTof3D() = default;
|
|
|
|
|
|
- // TODO
|
|
|
- void run();
|
|
|
-
|
|
|
Error_manager Init(const VzEtcMap &tp_tof3d, bool search = true);
|
|
|
|
|
|
Error_manager reInit(const VzEtcMap &etc);
|
|
@@ -170,10 +139,10 @@ protected:
|
|
|
pcl::PointCloud<pcl::PointXYZ>::Ptr &wheel_cloud);
|
|
|
|
|
|
// 车轮点云优化
|
|
|
- Error_manager WheelCloudOptimize(pcl::PointCloud<pcl::PointXYZ>::Ptr &wheel_cloud, DetectResult &result);
|
|
|
+ Error_manager WheelCloudOptimize(std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> &vct_wheel_cloud, DetectResult &result);
|
|
|
|
|
|
// 车身点云优化
|
|
|
- Error_manager CarPoseOptimize(pcl::PointCloud<pcl::PointXYZ>::Ptr &car_cloud, DetectResult &result);
|
|
|
+ Error_manager CarPoseOptimize(pcl::visualization::PCLVisualizer &viewer, int *view_port, pcl::PointCloud<pcl::PointXYZ>::Ptr &car_cloud, DetectResult &result);
|
|
|
|
|
|
Error_manager grpcVzenseMat(JetStream::ResFrame &frame, const DeviceAzimuth &azimuth, cv::Mat &mat);
|
|
|
|
|
@@ -196,16 +165,19 @@ private:
|
|
|
|
|
|
struct DeviceMat {
|
|
|
cv::Mat depthMat;
|
|
|
+ cv::Mat irMat;
|
|
|
cv::Mat pointMat;
|
|
|
|
|
|
DeviceMat() {
|
|
|
- depthMat.create(480, 640, CV_16UC1);
|
|
|
- pointMat.create(480, 640, CV_32FC4);
|
|
|
+ irMat = cv::Mat::zeros(480, 640, CV_8UC1);
|
|
|
+ depthMat = cv::Mat::zeros(480, 640, CV_16UC1);
|
|
|
+ pointMat = cv::Mat::zeros(480, 640, CV_32FC4);
|
|
|
}
|
|
|
|
|
|
DeviceMat& operator=(const DeviceMat &p) {
|
|
|
this->depthMat = p.depthMat.clone();
|
|
|
this->pointMat = p.pointMat.clone();
|
|
|
+ this->irMat = p.irMat.clone();
|
|
|
return *this;
|
|
|
}
|
|
|
};
|