1
我正在使用Point Grey Research BumbleBee 2相機及其SDK。我有這個循環來連續抓幀,但它不起作用。它抓住第一幀確定,但triclopsGetImage()似乎並沒有更新refImage(R | L)的內容,因爲所顯示的圖像僅僅是第一幀...任何人都有使用Point Gray相機或triclops SDK的經驗?Point Grey Research Triclops只能讀取1幀
//There's more code above
int nframes = 20;
for (int frame = 0; frame < nframes ; frame++) {
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_RIGHT, &refImageR);
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_LEFT, &refImageL);
cv::Mat leftIm(cv::Mat::zeros(refImageR.nrows,refImageR.ncols,CV_8UC1));
cv::Mat rightIm(cv::Mat::zeros(refImageR.nrows,refImageR.ncols,CV_8UC1));
int counter = 0;
for (int row=0;row<refImageR.nrows;row++) {
for (int col=0;col<refImageR.ncols;col++) {
leftIm.at<uchar>(row,col) = refImageL.data[counter];
rightIm.at<uchar>(row,col) = refImageR.data[counter];
counter++;
}
}
imshow("LeftIm",leftIm);
imshow("RightIm",rightIm);
cv::waitKey(1000);
cout << "frame = " << frame << endl;
}
編輯
好吧,這是不以任何方式優雅,但我認爲它幫助。即使這樣做,我只能得到第一幀的內容。 我在想,無論是cv :: Mat leftIm和rightIm都在保持數據,而不是正在更新或有任何錯誤的triclops。
TriclopsContext triclops;
從它說 頭文件「TriclopsContext是指向維護需要將Triclops庫中的所有圖像和簿記信息的內部結構,它是所有參數的容器」
for (int frame = 1; frame < nframes ; frame++) {
if (frame == 1) {
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_RIGHT, &refImageR1);
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_LEFT, &refImageL1);
} else if (frame == 2) {
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_RIGHT, &refImageR2);
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_LEFT, &refImageL2);
} else if (frame == 3) {
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_RIGHT, &refImageR3);
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_LEFT, &refImageL3);
} else if (frame == 4) {
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_RIGHT, &refImageR4);
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_LEFT, &refImageL4);
} else if (frame == 5) {
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_RIGHT, &refImageR5);
te = triclopsGetImage(triclops, TriImg_RECTIFIED, TriCam_LEFT, &refImageL5);
}
cv::Mat leftIm(cv::Mat::zeros(refImageR1.nrows,refImageR1.ncols,CV_8UC1));
cv::Mat rightIm(cv::Mat::zeros(refImageR1.nrows,refImageR1.ncols,CV_8UC1));
int counter = 0;
for (int row=0;row<refImageR1.nrows;row++) {
for (int col=0;col<refImageR1.ncols;col++) {
//leftIm.at<uchar>(row,col) = refImageL.data[counter];
//rightIm.at<uchar>(row,col) = refImageR.data[counter];
if (frame == 1) {
leftIm.at<uchar>(row,col) = refImageL1.data[counter];
rightIm.at<uchar>(row,col) = refImageR1.data[counter];
} else if (frame == 2) {
leftIm.at<uchar>(row,col) = refImageL2.data[counter];
rightIm.at<uchar>(row,col) = refImageR2.data[counter];
} else if (frame == 3) {
leftIm.at<uchar>(row,col) = refImageL3.data[counter];
rightIm.at<uchar>(row,col) = refImageR3.data[counter];
} else if (frame == 4) {
leftIm.at<uchar>(row,col) = refImageL4.data[counter];
rightIm.at<uchar>(row,col) = refImageR4.data[counter];
} else if (frame == 5) {
leftIm.at<uchar>(row,col) = refImageL5.data[counter];
rightIm.at<uchar>(row,col) = refImageR5.data[counter];
}
counter++;
}
}
imshow("LeftIm",leftIm);
imshow("RightIm",rightIm);
cv::waitKey(1000);
cout << "frame = " << frame << endl;
}
什麼是'triclopsGetImage'返回? –
te從triclops返回teImage報告一個0,表示它工作正常。標記錯誤的非零值。 – Oliver9523