diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d75564..efb8a14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,6 +169,10 @@ IF( ${BUILD_APP} ) ADD_SUBDIRECTORY( app ) ENDIF() +IF( ${BUILD_EXAMPLES} ) + ADD_SUBDIRECTORY( examples ) +ENDIF() + # add a target to generate API documentation with Doxygen # IF(BUILD_DOC) # configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp index 93c84ca..ad25214 100644 --- a/app/PlaYUVerApp.cpp +++ b/app/PlaYUVerApp.cpp @@ -320,7 +320,7 @@ Void PlaYUVerApp::save() << formatsList << tr( "All Files (*)" ); - QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), QString(), filter.join( ";;" ) ); + QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) ); if( !fileName.isEmpty() ) { diff --git a/app/resources/playuver.desktop b/app/resources/playuver.desktop index 95c6e2b..c0f9a90 100755 --- a/app/resources/playuver.desktop +++ b/app/resources/playuver.desktop @@ -1,7 +1,7 @@ #!/usr/bin/env xdg-open [Desktop Entry] Type=Application -Name=plaYUVer +Name=PlaYUVer Exec=playuver %U Icon=playuver Terminal=false diff --git a/examples/modules/AbsoluteFrameDifference_APIv2.cpp b/examples/modules/AbsoluteFrameDifferenceExample.cpp similarity index 73% rename from examples/modules/AbsoluteFrameDifference_APIv2.cpp rename to examples/modules/AbsoluteFrameDifferenceExample.cpp index a772410..033f221 100644 --- a/examples/modules/AbsoluteFrameDifference_APIv2.cpp +++ b/examples/modules/AbsoluteFrameDifferenceExample.cpp @@ -18,23 +18,23 @@ */ /** - * \file AbsoluteFrameDifference_APIv2.cpp - * \brief Absolute Frame Difference module + * \file AbsoluteFrameDifferenceExample.cpp + * \brief Absolute Frame Difference module example */ -#include "AbsoluteFrameDifference_APIv2.h" +#include "AbsoluteFrameDifferenceExample.h" #include -REGISTER_CLASS_MAKER( AbsoluteFrameDifference ) +REGISTER_CLASS_MAKER( AbsoluteFrameDifferenceExample ) -AbsoluteFrameDifference::AbsoluteFrameDifference() +AbsoluteFrameDifferenceExample::AbsoluteFrameDifferenceExample() { /* Module Definition */ m_iModuleAPI = MODULE_API_2; // Use API version 2 (recommended). // See this example for details on the functions prototype m_iModuleType = FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence. m_pchModuleCategory = "Measurements"; // Category (sub-menu) - m_pchModuleName = "AbsoluteFrameDifference"; // Name + m_pchModuleName = "AbsoluteFrameDifferenceExampleExample"; // Name m_pchModuleTooltip = "Measure the absolute difference " // Description "between two images (Y plane), e. g., abs( Y1 - Y2 )"; m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES) @@ -44,14 +44,19 @@ AbsoluteFrameDifference::AbsoluteFrameDifference() } -Bool AbsoluteFrameDifference::create( std::vector apcFrameList ) +Bool AbsoluteFrameDifferenceExample::create( std::vector apcFrameList ) { _BASIC_MODULE_API_2_CHECK_ - m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY ); + + for( UInt i = 1; i < apcFrameList.size(); i++ ) + if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) ) + return false; + + m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY ); return true; } -PlaYUVerFrame* AbsoluteFrameDifference::process( std::vector apcFrameList ) +PlaYUVerFrame* AbsoluteFrameDifferenceExample::process( std::vector apcFrameList ) { PlaYUVerFrame* Input1 = apcFrameList[0]; PlaYUVerFrame* Input2 = apcFrameList[1]; @@ -67,10 +72,10 @@ PlaYUVerFrame* AbsoluteFrameDifference::process( std::vector apc aux_pel_2 = *pInput2PelYUV++; *pOutputPelYUV++ = abs( aux_pel_1 - aux_pel_2 ); } - return m_pcFrameDifference; + return m_pcFrameDifference; } -Void AbsoluteFrameDifference::destroy() +Void AbsoluteFrameDifferenceExample::destroy() { if( m_pcFrameDifference ) delete m_pcFrameDifference; diff --git a/examples/modules/AbsoluteFrameDifference_APIv2.h b/examples/modules/AbsoluteFrameDifferenceExample.h similarity index 76% rename from examples/modules/AbsoluteFrameDifference_APIv2.h rename to examples/modules/AbsoluteFrameDifferenceExample.h index 40825f5..01951a7 100644 --- a/examples/modules/AbsoluteFrameDifference_APIv2.h +++ b/examples/modules/AbsoluteFrameDifferenceExample.h @@ -18,27 +18,27 @@ */ /** - * \file AbsoluteFrameDifference_APIv2.h + * \file AbsoluteFrameDifferenceExampleExample.h * \brief Absolute Frame Difference module */ -#ifndef __ABSOLUTEFRAMEDIFFERENCE_H__ -#define __ABSOLUTEFRAMEDIFFERENCE_H__ +#ifndef __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__ +#define __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__ #include "PlaYUVerModuleIf.h" #include -class AbsoluteFrameDifference: public PlaYUVerModuleIf +class AbsoluteFrameDifferenceExample: public PlaYUVerModuleIf { -REGISTER_CLASS_FACTORY( AbsoluteFrameDifference ) +REGISTER_CLASS_FACTORY( AbsoluteFrameDifferenceExample ) private: PlaYUVerFrame* m_pcFrameDifference; public: - AbsoluteFrameDifference(); - virtual ~AbsoluteFrameDifference() + AbsoluteFrameDifferenceExample(); + virtual ~AbsoluteFrameDifferenceExample() { } Bool create( std::vector apcFrameList ); @@ -47,5 +47,5 @@ public: }; -#endif // __FRAMEDIFFERENCE_H__ +#endif // __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__ diff --git a/examples/modules/CMakeLists.txt b/examples/modules/CMakeLists.txt index a01e7ee..3a0aff7 100644 --- a/examples/modules/CMakeLists.txt +++ b/examples/modules/CMakeLists.txt @@ -14,6 +14,6 @@ INCLUDE_DIRECTORIES( ${PLAYUVER_INCLUDE_DIRS} ) ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp) TARGET_LINK_LIBRARIES( FrameBinarization ${PLAYUVER_LINKER_LIBS} ) -ADD_LIBRARY(AbsoluteFrameDifference SHARED AbsoluteFrameDifference_APIv2.cpp) -TARGET_LINK_LIBRARIES( AbsoluteFrameDifference ${PLAYUVER_LINKER_LIBS} ) +ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp) +TARGET_LINK_LIBRARIES( AbsoluteFrameDifferenceExample ${PLAYUVER_LINKER_LIBS} ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5e03600..21d32b0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -49,6 +49,6 @@ TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} ) IF( NOT USE_STATIC ) INSTALL(FILES ${PlaYUVer_Lib_HEADERS} DESTINATION include ) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PlaYUVerConfig.cmake DESTINATION share/PlaYUVer ) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PlaYUVerConfig.cmake DESTINATION share/playuver ) INSTALL(TARGETS PlaYUVerLib DESTINATION lib ) ENDIF() diff --git a/lib/PlaYUVerConfig.cmake.in b/lib/PlaYUVerConfig.cmake.in index 1c8fb93..2e6417a 100644 --- a/lib/PlaYUVerConfig.cmake.in +++ b/lib/PlaYUVerConfig.cmake.in @@ -10,10 +10,6 @@ # include_directories(${PLAYUVER_INCLUDE_DIRS}) # target_link_libraries(MY_TARGET_NAME ${PLAYUVER_LINKER_LIBS}) # -# Or you can search for specific PlaYUVer modules: -# -# find_package(PlaYUVer REQUIRED Frame Stream) -# # If the module is found then PLAYUVER__FOUND is set to TRUE. # # This file will define the following variables: @@ -47,16 +43,13 @@ LIST(APPEND PLAYUVER_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include ) # PlaYUVer dependencies: # ====================================================== -SET( PLAYUVER_HAS_OPENCV @USE_OPENCV@ ) -SET( PLAYUVER_HAS_FFMPEG @USE_FFMPEG@ ) - -IF( PLAYUVER_HAS_FFMPEG ) +IF( @USE_OPENCV@ ) LIST(APPEND PLAYUVER_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} ) LIST(APPEND PLAYUVER_LINKER_LIBS @OpenCV_LIBRARIES@ ) ENDIF() -IF( PLAYUVER_HAS_OPENCV ) +IF( @USE_FFMPEG@ ) LIST(APPEND PLAYUVER_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) LIST(APPEND PLAYUVER_LINKER_LIBS @OpenCV_LIBRARIES@ ) ENDIF()