Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

fail to load keypoints from .yml file

Hi,

I want to find keypoints in different images and save them on my hard disk. The saving part works very well. To save the keypoints I use the following:

    Mat it;
    it = imread( "pic1.jpg", IMREAD_GRAYSCALE);
    vector<KeyPoint> keypoints;
    detector.detect( (it), keypoints );
    FileStorage fs("keypoint1.yml", FileStorage::WRITE);
    write( fs , "keypoint", keypoints );
    fs.release();

When I try to read the file I fail with this :

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

If I do it like that, "keypoint1s" remains empty. Would be great if somebody knows how to fix this!

Thanks!

click to hide/show revision 2
retagged

updated 2013-09-19 05:36:22 -0600

berak gravatar image

fail to load keypoints from .yml file

Hi,

I want to find keypoints in different images and save them on my hard disk. The saving part works very well. To save the keypoints I use the following:

    Mat it;
    it = imread( "pic1.jpg", IMREAD_GRAYSCALE);
    vector<KeyPoint> keypoints;
    detector.detect( (it), keypoints );
    FileStorage fs("keypoint1.yml", FileStorage::WRITE);
    write( fs , "keypoint", keypoints );
    fs.release();

When I try to read the file I fail with this :

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

If I do it like that, "keypoint1s" remains empty. Would be great if somebody knows how to fix this!

Thanks!