mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 06:46:53 +08:00
@@ -336,16 +336,17 @@ namespace openalprnet {
|
||||
/// Recognize from an image on disk
|
||||
/// </summary>
|
||||
AlprResultsNet^ recognize(System::String^ filepath) {
|
||||
/*
|
||||
AlprResults results = m_Impl->recognize(marshal_as<std::string>(filepath));
|
||||
return gcnew AlprResultsNet(results);
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recognize from an image on disk
|
||||
/// </summary>
|
||||
AlprResultsNet^ recognize(System::String^ filepath, List<System::Drawing::Rectangle>^ regionsOfInterest) {
|
||||
cv::Mat frame = cv::imread( marshal_as<std::string>(filepath) );
|
||||
|
||||
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 );
|
||||
std::vector<AlprRegionOfInterest> rois = AlprHelper::ToVector(regionsOfInterest);
|
||||
AlprResults results = m_Impl->recognize(frame.data, frame.elemSize(), frame.cols, frame.rows, rois );
|
||||
return gcnew AlprResultsNet(results);
|
||||
}
|
||||
|
||||
@@ -378,11 +379,6 @@ namespace openalprnet {
|
||||
return AlprHelper::ToManagedString(Alpr::getVersion());
|
||||
}
|
||||
|
||||
// System::String^ toJson(AlprResultsNet^ results) {
|
||||
// std::string json = Alpr::toJson(marshal_as<AlprResults>(results));
|
||||
// return AlprHelper::ToManagedString(json);
|
||||
// }
|
||||
|
||||
protected:
|
||||
// Deallocate the native object on the finalizer just in case no destructor is called
|
||||
!AlprNet() {
|
||||
|
@@ -138,9 +138,9 @@ namespace openalprnet_windemo
|
||||
|
||||
var results = alpr.recognize(fileName);
|
||||
|
||||
var images = new List<Image>(results.Count());
|
||||
var images = new List<Image>(results.plates.Count());
|
||||
var i = 1;
|
||||
foreach (var result in results)
|
||||
foreach (var result in results.plates)
|
||||
{
|
||||
var rect = boundingRectangle(result.plate_points);
|
||||
var img = Image.FromFile(fileName);
|
||||
|
Reference in New Issue
Block a user