请教tbb问题

jiaocha 2010-08-16 05:40:21
class tbb_detection
{
public:
tbb_detection()
{
}

cv::Mat image_gray;
cv::Mat image_smooth;

std::vector<LPCascadeClassifier> v_findplate;

std::vector<cv::Rect> v_rect;

tbb::concurrent_vector<cv::Rect> tbb_rect;

double scale;

void operator ()(tbb::blocked_range<int>& rang)
{
for(int i=rang.begin();i<rang.end();i++)
{
v_rect=detection(v_findplate[i],scale);
}
}

tbb_detection(tbb_detection& x,tbb::split):v_findplate(x.v_findplate),image_gray(x.image_gray),image_smooth(x.image_smooth),scale(x.scale),v_rect(0)
{
}

void join(const tbb_detection& y)
{
tbb::spin_rw_mutex::scoped_lock mylock(vector_lock);
v_rect.insert(v_rect.end(),y.v_rect.begin(),y.v_rect.end());
}
};

最后发现并没有把所有的结果都合并起来,请问应该怎么处理呢?我用concurrent_vector也试过同样不行,谢谢
...全文
99 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiaocha 2010-09-02
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 intel_zhenyuwang 的回复:]
不会忘了先执行task_scheduler_init吧?
[/Quote]
谢谢,问题出在for循环里 已经解决
intel_zhenyuwang 2010-08-23
  • 打赏
  • 举报
回复
不会忘了先执行task_scheduler_init吧?

567

社区成员

发帖
与我相关
我的任务
社区描述
英特尔® 边缘计算,聚焦于边缘计算、AI、IoT等领域,为开发者提供丰富的开发资源、创新技术、解决方案与行业活动。
社区管理员
  • 英特尔技术社区
  • shere_lin
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧