diff --git a/openalpr-net/AssemblyInfo.cpp b/openalpr-net/AssemblyInfo.cpp
new file mode 100644
index 0000000..61560b3
--- /dev/null
+++ b/openalpr-net/AssemblyInfo.cpp
@@ -0,0 +1,40 @@
+#include "stdafx.h"
+
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute("openalprnet")];
+[assembly:AssemblyDescriptionAttribute("")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("")];
+[assembly:AssemblyProductAttribute("openalprnet")];
+[assembly:AssemblyCopyrightAttribute("Copyright (c) 2015")];
+[assembly:AssemblyTrademarkAttribute("")];
+[assembly:AssemblyCultureAttribute("")];
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the value or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
+
+[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
diff --git a/openalpr-net/Stdafx.cpp b/openalpr-net/Stdafx.cpp
new file mode 100644
index 0000000..144c129
--- /dev/null
+++ b/openalpr-net/Stdafx.cpp
@@ -0,0 +1,5 @@
+// stdafx.cpp : source file that includes just the standard includes
+// openalpr-net.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
diff --git a/openalpr-net/Stdafx.h b/openalpr-net/Stdafx.h
new file mode 100644
index 0000000..3cc4c24
--- /dev/null
+++ b/openalpr-net/Stdafx.h
@@ -0,0 +1,7 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+
diff --git a/openalpr-net/app.ico b/openalpr-net/app.ico
new file mode 100644
index 0000000..3a5525f
Binary files /dev/null and b/openalpr-net/app.ico differ
diff --git a/openalpr-net/app.rc b/openalpr-net/app.rc
new file mode 100644
index 0000000..eab4306
Binary files /dev/null and b/openalpr-net/app.rc differ
diff --git a/openalpr-net/openalpr-net.cpp b/openalpr-net/openalpr-net.cpp
new file mode 100644
index 0000000..58eddbb
--- /dev/null
+++ b/openalpr-net/openalpr-net.cpp
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2015 Dr. Masroor Ehsan
+ *
+ * This file is part of OpenAlpr.Net.
+ *
+ * OpenAlpr.Net is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License
+ * version 3 as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "stdafx.h"
+#include "openalpr-net.h"
+#include "alpr.h"
+#include
+#include
+#include
+#using
+//#include
+#include
+
+using namespace System;
+using namespace msclr::interop;
+using namespace System::Collections::Generic;
+using namespace System::Runtime::InteropServices;
+
+namespace openalprnet {
+
+ ref class StringConverter
+ {
+ public:
+ static std::vector ToVector(array^ src)
+ {
+ std::vector result(src->Length);
+ pin_ptr pin(&src[0]);
+ unsigned char *first(pin), *last(pin + src->Length);
+ std::copy(first, last, result.begin());
+ return result;
+ }
+
+ static System::String^ ToManagedString(std::string s)
+ {
+ return gcnew String(s.c_str());
+ }
+
+ static std::string ToStlString(System::String^ s)
+ {
+ IntPtr ptr = Marshal::StringToHGlobalAnsi(s);
+ if(ptr != IntPtr::Zero)
+ {
+ std::string tmp(reinterpret_cast(static_cast(ptr)));
+ Marshal::FreeHGlobal(ptr);
+ return tmp;
+ }
+ return std::string();
+ }
+ };
+
+ public ref class AlprPlateNet
+ {
+ public:
+ AlprPlateNet(AlprPlate plate){
+ //_characters = marshal_as(plate.characters);
+ m_characters = StringConverter::ToManagedString(plate.characters);
+ m_overall_confidence=plate.overall_confidence;
+ m_matches_template=plate.matches_template;
+ }
+
+ property System::String^ characters {
+ System::String^ get() {
+ return m_characters;
+ }
+ }
+
+ property float overall_confidence {
+ float get() {
+ return m_overall_confidence;
+ }
+ }
+
+ property bool matches_template {
+ bool get() {
+ return m_matches_template;
+ }
+ }
+
+ private:
+ System::String^ m_characters;
+ float m_overall_confidence;
+ bool m_matches_template;
+ };
+
+ public ref class AlprResultNet
+ {
+ public:
+ AlprResultNet() : m_Impl( new AlprResult ) {}
+
+ AlprResultNet(AlprResult* result) : m_Impl( result ) {}
+
+ property int requested_topn {
+ int get() {
+ return m_Impl->requested_topn;
+ }
+ }
+
+ property int regionConfidence {
+ int get() {
+ return m_Impl->regionConfidence;
+ }
+ }
+
+ property System::String^ region {
+ System::String^ get() {
+ return StringConverter::ToManagedString(m_Impl->region);
+ }
+ }
+
+ property int result_count {
+ int get() {
+ return m_Impl->result_count;
+ }
+ }
+
+ property AlprPlateNet^ bestPlate {
+ AlprPlateNet^ get() {
+ AlprPlateNet^ result = gcnew AlprPlateNet(m_Impl->bestPlate);
+ return result;
+ }
+ }
+
+ property List^ topNPlates {
+ List^ get() {
+ List^ list = gcnew List(m_Impl->topNPlates.size());
+ for (std::vector::iterator itr = m_Impl->topNPlates.begin(); itr != m_Impl->topNPlates.end(); itr++)
+ {
+ list->Add(gcnew AlprPlateNet(*itr));
+ }
+ return list;
+ }
+ }
+
+ property float processing_time_ms {
+ float get() {
+ return m_Impl->processing_time_ms;
+ }
+ }
+
+ /*
+ AlprCoordinate plate_points[4];
+ */
+ private:
+ AlprResult * m_Impl;
+ };
+
+ public ref class AlprNet {
+ public:
+ // Allocate the native object on the C++ Heap via a constructor
+ AlprNet(System::String^ country, System::String^ configFile) : m_Impl( new Alpr(marshal_as(country), marshal_as(configFile)) ) { }
+
+ // Deallocate the native object on a destructor
+ ~AlprNet(){
+ delete m_Impl;
+ }
+
+ property int TopN {
+ int get() {
+ return m_topN;
+ }
+ void set( int topn ){
+ m_topN = topn;
+ m_Impl->setTopN(topn);
+ }
+ }
+
+ property bool DetectRegion {
+ bool get() {
+ return m_detectRegion;
+ }
+ void set( bool detectRegion ) {
+ m_detectRegion = detectRegion;
+ m_Impl->setDetectRegion(detectRegion);
+ }
+ }
+
+ property System::String^ DefaultRegion {
+ System::String^ get() {
+ return m_defaultRegion;
+ }
+ void set( System::String^ region ){
+ m_defaultRegion = region;
+ m_Impl->setDefaultRegion(marshal_as(region));
+ }
+ }
+
+ //std::vector recognize(std::string filepath);
+ //std::vector recognize(std::string filepath, std::vector regionsOfInterest);
+ //std::vector recognize(std::vector imageBuffer);
+ //std::vector recognize(std::vector imageBuffer, std::vector regionsOfInterest);
+ List^ recognize(System::String^ filepath) {
+ m_results = new std::vector(m_Impl->recognize(marshal_as(filepath)));
+ std::vector& runList = *m_results;
+ std::vector::iterator itr;
+ List^ list = gcnew List(runList.size());
+ for (itr = runList.begin(); itr != runList.end(); itr++)
+ {
+ list->Add(gcnew AlprResultNet(&*itr));
+ }
+ return list;
+ }
+
+ List^ recognize(cli::array^ imageBuffer) {
+ std::vector p = StringConverter::ToVector(imageBuffer);
+ m_results = new std::vector(m_Impl->recognize(p));
+ std::vector& runList = *m_results;
+ std::vector::iterator itr;
+ List^ list = gcnew List(runList.size());
+ for (itr = runList.begin(); itr != runList.end(); itr++)
+ {
+ list->Add(gcnew AlprResultNet(&*itr));
+ }
+ return list;
+ }
+
+ bool isLoaded() {
+ return m_Impl->isLoaded();
+ }
+
+ static System::String^ getVersion() {
+ return StringConverter::ToManagedString(Alpr::getVersion());
+ }
+
+ System::String^ toJson() {
+ std::string json = m_Impl->toJson(*m_results, -1);
+ return StringConverter::ToManagedString(json);
+ }
+
+ protected:
+ // Deallocate the native object on the finalizer just in case no destructor is called
+ !AlprNet() {
+ delete m_Impl;
+ }
+
+ private:
+ Alpr * m_Impl;
+ std::vector* m_results;
+ int m_topN;
+ bool m_detectRegion;
+ System::String^ m_defaultRegion;
+ };
+}
\ No newline at end of file
diff --git a/openalpr-net/openalpr-net.h b/openalpr-net/openalpr-net.h
new file mode 100644
index 0000000..e56ad27
--- /dev/null
+++ b/openalpr-net/openalpr-net.h
@@ -0,0 +1,9 @@
+// openalpr-net.h
+
+#pragma once
+
+//using namespace System;
+
+namespace openalprnet {
+
+}
diff --git a/openalpr-net/openalpr-net.vcxproj b/openalpr-net/openalpr-net.vcxproj
new file mode 100644
index 0000000..2088375
--- /dev/null
+++ b/openalpr-net/openalpr-net.vcxproj
@@ -0,0 +1,101 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {4044340C-C435-4A1F-8F12-0806C38AE3B6}
+ v4.0
+ ManagedCProj
+ openalprnet
+
+
+
+ DynamicLibrary
+ true
+ true
+ Unicode
+
+
+ DynamicLibrary
+ false
+ true
+ Unicode
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;%(PreprocessorDefinitions)
+ Use
+
+
+ true
+
+
+
+
+
+
+ Level3
+ WIN32;NDEBUG;%(PreprocessorDefinitions)
+ Use
+ C:\projects\openalpr\libraries\tesseract-ocr\api;C:\projects\openalpr\libraries\tesseract-ocr\ccstruct;C:\projects\openalpr\libraries\tesseract-ocr\ccmain;C:\projects\openalpr\libraries\tesseract-ocr\ccutil;C:\projects\openalpr\libraries\opencv;C:\projects\openalpr\libraries\opencv\include;C:\projects\openalpr\libraries\opencv\include\opencv;C:\projects\openalpr\libraries\opencv\modules\core\include;C:\projects\openalpr\libraries\opencv\modules\flann\include;C:\projects\openalpr\libraries\opencv\modules\imgproc\include;C:\projects\openalpr\libraries\opencv\modules\highgui\include;C:\projects\openalpr\libraries\opencv\modules\features2d\include;C:\projects\openalpr\libraries\opencv\modules\calib3d\include;C:\projects\openalpr\libraries\opencv\modules\ml\include;C:\projects\openalpr\libraries\opencv\modules\video\include;C:\projects\openalpr\libraries\opencv\modules\legacy\include;C:\projects\openalpr\libraries\opencv\modules\objdetect\include;C:\projects\openalpr\libraries\opencv\modules\photo\include;C:\projects\openalpr\libraries\opencv\modules\gpu\include;C:\projects\openalpr\libraries\opencv\modules\ocl\include;C:\projects\openalpr\libraries\opencv\modules\nonfree\include;C:\projects\openalpr\libraries\opencv\modules\contrib\include;C:\projects\openalpr\libraries\opencv\modules\stitching\include;C:\projects\openalpr\libraries\opencv\modules\superres\include;C:\projects\openalpr\libraries\opencv\modules\ts\include;C:\projects\openalpr\libraries\opencv\modules\videostab\include;C:\projects\openalpr\src\openalpr;%(AdditionalIncludeDirectories)
+
+
+ true
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_videostab248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_ts248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_superres248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_stitching248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_contrib248.lib;C:\projects\openalpr\libraries\tesseract-ocr\vs2010\LIB_Release\libtesseract303-static.lib;C:\projects\openalpr\libraries\tesseract-ocr\vs2010\LIB_Release\liblept170.lib;ws2_32.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_nonfree248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_ocl248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_gpu248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_photo248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_objdetect248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_legacy248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_video248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_ml248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_calib3d248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_features2d248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_highgui248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_imgproc248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_flann248.lib;C:\projects\openalpr\libraries\opencv\lib\Release\opencv_core248.lib;C:\projects\openalpr\src\openalpr\support\Release\support.lib;C:\projects\openalpr\src\openalpr\Release\openalpr-static.lib
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/openalpr-net/openalpr-net.vcxproj.filters b/openalpr-net/openalpr-net.vcxproj.filters
new file mode 100644
index 0000000..221dbe4
--- /dev/null
+++ b/openalpr-net/openalpr-net.vcxproj.filters
@@ -0,0 +1,49 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Resource Files
+
+
+
+
+ Resource Files
+
+
+
\ No newline at end of file
diff --git a/openalpr-net/openalpr-net.vcxproj.user b/openalpr-net/openalpr-net.vcxproj.user
new file mode 100644
index 0000000..ace9a86
--- /dev/null
+++ b/openalpr-net/openalpr-net.vcxproj.user
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/openalpr-net/resource.h b/openalpr-net/resource.h
new file mode 100644
index 0000000..d5ac7c4
--- /dev/null
+++ b/openalpr-net/resource.h
@@ -0,0 +1,3 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by app.rc
diff --git a/openalprnet-cli/Program.cs b/openalprnet-cli/Program.cs
new file mode 100644
index 0000000..ddef99b
--- /dev/null
+++ b/openalprnet-cli/Program.cs
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015 Dr. Masroor Ehsan
+ *
+ * This file is part of OpenAlpr.Net.
+ *
+ * OpenAlpr.Net is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License
+ * version 3 as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using openalprnet;
+
+namespace openalprnet_cli
+{
+ internal class Program
+ {
+ public static string AssemblyDirectory
+ {
+ get
+ {
+ var codeBase = Assembly.GetExecutingAssembly().CodeBase;
+ var uri = new UriBuilder(codeBase);
+ var path = Uri.UnescapeDataString(uri.Path);
+ return Path.GetDirectoryName(path);
+ }
+ }
+
+ private static void Main(string[] args)
+ {
+ Console.WriteLine(AlprNet.getVersion());
+ var config = Path.Combine(AssemblyDirectory, "openalpr.conf");
+ var alpr = new AlprNet("us", config);
+ var loaded = alpr.isLoaded();
+ var samplePath = Path.Combine(AssemblyDirectory, @"samples\us-1.jpg");
+ var imgBytes = File.ReadAllBytes(samplePath);
+ //alpr.TopN = 3;
+ alpr.DefaultRegion = "us";
+ alpr.DetectRegion = true;
+ //var results = alpr.recognize(samplePath);
+ var results = alpr.recognize(imgBytes);
+ var json = alpr.toJson();
+ Console.WriteLine(json);
+ var plates = results.First().topNPlates;
+ }
+ }
+}
\ No newline at end of file
diff --git a/openalprnet-cli/Properties/AssemblyInfo.cs b/openalprnet-cli/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8c169b6
--- /dev/null
+++ b/openalprnet-cli/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("openalprnet-cli")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("openalprnet-cli")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("42477de2-b13e-4959-a03e-ae43c65e68f3")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/openalprnet-cli/openalprnet-cli.csproj b/openalprnet-cli/openalprnet-cli.csproj
new file mode 100644
index 0000000..4e641d8
--- /dev/null
+++ b/openalprnet-cli/openalprnet-cli.csproj
@@ -0,0 +1,63 @@
+
+
+
+ Debug
+ x86
+ 8.0.30703
+ 2.0
+ {BD50C6C1-EEB9-48D2-A87C-70F5342579DD}
+ Exe
+ Properties
+ openalprnet_cli
+ openalprnet-cli
+ v4.0
+ Client
+ 512
+
+
+ x86
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ x86
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {4044340C-C435-4A1F-8F12-0806C38AE3B6}
+ openalpr-net
+
+
+
+
+
\ No newline at end of file