From de087abe1b21eae06f7dbb673bb2e87b6a85400a Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Fri, 13 Nov 2026 18:18:19 +0100 Subject: [PATCH 1/9] Add tests --- .../BitmapOperations/AiDenoiseOperation.cs | 4 +- PhotoLocator/MainWindow.xaml.cs | 5 ++ PhotoLocatorTest/HoleClosingOperationTest.cs | 59 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 PhotoLocatorTest/HoleClosingOperationTest.cs diff --git a/PhotoLocator/BitmapOperations/AiDenoiseOperation.cs b/PhotoLocator/BitmapOperations/AiDenoiseOperation.cs index 564dfd6..dbf82e8 100644 --- a/PhotoLocator/BitmapOperations/AiDenoiseOperation.cs +++ b/PhotoLocator/BitmapOperations/AiDenoiseOperation.cs @@ -178,7 +178,7 @@ private static InferenceSession CreateSession(string modelPath, bool preferDirec private static void RunTileInference(InferenceSession session, FloatBitmap source, int srcLeft, int srcTop, int tileWidth, int tileHeight, int channels, FloatBitmap dstBitmap, int dstLeft, int dstTop) { var inputBuffer = new float[1 * channels * tileHeight * tileWidth]; - for (var y = 0; y < tileHeight; y++) + Parallel.For(0, tileHeight, y => { var sourceY = srcTop + y; for (var x = 0; x < tileWidth; x++) @@ -190,7 +190,7 @@ private static void RunTileInference(InferenceSession session, FloatBitmap sourc inputBuffer[index] = source.Elements[sourceY, sourceX * channels + c]; } } - } + }); var inputName = session.InputMetadata.Keys.First(); using var output = session.Run([NamedOnnxValue.CreateFromTensor(inputName, new DenseTensor(inputBuffer, [1, channels, tileHeight, tileWidth]))]); diff --git a/PhotoLocator/MainWindow.xaml.cs b/PhotoLocator/MainWindow.xaml.cs index c979ba1..928cefd 100644 --- a/PhotoLocator/MainWindow.xaml.cs +++ b/PhotoLocator/MainWindow.xaml.cs @@ -432,6 +432,11 @@ private void UpdateLogView() private void HandleLogEventAdded(string line) { + Threads.DefaultDispatcher.SwitchToMainThreadAsync().ContinueWith(_ => + { + LogTextBox.AppendText("\n" + line); + LogTextBox.ScrollToEnd(); + }, TaskScheduler.FromCurrentSynchronizationContext()); Dispatcher.BeginInvoke(() => { LogTextBox.AppendText("\n" + line); diff --git a/PhotoLocatorTest/HoleClosingOperationTest.cs b/PhotoLocatorTest/HoleClosingOperationTest.cs new file mode 100644 index 0000000..f7ea517 --- /dev/null +++ b/PhotoLocatorTest/HoleClosingOperationTest.cs @@ -0,0 +1,59 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using PhotoLocator.BitmapOperations; +using System; + +namespace PhotoLocator +{ + [TestClass] + public class HoleClosingOperationTest + { + [TestMethod] + public void CloseHolesIteratively_FillsSingleHole() + { + // Arrange + int width = 3; + int height = 1; + int planes = 1; + var image = new FloatBitmap(width, height, planes); + var mask = new FloatBitmap(width, height, planes); + // set all pixel values to 1 (non-hole) + for (int x = 0; x < width; x++) + image[x, 0] = 1f; + // create a single hole at middle pixel + image[1, 0] = 0f; + mask[1, 0] = 1f; // hole indicator + // non-hole pixels in mask are 0 + float threshold = 0.5f; + // Act + HoleClosingOperation.CloseHolesIteratively(image, mask, threshold); + // Assert + // The center pixel should be replaced by the average of its neighbors (both 1) + Assert.AreEqual(1f, image[1, 0], 1e-6f, "Center pixel should be filled with average of neighbors"); + } + + [TestMethod] + public void CloseHolesIteratively_FillsAdjacentHoles() + { + // Arrange + int width = 5; + int height = 1; + int planes = 1; + var image = new FloatBitmap(width, height, planes); + var mask = new FloatBitmap(width, height, planes); + // set all pixel values to 1 (non-hole) + for (int x = 0; x < width; x++) + image[x, 0] = 1f; + // create holes at positions 1 and 3 + image[1, 0] = 0f; + image[3, 0] = 0f; + mask[1, 0] = 1f; + mask[3, 0] = 1f; + float threshold = 0.5f; + // Act + HoleClosingOperation.CloseHolesIteratively(image, mask, threshold); + // Assert + Assert.AreEqual(1f, image[1, 0], 1e-6f, "Hole at position 1 should be filled"); + Assert.AreEqual(1f, image[3, 0], 1e-6f, "Hole at position 3 should be filled"); + } + } +} \ No newline at end of file From 04a2feec599c7cb52cde762b683d1605b7d511f1 Mon Sep 17 00:00:00 2001 From: meesoft Date: Sat, 14 Nov 2026 11:08:29 +0100 Subject: [PATCH 2/9] Bitmap constructor --- PhotoLocator/BitmapOperations/FloatBitmap.cs | 25 ++++++- PhotoLocator/MainWindow.xaml.cs | 5 -- .../HoleClosingOperationTest.cs | 72 +++++++++++++++++++ PhotoLocatorTest/HoleClosingOperationTest.cs | 59 --------------- 4 files changed, 96 insertions(+), 65 deletions(-) create mode 100644 PhotoLocatorTest/BitmapOperations/HoleClosingOperationTest.cs delete mode 100644 PhotoLocatorTest/HoleClosingOperationTest.cs diff --git a/PhotoLocator/BitmapOperations/FloatBitmap.cs b/PhotoLocator/BitmapOperations/FloatBitmap.cs index 07842e5..41506da 100644 --- a/PhotoLocator/BitmapOperations/FloatBitmap.cs +++ b/PhotoLocator/BitmapOperations/FloatBitmap.cs @@ -3,12 +3,14 @@ using System; using System.Buffers; using System.Diagnostics; +using System.Globalization; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.Imaging; namespace PhotoLocator.BitmapOperations { + [DebuggerDisplay("{Width}x{Height}x{PlaneCount}")] public class FloatBitmap { public const double DefaultMonitorGamma = 2.2; @@ -32,6 +34,14 @@ public FloatBitmap(BitmapSource source, double gamma) Assign(source, gamma); } + public FloatBitmap(params float[][] elements) + { + New(elements[0].Length, elements.Length, 1); + for(int y = 0; y < elements.Length; y++) + for (int x = 0; x < elements[y].Length; x++) + Elements[y, x] = elements[y][x]; + } + public float[,] Elements { get; private set; } = null!; public float this[int x, int y] @@ -53,7 +63,20 @@ public FloatBitmap(BitmapSource source, double gamma) public override string ToString() { - return $"{Width}x{Height}x{PlaneCount}"; + if (Width> 100 || Height > 100 || PlaneCount > 1) + return $"{Width}x{Height}x{PlaneCount}"; + var sb = new System.Text.StringBuilder(); + for (int y = 0; y < Height; y++) + { + for (int x = 0; x < Width; x++) + { + sb.Append(Elements[y, x].ToString("F2", CultureInfo.InvariantCulture)); + if (x < Width - 1) + sb.Append(", "); + } + sb.AppendLine(); + } + return sb.ToString(); } public void New(int width, int height, int planes) diff --git a/PhotoLocator/MainWindow.xaml.cs b/PhotoLocator/MainWindow.xaml.cs index 928cefd..c979ba1 100644 --- a/PhotoLocator/MainWindow.xaml.cs +++ b/PhotoLocator/MainWindow.xaml.cs @@ -432,11 +432,6 @@ private void UpdateLogView() private void HandleLogEventAdded(string line) { - Threads.DefaultDispatcher.SwitchToMainThreadAsync().ContinueWith(_ => - { - LogTextBox.AppendText("\n" + line); - LogTextBox.ScrollToEnd(); - }, TaskScheduler.FromCurrentSynchronizationContext()); Dispatcher.BeginInvoke(() => { LogTextBox.AppendText("\n" + line); diff --git a/PhotoLocatorTest/BitmapOperations/HoleClosingOperationTest.cs b/PhotoLocatorTest/BitmapOperations/HoleClosingOperationTest.cs new file mode 100644 index 0000000..f531372 --- /dev/null +++ b/PhotoLocatorTest/BitmapOperations/HoleClosingOperationTest.cs @@ -0,0 +1,72 @@ +using System.Diagnostics; + +namespace PhotoLocator.BitmapOperations; + +[TestClass] +public class HoleClosingOperationTest +{ + [TestMethod] + public void CloseHolesIteratively_FillsSingleHole() + { + int width = 3; + int height = 1; + var image = new FloatBitmap(width, height, 1); + var mask = new FloatBitmap(width, height, 1); + // set all pixel values to 1 (non-hole) + for (int x = 0; x < width; x++) + image[x, 0] = 1f; + // create a single hole at middle pixel + image[1, 0] = 0f; // non-hole pixels in mask are 0 + mask[1, 0] = 1f; // hole indicator + + HoleClosingOperation.CloseHolesIteratively(image, mask, 0.5f); + + // The center pixel should be replaced by the average of its neighbors (both 1) + Assert.AreEqual(1f, image[1, 0], 1e-6f, "Center pixel should be filled with average of neighbors"); + } + + [TestMethod] + public void CloseHolesIteratively_FillsAdjacentHoles() + { + int width = 5; + int height = 1; + var image = new FloatBitmap(width, height, 1); + var mask = new FloatBitmap(width, height, 1); + // set all pixel values to 1 (non-hole) + for (int x = 0; x < width; x++) + image[x, 0] = 1f; + // create holes at positions 1 and 3 + image[1, 0] = 0f; + image[3, 0] = 0f; + mask[1, 0] = 1f; + mask[3, 0] = 1f; + + HoleClosingOperation.CloseHolesIteratively(image, mask, 0.5f); + + Assert.AreEqual(1f, image[1, 0], 1e-6f, "Hole at position 1 should be filled"); + Assert.AreEqual(1f, image[3, 0], 1e-6f, "Hole at position 3 should be filled"); + } + + [TestMethod] + public void CloseHolesIteratively_FillsBiggerHole() + { + var image = new FloatBitmap( + [ 1, 1, 1, 1 ], + [ 0.5f, 0, 0, 0 ], + [ 0.5f, 0, 0, 0 ], + [ 0.5f, 0, 0, 0 ], + [ 1, 1, 1, 1 ]); + var mask = new FloatBitmap( + [ 0, 0, 0, 0 ], + [ 0, 1, 1, 1 ], + [ 0, 1, 1, 1 ], + [ 0, 1, 1, 1 ], + [ 0, 0, 0, 0 ]); + + HoleClosingOperation.CloseHolesIteratively(image, mask, 0.5f); + + Debug.WriteLine(image); + Assert.AreEqual(0.8f, image[1, 1], 1e-6f, "Hole at position 1 should be filled"); + Assert.AreEqual(1f, image[3, 3], 1e-6f, "Hole at position 3 should be filled"); + } +} \ No newline at end of file diff --git a/PhotoLocatorTest/HoleClosingOperationTest.cs b/PhotoLocatorTest/HoleClosingOperationTest.cs deleted file mode 100644 index f7ea517..0000000 --- a/PhotoLocatorTest/HoleClosingOperationTest.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using PhotoLocator.BitmapOperations; -using System; - -namespace PhotoLocator -{ - [TestClass] - public class HoleClosingOperationTest - { - [TestMethod] - public void CloseHolesIteratively_FillsSingleHole() - { - // Arrange - int width = 3; - int height = 1; - int planes = 1; - var image = new FloatBitmap(width, height, planes); - var mask = new FloatBitmap(width, height, planes); - // set all pixel values to 1 (non-hole) - for (int x = 0; x < width; x++) - image[x, 0] = 1f; - // create a single hole at middle pixel - image[1, 0] = 0f; - mask[1, 0] = 1f; // hole indicator - // non-hole pixels in mask are 0 - float threshold = 0.5f; - // Act - HoleClosingOperation.CloseHolesIteratively(image, mask, threshold); - // Assert - // The center pixel should be replaced by the average of its neighbors (both 1) - Assert.AreEqual(1f, image[1, 0], 1e-6f, "Center pixel should be filled with average of neighbors"); - } - - [TestMethod] - public void CloseHolesIteratively_FillsAdjacentHoles() - { - // Arrange - int width = 5; - int height = 1; - int planes = 1; - var image = new FloatBitmap(width, height, planes); - var mask = new FloatBitmap(width, height, planes); - // set all pixel values to 1 (non-hole) - for (int x = 0; x < width; x++) - image[x, 0] = 1f; - // create holes at positions 1 and 3 - image[1, 0] = 0f; - image[3, 0] = 0f; - mask[1, 0] = 1f; - mask[3, 0] = 1f; - float threshold = 0.5f; - // Act - HoleClosingOperation.CloseHolesIteratively(image, mask, threshold); - // Assert - Assert.AreEqual(1f, image[1, 0], 1e-6f, "Hole at position 1 should be filled"); - Assert.AreEqual(1f, image[3, 0], 1e-6f, "Hole at position 3 should be filled"); - } - } -} \ No newline at end of file From 76254daec689943dceea17cef1874796d5dfcffe Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Mon, 16 Nov 2026 23:03:47 +0100 Subject: [PATCH 3/9] Microsoft_AI_DirectML_SkipDebugLayerCopy --- Directory.Build.props | 15 +++++++++------ MapUiTools/WPF/MapUiTools.WPF.csproj | 2 -- PhotoLocator/PhotoLocator.csproj | 3 +-- PhotoLocatorTest/PhotoLocatorTest.csproj | 2 -- .../PhotoLocator.PhotoshopImageLoader.csproj | 2 -- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 81a1384..915be94 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,13 +1,16 @@ - + + 15 true + x64 + false - - true - true - true - true + + true + true + true + true \ No newline at end of file diff --git a/MapUiTools/WPF/MapUiTools.WPF.csproj b/MapUiTools/WPF/MapUiTools.WPF.csproj index 200f246..bbab847 100644 --- a/MapUiTools/WPF/MapUiTools.WPF.csproj +++ b/MapUiTools/WPF/MapUiTools.WPF.csproj @@ -9,8 +9,6 @@ Clemens Fischer Copyright © 2023 Clemens Fischer true - x64 - false diff --git a/PhotoLocator/PhotoLocator.csproj b/PhotoLocator/PhotoLocator.csproj index f1cb8b9..e9b3b7d 100644 --- a/PhotoLocator/PhotoLocator.csproj +++ b/PhotoLocator/PhotoLocator.csproj @@ -14,13 +14,12 @@ All CA1014,CA1309,CA1515,CA1814,CA1819,IDE0017 true - x64 - false false true + True diff --git a/PhotoLocatorTest/PhotoLocatorTest.csproj b/PhotoLocatorTest/PhotoLocatorTest.csproj index 5511d8e..42f98b1 100644 --- a/PhotoLocatorTest/PhotoLocatorTest.csproj +++ b/PhotoLocatorTest/PhotoLocatorTest.csproj @@ -6,8 +6,6 @@ enable PhotoLocator false - x64 - false diff --git a/PhotoshopImageLoader/PhotoLocator.PhotoshopImageLoader.csproj b/PhotoshopImageLoader/PhotoLocator.PhotoshopImageLoader.csproj index 24fef04..6b5735a 100644 --- a/PhotoshopImageLoader/PhotoLocator.PhotoshopImageLoader.csproj +++ b/PhotoshopImageLoader/PhotoLocator.PhotoshopImageLoader.csproj @@ -3,8 +3,6 @@ net10.0-windows True - x64 - false CA2022 From 2be792ab2405d1eef144735d626df27c9ff47c48 Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Tue, 17 Nov 2026 22:34:12 +0100 Subject: [PATCH 4/9] Update dotnet build version --- .github/workflows/dotnet.yml | 2 +- PhotoLocator/Settings/RegistrySettings.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9b512b6..f946ee9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/PhotoLocator/Settings/RegistrySettings.cs b/PhotoLocator/Settings/RegistrySettings.cs index 1fe10a6..8f3030e 100644 --- a/PhotoLocator/Settings/RegistrySettings.cs +++ b/PhotoLocator/Settings/RegistrySettings.cs @@ -8,7 +8,7 @@ namespace PhotoLocator.Settings { sealed class RegistrySettings : IDisposable, IRegistrySettings { - public const string DefaultPhotoFileExtensions = ".jpg, .jpeg, .png, .cr2, .cr3, .arw, .nef, .dng, .psd, .tif, .tiff, .jxr, .jxl, .fits, .mp4, .mov"; + public const string DefaultPhotoFileExtensions = ".jpg, .jpeg, .png, .cr2, .cr3, .arw, .nef, .dng, .psd, .tif, .tiff, .jxr, .jxl, .bmp, .fits, .mp4, .mov"; public RegistryKey Key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\MeeSoft\PhotoLocator"); From b57aede70337eac6278bedf72c66f1a426533e7d Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Fri, 20 Nov 2026 22:31:42 +0100 Subject: [PATCH 5/9] Fix png metadata transfer --- PhotoLocator/Metadata/ExifHandler.cs | 1 + PhotoLocatorTest/Metadata/ExifHandlerTest.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/PhotoLocator/Metadata/ExifHandler.cs b/PhotoLocator/Metadata/ExifHandler.cs index ba39e88..0101f47 100644 --- a/PhotoLocator/Metadata/ExifHandler.cs +++ b/PhotoLocator/Metadata/ExifHandler.cs @@ -210,6 +210,7 @@ void TransferValue(string query1, string query2, string? query3 = null) if (source.TryGetFormat() == "png") { + result.ApplicationName = nameof(PhotoLocator); var (exposureTime, location) = DecodePngMetadata(source); if (exposureTime is not null) { diff --git a/PhotoLocatorTest/Metadata/ExifHandlerTest.cs b/PhotoLocatorTest/Metadata/ExifHandlerTest.cs index 1cf25f0..90a71b0 100644 --- a/PhotoLocatorTest/Metadata/ExifHandlerTest.cs +++ b/PhotoLocatorTest/Metadata/ExifHandlerTest.cs @@ -163,6 +163,20 @@ public void SetMetadata_ShouldSetPngMetadataOnTiff() //Assert.AreEqual(ExifHandler.GetGeotag(source), ExifHandler.GetGeotag(target)); } + [TestMethod] + public void SetMetadata_ShouldSetEmptyPngMetadataOnTiff() + { + const string TestFileName = "fromEmptyPng.tif"; + + var source = new BitmapMetadata("png"); + var bitmap = BitmapSource.Create(2, 2, 96, 96, PixelFormats.Gray8, null, new byte[4], 2); + + GeneralFileFormatHandler.SaveToFile(bitmap, TestFileName, source); + + using var targetStream = File.OpenRead(TestFileName); + var target = ExifHandler.LoadMetadata(targetStream)!; + } + [TestMethod] public void SetMetadata_ShouldSetTiffMetadataOnJpeg() { From 55f862a1c399080b216faaf23eb30a26b7630f79 Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Fri, 20 Nov 2026 23:03:55 +0100 Subject: [PATCH 6/9] Fix WorkingDirectory --- PhotoLocator/PictureFileFormats/JpegXlFileFormatHandler.cs | 1 + PhotoLocator/PictureFileFormats/JpegliEncoder.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/PhotoLocator/PictureFileFormats/JpegXlFileFormatHandler.cs b/PhotoLocator/PictureFileFormats/JpegXlFileFormatHandler.cs index a3cc7aa..b2c13c8 100644 --- a/PhotoLocator/PictureFileFormats/JpegXlFileFormatHandler.cs +++ b/PhotoLocator/PictureFileFormats/JpegXlFileFormatHandler.cs @@ -39,6 +39,7 @@ public static void TranscodeToJxl(string sourcePath, string targetPath, string? { using var process = new Process(); process.StartInfo.FileName = EncoderPath; + process.StartInfo.WorkingDirectory = AppContext.BaseDirectory; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = true; diff --git a/PhotoLocator/PictureFileFormats/JpegliEncoder.cs b/PhotoLocator/PictureFileFormats/JpegliEncoder.cs index 21b08fe..2334e0f 100644 --- a/PhotoLocator/PictureFileFormats/JpegliEncoder.cs +++ b/PhotoLocator/PictureFileFormats/JpegliEncoder.cs @@ -33,6 +33,7 @@ internal static void Process(string executablePath, Stream srcStream, string src { using var process = new Process(); process.StartInfo.FileName = executablePath; + process.StartInfo.WorkingDirectory = AppContext.BaseDirectory; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = true; From 8d48c2c5c3a8d50aa334e457cd7299cb42ddf5e9 Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Sat, 21 Nov 2026 20:46:37 +0100 Subject: [PATCH 7/9] Add AI tests --- .../AiDenoiseOperationTest.cs | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/PhotoLocatorTest/BitmapOperations/AiDenoiseOperationTest.cs b/PhotoLocatorTest/BitmapOperations/AiDenoiseOperationTest.cs index 3d7788b..d7044d6 100644 --- a/PhotoLocatorTest/BitmapOperations/AiDenoiseOperationTest.cs +++ b/PhotoLocatorTest/BitmapOperations/AiDenoiseOperationTest.cs @@ -6,21 +6,32 @@ namespace PhotoLocator.BitmapOperations; public class AiDenoiseOperationTest { [TestMethod] - public void Apply_ShouldRunDenoiseModel_WhenPretrainedOnnxExists() + [DataRow(8, 1, 6, 2)] + [DataRow(8, 1, 8, 0)] + [DataRow(8, 3, 6, 2)] + [DataRow(8, 3, 8, 0)] + public void Apply_ShouldRunDenoiseModel_With3Planes(int imageSize, int planes, int tileSize, int tileOverlap) { var modelPath = Path.Combine(AppContext.BaseDirectory, "TestData", "dncnn_test.onnx"); if (!File.Exists(modelPath)) Assert.Inconclusive($"Pretrained ONNX file not found: {modelPath}. Add a trained dncnn model to PhotoLocatorTest/TestData/dncnn_test.onnx to run this test."); - var bitmap = new FloatBitmap(8, 8, 3); - for (var y = 0; y < bitmap.Height; y++) + var bitmap = new FloatBitmap(imageSize, imageSize, planes); + if (planes == 1) { - for (var x = 0; x < bitmap.Width; x++) - { - bitmap.Elements[y, x * 3 + 0] = ((x * 13 + y * 7) % 17) / 16f; - bitmap.Elements[y, x * 3 + 1] = (float)(0.5 + 0.2 * Math.Sin(x * 0.7 + y * 0.9)); - bitmap.Elements[y, x * 3 + 2] = (float)(1.0 - 0.3 * Math.Cos(x * 0.5 + y * 0.4)); - } + for (var y = 0; y < bitmap.Height; y++) + for (var x = 0; x < bitmap.Width; x++) + bitmap.Elements[y, x] = ((x * 13 + y * 7) % 17) / 16f; + } + else + { + for (var y = 0; y < bitmap.Height; y++) + for (var x = 0; x < bitmap.Width; x++) + { + bitmap.Elements[y, x * 3 + 0] = ((x * 13 + y * 7) % 17) / 16f; + bitmap.Elements[y, x * 3 + 1] = (float)(0.5 + 0.2 * Math.Sin(x * 0.7 + y * 0.9)); + bitmap.Elements[y, x * 3 + 2] = (float)(1.0 - 0.3 * Math.Cos(x * 0.5 + y * 0.4)); + } } var op = new AiDenoiseOperation @@ -28,8 +39,9 @@ public void Apply_ShouldRunDenoiseModel_WhenPretrainedOnnxExists() SrcBitmap = bitmap, DstBitmap = new FloatBitmap(), ModelPath = modelPath, - TileSize = 6, - TileOverlap = 2, + ExpectColorModel = true, + TileSize = tileSize, + TileOverlap = tileOverlap, }; var sw = Stopwatch.StartNew(); From 37eea7ead4d0bb7e0653d9e21f41b22bc2c97ef4 Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Sat, 21 Nov 2026 21:47:13 +0100 Subject: [PATCH 8/9] Prepare release --- .gitignore | 1 + PhotoLocator/MainViewModel.cs | 1 - PhotoLocator/PhotoLocator.csproj | 5 ++++- PhotoLocatorSetup/Package.appxmanifest | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d8d9a29..2ff7712 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ obj/ bin/ PublishProfiles/ Properties/ +PhotoLocator/ai/ PhotoLocator/exiftool/ PhotoLocator/ffmpeg/ PhotoLocator/jpegli/ diff --git a/PhotoLocator/MainViewModel.cs b/PhotoLocator/MainViewModel.cs index 9f4af91..0f78dae 100644 --- a/PhotoLocator/MainViewModel.cs +++ b/PhotoLocator/MainViewModel.cs @@ -24,7 +24,6 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shell; -using System.Windows.Threading; namespace PhotoLocator { diff --git a/PhotoLocator/PhotoLocator.csproj b/PhotoLocator/PhotoLocator.csproj index e9b3b7d..1de2210 100644 --- a/PhotoLocator/PhotoLocator.csproj +++ b/PhotoLocator/PhotoLocator.csproj @@ -6,7 +6,7 @@ enable true app.manifest - 2026.10.4.0 + 2026.11.21.0 (c) 2022-2026 Michael Vinther MeeSoft Resources\PhotoLocator.ico @@ -64,6 +64,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/PhotoLocatorSetup/Package.appxmanifest b/PhotoLocatorSetup/Package.appxmanifest index 65ed8f3..7c63101 100644 --- a/PhotoLocatorSetup/Package.appxmanifest +++ b/PhotoLocatorSetup/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="2026.11.21.0" /> PhotoLocator From 7738374c36ad2ff91a6d3d10c167aabb41d44447 Mon Sep 17 00:00:00 2001 From: Michael Vinther Date: Sat, 21 Nov 2026 22:46:44 +0100 Subject: [PATCH 9/9] Improve test --- PhotoLocatorTest/Metadata/ExifHandlerTest.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PhotoLocatorTest/Metadata/ExifHandlerTest.cs b/PhotoLocatorTest/Metadata/ExifHandlerTest.cs index 90a71b0..dda3a75 100644 --- a/PhotoLocatorTest/Metadata/ExifHandlerTest.cs +++ b/PhotoLocatorTest/Metadata/ExifHandlerTest.cs @@ -175,6 +175,8 @@ public void SetMetadata_ShouldSetEmptyPngMetadataOnTiff() using var targetStream = File.OpenRead(TestFileName); var target = ExifHandler.LoadMetadata(targetStream)!; + Assert.AreAllNotNull(target); + Assert.AreEqual("PhotoLocator", target.ApplicationName); } [TestMethod]