openmp简单实现例子

#include
#include
#include
using namespace std;
using namespace cv;

void main()
{
#pragma omp parallel sections 
	{
#pragma omp section
		{//程序1
			while (1)
			{
				Mat m1 = imread("photoL00.jpg");
				imshow("11", m1);
				uchar k=waitKey(1);
				if (k == 'q')
				{
					cout << "输出1" << endl;
				}
			}
		}

#pragma omp section
		{//程序2
			while (1)
			{
				Mat m2 = imread("right00.jpg");
				imshow("22", m2);
				waitKey(1);
				uchar l = waitKey(1);
				if (l == 'w')
				{
					cout << "输出2" << endl;
				}
			}
		}
	}
}

你可能感兴趣的:(c/c++,openmp,多线程并行处理)