zx 5 éve
szülő
commit
b1e6b6bbb0

+ 2 - 0
.idea/.gitignore

@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml

+ 26 - 11
GarageMeasurement.pro

@@ -28,8 +28,8 @@ INCLUDEPATH += /usr/include/vtk-6.2
 LIBS += /usr/lib/x86_64-linux-gnu/libvtk*.so
 INCLUDEPATH += /usr/include/boost
 LIBS += /usr/lib/x86_64-linux-gnu/libboost_*.so
-INCLUDEPATH += /usr/include/pcl-1.7
-LIBS += /usr/lib/x86_64-linux-gnu/libpcl_*.so
+INCLUDEPATH += /usr/local/include/pcl-1.8
+LIBS += /usr/local/lib/libpcl_*.so
 
 # add opencv 34
 INCLUDEPATH += /usr/local/include
@@ -49,6 +49,23 @@ LIBS += /usr/local/lib/libprotobuf.a
 INCLUDEPATH += /usr/local/include/modbus
 LIBS += /usr/local/lib/libmodbus.so
 
+#cuda
+LIBS += /usr/local/cuda/lib64/libcublas.so
+LIBS += /usr/local/cuda/lib64/libcusolver.so
+LIBS += /usr/local/cuda/lib64/libcudnn.so
+LIBS += /usr/local/cuda/lib64/libcudart.so
+LIBS += /usr/local/cuda/lib64/libcurand.so
+LIBS += /usr/local/cuda/lib64/libcufft.so
+
+
+# locate
+LIBS += /home/zx/zzw/GarageMeasurement/libs/libdark.so
+LIBS += /home/zx/zzw/GarageMeasurement/libs/libpointSIFT_API.so
+LIBS += /home/zx/zzw/GarageMeasurement/libs/libtf_3dcnn_api.so
+LIBS += /home/zx/zzw/GarageMeasurement/libs/libLocate_API.so
+LIBS += /home/zx/zzw/inv/tensorflow-1.8.0/bazel-bin/tensorflow/libtensorflow_cc.so
+LIBS += /home/zx/zzw/inv/tensorflow-1.8.0/bazel-bin/tensorflow/libtensorflow_framework.so
+
 
 SOURCES += \
     laser/Laser.cpp \
@@ -73,14 +90,6 @@ SOURCES += \
     laser/LivoxHubLaser.cpp
 
 HEADERS += \
-    laser/Laser.h \
-    laser/LivoxLaser.h \
-    laser/LivoxMid100Laser.h \
-    laser/LogFiles.h \
-    laser/Point2D.h \
-    laser/Point3D.h \
-    src/StdCondition.h \
-    mainwindow.h \
     laser/Laser.h \
     laser/LivoxLaser.h \
     laser/LivoxMid100Laser.h \
@@ -117,7 +126,13 @@ HEADERS += \
     Process.h \
     src/pathcreator.h \
     laser/LivoxHubLaser.h \
-    qtmessagedef.h
+    qtmessagedef.h \
+    src/locate/Locater.h \
+    src/locate/Locater3Dcnn.h \
+    src/locate/PointSiftSeg.h \
+    src/locate/yolo_v2_class.hpp \
+    src/locate/YoloDetector.h \
+    src/locate/pointSIFT_API.h
 
 FORMS += \
         mainwindow.ui

+ 1 - 1
GarageMeasurement.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.4.1, 2019-10-24T16:02:49. -->
+<!-- Written by QtCreator 4.4.1, 2019-10-29T19:23:33. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>

+ 9 - 8
Process.cpp

@@ -10,7 +10,7 @@ CProcess::CProcess(Automatic::stCalibParam param, void* mainWnd)
 	m_laser = NULL;
 	m_main_wnd = mainWnd;
     m_thread_queue=0;
-
+    m_locater=0;
     connect(this,SIGNAL(MainWndSignal(QVariant)),
             (MainWindow*)m_main_wnd,SLOT(ProcessSlot(QVariant)));
 }
@@ -52,7 +52,8 @@ CProcess::~CProcess()
 	}
 	if (m_laser_calib_param.is_calib() == false)
 	{
-        //delete m_locate;
+        if(m_locater)
+            delete m_locater;
 	}
 
 	
@@ -72,7 +73,7 @@ bool CProcess::Init()
 		for (int i = 0; i < n; ++i)
 		{
 			std::string type = m_laser_calib_param.laser(i).type();
-			////判断是否是从文件来
+			////锟叫讹拷锟角凤拷锟角达拷锟侥硷拷锟斤拷
 			if (type.find("File") != type.npos)
 			{
 				LOG(INFO) << "create fileLaser";
@@ -80,7 +81,7 @@ bool CProcess::Init()
 				m_laser_calib_param.mutable_laser(i)->set_laser_ip(dir);
 
 			}
-			//创建laser
+			//锟斤拷锟斤拷laser
 			m_laser[i] = LaserRegistory::CreateLaser(type, i, m_laser_calib_param.laser(i));
 			if (m_laser[i] == NULL)
 			{
@@ -123,7 +124,7 @@ bool CProcess::Init()
 	}
 
 
-	// 连接到PLC,创建locate
+	// 锟斤拷锟接碉拷PLC,锟斤拷锟斤拷locate
 	if (m_laser_calib_param.is_calib() == false)
 	{
 		if (0 != m_monitor.connect(m_laser_calib_param.plc().plc_ip().c_str(), m_laser_calib_param.plc().plc_port(), 1))
@@ -136,10 +137,10 @@ bool CProcess::Init()
             m_monitor.set_callback(action_callback, monitor_callback,this);
 		}
 
-        /*if (m_locater == 0)
+        if (m_locater == 0)
 		{
 			m_locater = new CLocater();
-        }*/
+        }
 	}
 
 	return true;
@@ -162,7 +163,7 @@ void CProcess::PushTask(uint16_t param, int action_type,bool test)
 		}
 	}
 
-	//创建摆扫测量任务
+	//锟斤拷锟斤拷锟斤拷扫锟斤拷锟斤拷锟斤拷锟斤拷
 
 	modbus::CPLCMonitor* plc = 0;
 	if (test == false)

+ 2 - 0
Process.h

@@ -30,6 +30,7 @@ protected:
     static void result_callback(void* data,void* pointer);
 
 public:
+    CLocater*                                   m_locater;
 
 	CLaser**  m_laser;
 	modbus::CPLCMonitor							m_monitor;
@@ -45,6 +46,7 @@ public:
     void*										m_main_wnd;
 	int											m_plate_index;
 
+
 };
 
 std::string Error_string(ERROR_CODE code);

+ 4 - 3
main.cpp

@@ -56,12 +56,12 @@ int main(int argc, char *argv[])
     QApplication a(argc, argv);
     MainWindow w;
     w.show();
-    char buf[255]={0};
-    getcwd(buf,255);
-    sprintf(buf,"%s/setting/calib.prototxt",buf);
 
     InitGlog();
 
+    char buf[255]={0};
+    getcwd(buf,255);
+    sprintf(buf,"%s/setting/calib.prototxt",buf);
     if(!ReadProtoParam(buf,m_laser_calib_param))
     {
         QMessageBox::about(NULL, "Error", "Read proto failed...");
@@ -72,5 +72,6 @@ int main(int argc, char *argv[])
         QMessageBox::about(NULL, "Error", m_pProcess->LastError().c_str());
     }
 
+    return 0;
     return a.exec();
 }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 387 - 2047
src/CalibParam.pb.cc


+ 111 - 59
src/CalibParam.pb.h

@@ -8,12 +8,12 @@
 
 #include <google/protobuf/stubs/common.h>
 
-#if GOOGLE_PROTOBUF_VERSION < 3004000
+#if GOOGLE_PROTOBUF_VERSION < 3005000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers.  Please update
 #error your headers.
 #endif
-#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers.  Please
 #error regenerate this file with a newer version of protoc.
@@ -30,6 +30,45 @@
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
 #include <google/protobuf/unknown_field_set.h>
 // @@protoc_insertion_point(includes)
+
+namespace protobuf_CalibParam_2eproto {
+// Internal implementation detail -- do not use these members.
+struct TableStruct {
+  static const ::google::protobuf::internal::ParseTableField entries[];
+  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+  static const ::google::protobuf::internal::ParseTable schema[8];
+  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+  static const ::google::protobuf::internal::SerializationTable serialization_table[];
+  static const ::google::protobuf::uint32 offsets[];
+};
+void AddDescriptors();
+void InitDefaultsstValidRegionImpl();
+void InitDefaultsstValidRegion();
+void InitDefaultsstCameraPositionImpl();
+void InitDefaultsstCameraPosition();
+void InitDefaultsstAxis3DImpl();
+void InitDefaultsstAxis3D();
+void InitDefaultsstPointImpl();
+void InitDefaultsstPoint();
+void InitDefaultsstPlateAreaImpl();
+void InitDefaultsstPlateArea();
+void InitDefaultsstPLCParamImpl();
+void InitDefaultsstPLCParam();
+void InitDefaultsstLaserCalibParamImpl();
+void InitDefaultsstLaserCalibParam();
+void InitDefaultsstCalibParamImpl();
+void InitDefaultsstCalibParam();
+inline void InitDefaults() {
+  InitDefaultsstValidRegion();
+  InitDefaultsstCameraPosition();
+  InitDefaultsstAxis3D();
+  InitDefaultsstPoint();
+  InitDefaultsstPlateArea();
+  InitDefaultsstPLCParam();
+  InitDefaultsstLaserCalibParam();
+  InitDefaultsstCalibParam();
+}
+}  // namespace protobuf_CalibParam_2eproto
 namespace Automatic {
 class stAxis3D;
 class stAxis3DDefaultTypeInternal;
@@ -56,24 +95,8 @@ class stValidRegion;
 class stValidRegionDefaultTypeInternal;
 extern stValidRegionDefaultTypeInternal _stValidRegion_default_instance_;
 }  // namespace Automatic
-
 namespace Automatic {
 
-namespace protobuf_CalibParam_2eproto {
-// Internal implementation detail -- do not call these.
-struct TableStruct {
-  static const ::google::protobuf::internal::ParseTableField entries[];
-  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
-  static const ::google::protobuf::internal::ParseTable schema[];
-  static const ::google::protobuf::uint32 offsets[];
-  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
-  static const ::google::protobuf::internal::SerializationTable serialization_table[];
-  static void InitDefaultsImpl();
-};
-void AddDescriptors();
-void InitDefaults();
-}  // namespace protobuf_CalibParam_2eproto
-
 // ===================================================================
 
 class stValidRegion : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Automatic.stValidRegion) */ {
@@ -112,6 +135,7 @@ class stValidRegion : public ::google::protobuf::Message /* @@protoc_insertion_p
   static const ::google::protobuf::Descriptor* descriptor();
   static const stValidRegion& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stValidRegion* internal_default_instance() {
     return reinterpret_cast<const stValidRegion*>(
                &_stValidRegion_default_instance_);
@@ -230,7 +254,8 @@ class stValidRegion : public ::google::protobuf::Message /* @@protoc_insertion_p
   float max_y_;
   float min_z_;
   float max_z_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstValidRegionImpl();
 };
 // -------------------------------------------------------------------
 
@@ -270,6 +295,7 @@ class stCameraPosition : public ::google::protobuf::Message /* @@protoc_insertio
   static const ::google::protobuf::Descriptor* descriptor();
   static const stCameraPosition& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stCameraPosition* internal_default_instance() {
     return reinterpret_cast<const stCameraPosition*>(
                &_stCameraPosition_default_instance_);
@@ -418,7 +444,8 @@ class stCameraPosition : public ::google::protobuf::Message /* @@protoc_insertio
   float focus_x_;
   float focus_y_;
   float focus_z_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstCameraPositionImpl();
 };
 // -------------------------------------------------------------------
 
@@ -458,6 +485,7 @@ class stAxis3D : public ::google::protobuf::Message /* @@protoc_insertion_point(
   static const ::google::protobuf::Descriptor* descriptor();
   static const stAxis3D& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stAxis3D* internal_default_instance() {
     return reinterpret_cast<const stAxis3D*>(
                &_stAxis3D_default_instance_);
@@ -549,7 +577,8 @@ class stAxis3D : public ::google::protobuf::Message /* @@protoc_insertion_point(
   double x_;
   double y_;
   double z_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstAxis3DImpl();
 };
 // -------------------------------------------------------------------
 
@@ -589,6 +618,7 @@ class stPoint : public ::google::protobuf::Message /* @@protoc_insertion_point(c
   static const ::google::protobuf::Descriptor* descriptor();
   static const stPoint& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stPoint* internal_default_instance() {
     return reinterpret_cast<const stPoint*>(
                &_stPoint_default_instance_);
@@ -670,7 +700,8 @@ class stPoint : public ::google::protobuf::Message /* @@protoc_insertion_point(c
   mutable int _cached_size_;
   float x_;
   float y_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstPointImpl();
 };
 // -------------------------------------------------------------------
 
@@ -710,6 +741,7 @@ class stPlateArea : public ::google::protobuf::Message /* @@protoc_insertion_poi
   static const ::google::protobuf::Descriptor* descriptor();
   static const stPlateArea& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stPlateArea* internal_default_instance() {
     return reinterpret_cast<const stPlateArea*>(
                &_stPlateArea_default_instance_);
@@ -791,7 +823,8 @@ class stPlateArea : public ::google::protobuf::Message /* @@protoc_insertion_poi
   mutable int _cached_size_;
   ::google::protobuf::RepeatedPtrField< ::Automatic::stPoint > point_;
   ::google::protobuf::int64 plc_addr_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstPlateAreaImpl();
 };
 // -------------------------------------------------------------------
 
@@ -831,6 +864,7 @@ class stPLCParam : public ::google::protobuf::Message /* @@protoc_insertion_poin
   static const ::google::protobuf::Descriptor* descriptor();
   static const stPLCParam& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stPLCParam* internal_default_instance() {
     return reinterpret_cast<const stPLCParam*>(
                &_stPLCParam_default_instance_);
@@ -917,7 +951,8 @@ class stPLCParam : public ::google::protobuf::Message /* @@protoc_insertion_poin
   mutable int _cached_size_;
   ::google::protobuf::internal::ArenaStringPtr plc_ip_;
   ::google::protobuf::int64 plc_port_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstPLCParamImpl();
 };
 // -------------------------------------------------------------------
 
@@ -957,6 +992,7 @@ class stLaserCalibParam : public ::google::protobuf::Message /* @@protoc_inserti
   static const ::google::protobuf::Descriptor* descriptor();
   static const stLaserCalibParam& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stLaserCalibParam* internal_default_instance() {
     return reinterpret_cast<const stLaserCalibParam*>(
                &_stLaserCalibParam_default_instance_);
@@ -1299,7 +1335,8 @@ class stLaserCalibParam : public ::google::protobuf::Message /* @@protoc_inserti
   double mat_r22_;
   double mat_r23_;
   ::google::protobuf::int64 frame_num_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstLaserCalibParamImpl();
 };
 // -------------------------------------------------------------------
 
@@ -1339,6 +1376,7 @@ class stCalibParam : public ::google::protobuf::Message /* @@protoc_insertion_po
   static const ::google::protobuf::Descriptor* descriptor();
   static const stCalibParam& default_instance();
 
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
   static inline const stCalibParam* internal_default_instance() {
     return reinterpret_cast<const stCalibParam*>(
                &_stCalibParam_default_instance_);
@@ -1477,8 +1515,8 @@ class stCalibParam : public ::google::protobuf::Message /* @@protoc_insertion_po
   void clear_valid_region();
   static const int kValidRegionFieldNumber = 1;
   const ::Automatic::stValidRegion& valid_region() const;
-  ::Automatic::stValidRegion* mutable_valid_region();
   ::Automatic::stValidRegion* release_valid_region();
+  ::Automatic::stValidRegion* mutable_valid_region();
   void set_allocated_valid_region(::Automatic::stValidRegion* valid_region);
 
   // optional .Automatic.stPLCParam plc = 4;
@@ -1486,8 +1524,8 @@ class stCalibParam : public ::google::protobuf::Message /* @@protoc_insertion_po
   void clear_plc();
   static const int kPlcFieldNumber = 4;
   const ::Automatic::stPLCParam& plc() const;
-  ::Automatic::stPLCParam* mutable_plc();
   ::Automatic::stPLCParam* release_plc();
+  ::Automatic::stPLCParam* mutable_plc();
   void set_allocated_plc(::Automatic::stPLCParam* plc);
 
   // optional bool is_calib = 9 [default = true];
@@ -1525,14 +1563,14 @@ class stCalibParam : public ::google::protobuf::Message /* @@protoc_insertion_po
   ::Automatic::stValidRegion* valid_region_;
   ::Automatic::stPLCParam* plc_;
   bool is_calib_;
-  friend struct protobuf_CalibParam_2eproto::TableStruct;
+  friend struct ::protobuf_CalibParam_2eproto::TableStruct;
+  friend void ::protobuf_CalibParam_2eproto::InitDefaultsstCalibParamImpl();
 };
 // ===================================================================
 
 
 // ===================================================================
 
-#if !PROTOBUF_INLINE_NOT_IN_HEADERS
 #ifdef __GNUC__
   #pragma GCC diagnostic push
   #pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -2940,7 +2978,7 @@ inline void stCalibParam::clear_has_valid_region() {
   _has_bits_[0] &= ~0x00000008u;
 }
 inline void stCalibParam::clear_valid_region() {
-  if (valid_region_ != NULL) valid_region_->::Automatic::stValidRegion::Clear();
+  if (valid_region_ != NULL) valid_region_->Clear();
   clear_has_valid_region();
 }
 inline const ::Automatic::stValidRegion& stCalibParam::valid_region() const {
@@ -2949,6 +2987,13 @@ inline const ::Automatic::stValidRegion& stCalibParam::valid_region() const {
   return p != NULL ? *p : *reinterpret_cast<const ::Automatic::stValidRegion*>(
       &::Automatic::_stValidRegion_default_instance_);
 }
+inline ::Automatic::stValidRegion* stCalibParam::release_valid_region() {
+  // @@protoc_insertion_point(field_release:Automatic.stCalibParam.valid_region)
+  clear_has_valid_region();
+  ::Automatic::stValidRegion* temp = valid_region_;
+  valid_region_ = NULL;
+  return temp;
+}
 inline ::Automatic::stValidRegion* stCalibParam::mutable_valid_region() {
   set_has_valid_region();
   if (valid_region_ == NULL) {
@@ -2957,21 +3002,22 @@ inline ::Automatic::stValidRegion* stCalibParam::mutable_valid_region() {
   // @@protoc_insertion_point(field_mutable:Automatic.stCalibParam.valid_region)
   return valid_region_;
 }
-inline ::Automatic::stValidRegion* stCalibParam::release_valid_region() {
-  // @@protoc_insertion_point(field_release:Automatic.stCalibParam.valid_region)
-  clear_has_valid_region();
-  ::Automatic::stValidRegion* temp = valid_region_;
-  valid_region_ = NULL;
-  return temp;
-}
 inline void stCalibParam::set_allocated_valid_region(::Automatic::stValidRegion* valid_region) {
-  delete valid_region_;
-  valid_region_ = valid_region;
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete valid_region_;
+  }
   if (valid_region) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      valid_region = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, valid_region, submessage_arena);
+    }
     set_has_valid_region();
   } else {
     clear_has_valid_region();
   }
+  valid_region_ = valid_region;
   // @@protoc_insertion_point(field_set_allocated:Automatic.stCalibParam.valid_region)
 }
 
@@ -3046,7 +3092,7 @@ inline void stCalibParam::clear_has_plc() {
   _has_bits_[0] &= ~0x00000010u;
 }
 inline void stCalibParam::clear_plc() {
-  if (plc_ != NULL) plc_->::Automatic::stPLCParam::Clear();
+  if (plc_ != NULL) plc_->Clear();
   clear_has_plc();
 }
 inline const ::Automatic::stPLCParam& stCalibParam::plc() const {
@@ -3055,6 +3101,13 @@ inline const ::Automatic::stPLCParam& stCalibParam::plc() const {
   return p != NULL ? *p : *reinterpret_cast<const ::Automatic::stPLCParam*>(
       &::Automatic::_stPLCParam_default_instance_);
 }
+inline ::Automatic::stPLCParam* stCalibParam::release_plc() {
+  // @@protoc_insertion_point(field_release:Automatic.stCalibParam.plc)
+  clear_has_plc();
+  ::Automatic::stPLCParam* temp = plc_;
+  plc_ = NULL;
+  return temp;
+}
 inline ::Automatic::stPLCParam* stCalibParam::mutable_plc() {
   set_has_plc();
   if (plc_ == NULL) {
@@ -3063,21 +3116,22 @@ inline ::Automatic::stPLCParam* stCalibParam::mutable_plc() {
   // @@protoc_insertion_point(field_mutable:Automatic.stCalibParam.plc)
   return plc_;
 }
-inline ::Automatic::stPLCParam* stCalibParam::release_plc() {
-  // @@protoc_insertion_point(field_release:Automatic.stCalibParam.plc)
-  clear_has_plc();
-  ::Automatic::stPLCParam* temp = plc_;
-  plc_ = NULL;
-  return temp;
-}
 inline void stCalibParam::set_allocated_plc(::Automatic::stPLCParam* plc) {
-  delete plc_;
-  plc_ = plc;
+  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
+  if (message_arena == NULL) {
+    delete plc_;
+  }
   if (plc) {
+    ::google::protobuf::Arena* submessage_arena = NULL;
+    if (message_arena != submessage_arena) {
+      plc = ::google::protobuf::internal::GetOwnedMessage(
+          message_arena, plc, submessage_arena);
+    }
     set_has_plc();
   } else {
     clear_has_plc();
   }
+  plc_ = plc;
   // @@protoc_insertion_point(field_set_allocated:Automatic.stCalibParam.plc)
 }
 
@@ -3248,7 +3302,7 @@ inline void stCalibParam::clear_has_project_dir() {
   _has_bits_[0] &= ~0x00000004u;
 }
 inline void stCalibParam::clear_project_dir() {
-  project_dir_.ClearToDefaultNoArena(&stCalibParam::_default_project_dir_.get());
+  project_dir_.ClearToDefaultNoArena(&::Automatic::stCalibParam::_default_project_dir_.get());
   clear_has_project_dir();
 }
 inline const ::std::string& stCalibParam::project_dir() const {
@@ -3257,38 +3311,38 @@ inline const ::std::string& stCalibParam::project_dir() const {
 }
 inline void stCalibParam::set_project_dir(const ::std::string& value) {
   set_has_project_dir();
-  project_dir_.SetNoArena(&stCalibParam::_default_project_dir_.get(), value);
+  project_dir_.SetNoArena(&::Automatic::stCalibParam::_default_project_dir_.get(), value);
   // @@protoc_insertion_point(field_set:Automatic.stCalibParam.project_dir)
 }
 #if LANG_CXX11
 inline void stCalibParam::set_project_dir(::std::string&& value) {
   set_has_project_dir();
   project_dir_.SetNoArena(
-    &stCalibParam::_default_project_dir_.get(), ::std::move(value));
+    &::Automatic::stCalibParam::_default_project_dir_.get(), ::std::move(value));
   // @@protoc_insertion_point(field_set_rvalue:Automatic.stCalibParam.project_dir)
 }
 #endif
 inline void stCalibParam::set_project_dir(const char* value) {
   GOOGLE_DCHECK(value != NULL);
   set_has_project_dir();
-  project_dir_.SetNoArena(&stCalibParam::_default_project_dir_.get(), ::std::string(value));
+  project_dir_.SetNoArena(&::Automatic::stCalibParam::_default_project_dir_.get(), ::std::string(value));
   // @@protoc_insertion_point(field_set_char:Automatic.stCalibParam.project_dir)
 }
 inline void stCalibParam::set_project_dir(const char* value, size_t size) {
   set_has_project_dir();
-  project_dir_.SetNoArena(&stCalibParam::_default_project_dir_.get(),
+  project_dir_.SetNoArena(&::Automatic::stCalibParam::_default_project_dir_.get(),
       ::std::string(reinterpret_cast<const char*>(value), size));
   // @@protoc_insertion_point(field_set_pointer:Automatic.stCalibParam.project_dir)
 }
 inline ::std::string* stCalibParam::mutable_project_dir() {
   set_has_project_dir();
   // @@protoc_insertion_point(field_mutable:Automatic.stCalibParam.project_dir)
-  return project_dir_.MutableNoArena(&stCalibParam::_default_project_dir_.get());
+  return project_dir_.MutableNoArena(&::Automatic::stCalibParam::_default_project_dir_.get());
 }
 inline ::std::string* stCalibParam::release_project_dir() {
   // @@protoc_insertion_point(field_release:Automatic.stCalibParam.project_dir)
   clear_has_project_dir();
-  return project_dir_.ReleaseNoArena(&stCalibParam::_default_project_dir_.get());
+  return project_dir_.ReleaseNoArena(&::Automatic::stCalibParam::_default_project_dir_.get());
 }
 inline void stCalibParam::set_allocated_project_dir(::std::string* project_dir) {
   if (project_dir != NULL) {
@@ -3296,7 +3350,7 @@ inline void stCalibParam::set_allocated_project_dir(::std::string* project_dir)
   } else {
     clear_has_project_dir();
   }
-  project_dir_.SetAllocatedNoArena(&stCalibParam::_default_project_dir_.get(), project_dir);
+  project_dir_.SetAllocatedNoArena(&::Automatic::stCalibParam::_default_project_dir_.get(), project_dir);
   // @@protoc_insertion_point(field_set_allocated:Automatic.stCalibParam.project_dir)
 }
 
@@ -3327,7 +3381,6 @@ inline void stCalibParam::set_is_calib(bool value) {
 #ifdef __GNUC__
   #pragma GCC diagnostic pop
 #endif  // __GNUC__
-#endif  // !PROTOBUF_INLINE_NOT_IN_HEADERS
 // -------------------------------------------------------------------
 
 // -------------------------------------------------------------------
@@ -3345,7 +3398,6 @@ inline void stCalibParam::set_is_calib(bool value) {
 
 // @@protoc_insertion_point(namespace_scope)
 
-
 }  // namespace Automatic
 
 // @@protoc_insertion_point(global_scope)

+ 114 - 0
src/locate/Locater.h

@@ -0,0 +1,114 @@
+#ifndef __LOCATER__HH__
+#define __LOCATER__HH__
+#include <mutex>
+#include "common.h"
+#include "Locater3Dcnn.h"
+#include "PointSiftSeg.h"
+#include "YoloDetector.h"
+
+
+#ifndef PI
+#define PI 3.14159265
+#endif
+
+
+typedef struct PLANE
+{
+	float a;
+	float b;
+	float c;
+}Plane;
+
+enum ERROR_CODE
+{
+	eSucc=0
+	,eArea				//车位区域错误
+	,eLidar				//雷达点云不重合
+	,eCloud				//点云为空
+	,eNoCar				//未检测到车
+	,eMulCar			//多辆车
+	,eDistance			//车间距过小
+
+	,eLimitL=101
+	,eLimitT
+	,eLimitR
+	,eLimitB
+};
+
+typedef struct stCarPosition
+{
+	float x;
+	float y;
+	float a;
+	float l;
+	float w;
+	float h;
+	ERROR_CODE error_code;
+	cv::RotatedRect rrect;
+	int		pos_id;				//车位ID
+	stCarPosition()
+	{
+		error_code = eSucc;
+		pos_id = -1;
+	}
+}CarPosition;
+
+
+class  CLocater
+{
+public:
+	CLocater();
+	~CLocater();
+	bool Locate_test(PtrCloud cloud0, PtrCloud cloud1, std::vector<CarPosition>& results, std::string work_dir,
+		ERROR_CODE& sta,std::string dir_name);
+
+	bool Locate(PtrCloud cloud0, PtrCloud cloud1, std::vector<CarPosition>& results, std::string work_dir,ERROR_CODE& sta);
+	bool Locate(PtrCloud cloud_in, std::vector<CarPosition>& results, std::string work_dir, ERROR_CODE& sta);
+	
+protected:
+	//pointSIFT
+	bool Locate_SIFT(PtrCloud cloud_in, std::vector<bbox_t> boxes ,PtrCloud& cloud_targe, std::string work_dir);
+	///yolo
+	bool Locate_yolo(PtrCloud cloud_in, std::vector<bbox_t>& boxes, std::string work_dir);
+	
+	////
+	bool TestPointInbbox(PointT point, bbox_t box);
+	//////对点云根据yolo结果重新聚类
+	std::vector<PtrCloud> ReCluster(PtrCloud cloud_target, PtrCloud cloud_in, std::vector<bbox_t> boxes, std::string save_dir, std::string dir_name="");
+
+	PtrCloud FilterXY(PtrCloud cloud);
+	//6-25 找直线方法过滤后视镜点
+	bool bound_box(PtrCloud cloud, cv::RotatedRect& box);
+	//原始投影滤波方法
+	bool bound_box_median(PtrCloud cloud, cv::RotatedRect& box);
+	//验证在 z<200 以下的两片点云是否重合(各个区域高度差)
+	bool verify_cloud2(PtrCloud cloud1, PtrCloud cloud2);
+
+
+public:
+	void cut_RGB_cloud_By_yolo(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud, std::string save_path, std::string name_dir);
+
+private:
+	//切割找box
+	cv::RotatedRect getRotateRect1(PtrCloud cloud);
+	//投影滤波找box
+	cv::RotatedRect  getRotateRect0(PtrCloud cloud);
+	
+	cv::RotatedRect  GetMinRotateRect(PtrCloud cloud);
+	bool check_box(cv::RotatedRect& box,PtrCloud convex_hull);
+	PtrCloud Filter_obj(PtrCloud cloud);
+	bool is_need_cluser(PtrCloud cloud);
+	std::vector<PtrCloud> find_clusters(PtrCloud cloud);
+protected:
+	bool getRotatedRectFromImageXY(PtrCloud cloud, double dense, cv::RotatedRect& rect);
+	int getRotatedRectFromImageXY(pcl::PointCloud<PointT>::Ptr cloud, cv::RotatedRect &dstRect);
+protected:
+public:
+	int								m_nfunction;
+	CLocater3Dcnn*					m_p3dcnn_locater;
+	CPointSiftSeg*					m_pPointSiftSeg;
+	YoloDetector*					m_pYoloDetector;
+	std::mutex						m_mutex;
+};
+
+#endif

+ 33 - 0
src/locate/Locater3Dcnn.h

@@ -0,0 +1,33 @@
+#pragma once
+#include "common.h"
+
+
+class  CLocater3Dcnn
+{
+public:
+	CLocater3Dcnn(int l,int w,int h,int freq,int nClass);
+	virtual ~CLocater3Dcnn();
+	virtual bool Init(std::string weights);
+	
+	virtual bool Predict(PtrCloud cloud, cv::RotatedRect& rect, std::string save_dir);
+
+protected:
+	float* generate_tensor(PtrCloud cloud, float min_x, float max_x,
+		float min_y, float max_y, float min_z, float max_z);
+	std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> decodeCloud(pcl::PointCloud<PointT>& cloud,
+		float* data, float min_x, float max_x, float min_y, float max_y, float min_z, float max_z);
+protected:
+	//判断四点是否是矩形
+	bool isRect(std::vector<cv::Point2f> points);
+	std::vector<cv::Point2f> kmeans(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud, std::string cluster_file_path);
+	bool check_box(cv::RotatedRect& box, PtrCloud cloud);
+	////计算长轴延长后的 IOU 防止车门打开
+	bool check_IOU(cv::RotatedRect& box, PtrCloud cloud);
+protected:
+	int m_lenth;
+	int m_width;
+	int m_height;
+	int m_freq;
+	int m_nClass;
+};
+

+ 25 - 0
src/locate/PointSiftSeg.h

@@ -0,0 +1,25 @@
+#pragma once
+#include "common.h"
+#include <string>
+#include "pointSIFT_API.h"
+class CPointSiftSeg : public PointSifter
+{
+public:
+	CPointSiftSeg(int point_size,int cls,float freq,PointT minp,PointT maxp);
+
+	virtual bool Init(std::string graph,std::string cpkt);
+	virtual bool Seg(PtrCloud cloud, std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr>& clouds, std::string save_dir);
+
+	virtual ~CPointSiftSeg();
+protected:
+	bool	Create_data(PtrCloud cloud, float* output);
+	bool    RecoveryCloud(float* output, float* cloud, std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr>& cloud_seg);
+	////  对目标类过滤, 过滤掉障碍物附近的目标点
+	bool	FilterObs(std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr>& cloud_seg, std::string save_dir);
+protected:
+	float		m_freq;
+	PointT		m_minp;
+	PointT		m_maxp;
+
+};
+

+ 82 - 0
src/locate/YoloDetector.h

@@ -0,0 +1,82 @@
+#pragma once
+#include "common.h"
+#define YOLO_API_USED	1
+#include "yolo_v2_class.hpp"
+
+
+
+class YoloDetector
+{
+public:
+	YoloDetector(std::string cfg,std::string weights,float minx,float maxx,float miny,float maxy,float freq);
+	virtual ~YoloDetector();
+
+	bool detect(cv::Mat& l, cv::Mat& r, std::vector<bbox_t>& boxes,std::string save_dir);
+	bool detect(PtrCloud cloud_in, std::vector<bbox_t>& boxes, std::string save_dir);
+protected:
+    void free_img(image_t img);
+    std::shared_ptr<image_t> mat_to_image_resize(cv::Mat mat) const
+    {
+        if (mat.data == NULL) return std::shared_ptr<image_t>(NULL);
+        cv::Mat det_mat;
+        cv::resize(mat, det_mat, cv::Size(m_pDetector->get_net_width(), m_pDetector->get_net_height()));
+        return mat_to_image(det_mat);
+    }
+
+    static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src)
+    {
+        cv::Mat img;
+        cv::cvtColor(img_src, img, cv::COLOR_RGB2BGR);
+        std::shared_ptr<image_t> image_ptr(new image_t, [](image_t *img) { if(img->data) free(img->data); delete img; });
+        std::shared_ptr<IplImage> ipl_small = std::make_shared<IplImage>(img);
+        *image_ptr = ipl_to_image(ipl_small.get());
+        return image_ptr;
+    }
+    static image_t ipl_to_image(IplImage* src)
+    {
+        unsigned char *data = (unsigned char *)src->imageData;
+        int h = src->height;
+        int w = src->width;
+        int c = src->nChannels;
+        int step = src->widthStep;
+        image_t out = make_image_custom(w, h, c);
+        int count = 0;
+
+        for (int k = 0; k < c; ++k) {
+            for (int i = 0; i < h; ++i) {
+                int i_step = i*step;
+                for (int j = 0; j < w; ++j) {
+                    out.data[count++] = data[i_step + j*c + k] / 255.;
+                }
+            }
+        }
+
+        return out;
+    }
+
+    static image_t make_empty_image(int w, int h, int c)
+    {
+        image_t out;
+        out.data = 0;
+        out.h = h;
+        out.w = w;
+        out.c = c;
+        return out;
+    }
+
+    static image_t make_image_custom(int w, int h, int c)
+    {
+        image_t out = make_empty_image(w, h, c);
+        out.data = (float *)calloc(h*w*c, sizeof(float));
+        return out;
+    }
+
+protected:
+	Detector*	m_pDetector;
+	float m_minx;
+	float m_maxx;
+	float m_miny;
+	float m_maxy;
+	float m_freq;
+};
+

+ 22 - 0
src/locate/pointSIFT_API.h

@@ -0,0 +1,22 @@
+#pragma once
+#include <string>
+#include <mutex>
+
+class PointSifter
+{
+public:
+	PointSifter(int point_num, int cls_num);
+	~PointSifter();
+	bool Load(std::string meta, std::string cpkt);
+	bool Predict(float* data, float* output);
+	std::string LastError();
+private:
+	PointSifter();
+protected:
+	std::mutex		m_mutex;
+	std::string		m_error;
+	bool			m_bInit;
+	int				m_point_num;
+	int				m_cls_num;
+	void*			m_sess;
+};

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1052 - 0
src/locate/yolo_v2_class.hpp


+ 1 - 39
src/measuretask.h

@@ -5,51 +5,13 @@
 #include "TaskQueue/BaseTask.h"
 #include "laser/Laser.h"
 #include "modbus/PLCMonitor.h"
+#include "locate/Locater.h"
 
 #ifndef PI
 #define PI 3.14159265
 #endif
 
-typedef struct PLANE
-{
-    float a;
-    float b;
-    float c;
-}Plane;
 
-enum ERROR_CODE
-{
-    eSucc=0
-    ,eArea				//³µÎ»ÇøÓòŽíÎó
-    ,eLidar				//À׎ïµãÔÆ²»ÖغÏ
-    ,eCloud				//µãÔÆÎª¿Õ
-    ,eNoCar				//ÎŽŒì²âµœ³µ
-    ,eMulCar			//¶àÁŸ³µ
-    ,eDistance			//³µŒäŸà¹ýС
-
-    ,eLimitL=101
-    ,eLimitT
-    ,eLimitR
-    ,eLimitB
-};
-
-typedef struct stCarPosition
-{
-    float x;
-    float y;
-    float a;
-    float l;
-    float w;
-    float h;
-    ERROR_CODE error_code;
-    cv::RotatedRect rrect;
-    int		pos_id;				//³µÎ»ID
-    stCarPosition()
-    {
-        error_code = eSucc;
-        pos_id = -1;
-    }
-}CarPosition;
 
 std::string Error_string(ERROR_CODE code);
 bool RegionInRegion(std::vector<cv::Point2f>& mini_poly, std::vector<cv::Point2f>& large_poly);