From fb7c0394736050c4e905fe64ffd8d731078fd1b2 Mon Sep 17 00:00:00 2001 From: Matthew Hill Date: Sat, 21 Mar 2015 11:38:04 -0400 Subject: [PATCH 1/5] Added OS X instructions --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1a842f4..4556ad4 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ Please follow these detailed compilation guides for your respective operating sy * [Windows] (https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Windows)) * [Ubuntu Linux] (https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Ubuntu-Linux)) +* [OS X] (https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(OS-X)) * [Android] (https://github.com/sujaybhowmick/OpenAlprDroidApp) * [iOS] (https://github.com/twelve17/openalpr-ios) From 255190b16cac21cecd6ea2359920caf5cf9c130c Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 20 Mar 2015 01:49:06 +0200 Subject: [PATCH 2/5] Added an overload to the C# binding for reading plates from a video. Signed-off-by: Dimitar Dobrev --- .../csharp/openalpr-net/openalpr-net.cpp | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/bindings/csharp/openalpr-net/openalpr-net.cpp b/src/bindings/csharp/openalpr-net/openalpr-net.cpp index a8103d0..7eee6da 100644 --- a/src/bindings/csharp/openalpr-net/openalpr-net.cpp +++ b/src/bindings/csharp/openalpr-net/openalpr-net.cpp @@ -291,6 +291,49 @@ namespace openalprnet { }; + public ref class AlprFrameEventArgs : public EventArgs + { + public: + AlprFrameEventArgs(int frameNumber, System::Drawing::Image^ frame, AlprResultsNet^ results) { + m_frameNumber = frameNumber; + m_frame = frame; + m_results = results; + m_cancel = false; + } + + property int FrameNumber { + int get() { + return m_frameNumber; + } + } + + property System::Drawing::Image^ Frame { + System::Drawing::Image^ get() { + return m_frame; + } + } + + property AlprResultsNet^ Results { + AlprResultsNet^ get() { + return m_results; + } + } + + property bool Cancel { + bool get() { + return m_cancel; + } + void set( bool cancel ) { + m_cancel = cancel; + } + } + private: + int m_frameNumber; + System::Drawing::Image^ m_frame; + AlprResultsNet^ m_results; + bool m_cancel; + }; + public ref class AlprNet sealed { public: @@ -332,6 +375,37 @@ namespace openalprnet { } } + event EventHandler^ FrameProcessed; + + void recognizeFromVideo(System::String^ videoPath) { + if (System::IO::File::Exists(videoPath)) { + int framenum = 0; + cv::VideoCapture cap = cv::VideoCapture(); + cap.open(marshal_as(videoPath)); + + cv::Mat frame; + + while (cap.read(frame)) + { + std::vector regionsOfInterest; + regionsOfInterest.push_back(AlprRegionOfInterest(0, 0, frame.cols, frame.rows)); + + AlprResults results = m_Impl->recognize(frame.data, frame.elemSize(), frame.cols, frame.rows, regionsOfInterest); + Image^ frameImage = gcnew Bitmap(frame.cols, frame.rows, frame.step, Imaging::PixelFormat::Format24bppRgb, IntPtr(frame.data)); + AlprFrameEventArgs^ alprFrameEventArgs = gcnew AlprFrameEventArgs(framenum, frameImage, gcnew AlprResultsNet(results)); + FrameProcessed(this, alprFrameEventArgs); + delete frameImage; + if (alprFrameEventArgs->Cancel) { + break; + } + framenum++; + } + } + else { + throw gcnew System::IO::FileNotFoundException("No video was not found at " + videoPath, videoPath); + } + } + /// /// Recognize from an image on disk /// From 196d8a0cf0cc04f49a08979fb9cdb15a1897a44a Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sat, 21 Mar 2015 17:51:07 -0400 Subject: [PATCH 3/5] Fixed compile issue on Windows --- src/openalpr/support/timing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openalpr/support/timing.cpp b/src/openalpr/support/timing.cpp index 0a93507..82c8374 100644 --- a/src/openalpr/support/timing.cpp +++ b/src/openalpr/support/timing.cpp @@ -83,7 +83,7 @@ namespace alpr timespec time_start; time_start.tv_sec = 0; - time_start.tv_nsec = 0; + time_start.tv_usec = 0; return diffclock(time_start, time); } From 19d0e55727b437f073188c9d4dd6a7f0d4ca72b6 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sat, 21 Mar 2015 17:51:20 -0400 Subject: [PATCH 4/5] Fixed compile issue on Windows --- src/openalpr/support/windows/unistd_partial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openalpr/support/windows/unistd_partial.h b/src/openalpr/support/windows/unistd_partial.h index a335c26..c4efc98 100644 --- a/src/openalpr/support/windows/unistd_partial.h +++ b/src/openalpr/support/windows/unistd_partial.h @@ -30,7 +30,7 @@ #define STDOUT_FILENO 1 #define STDERR_FILENO 2 /* should be in some equivalent to */ -typedef __int8 int8_t; +//typedef __int8 int8_t; typedef __int16 int16_t; typedef __int32 int32_t; typedef __int64 int64_t; From 69a8282580984f6714eec09af0c6c4108dbf16ab Mon Sep 17 00:00:00 2001 From: Frederico Lopes Date: Wed, 25 Mar 2015 13:07:36 -0300 Subject: [PATCH 5/5] Eliminate false positives The routine was incorrectly returning too many garbage rects. --- src/openalpr/detection/detectormorph.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openalpr/detection/detectormorph.cpp b/src/openalpr/detection/detectormorph.cpp index 0d6e81e..cf6a2dc 100644 --- a/src/openalpr/detection/detectormorph.cpp +++ b/src/openalpr/detection/detectormorph.cpp @@ -137,6 +137,7 @@ const int num_thresholds = 7; int numValidChars = 0; Mat rotated; for (int i = 0; i < rects.size(); i++) { + numValidChars = 0; RotatedRect PlateRect = rects[i]; Size rect_size = PlateRect.size;