fix editing tiled images

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-08-14 12:54:32 +03:00
parent eb9e2a6f47
commit d1ce9d9365
6 changed files with 31 additions and 25 deletions
+3 -3
View File
@@ -7,6 +7,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Azaion.Common.Database;
using Azaion.Common.DTO;
using Azaion.Common.Extensions;
using MediatR;
using Color = System.Windows.Media.Color;
using Image = System.Windows.Controls.Image;
@@ -473,17 +474,16 @@ public class CanvasEditor : Canvas
public void CreateDetections(Annotation annotation, List<DetectionClass> detectionClasses, Size mediaSize)
{
var splitTile = annotation.SplitTile;
foreach (var detection in annotation.Detections)
{
var detectionClass = DetectionClass.FromYoloId(detection.ClassNumber, detectionClasses);
CanvasLabel canvasLabel;
if (splitTile == null)
if (!annotation.IsSplit || mediaSize.FitSizeForAI())
canvasLabel = new CanvasLabel(detection, RenderSize, mediaSize, detection.Confidence);
else
{
canvasLabel = new CanvasLabel(detection, new Size(Constants.AI_TILE_SIZE, Constants.AI_TILE_SIZE), null, detection.Confidence)
.ReframeFromSmall(splitTile);
.ReframeFromSmall(annotation.SplitTile!);
//From CurrentMediaSize to Render Size
var yoloLabel = new YoloLabel(canvasLabel, mediaSize);