mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:06:30 +00:00
fix saving scale for datasetexplorer and annotation
This commit is contained in:
@@ -313,11 +313,13 @@ public class AnnotatorEventHandler(
|
||||
private async Task<List<Annotation>> SaveAnnotationInner(string imgPath, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var canvasDetections = mainWindow.Editor.CurrentDetections.Select(x => x.ToCanvasLabel()).ToList();
|
||||
|
||||
var source = (mainWindow.Editor.BackgroundImage.Source as BitmapSource)!;
|
||||
var mediaSize = new Size(source.PixelWidth, source.PixelHeight);
|
||||
var annotationsResult = new List<Annotation>();
|
||||
if (!File.Exists(imgPath))
|
||||
{
|
||||
var source = (mainWindow.Editor.BackgroundImage.Source as BitmapSource)!;
|
||||
if (new Size(source.PixelWidth, source.PixelHeight).FitSizeForAI())
|
||||
if (mediaSize.FitSizeForAI())
|
||||
await source.SaveImage(imgPath, cancellationToken);
|
||||
else
|
||||
{
|
||||
@@ -356,7 +358,7 @@ public class AnnotatorEventHandler(
|
||||
var timeImg = formState.BackgroundTime ?? TimeSpan.FromMilliseconds(mediaPlayer.Time);
|
||||
var annName = formState.MediaName.ToTimeName(timeImg);
|
||||
var currentDetections = canvasDetections.Select(x =>
|
||||
new Detection(annName, new YoloLabel(x, mainWindow.Editor.RenderSize)))
|
||||
new Detection(annName, new YoloLabel(x, mainWindow.Editor.RenderSize, mediaSize)))
|
||||
.ToList();
|
||||
var annotation = await annotationService.SaveAnnotation(formState.MediaName, annName, timeImg, currentDetections, token: cancellationToken);
|
||||
return [annotation];
|
||||
|
||||
Reference in New Issue
Block a user