OpenCV_4.2.0/opencv-4.2.0/modules/ml/misc/python/test/test_knearest.py

14 lines
373 B
Python
Raw Permalink Normal View History

2024-07-25 16:47:56 +08:00
#!/usr/bin/env python
import cv2 as cv
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
self.assertTrue(k_nearest.isTrained())
if __name__ == '__main__':
NewOpenCVTests.bootstrap()