OpenCVを使用して2番目のカメラを開くにはどうすればよいですか?私はVS2008、OpenCV 2.4.13を使用しており、2種類のUSBカメラを接続しています。2番目のカメラを開くことができません
私は以下のコードを使用してみましたが、私はエラーを取得:
Capture1 can't be opened
コードは次のとおりです。
int _tmain(int argc, _TCHAR* argv[])
{
VideoCapture capture(0);
if(!capture.isOpened())
std::cout << "Capture0 can't be opened\n" << std::endl;
VideoCapture capture1(1);
if(!capture1.isOpened())
std::cout << "Capture1 can't be opened\n" << std::endl;
return 0;
}
あなたは(グラブを使用する必要があります)複数のカメラを使用した場合、その後)(取得http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture-grab –
することができます私の経験に基づく回答を以下にチェックしてください:) –
VideoCapture capture1(DSHOW +1)はどうですか? –