private async Task StartTrackingAsync() { buttonStartTracking.Enabled = false; var imageInfo = GetCurrentImage(); var yoloTracking = new YoloTracking(imageInfo.Width, imageInfo.Height); var count = dataGridViewFiles.RowCount; for (var i = 0; i < count; i++) { if (i > 0) { dataGridViewFiles.Rows[i - 1].Selected = false; } dataGridViewFiles.Rows[i].Selected = true; dataGridViewFiles.CurrentCell = dataGridViewFiles.Rows[i].Cells[0]; var items = Detect(); var trackingItems = yoloTracking.Analyse(items); DrawBoundingBoxes(trackingItems); await Task.Delay(100); } buttonStartTracking.Enabled = true; }
static void TestTracking() { Directory.CreateDirectory("trackingImages"); var configurationDetector = new ConfigurationDetector(); var config = configurationDetector.Detect(); using (var yoloWrapper = new YoloWrapper(config)) { var yoloTracking = new YoloTracking(yoloWrapper, 200); yoloTracking.SetTrackingObject(new Point(216, 343)); var files = Directory.GetFiles(@"test"); //yoloTracking.SetTrackingObject(new Point(385, 480)); //var files = Directory.GetFiles(@"test3"); foreach (var file in files) { var imageData = File.ReadAllBytes(file); var trackingItem = yoloTracking.Analyse(imageData); if (trackingItem == null) { continue; } var fileInfo = new FileInfo(file); File.WriteAllBytes($@"trackingImages\{trackingItem.Index}.bmp", trackingItem.TaggedImageData); } } Console.ReadLine(); }
public YoloItem Track(Image img) { using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Bmp); return(yoloTracking.Analyse(ms.ToArray())); } }
public List <YoloTrackingItem> Detect(byte[] imgByte, Dictionary <string, int> cat, int lineID, Brush bboxColor, double min_score_for_linebbox_overlap, int frameIndex = 0) { IEnumerable <YoloTrackingItem> yoloItems = frameYoloTracking.Analyse(imgByte, cat, bboxColor); return(OverlapVal(imgByte, yoloItems, lineID, bboxColor, min_score_for_linebbox_overlap)); }