Hello, I have a KNearest object, i trained it and it works well but I should want to save the training data because I don't want to train my KNearest object everytime I run my app. I've tried to use knn.save() function but i got this error:
Exception in thread "AWT-EventQueue-0" java.security.PrivilegedActionException: java.security.PrivilegedActionException: java.lang.Exception: unknown exception
I've also tried to save my training data Mat as image but when I loaded it and I tried to train I got this error:
OpenCV Error: Assertion failed (samples.type() == CV_32F || samples.type() == CV_32S) in cv::ml::TrainDataImpl::setData, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\ml\src\data.cpp, line 251
Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\ml\src\data.cpp:251: error: (-215) samples.type() == CV_32F || samples.type() == CV_32S in function cv::ml::TrainDataImpl::setData
]
But my image is CV_32F type. How can I solve this problem?