Ask Your Question

How to write Keypoints into document of txt

asked 2012-07-13 09:18:22 -0500

Guobiao gravatar image

I detect Keypoints by detector,such as MSER or Surf.I need to write these Keypoints into document(Txt format).But, What should I do?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-07-13 09:32:13 -0500

XCoder gravatar image

updated 2012-07-13 10:01:17 -0500

I would recommend using YML rather than txt, because with YML it will be much easier to access data afterwards.

To write in yml file your keypoints and descriptors use this:

 fileString = "keypoints.yml";
 cv::FileStorage fs(fileString, cv::FileStorage::WRITE);

 write(fs,"keyPointsSURF", keypointsSURF);              
 write(fs,"descriptorsSURF", descriptorsSURF);  

It's very simnple to access the data:"keypoints.yml", FileStorage::READ);
            read(fs["descriptorsSURF"], descriptorsSURF); 
            read(fs["keyPointsSURF"], keypointsSURF);   

The "read" command can be swapped with this too, I personally prefer the "read" method:

fs["descriptorsSURF"] >> descriptorsSURF;
fs["keyPointsSURF"] >> keypointsSURF;
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-07-13 09:18:22 -0500

Seen: 1,600 times

Last updated: Jul 13 '12