当前位置:网站首页>Parallelloopbody in opencv
Parallelloopbody in opencv
2022-07-26 02:43:00 【The little demon comes】
Mode one
CV::Mat img(cv::Size(16, 16), CV_8UC1, cv::Scalar(0));
CV: :parallel_for_(cv: : Range (0, img.cols * img.rows), [&] (const cv: : Range& range) f for (int s = range.start; s < range.end; ++s)
int j= s / img.cols;int i = s % img.cols;
*img.ptr<uchar>(j, i) = s;
std::cout << "j: "<j<"; i:"<i<< std::endl;));
Mode two
class ParallelBody : public cv::ParallelLoopBody
{
public:
ParallelBody(CV::Mat& img, const uchar& x, const uchar& y) :
m_img(img), m_x(x), m_y(y)
virtual void operator() (const cV:: Range& range) const CV_OVERRIDE
for (int r = range.start; r < range.end; ++r)
{
int j = r / m_img.cols;
int i = r % m img.cols;
*m_img.ptr<cv: :Vec3b> (j, i) = cV::Vec3b(r, m_x, m y);
}
ParallelBody& operator=(const ParallelBody&)
{
return *this
};
private:
CV::Mat& m_img;
uchar m_x;
uchar m y;
}
int main()
{
CV::Mat image(CV:: Size(16,16), CV_8UC3, CV:: Scalar::all(0));
ParallelBody ParallelBody (image, 2,1);
CV:: parallel_for_(CV:: Range (0, image.))cols * image.rows), parallelBody);
}

边栏推荐
- Wechat official account mutual aid, open white groups, and small white newspaper groups to keep warm
- 【方向盘】使用IDEA的60+个快捷键分享给你,权为了提效(重构篇)
- Business Intelligence BI full analysis, explore the essence and development trend of Bi
- U++ common type conversion and common forms and proxies of lambda
- Eslint common error reporting set
- Simply use MySQL index
- 18. Delete the penultimate node of the linked list
- 微信公众号互助、开白群,小白报团取暖
- Study notes of pytorch deep learning practice: convolutional neural network (Advanced)
- Case: using kept+haproxy to build a Web Cluster
猜你喜欢

Yum install MySQL FAQ

How to design automated test cases?

HLS实验一--乘法器

prometheus+redis-exporter+grafana 监控redis服务

What does the Red Cross in the SQL editor mean (toad and waterdrop have been encountered...)

Extended Physics-InformedNeural Networks论文详解

1. Software testing ----- the basic concept of software testing

Stack Title: the longest absolute path of a file

prometheus+process-exporter+grafana 监控进程的资源使用

Project management: lean management method
随机推荐
Image recognition (VI) | activation function
MySQL build websites data table
Chapter 3 business function development (delete clues)
SQL how to return all data when the input query condition is empty
[C] Explain language file operation in detail
Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation
织梦提示你设定了字段为联动类型如何解决
17. Reverse the linked list
Pytorch的API总览
MySQL建Websites数据表
Convert rich text to normal text
Brief introduction and use of NPM link
assert _Aligns
Vofa+ serial port debugging assistant
[introduction to C language] zzulioj 1006-1010
图像识别(六)| 激活函数
Business Intelligence BI full analysis, explore the essence and development trend of Bi
[纯理论] YOLO v4: Optimal Speed and Accuracy of Object Detection
massCode 一款优秀的开源代码片段管理器
[early knowledge of activities] list of recent activities of livevideostack