PS3 Eye Camera Video を画像にキャプチャして、サイズを変更して表示し、ディスクに保存しています。フレームレートに問題があったので、個々のプロセスで時間を測定しました。キャプチャを実際に遅くする唯一のプロセスは、各キャプチャ ループに約 20 ミリ秒を追加する cvWaitKey(1) であることが判明しました。
何らかの方法で cvWaitKey() を回避する回避策はありますか?
測定時間は、waitkey と表示なしで約 20ms、表示あり (waitkey が必要) で 60ms です。サイズを変更しても、それほど多くの時間が追加されることはありません。
助けてくれてありがとう。
// image capturing loop
while(_running)
{
//activate cvWaitKey - this drops framerate significantly!
cvWaitKey(1);
//get frame from capture and put into buffer
CLEyeCameraGetFrame(_cam, pCapBuffer);
//get system timestamps
GetSystemTime(&st);
GetLocalTime(<);
// Resize image to fit screen size
cvResize(pCapImage,resizedpCapImage,CV_INTER_NN);
//display image
cvShowImage(_windowName, resizedpCapImage);
//clear string
sstm.str(std::string());
//complete filname
sstm << _folder << prefix << _participant << std::setfill('0') << std::setw(10) << i << "-" << st.wHour << st.wMinute << st.wSecond << st.wMilliseconds << suffix;
image_name = sstm.str();
c = image_name.c_str();
//log if enabled
if (_logging){
//try to save image
try {
cvSaveImage(c, pCapImage); //bmp = speed!
}
catch (runtime_error& ex) {
fprintf(stderr, "Exception converting image to bmp format: %s\n", ex.what());
}
}
}