Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you write:

write( fs , "keypoint", keypoints );

you read:

FileNode kptFileNode = fs2["keypoint1"];

see the mismatch ? you have to use the same "key" for both, ie "keypoint", not "keypoint1"

btw, the whole could be rewritten like:

FileStorage fs("keypoint1.yml", FileStorage::WRITE);
fs << "keypoint" << keypoints;
fs.release();

vector<KeyPoint> keypoint1s;
FileStorage fs2("keypoint1.yml", FileStorage::READ);
fs2["keypoint"] >> keypoint1s;
fs2.release();