opt + bug fix

This commit is contained in:
AUnicornWithNoLife 2023-02-13 17:16:32 +00:00
parent 903ffdf219
commit 93ce80144b
2 changed files with 37 additions and 12 deletions

View File

@ -71,7 +71,7 @@ namespace Cupola
ReadWriteTexture2D<Bgra32, Float4> brightest = images[0]; ReadWriteTexture2D<Bgra32, Float4> brightest = images[0];
ReadWriteTexture2D<Bgra32, Float4> output = images[0]; ReadWriteTexture2D<Bgra32, Float4> output = images[0];
outputImages[0] = output; outputImages[0] = images[0];
for (int i = 1; i < images.Length; i++) for (int i = 1; i < images.Length; i++)
{ {

View File

@ -14,7 +14,6 @@ namespace Tranquility
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
string[]? files; string[]? files;
ReadWriteTexture2D<Bgra32, float4>? finalImage;
public MainWindow() public MainWindow()
{ {
@ -55,27 +54,53 @@ namespace Tranquility
if (files == null) if (files == null)
throw new Exception("Please select files before running"); throw new Exception("Please select files before running");
int opt; // 0 - Picture, 1 - Video
opt = Options.SelectedIndex;
Progress.Value = 10; Progress.Value = 10;
ReadWriteTexture2D<Bgra32, float4>[] images = Cupola.Cupola.Load(files); ReadWriteTexture2D<Bgra32, float4>[] images = Cupola.Cupola.Load(files);
Progress.Value = 30; Progress.Value = 30;
finalImage = Cupola.Cupola.RunSingle(images); if (opt == 0)
{
ReadWriteTexture2D<Bgra32, float4> finalImage = Cupola.Cupola.RunSingle(images);
Progress.Value = 90; Progress.Value = 90;
CommonSaveFileDialog saveFileDialog = new CommonSaveFileDialog(); CommonSaveFileDialog saveFileDialog = new CommonSaveFileDialog();
saveFileDialog.DefaultExtension = ".jpg"; saveFileDialog.DefaultExtension = ".jpg";
saveFileDialog.EnsurePathExists = true; saveFileDialog.EnsurePathExists = true;
CommonFileDialogResult result = saveFileDialog.ShowDialog(); CommonFileDialogResult result = saveFileDialog.ShowDialog();
if (result != CommonFileDialogResult.Ok) if (result != CommonFileDialogResult.Ok)
throw new Exception("please set location valid OKAY"); throw new Exception("please set location valid OKAY");
finalImage.Save(saveFileDialog.FileName); finalImage.Save(saveFileDialog.FileName);
Progress.Value = 100; Progress.Value = 100;
}
else if (opt == 1)
{
ReadWriteTexture2D<Bgra32, float4>[] finalImages = Cupola.Cupola.RunMulti(images);
Progress.Value = 90;
string save = OpenFolder();
for (int i = 0; i < finalImages.Length; i++)
{
finalImages[i].Save(save + "\\" + i.ToString() + ".jpg");
}
}
else
{
throw new Exception("invalid option please die");
}
} }
} }
} }