Чего я пытаюсь достичь:
Программно добавить сотрудника и захватить шаблон его лица с помощью C# и ESSL SDK.
/>Текущий код:
Код: Выделить всё
using System;
using zkemkeeper;
namespace FaceTMPConsoleApp
{
internal class Program
{
static void Main(string[] args)
{
IZKEM device = new CZKEMClass();
string ip = "xxx.xxx.x.xxx";
int port = 4370;
Console.WriteLine($"Connecting to {ip}...");
bool connected = device.Connect_Net(ip, port);
if (!connected)
{
Console.WriteLine("Connection failed!");
return;
}
Console.WriteLine("Connected!\n");
string empID = "1111";
string name = "testing";
bool userAdded = device.SSR_SetUserInfo(1, empID, name, "", 0, true);
if (userAdded)
{
Console.WriteLine($"Employee {empID} added.");
Console.WriteLine("\nLook at the device camera...");
// This returns true but doesn't activate camera
bool enrollStarted = device.StartEnrollEx(empID, 1, 0);
if (enrollStarted)
{
Console.WriteLine("Enrollment started on device.");
System.Threading.Thread.Sleep(10000);
byte[] faceData = new byte[20480];
int faceLength = 0;
bool faceSaved = device.GetUserFace(1, empID, 1, ref faceData[0], ref faceLength);
if (faceSaved && faceLength > 0)
{
Console.WriteLine($"Face registered! Data size: {faceLength} bytes");
}
else
{
Console.WriteLine("Face not detected. Try again.");
}
}
}
device.Disconnect();
}
}
}
- :
Код: Выделить всё
Connect_Net()Успех
- :
Код: Выделить всё
SSR_SetUserInfo()Сотрудник успешно добавлен
- :
Код: Выделить всё
StartEnrollEx()Возвращает true (без ошибок)
- Но: на экране устройства не отображается предварительный просмотр камеры, захват лица не происходит
Что я пробовал:- Различные параметры для StartEnrollEx():
— Режим 0Код: Выделить всё
device.StartEnrollEx(empID, 6, 0) - — Режим 1
Код: Выделить всё
device.StartEnrollEx(empID, 6, 1) - — Режим 2 (задокументирован для лица)
Код: Выделить всё
device.StartEnrollEx(empID, 6, 2) - – Альтернативный режим
Код: Выделить всё
device.StartEnrollEx(empID, 13, 1)
- Различные параметры для StartEnrollEx():
Сведения об устройстве:
- Модель: essl AI FaceMars (конкретная модель не указана)
- Связь: порт TCP/IP 4370
- Ручной процесс работает: Управление пользователями → Выбрать пользователя → Лицо → Добавить лицо
- Регистрация лица работает отлично, если выполняется вручную на экране устройства
Подробнее здесь: https://stackoverflow.com/questions/798 ... t-on-ai-fa