Created
June 6, 2018 12:35
-
-
Save msinnema/3ba87181e1d890d0bf434f02f32ea85a to your computer and use it in GitHub Desktop.
Asynchronous multithreaded Intrada ALPR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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