Search code examples
visual-studio-2010visual-c++opencvuser-interfacevideo-capture

how to grab a OpenCV frame without showing it or without creating cvNamedWindow?


I do not understand why OpenCV doesn't work when we do not need to create OpenCV window using cvNamedWindow. Actually, I do not want to use OpenCV GUI window, I want to use third party GUI in order to display grabbed frame, So for this, i do not need to create OpenCV window. But When I do not create OpenCV window, my application gets stuck, nothing works, and when I do create OpenCV window using cvNamedWindow, everything works fine.

Any suggestion, whats the reason? how can I grab OpenCV frame without creating its GUI window?

I am using OpenCV 2.4.3 (cvQueryFrame), VS2010 c++, WindowsXP

Thanks.


Solution

  • Solved: The problem was this, actually, I was creating a third party GUI window inside of the pthread which was causing its infinite updating. When I created window outside of the pthread, it works fine.

    procedure is this:

    void Init()
    {
       createGUIwin(w, h);
       init_pthread();
    }
    
    void init_pthread(void*)
    {
       //createGUIwin(w, h); // before I was creating GUIwin here
       while(ON)
       {
          frame = getOCVframe();
          UpdateGUIwin(frame);
          key = cvWaitKey(10);
       }
    }
    

    Thanks everyone. I appreciate your answers.