PDA

View Full Version : QT connect Logitech webcam



diego
24th June 2009, 03:40
Hi all.
I am start using QT to develop a project in Processing webcam, it is Logitech webcam.
I really dont know QT can help me solve this problem.
If you have any experience with same happen. Please help me.

Thanks in advance.
Diego

aamer4yu
24th June 2009, 05:27
First,, its Qt , not QT :D

Well I dont think Qt has any classes for webcam, You can have a look at opencv. It can be combined with Qt. Search the forum, there are many threads on this topic I guess.

diego
24th June 2009, 08:02
I have not any experience to process webcam device with QT.
so, it was very strange when i met this problem.
Please help me.
Thanks.
Diego

gsmiko
24th June 2009, 09:24
Hi diego!

By "Processing webcam" I suppose you want to capture frames from the webcam and then do some image processing on those frames. The current version of Qt can't help you with this. It's planned that the future versions of Phonon (http://phonon.kde.org/)will support capturing frames from webcams,tvcards etc.
I strongly suggest you to use OpenCV (http://opencv.willowgarage.com/wiki/). It's an image processing library full of features, and it supports capturing frames from webcams. If you want to integrate it with Qt, for example to display the processed video, just search the forum. There are plenty of topics about Qt+OpenCV.

diego
24th June 2009, 09:59
Thank for help.
I will research with OpenCV now.

carllooper
18th August 2009, 21:13
I found the following code on the OpenCV site. It recognised my IEEE 1394 ("firewire") camcorder displaying live video in a window. Now I compiled this with Visual C++ Express 2008 but it should be adaptable to work with Qt.


#include "cv.h"
#include "highgui.h"
#include <stdio.h>

// A Simple Camera Capture Framework

int main()
{

CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );

if( !capture )
{
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}

// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );

// Show the image captured from the camera in the window and repeat
while( 1 )
{

// Get one frame
IplImage* frame = cvQueryFrame( capture );

if( !frame )
{
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}

cvShowImage( "mywindow", frame );
// Do not release the frame!

//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator
if( (cvWaitKey(10) & 255) == 27 ) break;
}

// Release the capture device housekeeping
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );

return 0;
}

axeljaeger
18th August 2009, 22:21
Write some converter from IplImage to QImage.

cooper
19th August 2009, 03:56
hi diego,

i am using webcam in my current project to capture 2D barcode in Qt.
you can take a look "fswebcam". it is simple and very powerful webcam app.

here is the website link: http://www.firestorm.cx/fswebcam/

download the fswebcam.tar package, install it.
in Qt, you can use the following command to capture a photo

system("fswebcam -F 15 -r 352x288 --no-banner --save /mnt/cdrive/C++/mypro/DMB.jpg");

in order to improve quality of your picture, increase the value of -F

good luck :cool:

carllooper
19th August 2009, 11:16
I found this on the Qt Apps site:

http://www.qt-apps.org/content/show.php/Qt+Opencv+webcam+viewer?content=89995

I got it to work eventually.

Not only does it work with webcams (USB) but works with camcorders attached through IEEE 1394("firewire"). Nice.

This is what I did:

1. Downloaded and installed OpenCV:

http://sourceforge.net/projects/opencvlibrary/

2. I edited the pro file to be more specific to the opencv installation on my system:


TEMPLATE = app
TARGET =
DEPENDPATH += .

INCLUDEPATH += "C:\Program Files\OpenCV\cv\include"
INCLUDEPATH += "C:\Program Files\OpenCV\cxcore\include"
INCLUDEPATH += "C:\Program Files\OpenCV\cvaux\include"
INCLUDEPATH += "C:\Program Files\OpenCV\otherlibs\highgui"

LIBS += "C:\Program Files\OpenCV\lib\cv.lib"
LIBS += "C:\Program Files\OpenCV\lib\cxcore.lib"
LIBS += "C:\Program Files\OpenCV\lib\cvaux.lib"
LIBS += "C:\Program Files\OpenCV\lib\highgui.lib"

SOURCES += main.cpp QOpenCVWidget.cpp MyCameraWindow.cpp
HEADERS += QOpenCVWidget.cpp MyCameraWindow.h

3. I also had to look for and copy these dlls, to the same folder as my app:


mingwm10.dll
highgui.dll
cxcore110.dll
QtCored4.dll
QtGuid4.dll

4. And with respect to the pro file I rewrote the opencv includes, so that they directly reference the required header files, for instance:

from

#include <opencv/cv.h>

to just:

#include <cv.h>

Carl

carllooper
19th August 2009, 21:25
And here is me glancing at my DV camcorder.

http://www.qtcentre.org/forum/attachment.php?attachmentid=3592&stc=1&d=1250713008

oob2
12th October 2009, 19:12
on windows os, u can do directshow or vfw programming.
http://www.codeguru.com/cpp/g-m/directx/directshow/article.php/c6973/

oob2
12th October 2009, 19:22
to control logitech pan/tilt/zoom functions, take a look at this link

http://www.quickcamteam.net/documentation/how-to/how-to-control-pan-tilt-zoom-on-logitech-cameras