如何在我的图像处理项目中使用多线程?

时间:2016-08-19 13:57:41

标签: c++ multithreading image-processing synchronous

我有 recordFunction ,可以录制60秒的视频。此过程重复8次,然后重新开始(如同(1))。

另一方面,我的 imageProcessing 功能在第一条记录保存到文件后运行。

例如:

MyRecorder 开始:

record01 62 sec.

MyImageProcesser 开始:

Thread01 / Take Record01 and Work on it  ~140 sec.

(此时 MyRecorder 仍在后台运行并保存帧。)

record02 62 sec. (this guy start after record01 and save in to file video)

在record02之后,应该启动另一个线程(MyImageProcesser Thread02)。

Thread02 / Take Record02 and Work on it  ~140 sec.

我想创建8个线程并分配任务。

While(1){
    MyRecorder Start:
    MyImageProcesser Start:
    Thread01 task --> working on record01
    Thread02 task --> working on record02
    Thread03 task --> working on record03
    Thread04 task --> working on record04
    Thread05 task --> working on record05
    Thread06 task --> working on record06
    Thread07 task --> working on record07
    Thread08 task --> working on record08
}

MultiThread 会解决此问题吗?我该如何实现它?我不知道MultiThread事件。

0 个答案:

没有答案