Ask Your Question
1

Dynamic File path

asked 2013-05-25 06:54:17 -0600

ginson gravatar image

Hi I'm developing an app to read the raw frames and play thru it at 10FPS. I'm using Visual studio 2010 express C++. Can someone tell how to give the user the power to select the file containing frames and play.

Thankyou

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-05-25 08:02:40 -0600

berak gravatar image

there's no such thing in the opencv api.

but since you're on win, this might work:

#include <windows.h>

char *fileBox( char *filter="All\0*.*" ) 
{
    static char _fileName[0x2ff] = {0};
    OPENFILENAME of = {0};
    of.lStructSize = sizeof( OPENFILENAME );
    of.nMaxFile    = 0xfff;
    of.lpstrFile   = _fileName;
    of.lpstrFilter = filter;
    of.nFilterIndex= 1;
    of.Flags = OFN_LONGNAMES | OFN_FILEMUSTEXIST;
    int res  = GetOpenFileName( &of );
    if ( ! res || CommDlgExtendedError() )
        return 0; // cancelled.
    strcpy( _fileName, of.lpstrFile );
    return _fileName;  
}
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-25 06:54:17 -0600

Seen: 419 times

Last updated: May 25 '13