From ff5d64eff769023f666d60a3616c0a7fa171eb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Garth=E5=A4=A9=E5=8D=9C?= Date: Sun, 8 Dec 2024 10:37:13 +0800 Subject: [PATCH] =?UTF-8?q?v0.2.0=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LightCurve/Core/ImgAna.cs | 2 +- LightCurve/Core/ImgProc.cs | 2 +- LightCurve/Core/Tools/File.cs | 6 ++++-- LightCurve/Core/VidAna.cs | 6 +++--- LightCurve/LightCurve.csproj | 2 +- LightCurve/MainWindow.xaml.cs | 2 +- README.md | 10 ++++++++-- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/LightCurve/Core/ImgAna.cs b/LightCurve/Core/ImgAna.cs index 016513a..6979eeb 100644 --- a/LightCurve/Core/ImgAna.cs +++ b/LightCurve/Core/ImgAna.cs @@ -24,7 +24,7 @@ internal void Run() { using Mat image = Cv2.ImRead(files[i].FullName); using Mat roi = ImgProc.GetROI(image, x, y, w, h); - values[i] = ImgProc.GetValue(roi, channel); + values[i] = ImgProc.MeanValue(roi, channel); }); var outName = Tools.File.GenOutName(files); diff --git a/LightCurve/Core/ImgProc.cs b/LightCurve/Core/ImgProc.cs index dc0b2c5..acd5833 100644 --- a/LightCurve/Core/ImgProc.cs +++ b/LightCurve/Core/ImgProc.cs @@ -19,7 +19,7 @@ internal static Mat GetROI(Mat image, uint? x, uint? y, uint? w, uint? h) } /// 计算一块ROI中指定指标的均值 - internal static double GetValue(Mat image, int channel) + internal static double MeanValue(Mat image, int channel) => image.Channels() switch { 1 => ValCvt.MeanValue1(image, channel), // 单色图 diff --git a/LightCurve/Core/Tools/File.cs b/LightCurve/Core/Tools/File.cs index 96ecfc5..db0e31a 100644 --- a/LightCurve/Core/Tools/File.cs +++ b/LightCurve/Core/Tools/File.cs @@ -130,8 +130,10 @@ private static void OutputPlot(double[] values, string dir, string name) plot.YLabel("Value"); plot.ScaleFactor = 2; - if (values.Length > 1) plot.Axes.SetLimits(1, indexes[^1], 0, 1); - else plot.Axes.SetLimits(0, 2, 0, 1); + if (values.Length == 1) plot.Axes.SetLimitsX(0, 2); + else plot.Axes.SetLimitsX(1, indexes[^1]); + if (values.Max() > 0.3) plot.Axes.SetLimitsY(0, 1); + else plot.Axes.SetLimitsY(0, values.Max() * 1.1); // 优化线性图 plot.Axes.AntiAlias(true); var plotWidth = values.Length switch diff --git a/LightCurve/Core/VidAna.cs b/LightCurve/Core/VidAna.cs index 87d9ee9..7da007d 100644 --- a/LightCurve/Core/VidAna.cs +++ b/LightCurve/Core/VidAna.cs @@ -25,11 +25,11 @@ internal void Run() var values = vid.FrameCount > 0 ? new List(vid.FrameCount) : []; - Mat frame = new(), roi = new(); + Mat frame = new(); while (vid.Read(frame)) { - roi = ImgProc.GetROI(frame, x, y, w, h); - values.Add(ImgProc.GetValue(roi, channel)); + Mat roi = ImgProc.GetROI(frame, x, y, w, h); + values.Add(ImgProc.MeanValue(roi, channel)); } var outName = Tools.File.GenOutName([file]); diff --git a/LightCurve/LightCurve.csproj b/LightCurve/LightCurve.csproj index 12814aa..68307b4 100644 --- a/LightCurve/LightCurve.csproj +++ b/LightCurve/LightCurve.csproj @@ -9,7 +9,7 @@ LightCurve.App LightCurve LightCurve - 0.1.0 + 0.2.0 GarthTB GarthTB LightCurve diff --git a/LightCurve/MainWindow.xaml.cs b/LightCurve/MainWindow.xaml.cs index 4e8e8fa..fdf9e89 100644 --- a/LightCurve/MainWindow.xaml.cs +++ b/LightCurve/MainWindow.xaml.cs @@ -206,7 +206,7 @@ private void ReOrderFiles(int orderIndex, bool descending) private void BtRun_Click(object sender, RoutedEventArgs e) { - MW.Title = "LightCurve 处理中..."; + MW.Title = "LightCurve 处理中,请勿关闭..."; if (mode == 1) // 图片 { Core.ImgAna analyzer = CBFullFrame.IsChecked == true diff --git a/README.md b/README.md index 1e2ac8b..2e0629c 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ ## 注意 +- 此程序不使用GPU。在统计大文件时可能卡顿。 - 每一组照片或一个视频文件进行一次统计。照片和视频不能混合处理。 - 选择输出位置时的文件名不是最终的文件名。最终的文件根据原文件来命名。 -- 此程序不使用GPU。在统计大文件时可能卡顿。 - 折线图的高度固定为2000像素,宽度在2000至4800之间浮动。 ## 快捷键 @@ -29,6 +29,12 @@ ## 版本日志 -### [0.1.0] - 20241208 +### [v0.2.0](https://github.com/GarthTB/LightCurve/releases/tag/v0.2.0) - 20241208 + +- 修复:特殊视频文件无法读取的问题 +- 优化:微调界面,增加拖放功能 +- 优化:折线图外观 + +### [v0.1.0](https://github.com/GarthTB/LightCurve/releases/tag/v0.1.0) - 20241208 - 发布 \ No newline at end of file