forked from amkovkov/GranuSightSoftware2
feat: camera tuning + capturing command + raw image correction
This commit is contained in:
+73
-2
@@ -14,11 +14,68 @@ public partial class Program
|
||||
}
|
||||
|
||||
private static string[]? _args = null;
|
||||
private static readonly RootCommand _rootCommand = new("GranuSight Software 2");
|
||||
private static readonly RootCommand _rootCommand = new("Run UI application");
|
||||
|
||||
private static readonly Command _cameraTuningCommand = new("camera-tuning")
|
||||
{
|
||||
Description = "Tune camera parameters"
|
||||
};
|
||||
private static readonly Option<FileInfo> _cameraTuningOutputFile = new("--output")
|
||||
{
|
||||
Description = "Output image file",
|
||||
Required = false
|
||||
};
|
||||
private static readonly Option<double> _cameraTuningGainR = new("--gain-r")
|
||||
{
|
||||
Description = "Color gain (red channel) to start from",
|
||||
DefaultValueFactory = (_) => 1
|
||||
};
|
||||
private static readonly Option<double> _cameraTuningGainG = new("--gain-g")
|
||||
{
|
||||
Description = "Color gain (green channel) to start from",
|
||||
DefaultValueFactory = (_) => 1
|
||||
};
|
||||
private static readonly Option<double> _cameraTuningGainB = new("--gain-b")
|
||||
{
|
||||
Description = "Color gain (blue channel) to start from",
|
||||
DefaultValueFactory = (_) => 1
|
||||
};
|
||||
private static readonly Option<double> _cameraTuningThreshold = new("--threshold")
|
||||
{
|
||||
Description = "Threshold to stop on",
|
||||
DefaultValueFactory = (_) => 0.1
|
||||
};
|
||||
private static readonly Option<uint> _cameraTuningSteps = new("--steps")
|
||||
{
|
||||
Description = "Maximum steps count",
|
||||
DefaultValueFactory = (_) => 10
|
||||
};
|
||||
|
||||
private static readonly Command _captureCommand = new("capture")
|
||||
{
|
||||
Description = "Capture image from camera"
|
||||
};
|
||||
private static readonly Option<FileInfo> _captureOutputFile = new("--output")
|
||||
{
|
||||
Description = "Output image file",
|
||||
DefaultValueFactory = (_) => new FileInfo("image.png")
|
||||
};
|
||||
private static readonly Option<double> _captureIntencityWhite = new("--intencity-white")
|
||||
{
|
||||
Description = "Illuminator intencity for white (from 0 to 1)",
|
||||
DefaultValueFactory = (_) => 1
|
||||
};
|
||||
private static readonly Option<double> _captureIntencityUv365nm = new("--intencity-uv365nm")
|
||||
{
|
||||
Description = "Illuminator intencity for UV 365 nm (from 0 to 1)",
|
||||
DefaultValueFactory = (_) => 0
|
||||
};
|
||||
private static readonly Option<double> _captureIntencityUv254nm = new("--intencity-uv254nm")
|
||||
{
|
||||
Description = "Illuminator intencity for UV 254 nm (from 0 to 1)",
|
||||
DefaultValueFactory = (_) => 0
|
||||
};
|
||||
|
||||
private static readonly Option<RenderingMode> _renderingModeArgument = new("--rendering-mode")
|
||||
{
|
||||
Description = "Rendering mode to use",
|
||||
@@ -38,11 +95,25 @@ public partial class Program
|
||||
_args = args;
|
||||
|
||||
_rootCommand.Add(_cameraTuningCommand);
|
||||
_cameraTuningCommand.Add(_cameraTuningOutputFile);
|
||||
_cameraTuningCommand.Add(_cameraTuningGainR);
|
||||
_cameraTuningCommand.Add(_cameraTuningGainG);
|
||||
_cameraTuningCommand.Add(_cameraTuningGainB);
|
||||
_cameraTuningCommand.Add(_cameraTuningThreshold);
|
||||
_cameraTuningCommand.Add(_cameraTuningSteps);
|
||||
|
||||
_captureCommand.Add(_captureOutputFile);
|
||||
_captureCommand.Add(_captureIntencityWhite);
|
||||
_captureCommand.Add(_captureIntencityUv365nm);
|
||||
_captureCommand.Add(_captureIntencityUv254nm);
|
||||
_rootCommand.Add(_captureCommand);
|
||||
|
||||
_rootCommand.Add(_renderingModeArgument);
|
||||
_rootCommand.Add(_hideConsoleArgument);
|
||||
|
||||
|
||||
_rootCommand.SetAction(Ui);
|
||||
_cameraTuningCommand.SetAction(CameraTuning);
|
||||
_captureCommand.SetAction(Capture);
|
||||
|
||||
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnProgramShutdown);
|
||||
Console.WriteLine("Press Ctrl+C to shut down.");
|
||||
|
||||
Reference in New Issue
Block a user