I ran into a problem with the PCA::read() function. Saving a PCA object with PCA::write went well (I used XML format), but reading the file didn't go well:
- First, there is no [documentation](http://docs.opencv.org/master/d3/d8d/classcv_1_1PCA.html#a6d796707bf1c3f10b704d0f7ce154fca)* on this. I didn't find anything in the examples, neither.
- The read/write is inconsistent. read() should also accept FileStorage as parameter.
- Using
FileStorage fs("pcafile.xml");
pca.read(fs["PCA"]);
gives (!fs.empty()) exception (even if this is the node it needs).
- copying directly the source of the read function:
read(fs["vectors"], pca.eigenvectors);
read(fs["values"], pca.eigenvalues);
read(fs["mean"], pca.mean);
reads correctly the object.
Am I doing something wrong? Anyway, I think this should be corrected in the source code.
*BTW, the documentation of OpenCV 3.x seems much worse than OpenCV 2.4. It's too concise and it doesn't contain any explanations.
↧