How to write Keypoints into document of txt
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?
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?
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);
fs.release()
It's very simnple to access the data:
fs.open("keypoints.yml", FileStorage::READ);
if(fs.isOpened())
{
read(fs["descriptorsSURF"], descriptorsSURF);
read(fs["keyPointsSURF"], keypointsSURF);
}
fs.release();
The "read" command can be swapped with this too, I personally prefer the "read" method:
fs["descriptorsSURF"] >> descriptorsSURF;
fs["keyPointsSURF"] >> keypointsSURF;
Asked: 2012-07-13 09:18:22 -0600
Seen: 1,963 times
Last updated: Jul 13 '12
Compiling freak_demo.cpp - error
How to recognize detection fact
BRISK Feature Detector detects no keypoints
How to efficiently filter out points geometrically close to each other?
Multiple object detection with 2D features and homography?
Filtering matches by keypoint coordinates
Is there a way to make VideoWriter use the MKV container?
To save vector "KeyPoint" to file using builtin write function