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