add editor, fix some bugs

WIP
This commit is contained in:
Alex Bezdieniezhnykh
2024-09-10 17:10:54 +03:00
parent b4bedb7520
commit 52371ace3a
16 changed files with 498 additions and 148 deletions
+2 -11
View File
@@ -69,8 +69,6 @@ public class PlayerControlHandler :
public async Task Handle(KeyEvent notification, CancellationToken cancellationToken)
{
_logger.LogInformation($"Catch {notification.Args.Key} by {notification.Sender.GetType().Name}");
var key = notification.Args.Key;
var keyNumber = (int?)null;
@@ -79,7 +77,7 @@ public class PlayerControlHandler :
if ((int)key >= (int)Key.NumPad1 && (int)key <= (int)Key.NumPad9)
keyNumber = key - Key.NumPad1;
if (keyNumber.HasValue)
SelectClass(_mainWindow.AnnotationClasses[keyNumber.Value]);
SelectClass((AnnotationClass)_mainWindow.LvClasses.Items[keyNumber.Value]);
if (_keysControlEnumDict.TryGetValue(key, out var value))
await ControlPlayback(value);
@@ -234,16 +232,9 @@ public class PlayerControlHandler :
var currentAnns = _mainWindow.Editor.CurrentAnns
.Select(x => new YoloLabel(x.Info, _mainWindow.Editor.RenderSize, _formState.CurrentVideoSize))
.ToList();
var labels = string.Join(Environment.NewLine, currentAnns.Select(x => x.ToString()));
if (!Directory.Exists(_config.LabelsDirectory))
Directory.CreateDirectory(_config.LabelsDirectory);
if (!Directory.Exists(_config.ImagesDirectory))
Directory.CreateDirectory(_config.ImagesDirectory);
if (!Directory.Exists(_config.ResultsDirectory))
Directory.CreateDirectory(_config.ResultsDirectory);
await YoloLabel.WriteToFile(currentAnns, Path.Combine(_config.LabelsDirectory, $"{fName}.txt"));
await File.WriteAllTextAsync(Path.Combine(_config.LabelsDirectory, $"{fName}.txt"), labels);
var resultHeight = (uint)Math.Round(RESULT_WIDTH / _formState.CurrentVideoSize.Width * _formState.CurrentVideoSize.Height);
await _mainWindow.AddAnnotation(time, currentAnns);