如何使分布在许多主机上的opencv处理

我正在使用大量使用CPU的opencv应用程序。

我想分配帧处理,以便在多个主机之间共享。

这个想法与http://cloudcv.org/中的实现相同。 但问题是,你只能发送你的请求到他们的服务器来testing分布式image processing。

我在互联网上search了很长时间,我想知道是否可以实现opencv + Docker Swarm,或者opencv + Apache Spark,或者是否有其他方法来实现它。

我的代码在opencv中处理帧以检测其中的人,我想让它在多个主机上执行以最大化速度:

while(true) { webcam.read(image); //human detection-------------------------------------- cv::Mat resized_image; cv::resize(image, resized_image, Size(image.cols / 2, image.rows / 2), 0, 0, INTER_LINEAR); vector<Rect> found, found_filtered; // this line uses hog descriptor to detect // people body pattern in the frmaes // found is a vector of Rect that contains the // found peoples. // Rect is a struct (x, y, height, width) hog.detectMultiScale(image, found, 0, Size(8, 8), Size(32, 32), 1.05, 2); size_t u, h; // this loop just make sure that the found // rectangles are not duplicated. for (u = 0; u<found.size(); u++) { Rect r = found[u]; for (h = 0; h<found.size(); h++) if (h != u && (r & found[h]) == r) break; if (h == found.size()) found_filtered.push_back(r); } // this loop is for drawing the rectangles on the frame for (u = 0; u<found_filtered.size(); u++) { Rect r = found_filtered[u]; rx += cvRound(r.width*0.1); r.width = cvRound(r.width*0.8); ry += cvRound(r.height*0.07); r.height = cvRound(r.height*0.8); rectangle(showed_image, r.tl()*2, r.br()*2, Scalar(0, 255, 0), 3); cout << '\a'; } } 

Spark是在分布式系统上处理的好方法。 但是OpenCV并没有一个强大的社区。 Storm是另一个Apache的免费开源分布式实时计算系统。 Storm可以轻松地处理无限数据stream,实时处理Hadoop为批处理所做的事情。

StormCV是Apache Storm的一个扩展,专门用于支持分布式计算机视觉pipe道的开发。 通过添加计算机视觉(CV)特定操作和数据模型,StormCV可以使用Storm进行video处理。 该平台在大多数CV操作中使用OpenCV,使用该库用于其他function相对容易。

有几个使用OpenCV风暴的例子。 有一个类似的例子,你正在尝试在他们的官方github页面。 你可能想看看这个脸部检测的例子,并尝试做人为检测 – https://github.com/sensorstorm/StormCV/blob/master/stormcv-examples/src/nl/tno/stormcv/example/E2_FacedetectionTopology&#x3002; java 。