From e3dbb8258767eeb58a13b16524e3538d8f56bed1 Mon Sep 17 00:00:00 2001 From: Samuele Lorefice Date: Wed, 26 Mar 2025 06:32:38 +0100 Subject: [PATCH] Removed extra reference in record --- SDFMapCreator/Program.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/SDFMapCreator/Program.cs b/SDFMapCreator/Program.cs index 36816f2..8efb7bf 100644 --- a/SDFMapCreator/Program.cs +++ b/SDFMapCreator/Program.cs @@ -20,7 +20,7 @@ public struct float4(float r, float g, float b, float a) { } public record ImageData(MagickImage Image, float3[,] Pixels, List Edges); -public record MaskData(float3[,] Mask, ImageData A, ImageData B, List Edges); +public record MaskData(float3[,] Mask, ImageData A, List Edges); public record SDFData(float3[,] SDF); @@ -51,10 +51,13 @@ public static class ArrayExt { public class Program { private const float MAX = 65535f; private const float MIN = 0f; - private const bool outputMasks = true; + private const bool outputMasks = false; + private const bool outputSDFs = false; + private const bool outputGradients = false; static List Images = new(); static List Masks = new(); static List SDFs = new(); + static List Gradients = new(); static void LoadImage(string imgPath) { var image = new MagickImage(imgPath); @@ -75,6 +78,7 @@ public class Program { public static void Main(string[] args) { Console.WriteLine("Reading images..."); //foreach image in arguments load the image + LoadImage("01.png"); LoadImage("02.png"); LoadImage("03.png"); @@ -93,10 +97,11 @@ public class Program { } Console.WriteLine("Creating masks..."); + Masks.Add(new (SelfMask(Images[0].Pixels, Images[0].Image.Width, Images[0].Image.Height), Images[0], new())); //for each image pair, create a mask - for (int i = 0; i < Images.Count - 1; i++) { - var mask = GetABMask(Images[i].Pixels, Images[i + 1].Pixels, Images[i].Image.Width, Images[i].Image.Height); - Masks.Add(new(mask, Images[i], Images[i + 1], new())); + for (int i = 1; i < Images.Count; i++) { + var mask = GetABMask(Images[i-1].Pixels, Images[i].Pixels, Images[i].Image.Width, Images[i].Image.Height); + Masks.Add(new(mask, Images[i], new())); } Console.WriteLine("Edge detecting masks...");