fixed final image masking
This commit is contained in:
@@ -55,6 +55,9 @@ public static class Program {
|
||||
|
||||
width = (uint)Images[0].Width;
|
||||
height = (uint)Images[0].Height;
|
||||
|
||||
// sum all images together
|
||||
if(debug) Images[0].Pixels.SaveImage("Debug/Sum0.png");
|
||||
|
||||
for (int i = 1; i < Images.Count; i++) {
|
||||
for (int x = 0; x < Images[i].Width; x++) {
|
||||
@@ -67,6 +70,7 @@ public static class Program {
|
||||
|
||||
if(debug)Images[i].Pixels.SaveImage($"Debug/Sum{i}.png");
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("Creating masks...");
|
||||
for (var i = 0; i < Images.Count; i++) { //for each image pair, create a mask
|
||||
@@ -109,6 +113,7 @@ public static class Program {
|
||||
var currStep = 0f;
|
||||
var stepIncrement = MAX / Gradients.Count;
|
||||
|
||||
|
||||
for (var x = 0; x < width; x++)
|
||||
for (var y = 0; y < height; y++)
|
||||
finalImage[x, y] = new(Images[0].Pixels[x, y].X);
|
||||
@@ -119,7 +124,7 @@ public static class Program {
|
||||
Console.WriteLine($"Applying gradient {i}..., {currStep} -> {currStep + stepIncrement}");
|
||||
for (var x = 0; x < mask.Mask.GetLength(0); x++) {
|
||||
for (var y = 0; y < mask.Mask.GetLength(1); y++) {
|
||||
if (gradient[x, y].X == 0) continue;
|
||||
if (mask.Mask[x,y].X == 0) continue;
|
||||
var pixel = new Vector3(Remap(gradient[x, y].X, MIN, MAX, 1.0f - currStep,
|
||||
1.0f - (currStep + stepIncrement)));
|
||||
if (pixel.X > finalImage[x, y].X) finalImage[x, y] = pixel;
|
||||
|
||||
Reference in New Issue
Block a user