FileNodeIterator not conformant with STL iterator interface

asked 2013-05-01 12:08:33 -0600

Enrique gravatar image

Hi,

I have this piece of code:

std::copy( fn.begin(), fn.end(), std::back_inserter( v ) );

where fn is a FileNode and v is and std::vector<cv::keypoint>.

I have the following error at compile time:

  /usr/include/c++/4.7/bits/stl_iterator_base_types.h:166:53: error: no type named ‘iterator_category’ in ‘class cv::FileNodeIterator’
  /usr/include/c++/4.7/bits/stl_iterator_base_types.h:167:53: error: no type named ‘value_type’ in ‘class cv::FileNodeIterator’
  /usr/include/c++/4.7/bits/stl_iterator_base_types.h:168:53: error: no type named ‘difference_type’ in ‘class cv::FileNodeIterator’
  /usr/include/c++/4.7/bits/stl_iterator_base_types.h:169:53: error: no type named ‘pointer’ in ‘class cv::FileNodeIterator’
  /usr/include/c++/4.7/bits/stl_iterator_base_types.h:170:53: error: no type named ‘reference’ in ‘class cv::FileNodeIterator’

Shouldn't FileNodeIterator declare those typedefs?

Thanks!

edit retag flag offensive close merge delete

Comments

http://answers.opencv.org/question/323/how-to-write-keypoints-into-document-of-txt/ http://answers.opencv.org/question/4040/to-save-vector-keypoint-to-file-using-builtin/ These links have a solution such that my low-level approach is not required, so this question can be close/delete. Sorry, and thanks!

Enrique gravatar imageEnrique ( 2013-05-01 12:55:46 -0600 )edit

Anyway, for some reason, I must use: cv::read( fs["keypoints"], keypoints ); because the extractor operator>> fails: fs["keypoints"] >> keypoints Is this behavior expected?

Enrique gravatar imageEnrique ( 2013-05-01 13:02:24 -0600 )edit

It seems some problem specific with std::vector<cv::KeyPoint>, since I have tried the same with a cv::Mat and it works: cv::Mat m; fs["m"] >> m;

Enrique gravatar imageEnrique ( 2013-05-01 13:09:53 -0600 )edit