Add modules arguments - test with binarization
This commit is contained in:
1 parent
013a5a967c
commit
2072efd2d7
11 files changed
+79
-10
No files matched your search
+1
-1
@@ -46,7 +46,7 @@ CONFIGURE_FILE( PlaYUVerConfig.cmake.in ${CMAKE_BINARY_DIR}/PlaYUVerConfig.cmake
|
||||
ADD_LIBRARY( PlaYUVerLib STATIC ${plaYUver_Lib_SRCS} )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
|
||||
TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} ${Boost_LIBRARIES} )
|
||||
TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} )
|
||||
|
||||
INSTALL(FILES ${plaYUver_Lib_HEADERS} DESTINATION include )
|
||||
# INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libPlaYUVerLib${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION lib )
|
||||
|
||||
@@ -67,10 +67,10 @@ Bool PlaYUVerCmdParser::parse()
|
||||
// m_cParserOptions.setDefaults();
|
||||
m_aUnhandledArgs = scanArgv( m_cParserOptions, m_iArgc, ( const Char** )m_ppArgv );
|
||||
|
||||
// for( std::list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++ )
|
||||
// {
|
||||
// fprintf( stderr, "Unhandled argument ignored: `%s'\n", *it );
|
||||
// }
|
||||
// for( std::list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++ )
|
||||
// {
|
||||
// fprintf( stderr, "Unhandled argument ignored: `%s'\n", *it );
|
||||
// }
|
||||
|
||||
if( checkListingOpts() )
|
||||
{
|
||||
@@ -91,6 +91,28 @@ Bool PlaYUVerCmdParser::parse()
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool PlaYUVerCmdParser::parse( Options& opts, Int argc, Char *argv[] )
|
||||
{
|
||||
try
|
||||
{
|
||||
// m_cParserOptions.setDefaults();
|
||||
m_aUnhandledArgs = scanArgv( opts, argc, ( const Char** )argv );
|
||||
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cerr << "error: "
|
||||
<< e.what()
|
||||
<< "\n";
|
||||
return false;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
std::cerr << "Exception of unknown type!\n";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool PlaYUVerCmdParser::checkListingOpts()
|
||||
{
|
||||
Bool bRet = false;
|
||||
@@ -111,7 +133,6 @@ Bool PlaYUVerCmdParser::checkListingOpts()
|
||||
}
|
||||
bRet |= true;
|
||||
}
|
||||
|
||||
if( Opts()["quality_metrics"]->count() )
|
||||
{
|
||||
printf( "PlaYUVer supported quality metrics: \n" );
|
||||
@@ -121,7 +142,6 @@ Bool PlaYUVerCmdParser::checkListingOpts()
|
||||
}
|
||||
bRet |= true;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
m_ppArgv = argv;
|
||||
}
|
||||
Bool parse();
|
||||
Bool parse( Options& opts, Int argc, Char *argv[] );
|
||||
std::list<const Char*>& getNoArgs();
|
||||
Options& Opts();
|
||||
private:
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace plaYUVer
|
||||
Options::Options( const std::string& name )
|
||||
{
|
||||
opt_name = name;
|
||||
allow_unknow = false;
|
||||
}
|
||||
|
||||
Options::~Options()
|
||||
@@ -309,6 +310,8 @@ bool storePair( Options& opts, bool allow_long, bool allow_short, const string&
|
||||
|
||||
if( !found )
|
||||
{
|
||||
if( !opts.allow_unknow )
|
||||
{
|
||||
/* not found */
|
||||
cerr << "Unknown option: `"
|
||||
<< name
|
||||
@@ -316,6 +319,7 @@ bool storePair( Options& opts, bool allow_long, bool allow_short, const string&
|
||||
<< value
|
||||
<< "')"
|
||||
<< endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +263,8 @@ struct Options
|
||||
NamesMap opt_short_map;
|
||||
|
||||
std::string opt_name;
|
||||
|
||||
Bool allow_unknow;
|
||||
};
|
||||
|
||||
/* Class with templated overloaded operator(), for use by Options::addOptions() */
|
||||
|
||||
@@ -37,6 +37,7 @@ ADD_MODULE( FilterComponentChromaU "FilterComponent" )
|
||||
ADD_MODULE( FilterComponentChromaV "FilterComponent" )
|
||||
ADD_MODULE( FrameDifference "FrameDifference" )
|
||||
ADD_MODULE( AbsoluteFrameDifference "AbsoluteFrameDifference" )
|
||||
ADD_MODULE( FrameBinarization "FrameBinarization" )
|
||||
ADD_MODULE( LumaAverage "LumaAverage" )
|
||||
IF( USE_OPENCV )
|
||||
ADD_MODULE( DisparityStereoVar "DisparityStereoVar" )
|
||||
@@ -48,4 +49,7 @@ ENDIF()
|
||||
#
|
||||
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#endif // __MODULESLISTHEADER_H__\n" )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} )
|
||||
ADD_LIBRARY( PlaYUVerModules ${plaYUver_Mod_SRCS} )
|
||||
TARGET_LINK_LIBRARIES( PlaYUVerModules PlaYUVerLib ${OpenCV_LIBRARIES} )
|
||||
|
||||
@@ -37,6 +37,7 @@ PlaYUVerModuleFactory::PlaYUVerModuleFactory()
|
||||
Register( "FilterComponentChromaU", &FilterComponentChromaU::Create );
|
||||
Register( "FilterComponentChromaV", &FilterComponentChromaV::Create );
|
||||
Register( "FrameDifference", &FrameDifference::Create );
|
||||
Register( "FrameBinarization", &FrameBinarization::Create );
|
||||
Register( "AbsoluteFrameDifference", &AbsoluteFrameDifference::Create );
|
||||
Register( "LumaAverage", &LumaAverage::Create );
|
||||
#ifdef USE_OPENCV
|
||||
@@ -59,7 +60,7 @@ PlaYUVerModuleIf *PlaYUVerModuleFactory::CreateModule( const char* moduleName )
|
||||
{
|
||||
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
|
||||
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
|
||||
for( ; it != PlaYUVerModuleFactoryMap.end(); ++it)
|
||||
for( ; it != PlaYUVerModuleFactoryMap.end(); ++it )
|
||||
{
|
||||
if( !strcmp( it->first, moduleName ) )
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "lib/PlaYUVerDefs.h"
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include "lib/ProgramOptions.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
@@ -84,6 +85,8 @@ public:
|
||||
UInt m_uiModuleRequirements;
|
||||
Bool m_bApplyWhilePlaying;
|
||||
|
||||
Options m_cModuleOptions;
|
||||
|
||||
PlaYUVerModuleIf() {}
|
||||
virtual ~PlaYUVerModuleIf() {}
|
||||
|
||||
|
||||
@@ -87,13 +87,23 @@ Int CommandLineHandle::parseToolsArgs( Int argc, Char *argv[] )
|
||||
m_uiLogLevel = RESULT;
|
||||
}
|
||||
|
||||
if( Opts()["help"]->count() )
|
||||
if( Opts()["module"]->count() && Opts()["help"]->count() )
|
||||
{
|
||||
listModuleHelp();
|
||||
iRet = 1;
|
||||
}
|
||||
else if( Opts()["help"]->count() )
|
||||
{
|
||||
printf( "Usage: %s modules/quality [options] -input=input_file [--output=output_file]\n", argv[0] );
|
||||
doHelp( std::cout, Opts() );
|
||||
iRet = 1;
|
||||
}
|
||||
|
||||
if( Opts()["module_list"]->count() || Opts()["module_list_full"]->count() )
|
||||
{
|
||||
listModules();
|
||||
iRet = 1;
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -151,7 +161,28 @@ Void CommandLineHandle::listModules()
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
Void CommandLineHandle::listModuleHelp()
|
||||
{
|
||||
std::string moduleName = m_strModule;
|
||||
PlaYUVerModuleIf* pcCurrModuleIf = NULL;
|
||||
|
||||
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
|
||||
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
|
||||
for( UInt i = 0; it != PlaYUVerModuleFactoryMap.end(); ++it, i++ )
|
||||
{
|
||||
if( strcmp( it->first, moduleName.c_str() ) == 0 )
|
||||
{
|
||||
pcCurrModuleIf = it->second();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( pcCurrModuleIf )
|
||||
{
|
||||
printf( "Usage: playuverTools --module=%s options:\n", it->first );
|
||||
doHelp( std::cout, pcCurrModuleIf->m_cModuleOptions );
|
||||
}
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -94,6 +94,7 @@ private:
|
||||
std::string m_strModule;
|
||||
|
||||
Void listModules();
|
||||
Void listModuleHelp();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -180,13 +180,15 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] )
|
||||
|
||||
m_pcCurrModuleIf->create( m_apcInputStreams[0]->getCurrFrame() );
|
||||
|
||||
m_pcCurrModuleIf->m_cModuleOptions.allow_unknow = true;
|
||||
scanArgv( m_pcCurrModuleIf->m_cModuleOptions, argc, ( const Char** )argv );
|
||||
|
||||
if( m_pcCurrModuleIf->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
{
|
||||
// Check outputs
|
||||
std::vector<std::string> outputFileNames;
|
||||
if( m_cCmdLineHandler.Opts()["output"]->count() )
|
||||
outputFileNames.push_back( m_cCmdLineHandler.m_strOutput );
|
||||
;
|
||||
|
||||
if( outputFileNames.size() == 1 )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user