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 Rs.Controls;
|
|
|
|
|
using Rs.Framework;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Rs.MotionPlat.Commom
|
|
|
|
|
{
|
|
|
|
|
public class BarCodeManager
|
|
|
|
|
{
|
|
|
|
|
public static string FindCode(HObject images)
|
|
|
|
|
{
|
|
|
|
|
HTuple decodedDataStrings = "";
|
|
|
|
|
HObject xlds = new HObject();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string[] modes = new string[] { "standard_recognition", "enhanced_recognition", "maximum_recognition" };
|
|
|
|
|
foreach (string mode in modes)
|
|
|
|
|
{
|
|
|
|
|
HOperatorSet.CreateDataCode2dModel("Data Matrix ECC 200", "default_parameters", mode, out HTuple dataCodeHandle);
|
|
|
|
|
HOperatorSet.FindDataCode2d(images, out xlds, dataCodeHandle, new HTuple(), new HTuple(), out HTuple resultHandles, out decodedDataStrings);
|
|
|
|
|
|
|
|
|
|
if (decodedDataStrings.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
HOperatorSet.ClearDataCode2dModel(dataCodeHandle);
|
|
|
|
|
return decodedDataStrings.ToString().Replace("\"", "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Error(ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|