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:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user