Skip to content

Instantly share code, notes, and snippets.

@msinnema
Created June 6, 2018 12:35
Show Gist options
  • Save msinnema/3ba87181e1d890d0bf434f02f32ea85a to your computer and use it in GitHub Desktop.
Save msinnema/3ba87181e1d890d0bf434f02f32ea85a to your computer and use it in GitHub Desktop.
Asynchronous multithreaded Intrada ALPR
using System;
using System.IO;
using System.Linq;
using System.Threading;
using Intrada.ALPR;
namespace RecognizeHotFolder
{
class Program
{
static void HandleResult(int id, string filename, Result result)
{
Console.WriteLine( filename + "\t" + result );
File.Delete(filename);
}
static void Main(string[] args)
{
try
{
ThreadedIntradaALPR intrada = new ThreadedIntradaALPR("COMPANY_NAME>",
"<COMPANY_KEY>", 4, "settings.txt",HandleResult);
string[] lastfilenames = Directory.GetFiles(".\\hotfolder", "*.jpg");
while (!Console.KeyAvailable)
{
string[] filenames = Directory.GetFiles(".\\hotfolder", "*.jpg");
foreach (string filename in filenames.Except(lastfilenames))
{
intrada.Recognize(filename);
}
lastfilenames = filenames;
Thread.Sleep(1000);
}
intrada.Stop();
Console.ReadLine();
}
catch (IntradaException e)
{
Console.WriteLine("Error: " + e);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment