オフラインビデオ顔検出プログラムを作成しようとしています。私は顔検出のためのサンプルコードを使用して、それは良い仕事です。しかし、dlibライブラリはビデオ上で直接動作しない(または私がそれをしているかどうかわからない)ので、私はフレームを画像の顔検出プログラムに提供しています。 20-30フレームビデオのような小さなビデオの場合は正常に動作していますが、大きなビデオがある場合はバッファオーバーフローエラーが発生しています。データを削除したり、ダイナミックメモリを明示的にクリアする必要がありますか?それとも、顔検出のための画像しかほとんど扱いませんか?以下はdlibを使用したビデオ顔検出
コードスニペット
// Loop over all the images provided on the command line.
for (int i = 1; i <= 629; ++i)
{
//cout << "processing image " << endl;
array2d<unsigned char> img;
//load_image(img, argv[i]);
sprintf(image, "./frame/frame%d.jpg",i);
load_image(img, image);
pyramid_up(img);
// Now tell the face detector to give us a list of bounding boxes
// around all the faces it can find in the image.
std::vector<rectangle> dets = detector(img);
//cout << "Number of faces detected: " << dets.size() << endl;
//cout<<i<<"\t"<<dets.size()<<endl;
// Now we show the image on the screen and the face detections as
// red overlay boxes.
win.clear_overlay();
win.set_image(img);
win.add_overlay(dets, rgb_pixel(255,0,0));
//cout << "Hit enter to process the next image..." << endl;
//cin.get();
}