mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Merge pull request #1111 from tinohager/master
Optimize C# interface adjust array size
This commit is contained in:
@ -6,6 +6,7 @@ namespace Darknet
|
||||
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 @@ namespace Darknet
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,6 @@ extern "C" {
|
||||
|
||||
#define FRAMES 3
|
||||
|
||||
int max_objects() { return C_SHARP_MAX_OBJECTS; }
|
||||
|
||||
//static Detector* detector = NULL;
|
||||
static std::unique_ptr<Detector> detector;
|
||||
|
||||
|
@ -45,7 +45,6 @@ struct bbox_t_container {
|
||||
#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);
|
||||
|
Reference in New Issue
Block a user