You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using HalconDotNet;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Rs.Framework
|
|
|
|
|
{
|
|
|
|
|
public static class ImageProcess
|
|
|
|
|
{
|
|
|
|
|
static UInt64 imageNum = 0;
|
|
|
|
|
public static ManualResetEvent manualTriggerEvent = new ManualResetEvent(false);
|
|
|
|
|
public static ManualResetEvent autoTriggerEvent = new ManualResetEvent(false);
|
|
|
|
|
|
|
|
|
|
static List<HObject> manualTriggerList=new List<HObject>();
|
|
|
|
|
static List<HObject> autoTriggerList = new List<HObject>();
|
|
|
|
|
|
|
|
|
|
public static void AddManualTrigger(HObject obj)
|
|
|
|
|
{
|
|
|
|
|
imageNum++;
|
|
|
|
|
if (imageNum>100)
|
|
|
|
|
{
|
|
|
|
|
GC.Collect();
|
|
|
|
|
imageNum = 0;
|
|
|
|
|
}
|
|
|
|
|
manualTriggerList.Add(obj);
|
|
|
|
|
manualTriggerEvent.Set();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ClearManualTrigger()
|
|
|
|
|
{
|
|
|
|
|
manualTriggerList.Clear();
|
|
|
|
|
manualTriggerEvent.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static HObject GetManualImage()
|
|
|
|
|
{
|
|
|
|
|
if(manualTriggerList.Count>0)
|
|
|
|
|
{
|
|
|
|
|
return manualTriggerList[0];
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static HObject[] GetAutoImage()
|
|
|
|
|
{
|
|
|
|
|
return autoTriggerList.ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void AddAutoTrigger(HObject obj)
|
|
|
|
|
{
|
|
|
|
|
imageNum++;
|
|
|
|
|
if (imageNum > 100)
|
|
|
|
|
{
|
|
|
|
|
GC.Collect();
|
|
|
|
|
imageNum = 0;
|
|
|
|
|
}
|
|
|
|
|
autoTriggerList.Add(obj);
|
|
|
|
|
autoTriggerEvent.Set();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ClearAutoTrigger()
|
|
|
|
|
{
|
|
|
|
|
autoTriggerList.Clear();
|
|
|
|
|
autoTriggerEvent.Reset();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|