Beispiel #1
0
    public void Setup()
    {
        yolo = new YoloWrapper(YoloConfigFilename, YoloWeightsFilename, YoloClassesFilename);
        var image = Image.FromFile(ImageFilename);

        channels = image.RawFormat.Equals(ImageFormat.Png)
                        ? 4
                        : 3;
        byteArray  = Image2Byte(image);
        colorImage = BitmapToColorImage((Bitmap)image, channels);
        var floatArray = new FloatArray();

        floatYoloFormatArray = floatArray.GetYoloFloatArray(colorImage, channels);
    }
Beispiel #2
0
        public unsafe void PassIntPtrForObjectTracking()
        {
            var image      = new Bitmap(YoloConfigurationTests.DummyImageFilename, false);
            var colorImage = BitmapToColorImage(image, new Model.Size(image.Width, image.Height));
            var floatArray = new FloatArray();
            var array      = floatArray.GetYoloFloatArray(colorImage, Channels);
            IEnumerable <YoloItem> yoloResponse;

            fixed(float *floatArrayPointer = &array[0])
            {
                yoloResponse = yolo.Track(new IntPtr(floatArrayPointer), colorImage.Width,
                                          colorImage.Height, Channels);
            }

            foreach (var item in yoloResponse)
            {
                Assert.That(item.Type, Is.EqualTo("StressBall"));
                Console.WriteLine("Frame: " + item.FrameId + " Shape: " + item.Shape + " Found:" +
                                  item.Type + " ID: " + item.TrackId + " BB: [" + item.X + "," + item.Y + "," +
                                  item.Width + "," + item.Height + "]");
            }
        }