From 5b6be00d4b1ffd671c20c4c72d2239c924eaa3d4 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Thu, 23 Aug 2018 12:28:34 +0000
Subject: [PATCH] Added yolov3-tiny_xnor.cfg
---
build/darknet/YoloWrapper.cs | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/build/darknet/YoloWrapper.cs b/build/darknet/YoloWrapper.cs
index 14bf56d..f0c1b0c 100644
--- a/build/darknet/YoloWrapper.cs
+++ b/build/darknet/YoloWrapper.cs
@@ -9,16 +9,16 @@
private const int MaxObjects = 1000;
[DllImport(YoloLibraryName, EntryPoint = "init")]
- public static extern int InitializeYolo(string configurationFilename, string weightsFilename, int gpu);
+ private static extern int InitializeYolo(string configurationFilename, string weightsFilename, int gpu);
[DllImport(YoloLibraryName, EntryPoint = "detect_image")]
- public static extern int DetectImage(string filename, ref BboxContainer container);
+ private static extern int DetectImage(string filename, ref BboxContainer container);
[DllImport(YoloLibraryName, EntryPoint = "detect_mat")]
- public static extern int DetectImage(IntPtr pArray, int nSize, ref BboxContainer container);
+ private static extern int DetectImage(IntPtr pArray, int nSize, ref BboxContainer container);
[DllImport(YoloLibraryName, EntryPoint = "dispose")]
- public static extern int DisposeYolo();
+ private static extern int DisposeYolo();
[StructLayout(LayoutKind.Sequential)]
public struct bbox_t
@@ -66,7 +66,11 @@
{
// Copy the array to unmanaged memory.
Marshal.Copy(imageData, 0, pnt, imageData.Length);
- DetectImage(pnt, imageData.Length, ref container);
+ var count = DetectImage(pnt, imageData.Length, ref container);
+ if (count == -1)
+ {
+ throw new NotSupportedException($"{YoloLibraryName} has no OpenCV support");
+ }
}
catch (Exception exception)
{
--
Gitblit v1.10.0