Results 1 to 2 of 2

Thread: Qthreads and webcam app

  1. #1

    Default Qthreads and webcam app

    Hi guys! I'm new to Qt and developing a face recognition app with QT4 and Intel Opencv! I'll explain you how my app should work and I've got some questions because i have some strange problems...
    My app need to start a webcam and display the frames captured by the webcam in a Qlabel, pushing a button the user should be able to get a webcam frame saved to the disk (.pgm format), display it in an other QLabel and after pushing another button do a face recognition task with that image.

    That's what I've done...
    For the webcam a started a Qthread, the webcam has to run continuosly and every time a frame is captured, the thread send a signal (with the frame included, coverted in a Qimage) to a slot defined in the main thread (GUI) where it will be showed in the label (label->setPixmap(Qimage)). I didn't focus up to know my attention on the "saving frame on the disk part" because I realized that when the thread is running the facerecognition tasks in the main thread don't work as they should. But facerec task in the main thread and webcam thread don't have any shared resource or variable. if i comment the line where I start the webcam thread, facerec taks are done perfect, if i run the app with the webcam thread i get some troubles.

    My questions:
    1. How would you in your opinion plan the app (how many threads, shared memory...)
    2. Shall i run my face rec tasks in an other Thread outside the main thread?
    3. Do you think i need some mutex? (IMHO no because i think that webcam thread and the main thread don't have any shared var...)

    Thanks in advance, and sorry for my english! Any help will be appreciated and if you need i'll also post the code. Thank you and bye!

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qthreads and webcam app

    Yes, a compilable code would be the best, if you want rapid solutions ;-)

    I have a similar architecture in my MediaBrowser, I have a separated thread that processes thumbnails of images contained in a specified directory, and notifies main GUI thread each time a thumbnail is ready, so it can be displayed !

    It works really fine with me, and your approach seems good.

    Seeing your code will surely help.

    Guilugi.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.