私は、CPUを大量に消費するopencvアプリケーションを開発中です。多くのホストでopencv処理を分散させる方法
多くのホスト間で共有されるように、フレーム処理を分散したいと考えています。
考え方はhttp://cloudcv.org/に実装されているものと同じです。問題は、分散イメージ処理をテストするために自分のサーバーに要求を送ることしかできないことです。
私はopencv + Docker Swarmやopencv + Apache Sparkを実装できるかどうか、あるいはそれを配布するための他の方法があるのだろうかと思います。
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];
r.x += cvRound(r.width*0.1);
r.width = cvRound(r.width*0.8);
r.y += 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';
}
}
アルゴリズムが並列化可能な場合、Apache Sparkはおそらく解決策を提供します。今の立場に立っているこの問題は、このフォーラムでは広すぎます。あなたを助けるために、私たちは現時点で提供されているものより多くのアルゴリズムに関する情報を必要とします。 – maasg
@maasg:ありがとう。私はちょうどそれを行うための指導の指示を持っているのが好きです。私はたくさん検索しましたが、私はこれを行う方法を見つけませんでした。 – ProEns08
あなたのプロセス+コードのキー要素を質問に追加すると、少なくともいくつかの大雑把な行で、それをスパークジョブにマップすることができます。 – maasg