解析第二个节点的嵌套 yml 文件
我有以下 yml 文件:
Contours count: 8
Contours:
-
Name: MI
Count: 28
Points:
-
x: 1116.
y: 687.
-
x: 1.1224088134765625e+003
y: 680.5911865234375000
-
我有以下 C++ 代码,在 Qt 和 opencv 2.3.1 下:
cv::FileNode Points = fs["Contours"];
if (Points.type() != cv::FileNode::SEQ)
ui->textEdit->append("is not a sequence! FAIL");
cv::FileNodeIterator it = Points.begin(), it_end = Points.end();
int idx = 0; int Count = 0;
std::vector<uchar> lbpval;
for( ; it != it_end; ++it, idx++ )
{
Count += (int)(*it)["Count"];
QString s = QString::number(Count);
ui->textEdit->append(s);
}
我一直走到轮廓转到计数,迭代它们,并找到总和,但我卡在了点节点。我该如何解析这个节点?
I have the following yml file:
Contours count: 8
Contours:
-
Name: MI
Count: 28
Points:
-
x: 1116.
y: 687.
-
x: 1.1224088134765625e+003
y: 680.5911865234375000
-
I have the following c++ code, under Qt, and opencv 2.3.1:
cv::FileNode Points = fs["Contours"];
if (Points.type() != cv::FileNode::SEQ)
ui->textEdit->append("is not a sequence! FAIL");
cv::FileNodeIterator it = Points.begin(), it_end = Points.end();
int idx = 0; int Count = 0;
std::vector<uchar> lbpval;
for( ; it != it_end; ++it, idx++ )
{
Count += (int)(*it)["Count"];
QString s = QString::number(Count);
ui->textEdit->append(s);
}
I walk until Contours go to Count, iterate them, and find the total sum, but i am stuck at the Points node. How can i parse this node?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)