Commit 4de1a697 张东亮

AOI检测测试ok

1 个父辈 5d31fcf9
......@@ -118,6 +118,8 @@ namespace OnlineStore.Common
public static MyConfig<bool> CamTestReel_useBarcode = false;
[MyConfigComment("是否使用AOI检测料盘在NG平台")]
public static MyConfig<bool> CamTestReel_useAOI = false;
[MyConfigComment("NG平台AOI检测料盘:总的面积。大于认为有料")]
public static MyConfig<int> CamTestReel_AOITotalArea = 300;
[MyConfigComment("NG平台一维码检测料盘:一维码的内容")]
public static MyConfig<string> CamTestReel_barcode = "RW0000015";
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCvSharp4.runtime.win.4.11.0.20250507\build\netstandard\OpenCvSharp4.runtime.win.props" Condition="Exists('..\packages\OpenCvSharp4.runtime.win.4.11.0.20250507\build\netstandard\OpenCvSharp4.runtime.win.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -13,6 +14,8 @@
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -35,8 +38,8 @@
<Reference Include="AGVLib">
<HintPath>..\DLL\AGVLib.dll</HintPath>
</Reference>
<Reference Include="AOI">
<HintPath>..\DLL\AOI.dll</HintPath>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\DLL\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
......@@ -59,10 +62,32 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp4.4.11.0.20250507\lib\netstandard2.0\OpenCvSharp.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp4.Extensions.4.11.0.20250507\lib\netstandard2.0\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.8.0.11\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
......@@ -79,6 +104,7 @@
<ItemGroup>
<Compile Include="DeviceLibrary\AcSerialBean.cs" />
<Compile Include="DeviceLibrary\Camera.cs" />
<Compile Include="DeviceLibrary\CameraReelCheck.cs" />
<Compile Include="DeviceLibrary\CameraTest.cs" />
<Compile Include="DeviceLibrary\CylinderManger.cs" />
<Compile Include="DeviceLibrary\dauxiKS107\DauxiKS107Controller.cs" />
......@@ -162,6 +188,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Config\AOI.data">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......@@ -188,4 +215,10 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\OpenCvSharp4.runtime.win.4.11.0.20250507\build\netstandard\OpenCvSharp4.runtime.win.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp4.runtime.win.4.11.0.20250507\build\netstandard\OpenCvSharp4.runtime.win.props'))" />
</Target>
</Project>
\ No newline at end of file
using CodeLibrary;
using DeviceLibrary;
using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
public class HIKCamera
{
......@@ -20,53 +13,52 @@ public class HIKCamera
public event EventHandler<Bitmap> camera_event;
public string DeviceName = "monitor1";
public PictureBox picture = new PictureBox();
//public bool LoadCameraConfig(out string msg, object preview = null)
//Asa.Camera.VisionLib camera;
//public bool LoadCameraConfig(string CameraID, out string msg)
//{
// Name = CameraID;
// msg = "";
// if (!enableCamera) return true;
// string path = $".\\Config\\IPCamera.json";
// //string path = $"D\\X800\\Config\\{CameraID}.json";
// string path = CommonLib.GetPath(@"Config\CameraA.json");
// if (!File.Exists(path))
// {
// msg = crc.GetString(L.monitor_config_not_exist, "找不到监控相机配置文件");
// LogUtil.error("找不到监控相机配置文件" + path);
// msg = Name + crc.GetString(L.monitor_config_not_exist, "找不到监控相机配置文件");
// LogUtil.error(Name + "找不到监控相机配置文件" + path);
// return false;
// }
// try
// {
// if (!VideoManager.LoadCamera(path, out string loadmsg))
// var configtxt = File.ReadAllText(path);
// if (configtxt.IndexOf("Pwd") > 0)
// {
// msg = loadmsg;
// configtxt = configtxt.Replace("Pwd", "Password");
// configtxt = configtxt.Replace("\"8000\"", "8000");
// File.WriteAllText(path, configtxt);
// }
// var m = Regex.Match(configtxt, "name\".*?\"(.+)\"", RegexOptions.IgnoreCase);
// DeviceName = m.Groups[1].Value;
// camera = new Asa.Camera.VisionLib(path, true, "HIKIPCamera");
// }
// catch (Exception e)
// {
// msg = crc.GetString(L.monitor_config_load_fail, "加载监控相机配置文件失败:") + e.ToString();
// LogUtil.error("加载监控相机配置文件失败:" + e.ToString());
// msg = Name + crc.GetString(L.monitor_config_load_fail, "加载监控相机配置文件失败:") + e.ToString();
// LogUtil.error(Name + "加载监控相机配置文件失败:" + e.ToString());
// return false;
// }
// if (VideoManager.CamNames != null && VideoManager.CamNames.Count > 0)
// {
// Name = VideoManager.CamNames[0];
// if (preview == null)
// {
// VideoManager.Open(new Dictionary<string, IntPtr> { { Name, picture.Handle } });
// }
// else
// {
// VideoManager.Open(new Dictionary<string, IntPtr> { { Name, (IntPtr)preview } });
// }
// VideoManager.GrabOneImg(Name, out Bitmap bmp);
// if (bmp == null)
// {
// msg = Name + crc.GetString(L.monitor_open_fail, "监控相机打开失败");
// LogUtil.error(Name + $"监控相机打开失败");
// return false;
// }
// VideoManager.StartRecord(Name, "Auto1");
// camera_event?.Invoke(this, bmp);
// camera.Open(DeviceName);
// //Bitmap bmp = camera.GetImage(DeviceName);
// //if (bmp == null)
// //{
// // msg = Name + crc.GetString(L.monitor_open_fail,"监控相机打开失败");
// // LogUtil.error(Name + $"监控相机打开失败");
// // return false;
// //}
// //camerathread = new Thread(new ThreadStart(startCamera));
// //camerathread.Start();
// //GC.KeepAlive(camerathread);
// return true;
// }
// return false;
//}
int errortimes = 0;
bool camerathreadrun = true;
......@@ -103,6 +95,15 @@ public class HIKCamera
// LogUtil.error(Name + e.ToString());
//}
}
public Bitmap GetImage(int index)
{
return null;
//if (camera == null)
// return null;
//return camera.GetImage(index);
}
public string GetFixtureStateFilename(string PositionNum, string WareNumber, StoreMoveType storeMoveType, FixtureState fixtureState)
{
Path.GetInvalidFileNameChars().ToList().ForEach((ix) => { WareNumber = WareNumber.Replace(ix.ToString(), ""); });
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
<package id="OpenCvSharp4" version="4.11.0.20250507" targetFramework="net462" />
<package id="OpenCvSharp4.Extensions" version="4.11.0.20250507" targetFramework="net462" />
<package id="OpenCvSharp4.runtime.win" version="4.11.0.20250507" targetFramework="net462" />
<package id="System.Buffers" version="4.6.1" targetFramework="net462" />
<package id="System.Drawing.Common" version="8.0.11" targetFramework="net462" />
<package id="System.Memory" version="4.6.3" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
......@@ -66,6 +66,18 @@
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
......
......@@ -59,7 +59,7 @@ namespace TheMachine
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
LogUtil.error($"Application_ThreadException:" + e.ToString());
LogUtil.error($"Application_ThreadException:" + $"{e.Exception.ToString()}");
}
......
......@@ -39,6 +39,7 @@ namespace TheMachine
this.button1 = new System.Windows.Forms.Button();
this.uC_LedConfig1 = new TheMachine.UC_LedConfig();
this.uC_SetUserPassword1 = new TheMachine.UC_SetUserPassword();
this.btn_careCameraTemplate = new System.Windows.Forms.Button();
this.tp.SuspendLayout();
this.SuspendLayout();
//
......@@ -152,10 +153,21 @@ namespace TheMachine
this.uC_SetUserPassword1.TabIndex = 8;
this.uC_SetUserPassword1.Tag = "not";
//
// btn_careCameraTemplate
//
this.btn_careCameraTemplate.Location = new System.Drawing.Point(15, 195);
this.btn_careCameraTemplate.Name = "btn_careCameraTemplate";
this.btn_careCameraTemplate.Size = new System.Drawing.Size(332, 43);
this.btn_careCameraTemplate.TabIndex = 10;
this.btn_careCameraTemplate.Text = "保存料盘检测背景模版";
this.btn_careCameraTemplate.UseVisualStyleBackColor = true;
this.btn_careCameraTemplate.Click += new System.EventHandler(this.btn_careCameraTemplate_Click);
//
// SettingControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScroll = true;
this.Controls.Add(this.btn_careCameraTemplate);
this.Controls.Add(this.uC_LedConfig1);
this.Controls.Add(this.uC_SetUserPassword1);
this.Controls.Add(this.button1);
......@@ -180,5 +192,6 @@ namespace TheMachine
private System.Windows.Forms.Button button1;
private UC_SetUserPassword uC_SetUserPassword1;
private UC_LedConfig uC_LedConfig1;
private System.Windows.Forms.Button btn_careCameraTemplate;
}
}
......@@ -130,6 +130,23 @@ namespace TheMachine
Task.Run(() => CodeManager.TestHasReel(CodeManager.hikNameList[0], out _, out _));
}
private void btn_careCameraTemplate_Click(object sender, EventArgs e)
{
if (MessageBox.Show(crc.GetString("Res0189.f7b0ab1c", "重新获取标定图像前,请确保皮带线上没有任何料盘, 光照水平与正常工作时一致"), crc.GetString("Res0190.43d586cd", "请确认"), MessageBoxButtons.OKCancel) != DialogResult.OK)
return;
if (CameraReelCheck.List.All(x =>
{
return x.SaveBackgroundTemplate();
}))
{
MessageBox.Show(crc.GetString("Res0191.3b108349", "保存成功"));
}
else
{
MessageBox.Show(crc.GetString("Res0192.5c88558f", "标定失败"));
}
}
//private void button2_Click(object sender, EventArgs e)
//{
......
......@@ -504,3 +504,8 @@ StringPosChecker_Home 上料定位旋转气缸避让 Avoidance of feeding positi
StringDoor_Axis_Break 上料机构折叠门刹车解除 Brake release of feeding mechanism folding door
StringDoor_Close 上料机构折叠门关闭端 Closing end of feeding mechanism folding door
timeout 超时 Timeout
Form1_tabc_tab_setting__SettingControl_btn_careCameraTemplate_Text 保存料盘检测背景模版 Save Tray Inspection Background Template
Res0191.3b108349 保存成功 Save successful
Res0192.5c88558f 标定失败 Calibration failed
Res0189.f7b0ab1c 重新获取标定图像前,请确保皮带线上没有任何料盘, 光照水平与正常工作时一致 Before reacquiring the calibration image, make sure that there are no trays on the belt line and that the light level is the same as in normal operation.
Res0190.43d586cd 请确认 Make sure
\ No newline at end of file
......@@ -500,3 +500,8 @@ StringPosChecker_Home 上料定位旋转气缸避让 上料位置決め回転シ
StringDoor_Axis_Break 上料机构折叠门刹车解除 上料機構折りたたみドアブレーキ解除
StringDoor_Close 上料机构折叠门关闭端 上料機構折りたたみドア閉鎖端
timeout 超时 タイムアウト
Form1_tabc_tab_setting__SettingControl_btn_careCameraTemplate_Text 保存料盘检测背景模版 キャリア基板検出用背景テンプレートを保存
Res0191.3b108349 保存成功 保存しました
Res0192.5c88558f 标定失败 キャリブレーション失敗
Res0189.f7b0ab1c 重新获取标定图像前,请确保皮带线上没有任何料盘, 光照水平与正常工作时一致 再びキャリブレーション画像を取得する前に、コンベアベルト上にキャリア基板が全くないことを確認してください。また、照明条件は通常の稼働時と同一である必要があります。
Res0190.43d586cd 请确认 確認してください
\ No newline at end of file
......@@ -504,3 +504,8 @@ StringPosChecker_Home 上料定位旋转气缸避让
StringDoor_Axis_Break 上料机构折叠门刹车解除
StringDoor_Close 上料机构折叠门关闭端
timeout 超时
Form1_tabc_tab_setting__SettingControl_btn_careCameraTemplate_Text 保存料盘检测背景模版 保存料盘检测背景模版
Res0191.3b108349 保存成功 保存成功
Res0192.5c88558f 标定失败 标定失败
Res0189.f7b0ab1c 重新获取标定图像前,请确保皮带线上没有任何料盘, 光照水平与正常工作时一致 重新获取标定图像前,请确保皮带线上没有任何料盘, 光照水平与正常工作时一致
Res0190.43d586cd 请确认 请确认
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!