|
|
|
@ -12,11 +12,18 @@ using System.Diagnostics; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
|
using SparkClient.Model.Common; |
|
|
|
|
using SparkClient.ViewModel.Configuration; |
|
|
|
|
|
|
|
|
|
namespace SparkClient.Model.Services |
|
|
|
|
{ |
|
|
|
|
public class AlgorithmServer |
|
|
|
|
{ |
|
|
|
|
private readonly AlgorithmConfigVM _algorithmConfigVM; |
|
|
|
|
|
|
|
|
|
public AlgorithmServer() |
|
|
|
|
{ |
|
|
|
|
_algorithmConfigVM = new AlgorithmConfigVM(); |
|
|
|
|
} |
|
|
|
|
private static readonly ILog Logger = LogManager.GetLogger(typeof(AlgorithmServer)); |
|
|
|
|
// 导入 C++ DLL 中的 DetectDiamond 函数 |
|
|
|
|
[DllImport("diamond_cut_inspector.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] |
|
|
|
@ -37,12 +44,11 @@ namespace SparkClient.Model.Services |
|
|
|
|
bool.TryParse(halfCircleValue.ToString(), out bool boolResult); |
|
|
|
|
bool half_circle = boolResult; |
|
|
|
|
|
|
|
|
|
//算法配置参数 |
|
|
|
|
string sql = $"SELECT JSON FROM ALGORITHM_CONFIG ORDER BY JSON_ORDER ASC"; |
|
|
|
|
DataTable table = DataBaseHelper.ExecuteQuery(sql); |
|
|
|
|
object lightLevelValue = table.Rows[0][0]; |
|
|
|
|
string algo_config = lightLevelValue.ToString() ?? throw new InvalidOperationException(); |
|
|
|
|
//算法配置参数,初始化算法配置数据并获取 AlgorithmConfigJson |
|
|
|
|
_algorithmConfigVM.InitAlgorithmData(null); |
|
|
|
|
string algo_config = _algorithmConfigVM.AlgorithmConfigJson; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//图片根目录 |
|
|
|
|
string? image_file_base_path = ConfigurationManager.AppSettings["ImageFileBasePath"]; |
|
|
|
|
if (string.IsNullOrEmpty(image_file_base_path)) |
|
|
|
|