// 更新属性
std::vector<std::string> temp; // [1 2 3 4 5 6 1 2 3 4 5 6],一个列表,存下多个斑块的属性,每个属性是6个
for (const auto& elem : attribute_vector) {
temp.push_back(elem);
if (temp.size() == 6) {
this_plugin->properties.push_back(temp);
temp.clear();
}
}
// 更新box
for (const auto& det: dets)
{
this_plugin->boxes.push_back(det.rect); // 添加最好图片下的检测框 cv::Rect(left, top, width, height)
}
// 更新跟踪 id
this_plugin->box_track_id = now_track_id; //添加最好图片下的跟踪id,几个框就有几个斑块id
// 更新图片
this_plugin->images = bgr_mat.clone(); //添加最好图片下的跟踪id,应该放在循环外
// 传递的数据,还有负数,打印查看一下
std::cout << "---------------------------------------------------------------------" << std::endl;
std::cout << "boxes: ";
for (const auto& rect : this_plugin->boxes) {
std::cout << "(" << rect.x << ", " << rect.y << ", " << rect.width << ", " << rect.height << ") ";
}
std::cout << std::endl;
// 打印 properties 数组
std::cout << "properties: ";
for (const auto& props : this_plugin->properties) {
std::cout << "[";
for (const auto& prop : props) {
std::cout << prop << " ";
}
std::cout << "] ";
}
std::cout << std::endl;
// 打印 box_track_id 数组
std::cout << "box_track_id: ";
for (const auto& id : this_plugin->box_track_id) {
std::cout << id << " ";
}
std::cout << std::endl;
std::cout << "--------------------------------------------------------------------*************************-" << std::endl;
c++ ,打印数组,vector 代码
最新推荐文章于 2024-03-20 00:05:16 发布