1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Add Ptr KNearest::load and python binding

This commit is contained in:
LaurentBerger
2019-04-15 15:51:30 +02:00
parent c9a76ede94
commit 621e3eaed8
3 changed files with 32 additions and 0 deletions
+11
View File
@@ -515,6 +515,17 @@ Ptr<KNearest> KNearest::create()
return makePtr<KNearestImpl>();
}
Ptr<KNearest> KNearest::load(const String& filepath)
{
FileStorage fs;
fs.open(filepath, FileStorage::READ);
Ptr<KNearest> knearest = makePtr<KNearestImpl>();
((KNearestImpl*)knearest.get())->read(fs.getFirstTopLevelNode());
return knearest;
}
}
}