c++ - Video from 2 cameras (for Stereo Vision) using OpenCV, but one of them is lagging -
i'm trying create stereo vision using 2 logitech c310 webcams. result not enough. 1 of videos lagging compared other one.
here opencv program using vc++ 2010:
#include <opencv\cv.h> #include <opencv\highgui.h> #include <iostream> using namespace cv; using namespace std; int main() { try { videocapture cap1; videocapture cap2; cap1.open(0); cap1.set(cv_cap_prop_frame_width, 1040.0); cap1.set(cv_cap_prop_frame_height, 920.0); cap2.open(1); cap2.set(cv_cap_prop_frame_width, 1040.0); cap2.set(cv_cap_prop_frame_height, 920.0); mat frame,frame1; (;;) { mat frame; cap1 >> frame; mat frame1; cap2 >> frame1; transpose(frame, frame); flip(frame, frame, 1); transpose(frame1, frame1); flip(frame1, frame1, 1); imshow("img1", frame); imshow("img2", frame1); if (waitkey(1) == 'q') break; } cap1.release(); return 0; } catch (cv::exception & e) { cout << e.what() << endl; } }
how can avoid lagging?
you're saturating usb bus.
try plug 1 in front, other in back(in hope land on different buses),
or reduce frame size / fps generate less traffic.
Comments
Post a Comment