feat: SeparatorCalibration View and ViewModel

This commit is contained in:
2026-04-14 16:18:13 +03:00
parent bb930aac88
commit 7a42ff5f3c
11 changed files with 1106 additions and 27 deletions
@@ -775,7 +775,7 @@ public class AmineContentAnalyzerService
p.First.VisibleIntensity != p.Second.VisibleIntensity ||
p.First.Uv365Intensity != p.Second.Uv365Intensity ||
p.First.Uv254Intensity != p.Second.Uv254Intensity))
throw new Exception("Image records indencities to correlate with separator images intencities");
throw new Exception("Image records intensities to correlate with separator images intensities");
var imagePaths = GetImageRecordsFilePaths(imageRecords);
var roi = CalculateSeparatorRoi(imagePaths, 5, cancellationToken);
@@ -867,7 +867,7 @@ public class AmineContentAnalyzerService
return calibrationRecord;
}
public async Task<(Mat result, Mat mask)> CalcaulateAmineContent(IEnumerable<ImageRecord> sampleImageRecords, IEnumerable<ImageRecord> separatorImageRecords, CalibrationRecord calibrationRecord, CancellationToken cancellationToken = default)
public async Task<(Mat result, Mat mask)> CalculateAmineContent(IEnumerable<ImageRecord> sampleImageRecords, IEnumerable<ImageRecord> separatorImageRecords, CalibrationRecord calibrationRecord, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
var sampleImagePaths = GetImageRecordsFilePaths(sampleImageRecords);
@@ -986,10 +986,10 @@ public class AmineContentAnalyzerService
}
}
// Срезаем 99 проценталь (1% самых горячих пикселей), которые скорее всего являются шумом или загрязенением
// Срезаем 99.9 процентиль (0.1% самых горячих пикселей), которые скорее всего являются шумом или загрязнением
var oldMean = Cv2.Mean(result, sampleMask).Val0;
values.Sort();
float p99 = values[(int)(values.Length * 0.99)];
float p99 = values[(int)(values.Length * 0.999)];
Cv2.Threshold(result, result, p99, p99, ThresholdTypes.Trunc);
var newMean = Cv2.Mean(result, sampleMask).Val0;
var scale = oldMean / newMean;