From d6cb0fcabcece079c6a5b511159127f585897dba Mon Sep 17 00:00:00 2001
From: Tino Hager <tino.hager@nager.at>
Date: Wed, 27 Jun 2018 21:11:33 +0000
Subject: [PATCH] optimize max object definition

---
 build/darknet/YoloWrapper.cs |    5 +++--
 src/yolo_v2_class.cpp        |    2 --
 src/yolo_v2_class.hpp        |    1 -
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/build/darknet/YoloWrapper.cs b/build/darknet/YoloWrapper.cs
index ade0059..14bf56d 100644
--- a/build/darknet/YoloWrapper.cs
+++ b/build/darknet/YoloWrapper.cs
@@ -6,6 +6,7 @@
     public class YoloWrapper : IDisposable
     {
         private const string YoloLibraryName = "yolo_cpp_dll.dll";
+        private const int MaxObjects = 1000;
 
         [DllImport(YoloLibraryName, EntryPoint = "init")]
         public static extern int InitializeYolo(string configurationFilename, string weightsFilename, int gpu);
@@ -29,10 +30,10 @@
             public UInt32 frames_counter;
         };
 
-        [StructLayout(LayoutKind.Sequential, Size = 10)]
+        [StructLayout(LayoutKind.Sequential)]
         public struct BboxContainer
         {
-            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
+            [MarshalAs(UnmanagedType.ByValArray, SizeConst = MaxObjects)]
             public bbox_t[] candidates;
         }
 
diff --git a/src/yolo_v2_class.cpp b/src/yolo_v2_class.cpp
index adba732..aad5876 100644
--- a/src/yolo_v2_class.cpp
+++ b/src/yolo_v2_class.cpp
@@ -22,8 +22,6 @@
 
 #define FRAMES 3
 
-int max_objects() { return C_SHARP_MAX_OBJECTS; }
-
 static Detector* detector;
 //static std::unique_ptr<Detector> detector;
 
diff --git a/src/yolo_v2_class.hpp b/src/yolo_v2_class.hpp
index 9875878..8f7f6ca 100644
--- a/src/yolo_v2_class.hpp
+++ b/src/yolo_v2_class.hpp
@@ -45,7 +45,6 @@
 #include "opencv2/imgproc/imgproc_c.h"	// C
 #endif	// OPENCV
 
-extern "C" YOLODLL_API int max_objects();
 extern "C" YOLODLL_API int init(const char *configurationFilename, const char *weightsFilename, int gpu);
 extern "C" YOLODLL_API int detect_image(const char *filename, bbox_t_container &container);
 extern "C" YOLODLL_API int detect_mat(const uint8_t* data, const size_t data_length, bbox_t_container &container);

--
Gitblit v1.10.0