Let's try getting the cam's fps.

This commit is contained in:
Andrzej Kapolka 2013-06-18 14:18:33 -07:00
parent 2ad8585f26
commit e98d1f9a92
2 changed files with 5 additions and 1 deletions

View file

@ -78,7 +78,7 @@ void Webcam::setFrame(void* image) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _frameWidth = img->width, _frameHeight = img->height, 0, GL_BGR,
GL_UNSIGNED_BYTE, img->imageData);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
printLog("Capturing webcam at %dx%d.\n", _frameWidth, _frameHeight);
printLog("Capturing webcam at %dx%dx%d.\n", _frameWidth, _frameHeight, _grabber->getFramesPerSecond());
} else {
glBindTexture(GL_TEXTURE_2D, _frameTextureID);
@ -112,6 +112,7 @@ void FrameGrabber::grabFrame() {
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_WIDTH, IDEAL_FRAME_WIDTH);
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_HEIGHT, IDEAL_FRAME_HEIGHT);
cvSetCaptureProperty(_capture, CV_CAP_PROP_FPS, IDEAL_FPS);
_framesPerSecond = cvGetCaptureProperty(_capture, CV_CAP_PROP_FPS);
}
IplImage* image = cvQueryFrame(_capture);
if (image == 0) {

View file

@ -56,6 +56,8 @@ public:
FrameGrabber() : _capture(0) { }
virtual ~FrameGrabber();
int getFramesPerSecond() const { return _framesPerSecond; }
public slots:
void grabFrame();
@ -63,6 +65,7 @@ public slots:
private:
CvCapture* _capture;
int _framesPerSecond;
};
#endif /* defined(__interface__Webcam__) */