[fw4spl-discuss] OpenCV with Framework help

20 views
Skip to first unread message

Anant Vemuri

unread,
May 3, 2010, 9:20:36 AM5/3/10
to fw4spl-...@googlegroups.com
Dear all,

I am using openCV 2.1 with the framework for video capture from USB source. On linux it uses video4linux api for video capture. I created a simple app for video stream using openCV and fw4spl. In this I use cvQueryFrame for getting frame from camera. It works alright, but I am having some trouble with the app. I do this inside an video adaptor, I created.

/// doUpdate() in Video adaptor
while ( 1 )
    {
        frame = cvQueryFrame( video->m_capture );
        OSLM_ASSERT( "Frame could not captured!", frame );

        /// Convert image to fw4spl format
       fromIPLImage( frame, pImage ); /// Convert from IplImage to fwdata::image


        // Notify message to all service listeners
        ::fwComEd::ImageMsg::NewSptr outMsg;
        outMsg->addEvent( "NEW_2D_IMAGE" );
        ::fwServices::IEditionService::notify( this->getSptr(), pImage, outMsg );  /// Message received by image adaptor to display it in the scene.

        key = cvWaitKey( 50 );
    }

the last cvWaitKey is to try to create a delay for the system. However in my simple app, is kind of freezing up even though it displays the video but then the app refuses to close and becomes unresponsive. The thing is I have done something similar in the past without the framework and I have not had any problems.  I believe this is due to three process intensive tasks,

a. cvQueryFrame().
b. fromIPLImage()
c. ::vtkIO::toVTKImage()

But I feel cvQueryFrame could be the primary culprit. This is just a test program and needs improvements, but for a quick test does anyone have any suggestions.

Thanks
Anant.

Anant Vemuri

unread,
May 3, 2010, 9:49:43 AM5/3/10
to fw4spl-discuss
Update: I added a timer to this and it seems to work, but I get
anything between 10-15 fps. Any more than that I try, the program
becomes non responsive. Any suggestions to improve its speed?

Anant Vemuri

unread,
May 3, 2010, 10:07:00 AM5/3/10
to fw4spl-discuss
Update: I think its the camera I was using. I tried with another
camera and it is giving me about 30 fps.

Anant Vemuri

unread,
May 3, 2010, 10:07:07 AM5/3/10
to fw4spl-discuss
Update: I think its the camera I was using. I tried with another
camera and it is giving me about 30 fps.



Reply all
Reply to author
Forward
0 new messages