【问题标题】:I want to write some data into a .txt file using c++ / opencv我想使用 c++ / opencv 将一些数据写入 .txt 文件
【发布时间】:2013-02-15 10:11:05
【问题描述】:

我想将有关视频中每一帧的一些信息保存到.txt 文件中。

信息可以是当前帧数、特征点位置等,

我只能找到将其写入 XML/YML 文件的方法。是否可以将这些写入 .txt 文件?如果是这样,如何?

提前致谢!

【问题讨论】:

  • 当然可以。文本文件可能是最基本的文件格式。 XML 文件基本上是一种受限制的文本文件形式。
  • OpenCV 在这里无关紧要。您需要搜索“将数字写入 C++ 中的文件”。显然这个问题在过去已经解决了。

标签: c++ opencv


【解决方案1】:

您必须自行实施。 c++文件流的基本原理是

#include <iostream>
#include <fstream>

using namespace std;

void writeSomething()
{
    ofstream outputfile;
    outputfile.open("data.txt");
    for (int i=0; i<10;i++)
        outputfile << i << endl;
}

您的问题不是很清楚,因此您最好对其进行编辑以明确您到底想做什么。

【讨论】:

    猜你喜欢
    • 2019-09-12
    • 2021-10-12
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 2017-11-01
    • 2016-01-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多