mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 01:36:51 +08:00
Merge branch 'master' of github.com:openalpr/openalpr
This commit is contained in:
@@ -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)
|
||||
|
||||
|
@@ -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<AlprFrameEventArgs^>^ FrameProcessed;
|
||||
|
||||
void recognizeFromVideo(System::String^ videoPath) {
|
||||
if (System::IO::File::Exists(videoPath)) {
|
||||
int framenum = 0;
|
||||
cv::VideoCapture cap = cv::VideoCapture();
|
||||
cap.open(marshal_as<std::string>(videoPath));
|
||||
|
||||
cv::Mat frame;
|
||||
|
||||
while (cap.read(frame))
|
||||
{
|
||||
std::vector<AlprRegionOfInterest> 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recognize from an image on disk
|
||||
/// </summary>
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
/* should be in some equivalent to <sys/types.h> */
|
||||
typedef __int8 int8_t;
|
||||
//typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
|
Reference in New Issue
Block a user