Improvements on CalypModuleIf
Add type safe flags Replace MACRO with templates (WIP)
This commit is contained in:
43 files changed
+209
-183
No files matched your search
+25
-1
@@ -102,7 +102,10 @@ SET(UPDATE_CHANNEL
|
||||
# ####################################################################################################################################################
|
||||
# Dependencies
|
||||
# ####################################################################################################################################################
|
||||
INCLUDE(FetchContent)
|
||||
|
||||
# ####################################################################################################################################################
|
||||
# Doxygen
|
||||
IF(BUILD_DOC)
|
||||
FIND_PACKAGE(Doxygen)
|
||||
SET(BUILD_DOC ${Doxygen_FOUND})
|
||||
@@ -114,8 +117,9 @@ SET_PACKAGE_PROPERTIES(
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
# ####################################################################################################################################################
|
||||
# Catch2 and Google Tests
|
||||
IF(BUILD_TESTS)
|
||||
INCLUDE(FetchContent)
|
||||
FETCHCONTENT_DECLARE(googletest URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip)
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
SET(gtest_force_shared_crt
|
||||
@@ -152,6 +156,24 @@ IF(BUILD_TESTS)
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# ####################################################################################################################################################
|
||||
# Type safe
|
||||
FETCHCONTENT_DECLARE(
|
||||
type_safe
|
||||
GIT_REPOSITORY https://github.com/foonathan/type_safe
|
||||
GIT_TAG v0.2.2
|
||||
)
|
||||
FETCHCONTENT_MAKEAVAILABLE(type_safe)
|
||||
SET_PACKAGE_PROPERTIES(
|
||||
type_safe PROPERTIES
|
||||
URL "https://github.com/foonathan/type_safe"
|
||||
DESCRIPTION "Zero overhead abstractions that use the C++ type system to prevent bugs."
|
||||
TYPE REQUIRED
|
||||
)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/_deps/type_safe-src/include/ ${CMAKE_CURRENT_BINARY_DIR}/_deps/type_safe-src/external/debug_assert/)
|
||||
|
||||
# ####################################################################################################################################################
|
||||
# OpenCV
|
||||
OPTION(USE_OPENCV "Add OpenCV support" ON)
|
||||
IF(USE_OPENCV)
|
||||
|
||||
@@ -177,6 +199,8 @@ SET_PACKAGE_PROPERTIES(
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
# ####################################################################################################################################################
|
||||
# FFmpeg
|
||||
OPTION(USE_FFMPEG "Add FFMPEG support" ON)
|
||||
IF(USE_FFMPEG)
|
||||
FIND_PACKAGE(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE)
|
||||
|
||||
@@ -119,7 +119,7 @@ void CalypAppModuleIf::run()
|
||||
bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
{
|
||||
bool moduleExecuted = false;
|
||||
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcModule->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
if( m_pcDisplaySubWindow )
|
||||
{
|
||||
@@ -130,7 +130,8 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
m_pcSubWindow[0]->setFillWindow( true );
|
||||
}
|
||||
}
|
||||
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
|
||||
|
||||
if( !( isPlaying && m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::SkipWhilePlaying ) ) )
|
||||
{
|
||||
m_frameList.clear();
|
||||
for( unsigned int i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
|
||||
@@ -178,7 +179,7 @@ bool CalypAppModuleIf::process()
|
||||
m_frameListPtr.push_back( frame.get() );
|
||||
}
|
||||
|
||||
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcModule->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
CalypFrame* framePtr{ nullptr };
|
||||
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
@@ -192,7 +193,7 @@ bool CalypAppModuleIf::process()
|
||||
assert( framePtr != nullptr );
|
||||
m_pcProcessedFrame = std::shared_ptr<CalypFrame>{ framePtr, []( CalypFrame* ptr ) {} };
|
||||
}
|
||||
else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
else if( m_pcModule->m_iModuleType == ClpModuleType::FrameMeasurement )
|
||||
{
|
||||
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
{
|
||||
@@ -217,7 +218,7 @@ void CalypAppModuleIf::show()
|
||||
return;
|
||||
switch( m_pcModule->m_iModuleType )
|
||||
{
|
||||
case CLP_FRAME_PROCESSING_MODULE: {
|
||||
case ClpModuleType::FrameProcessing: {
|
||||
auto displayWindow = qobject_cast<VideoSubWindow*>( m_pcDisplaySubWindow );
|
||||
if( displayWindow == nullptr )
|
||||
displayWindow = m_pcSubWindow[0];
|
||||
@@ -234,7 +235,7 @@ void CalypAppModuleIf::show()
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case CLP_FRAME_MEASUREMENT_MODULE:
|
||||
case ClpModuleType::FrameMeasurement:
|
||||
m_pcModuleDock->setModuleReturnValue( m_dMeasurementResult );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void ModuleSubWindow::updateVideoWindowInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
if( module_ptr->getModuleRequirements() & CLP_MODULES_HAS_INFO )
|
||||
if( module_ptr->getModuleRequirements().is_set( ClpModuleFeature::HasInfo ) )
|
||||
{
|
||||
QStringList list = QString::fromStdString( module_ptr->moduleInfo() ).split( '\n' );
|
||||
windowInfoList.append( list );
|
||||
|
||||
@@ -287,7 +287,7 @@ void ModulesHandle::activateModule()
|
||||
{
|
||||
int minNumFrames = numberOfFrames;
|
||||
int maxNumFrames = numberOfFrames;
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULES_VARIABLE_NUM_FRAMES )
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::VariableNumOfFrames ) )
|
||||
{
|
||||
minNumFrames = numberOfFrames;
|
||||
maxNumFrames = 255;
|
||||
@@ -360,7 +360,7 @@ void ModulesHandle::activateModule()
|
||||
pcCurrAppModuleIf->m_pcSubWindow[i] = videoSubWindowList.at( i );
|
||||
}
|
||||
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_OPTIONS )
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::Options ) )
|
||||
{
|
||||
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf.get() );
|
||||
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
|
||||
@@ -375,9 +375,9 @@ void ModulesHandle::activateModule()
|
||||
|
||||
QString windowName;
|
||||
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
||||
if( bShowModulesNewWindow || pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::NewWindow ) )
|
||||
{
|
||||
auto pcModuleSubWindow = new ModuleSubWindow( pcCurrAppModuleIf.get() );
|
||||
pcModuleSubWindow->resetWindowName();
|
||||
@@ -394,7 +394,7 @@ void ModulesHandle::activateModule()
|
||||
pcCurrAppModuleIf->m_pcSubWindow[0]->setDisplayModule( pcCurrAppModuleIf.get() );
|
||||
}
|
||||
}
|
||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == ClpModuleType::FrameMeasurement )
|
||||
{
|
||||
pcCurrAppModuleIf->m_pcDisplaySubWindow = NULL;
|
||||
pcCurrAppModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrAppModuleIf.get() );
|
||||
|
||||
@@ -120,7 +120,7 @@ void VideoStreamSubWindow::updateVideoWindowInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
if( m_pcDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO )
|
||||
if( m_pcDisplayModule->getModuleRequirements() & ClpModuleFeature::HasInfo )
|
||||
{
|
||||
QStringList list = QString::fromStdString( m_pcDisplayModule->moduleInfo() ).split( '\n' );
|
||||
windowInfoList.append( list );
|
||||
|
||||
@@ -158,7 +158,7 @@ void VideoSubWindow::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
if( m_pcDisplayModule )
|
||||
{
|
||||
if( m_pcDisplayModule->getModuleRequirements() & CLP_MODULE_USES_KEYS )
|
||||
if( m_pcDisplayModule->getModuleRequirements().is_set( ClpModuleFeature::KeysShortcuts ) )
|
||||
{
|
||||
bool bRet = false;
|
||||
switch( event->key() )
|
||||
|
||||
@@ -33,15 +33,15 @@ AbsoluteFrameDifferenceExample::AbsoluteFrameDifferenceExample()
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2; // Use API version 2 (recommended).
|
||||
// See this example for details on the functions prototype
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence.
|
||||
m_iModuleType = ClpModuleType::FrameProcessing; // Apply module to the frames or to the whole sequence.
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
m_pchModuleName = "AbsoluteDifferenceExample"; // Name
|
||||
m_pchModuleLongName = "Absolute Difference Example"; // Name
|
||||
m_pchModuleTooltip = "Measure the absolute difference " // Description
|
||||
"between two images (Y plane), e. g., abs( Y1 - Y2 )";
|
||||
m_uiNumberOfFrames = 2; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW; // Module requirements (check CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_uiNumberOfFrames = 2; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow; // Module requirements (check CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_pcFrameDifference = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ REGISTER_CLASS_MAKER( FrameBinarizationAPIv1 )
|
||||
FrameBinarizationAPIv1::FrameBinarizationAPIv1()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleName = "FrameBinarizationAPIv1";
|
||||
m_pchModuleLongName = "Frame Binarization API v1";
|
||||
m_pchModuleTooltip = "Binarize frame";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "threshold", m_uiThreshold, "Threshold level for binarization (0-255) [128]" );
|
||||
|
||||
+59
-47
@@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <type_safe/flag_set.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include "CalypFrame.h"
|
||||
@@ -71,8 +72,9 @@ public: \
|
||||
*/
|
||||
enum Module_API_Version
|
||||
{
|
||||
CLP_MODULE_API_1,
|
||||
CLP_MODULE_API_2,
|
||||
CLP_MODULE_API_INVALID = -1,
|
||||
CLP_MODULE_API_1 = 0,
|
||||
CLP_MODULE_API_2 = 1,
|
||||
CLP_MODULE_API_3,
|
||||
};
|
||||
|
||||
@@ -81,12 +83,11 @@ enum Module_API_Version
|
||||
* Type of module
|
||||
* @see m_iModuleType
|
||||
*/
|
||||
enum Module_Type
|
||||
enum class ClpModuleType : std::uint8_t
|
||||
{
|
||||
CLP_INVALID_MODULE = -1,
|
||||
CLP_FRAME_PROCESSING_MODULE = 0,
|
||||
CLP_FRAME_MEASUREMENT_MODULE = 1,
|
||||
CLP_MODULE_TYPE_MAX = 255,
|
||||
Invalid,
|
||||
FrameProcessing,
|
||||
FrameMeasurement,
|
||||
};
|
||||
|
||||
/** Module_Features Enum
|
||||
@@ -94,18 +95,20 @@ enum Module_Type
|
||||
* Features/Requirements of a module
|
||||
* @see m_uiModuleRequirements
|
||||
*/
|
||||
enum Module_Features
|
||||
enum class ClpModuleFeature
|
||||
{
|
||||
CLP_MODULE_REQUIRES_NOTHING = 0,
|
||||
CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY = 1,
|
||||
CLP_MODULE_REQUIRES_OPTIONS = 2,
|
||||
CLP_MODULE_REQUIRES_NEW_WINDOW = 4,
|
||||
CLP_MODULE_USES_KEYS = 8,
|
||||
CLP_MODULES_VARIABLE_NUM_FRAMES = 16,
|
||||
CLP_MODULES_HAS_INFO = 32,
|
||||
CLP_MODULE_REQURES_MAX = 1024,
|
||||
None,
|
||||
SkipWhilePlaying,
|
||||
Options,
|
||||
NewWindow,
|
||||
KeysShortcuts,
|
||||
VariableNumOfFrames,
|
||||
HasInfo,
|
||||
_flag_set_size
|
||||
};
|
||||
|
||||
using ClpModuleFeatures = type_safe::flag_set<ClpModuleFeature>;
|
||||
|
||||
enum Module_Key_Supported
|
||||
{
|
||||
MODULE_KEY_LEFT,
|
||||
@@ -122,29 +125,14 @@ enum Module_Key_Supported
|
||||
class CalypModuleIf
|
||||
{
|
||||
public:
|
||||
int m_iModuleAPI{ CLP_MODULE_API_1 };
|
||||
int m_iModuleType{ CLP_INVALID_MODULE };
|
||||
const char* m_pchModuleCategory{ "" };
|
||||
const char* m_pchModuleName{ "" };
|
||||
const char* m_pchModuleTooltip{ "" };
|
||||
const char* m_pchModuleLongName{ nullptr };
|
||||
|
||||
//! Number of frames
|
||||
unsigned int m_uiNumberOfFrames{ 1 };
|
||||
//! Features/Requirements
|
||||
unsigned int m_uiModuleRequirements{ CLP_MODULE_REQUIRES_NOTHING };
|
||||
|
||||
unsigned int m_iFrameBufferCount{ 0 };
|
||||
|
||||
CalypOptions m_cModuleOptions;
|
||||
|
||||
CalypModuleIf() = default;
|
||||
CalypModuleIf( const CalypModuleIf& other ) noexcept = delete;
|
||||
CalypModuleIf( CalypModuleIf&& other ) noexcept = delete;
|
||||
auto operator=( const CalypModuleIf& other ) -> CalypModuleIf& = delete;
|
||||
auto operator=( CalypModuleIf&& other ) noexcept -> CalypModuleIf& = delete;
|
||||
CalypModuleIf( const CalypModuleIf& buffer ) noexcept = delete;
|
||||
CalypModuleIf( CalypModuleIf&& buffer ) noexcept = delete;
|
||||
auto operator=( const CalypModuleIf& buffer ) -> CalypModuleIf& = delete;
|
||||
auto operator=( CalypModuleIf&& buffer ) noexcept -> CalypModuleIf& = delete;
|
||||
|
||||
virtual ~CalypModuleIf() = default;
|
||||
virtual void destroy() = 0;
|
||||
virtual void destroy(){};
|
||||
|
||||
const char* getModuleLongName()
|
||||
{
|
||||
@@ -175,6 +163,23 @@ public:
|
||||
m_iFrameBufferCount = 0;
|
||||
return true;
|
||||
};
|
||||
|
||||
public:
|
||||
int m_iModuleAPI{ CLP_MODULE_API_1 };
|
||||
ClpModuleType m_iModuleType{ ClpModuleType::Invalid };
|
||||
const char* m_pchModuleCategory{ "" };
|
||||
const char* m_pchModuleName{ "" };
|
||||
const char* m_pchModuleTooltip{ "" };
|
||||
const char* m_pchModuleLongName{ nullptr };
|
||||
|
||||
//! Number of frames
|
||||
unsigned int m_uiNumberOfFrames{ 1 };
|
||||
//! Features/Requirements
|
||||
ClpModuleFeatures m_uiModuleRequirements{ ClpModuleFeature::None };
|
||||
|
||||
unsigned int m_iFrameBufferCount{ 0 };
|
||||
|
||||
CalypOptions m_cModuleOptions;
|
||||
};
|
||||
|
||||
namespace cv
|
||||
@@ -191,16 +196,8 @@ class CalypOpenCVModuleIf : public CalypModuleIf
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
protected:
|
||||
//const char* m_pchPythonFunctionName;
|
||||
std::unique_ptr<CalypFrame> m_pcOutputFrame;
|
||||
bool m_bConvertToGray;
|
||||
|
||||
public:
|
||||
CalypOpenCVModuleIf()
|
||||
{
|
||||
m_bConvertToGray = false;
|
||||
};
|
||||
CalypOpenCVModuleIf() { m_bConvertToGray = false; };
|
||||
virtual ~CalypOpenCVModuleIf() {}
|
||||
|
||||
// Common API
|
||||
@@ -209,11 +206,26 @@ public:
|
||||
void destroy();
|
||||
|
||||
// API using OpenCV
|
||||
virtual cv::Mat* create_using_opencv( const std::vector<Mat>& apcFrameList ) { return nullptr; };
|
||||
virtual cv::Mat* create_using_opencv( const std::vector<Mat>& apcFrameList )
|
||||
{
|
||||
return nullptr;
|
||||
};
|
||||
virtual Mat* process_using_opencv( const std::vector<Mat>& apcFrameList ) = 0;
|
||||
virtual void destroy_using_opencv(){};
|
||||
|
||||
protected:
|
||||
// const char* m_pchPythonFunctionName;
|
||||
std::unique_ptr<CalypFrame> m_pcOutputFrame;
|
||||
bool m_bConvertToGray;
|
||||
};
|
||||
|
||||
using CalypModulePtr = std::unique_ptr<CalypModuleIf>;
|
||||
|
||||
template <typename T>
|
||||
class CalypModuleInstace
|
||||
{
|
||||
public:
|
||||
static CalypModulePtr Create() { return std::make_unique<T>(); }
|
||||
};
|
||||
|
||||
#endif // __CALYPMODULESIF_H__
|
||||
@@ -29,19 +29,19 @@ AbsoluteFrameDifference::AbsoluteFrameDifference()
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2; // Use API version 2 (recommended).
|
||||
// See this example for details on the functions prototype
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE; // Apply module to the frames or to
|
||||
m_iModuleType = ClpModuleType::FrameProcessing; // Apply module to the frames or to
|
||||
// the whole sequence.
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
m_pchModuleName = "AbsoluteFrameDifference"; // Name (no spaces)
|
||||
m_pchModuleLongName = "Absolute Difference"; // Long Name
|
||||
m_pchModuleTooltip = "Measure the absolute difference " // Description
|
||||
"between two images (Y plane), e. g., abs( Y1 - Y2 )";
|
||||
m_uiNumberOfFrames = 2; // Number of frames required
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW; // Module requirements
|
||||
// (check
|
||||
// CalypModulesIf.h).
|
||||
m_uiNumberOfFrames = 2; // Number of frames required
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow; // Module requirements
|
||||
// (check
|
||||
// CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_pcFrameDifference = NULL;
|
||||
m_pcFrameDifference = nullptr;
|
||||
}
|
||||
|
||||
bool AbsoluteFrameDifference::create( std::vector<CalypFrame*> apcFrameList )
|
||||
@@ -52,7 +52,7 @@ bool AbsoluteFrameDifference::create( std::vector<CalypFrame*> apcFrameList )
|
||||
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE_IGNORE_GRAY | CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION | CalypFrame::MATCH_BITS ) )
|
||||
return false;
|
||||
|
||||
m_pcFrameDifference = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, apcFrameList[0]->getBitsPel() );
|
||||
m_pcFrameDifference = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, apcFrameList[0]->getBitsPel() );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,12 +77,5 @@ CalypFrame* AbsoluteFrameDifference::process( std::vector<CalypFrame*> apcFrameL
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_pcFrameDifference;
|
||||
}
|
||||
|
||||
void AbsoluteFrameDifference::destroy()
|
||||
{
|
||||
if( m_pcFrameDifference )
|
||||
delete m_pcFrameDifference;
|
||||
m_pcFrameDifference = NULL;
|
||||
return m_pcFrameDifference.get();
|
||||
}
|
||||
@@ -28,19 +28,16 @@
|
||||
// CalypLib
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
class AbsoluteFrameDifference : public CalypModuleIf
|
||||
class AbsoluteFrameDifference : public CalypModuleIf,
|
||||
public CalypModuleInstace<AbsoluteFrameDifference>
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( AbsoluteFrameDifference )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcFrameDifference;
|
||||
std::unique_ptr<CalypFrame> m_pcFrameDifference;
|
||||
|
||||
public:
|
||||
AbsoluteFrameDifference();
|
||||
virtual ~AbsoluteFrameDifference() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
};
|
||||
|
||||
#endif // __FRAMEDIFFERENCE_H__
|
||||
@@ -29,14 +29,14 @@ DisparityStereoBM::DisparityStereoBM()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Stereo";
|
||||
m_pchModuleName = "Disparity-BM";
|
||||
m_pchModuleLongName = "Block macth based disparity";
|
||||
m_pchModuleTooltip = "Measure the disparity between two images using the "
|
||||
"Stereo BM method (OpenCV)";
|
||||
m_uiNumberOfFrames = 2;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying | ClpModuleFeature::NewWindow | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [9]" );
|
||||
|
||||
@@ -29,14 +29,14 @@ DisparityStereoSGBM::DisparityStereoSGBM()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Stereo";
|
||||
m_pchModuleName = "Disparity-SGBM";
|
||||
m_pchModuleLongName = "SGBM based disparity";
|
||||
m_pchModuleTooltip = "Measure the disparity between two images using the "
|
||||
"Stereo SGBM method (OpenCV)";
|
||||
m_uiNumberOfFrames = 2;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying | ClpModuleFeature::NewWindow | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [3]" )( "HHAlgorithm", m_bUseHH,
|
||||
|
||||
@@ -28,13 +28,13 @@ EightBitsSampling::EightBitsSampling()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Conversions";
|
||||
m_pchModuleName = "BitsResampling";
|
||||
m_pchModuleLongName = "Re-sampling frame (bpp)";
|
||||
m_pchModuleTooltip = "Re-sampling frame to a different value of bits per pixel";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "num_bits", m_iNumberOfBits, "Number of bits/pixel (8-16) [8]" );
|
||||
|
||||
@@ -30,9 +30,9 @@ FilterComponentModule::FilterComponentModule()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
|
||||
m_uiModuleRequirements = ClpModuleFeature::None;
|
||||
m_pchModuleCategory = "Filtering";
|
||||
|
||||
m_pcFilteredFrame = NULL;
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
FrameBinarization::FrameBinarization()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleLongName = "Binarization";
|
||||
m_pchModuleName = "FrameBinarization";
|
||||
m_pchModuleTooltip = "Binarize frame";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "threshold", m_uiThreshold, "Threshold level for binarization (0-255) [128]" );
|
||||
|
||||
@@ -28,13 +28,13 @@ FrameConcatenation::FrameConcatenation()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleLongName = "Frame Concatenation";
|
||||
m_pchModuleName = "FrameConc";
|
||||
m_pchModuleTooltip = "Concatenate frames side-by-side";
|
||||
m_uiNumberOfFrames = 2;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS | CLP_MODULE_REQUIRES_NEW_WINDOW;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options | ClpModuleFeature::NewWindow;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "ShiftHorizontal", m_iShiftHor, "Amount of pixels to shift in horizontal direction" );
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
FrameCrop::FrameCrop()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleLongName = "Crop";
|
||||
m_pchModuleName = "FrameCrop";
|
||||
m_pchModuleTooltip = "Crop a region of a frame";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "xPosition", m_uiXPosition, "X cordinate of the left-top corner of the crop region [0]" ) /**/
|
||||
|
||||
@@ -28,13 +28,13 @@ FrameDifference::FrameDifference()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Measurements";
|
||||
m_pchModuleName = "FrameDifference";
|
||||
m_pchModuleLongName = "Difference";
|
||||
m_pchModuleTooltip = "Measure the difference between two images (Y plane), "
|
||||
"Y1 - Y2, with max absolute diff of 128";
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow | ClpModuleFeature::Options;
|
||||
m_uiNumberOfFrames = 2;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
|
||||
@@ -28,13 +28,13 @@ FrameMask::FrameMask()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleLongName = "Apply mask";
|
||||
m_pchModuleName = "FrameMask";
|
||||
m_pchModuleTooltip = "Applies a mask to the selected image (first image)";
|
||||
m_uiNumberOfFrames = 2;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS | CLP_MODULE_USES_KEYS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow | ClpModuleFeature::Options | ClpModuleFeature::KeysShortcuts;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "MaskWeigth", m_iWeight, "Influence of the mask [60%]" );
|
||||
|
||||
@@ -37,13 +37,13 @@ FrameResampling::FrameResampling()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleName = "FrameResampling";
|
||||
m_pchModuleLongName = "Frame Resampling (Spatial)";
|
||||
m_pchModuleTooltip = "Resampling frame to an abritary resolution";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "width", m_iWidth, "Width of the crop region [-1]" ) /**/
|
||||
|
||||
@@ -28,13 +28,13 @@ FrameRotate::FrameRotate()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleLongName = "Rotation";
|
||||
m_pchModuleName = "FrameRotate";
|
||||
m_pchModuleTooltip = "Rotates frame";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "Angle", m_iAngle, "Angle to rotate (0, 90, 180, 270)" );
|
||||
|
||||
@@ -30,13 +30,13 @@ FrameShift::FrameShift()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleLongName = "Pixel Shift";
|
||||
m_pchModuleName = "FrameShift";
|
||||
m_pchModuleTooltip = "Shift frame horizontal and vertical";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS | CLP_MODULE_USES_KEYS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options | ClpModuleFeature::KeysShortcuts;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "ShiftHorizontal", m_iShiftHor, "Amount of pixels to shift in horizontal direction" ) /**/
|
||||
|
||||
@@ -30,16 +30,16 @@ HEVCIntraPrediction::HEVCIntraPrediction()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "HEVC";
|
||||
m_pchModuleLongName = "Intra Prediction";
|
||||
m_pchModuleName = "HEVCIntraPrediction";
|
||||
m_pchModuleTooltip = "Apply intra-frame prediction";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW |
|
||||
CLP_MODULE_USES_KEYS |
|
||||
CLP_MODULES_HAS_INFO |
|
||||
CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow |
|
||||
ClpModuleFeature::KeysShortcuts |
|
||||
ClpModuleFeature::HasInfo |
|
||||
ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "mode", m_uiMode, "Intra mode (26-34) [26]" ) /**/
|
||||
|
||||
@@ -29,15 +29,15 @@ InterFrameVariance::InterFrameVariance()
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2; // Use API version 2 (recommended).
|
||||
// See this example for details on the functions prototype
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE; // Apply module to the frames or to
|
||||
// the whole sequence.
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
m_pchModuleName = "InterFrameVariance"; // Name
|
||||
m_iModuleType = ClpModuleType::FrameProcessing; // Apply module to the frames or to
|
||||
// the whole sequence.
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
m_pchModuleName = "InterFrameVariance"; // Name
|
||||
m_pchModuleLongName = "Variance across frames";
|
||||
m_pchModuleTooltip = "Measure the variance across several frames";
|
||||
m_uiNumberOfFrames = 2; // Number of Frames required (This module
|
||||
// allows a variable number of inputs)
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULES_VARIABLE_NUM_FRAMES;
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow | ClpModuleFeature::VariableNumOfFrames;
|
||||
// Several requirements should be "or" between each others.
|
||||
m_pcFrameVariance = NULL;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
LumaAverage::LumaAverage()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = CLP_FRAME_MEASUREMENT_MODULE; // Apply module to the frames or to
|
||||
m_iModuleType = ClpModuleType::FrameMeasurement; // Apply module to the frames or to
|
||||
// the whole sequence.
|
||||
// Currently only support for frame
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
@@ -37,7 +37,7 @@ LumaAverage::LumaAverage()
|
||||
m_uiNumberOfFrames = 1; // Number of Frames required
|
||||
// (ONE_FRAME, TWO_FRAMES,
|
||||
// THREE_FRAMES)
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING; // Module requirements
|
||||
m_uiModuleRequirements = ClpModuleFeature::None; // Module requirements
|
||||
// (check
|
||||
// CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
|
||||
@@ -38,13 +38,13 @@ MeasureOpticalFlowDualTVL1::MeasureOpticalFlowDualTVL1()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Measurements";
|
||||
m_pchModuleName = "MeasureOpticalFlowDualTVL1";
|
||||
m_pchModuleLongName = "Optical flow based on DualTVL1";
|
||||
m_pchModuleTooltip = "Measure optical flow";
|
||||
m_uiNumberOfFrames = 2;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying | ClpModuleFeature::NewWindow | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "Show reconstruction", m_bShowReconstruction, "Show reconstructed frame instead of MVs [false]" );
|
||||
|
||||
@@ -39,10 +39,10 @@ OpticalFlowModule::OpticalFlowModule()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "OpticalFlow";
|
||||
m_uiNumberOfFrames = 2;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying | ClpModuleFeature::NewWindow | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "Show reconstruction", m_bShowReconstruction, "Show reconstructed frame instead of MVs [false]" );
|
||||
|
||||
@@ -32,18 +32,18 @@ OptimiseDisplay::OptimiseDisplay()
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2; // Use API version 2 (recommended).
|
||||
// See this example for details on the functions prototype
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE; // Apply module to the frames or to
|
||||
m_iModuleType = ClpModuleType::FrameProcessing; // Apply module to the frames or to
|
||||
// the whole sequence.
|
||||
m_pchModuleCategory = "Conversions"; // Category (sub-menu)
|
||||
m_pchModuleName = "OptimiseDisplay"; // Name (no spaces)
|
||||
m_pchModuleLongName = "Optimise Display"; // Long Name
|
||||
m_pchModuleTooltip = "Scales the display of images " // Description
|
||||
"for better visualization of small differences";
|
||||
m_uiNumberOfFrames = 1; // Number of frames required
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING; // Module requirements
|
||||
// (check
|
||||
// CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_uiNumberOfFrames = 1; // Number of frames required
|
||||
m_uiModuleRequirements = ClpModuleFeature::None; // Module requirements
|
||||
// (check
|
||||
// CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_pcOptimisedFrame = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ SaliencyBasedFiltering::SaliencyBasedFiltering()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Quality";
|
||||
m_pchModuleName = "SaliencyBasedFiltering";
|
||||
m_pchModuleLongName = "Saliency Based Filtering";
|
||||
m_pchModuleTooltip = "Image filter based on a map";
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
|
||||
m_uiModuleRequirements = ClpModuleFeature::None;
|
||||
m_uiNumberOfFrames = 2;
|
||||
|
||||
m_pcProcessedFrame = NULL;
|
||||
|
||||
@@ -36,17 +36,13 @@ SaliencyDetectionModule::SaliencyDetectionModule()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Saliency";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW;
|
||||
m_uiModuleRequirements = ClpModuleFeature::NewWindow;
|
||||
m_bConvertToGray = true;
|
||||
}
|
||||
|
||||
void SaliencyDetectionModule::destroy_using_opencv()
|
||||
{
|
||||
}
|
||||
|
||||
SaliencyDetectionSpectral::SaliencyDetectionSpectral()
|
||||
{
|
||||
/* Module Definition */
|
||||
@@ -54,7 +50,7 @@ SaliencyDetectionSpectral::SaliencyDetectionSpectral()
|
||||
m_pchModuleLongName = "Spectral residual";
|
||||
m_pchModuleTooltip = "Measure saliency using spectral residual method";
|
||||
|
||||
m_uiModuleRequirements = m_uiModuleRequirements | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = m_uiModuleRequirements | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "Binary map", m_bBinaryMap, "Measure a binary saliency map [false]" );
|
||||
|
||||
@@ -51,7 +51,6 @@ protected:
|
||||
public:
|
||||
SaliencyDetectionModule();
|
||||
virtual ~SaliencyDetectionModule() {}
|
||||
void destroy_using_opencv();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -66,11 +65,11 @@ public:
|
||||
* approach. In Computer Vision and Pattern Recognition, 2007.
|
||||
* CVPR'07. IEEE Conference on, pages 1–8. IEEE, 2007.
|
||||
*/
|
||||
class SaliencyDetectionSpectral : public SaliencyDetectionModule
|
||||
class SaliencyDetectionSpectral : public SaliencyDetectionModule,
|
||||
public CalypModuleInstace<SaliencyDetectionSpectral>
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
REGISTER_CLASS_FACTORY( SaliencyDetectionSpectral )
|
||||
private:
|
||||
bool m_bBinaryMap;
|
||||
|
||||
@@ -91,11 +90,11 @@ public:
|
||||
* platform and novel features derived from a visual saliency mechanism.
|
||||
* In Image and Vision Computing, Vol. 28 Issue 3, pages 391–402. Elsevier, 2010.
|
||||
*/
|
||||
class SaliencyDetectionFineGrained : public SaliencyDetectionModule
|
||||
class SaliencyDetectionFineGrained : public SaliencyDetectionModule,
|
||||
public CalypModuleInstace<SaliencyDetectionFineGrained>
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
REGISTER_CLASS_FACTORY( SaliencyDetectionFineGrained )
|
||||
public:
|
||||
SaliencyDetectionFineGrained();
|
||||
virtual ~SaliencyDetectionFineGrained() {}
|
||||
@@ -110,11 +109,11 @@ public:
|
||||
* Wang and P. Dudek “A Fast Self-tuning Background Subtraction Algorithm”,
|
||||
* in proc of IEEE Workshop on Change Detection, 2014
|
||||
*/
|
||||
class SaliencyDetectionBinWangApr2014 : public SaliencyDetectionModule
|
||||
class SaliencyDetectionBinWangApr2014 : public SaliencyDetectionModule,
|
||||
public CalypModuleInstace<SaliencyDetectionBinWangApr2014>
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
REGISTER_CLASS_FACTORY( SaliencyDetectionBinWangApr2014 )
|
||||
public:
|
||||
SaliencyDetectionBinWangApr2014();
|
||||
virtual ~SaliencyDetectionBinWangApr2014() {}
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
SetChromaHalfScale::SetChromaHalfScale()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "Conversions";
|
||||
m_pchModuleName = "SetChromaHalfScale";
|
||||
m_pchModuleLongName = "Half scale chroma";
|
||||
m_pchModuleTooltip = "Copy frame only keeping luma component";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
|
||||
m_uiModuleRequirements = ClpModuleFeature::None;
|
||||
|
||||
m_pcProcessedFrame = NULL;
|
||||
}
|
||||
|
||||
@@ -39,16 +39,16 @@ ThreeSixtyDownsampling::ThreeSixtyDownsampling()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleName = "ThreeSixtyDownsampling";
|
||||
m_pchModuleLongName = "Adaptive Latitude Downsampling";
|
||||
m_pchModuleTooltip = "Adaptive Latitude Downsampling";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY |
|
||||
CLP_MODULE_REQUIRES_OPTIONS |
|
||||
CLP_MODULES_HAS_INFO |
|
||||
CLP_MODULE_USES_KEYS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying |
|
||||
ClpModuleFeature::Options |
|
||||
ClpModuleFeature::HasInfo |
|
||||
ClpModuleFeature::KeysShortcuts;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "Downsampling", m_uiDownsampling, "ERP to NxN (0 for up, 1 for down and 2 for recon) [1]" ) /**/
|
||||
|
||||
@@ -37,13 +37,13 @@ ThreeSixtyDynamicDownsampling::ThreeSixtyDynamicDownsampling()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleLongName = "Dynamic Downsampling";
|
||||
m_pchModuleName = "ThreeSixtyDynamicDownsampling";
|
||||
m_pchModuleTooltip = "Dynamic downsampling of 360 videos";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "CodingFaceWidth", m_uiFaceWidth, "Coding Face Width [same as input]" ) /**/
|
||||
|
||||
@@ -37,15 +37,15 @@ ThreeSixtyFaceConcatenation::ThreeSixtyFaceConcatenation()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleLongName = "Face Concatenation";
|
||||
m_pchModuleName = "ThreeSixtyFaceConcatenation";
|
||||
m_pchModuleTooltip = "Concatenate 360 video faces";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY |
|
||||
CLP_MODULE_REQUIRES_OPTIONS |
|
||||
CLP_MODULES_VARIABLE_NUM_FRAMES;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying |
|
||||
ClpModuleFeature::Options |
|
||||
ClpModuleFeature::VariableNumOfFrames;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "projection", m_uiProjectionType, "Projection [1] \n 1: Cubemap (6 faces)" ) /**/
|
||||
|
||||
@@ -37,13 +37,13 @@ ThreeSixtyFaceExtraction::ThreeSixtyFaceExtraction()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleLongName = "Face Extration";
|
||||
m_pchModuleName = "ThreeSixtyFaceExtration";
|
||||
m_pchModuleTooltip = "Extract a 360 video face";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "faceNum", m_uiFaceNum, "360 proejction face to be outputed [0]" ) /**/
|
||||
|
||||
@@ -37,14 +37,14 @@ ThreeSixtyNxN::ThreeSixtyNxN()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleName = "ThreeSixtyNxN";
|
||||
m_pchModuleLongName = "ERP to NxN";
|
||||
m_pchModuleTooltip = "Downsampling ERP to NxN";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY |
|
||||
CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying |
|
||||
ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "Downsampling", m_uiDownsampling, "ERP to NxN (0 for up, 1 for down and 2 for recon) [1]" ) /**/
|
||||
|
||||
@@ -28,13 +28,13 @@ ThreeSixtySpatialtoTemporal::ThreeSixtySpatialtoTemporal()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_3;
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameProcessing;
|
||||
m_pchModuleCategory = "360Video";
|
||||
m_pchModuleLongName = "Spatial to Temporal";
|
||||
m_pchModuleName = "ThreeSixtySpatialtoTemporal";
|
||||
m_pchModuleTooltip = "Convert 360 video from Cube Map Projection to temporal frames";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::SkipWhilePlaying | ClpModuleFeature::Options;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "spa2temp", m_uiSpatial2Temporal, "Convert from spatial to temporal [1]" ) /**/
|
||||
|
||||
@@ -30,12 +30,12 @@ WeightedPSNR::WeightedPSNR()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2;
|
||||
m_iModuleType = CLP_FRAME_MEASUREMENT_MODULE;
|
||||
m_iModuleType = ClpModuleType::FrameMeasurement;
|
||||
m_pchModuleCategory = "Quality";
|
||||
m_pchModuleName = "WeightedPSNR";
|
||||
m_pchModuleLongName = "Weighted PSNR";
|
||||
m_pchModuleTooltip = "Measure the weighted PSNR between two images";
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiModuleRequirements = ClpModuleFeature::Options;
|
||||
m_uiNumberOfFrames = 3;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
|
||||
@@ -89,7 +89,7 @@ TEST_F( TestModuleCreate, FIND_MODULE )
|
||||
TEST_F( TestModuleCreate, CREATE_OK )
|
||||
{
|
||||
bool moduleRequireOptions = false;
|
||||
if( pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_OPTIONS )
|
||||
if( pcModule->m_uiModuleRequirements & ClpModuleFeature::Options )
|
||||
{
|
||||
moduleRequireOptions = true;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ int CalypTools::Open( int argc, char* argv[] )
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( m_pcCurrModuleIf->m_uiModuleRequirements & CLP_MODULES_VARIABLE_NUM_FRAMES )
|
||||
if( m_pcCurrModuleIf->m_uiModuleRequirements & ClpModuleFeature::VariableNumOfFrames )
|
||||
{
|
||||
m_pcCurrModuleIf->m_uiNumberOfFrames = m_apcInputStreams.size();
|
||||
}
|
||||
@@ -356,7 +356,7 @@ int CalypTools::Open( int argc, char* argv[] )
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
// Check outputs
|
||||
std::vector<std::string> outputFileNames;
|
||||
@@ -573,7 +573,7 @@ int CalypTools::QualityOperation()
|
||||
//CalypFrame* CalypTools::applyFrameModule()
|
||||
//{
|
||||
// CalypFrame* pcProcessedFrame = NULL;
|
||||
// if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
// if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
// {
|
||||
|
||||
// }
|
||||
@@ -621,7 +621,7 @@ int CalypTools::ModuleOperation()
|
||||
{
|
||||
log( CLP_LOG_INFO, " Processing frame %3d\n", frame );
|
||||
bool bReadFrame = true;
|
||||
if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
if( m_pcCurrModuleIf->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
pcProcessedFrame = m_pcCurrModuleIf->process( apcFrameList );
|
||||
@@ -633,7 +633,7 @@ int CalypTools::ModuleOperation()
|
||||
m_apcOutputStreams[0]->writeFrame( *pcProcessedFrame );
|
||||
}
|
||||
}
|
||||
else if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
else if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameMeasurement )
|
||||
{
|
||||
if( m_pcCurrModuleIf->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
dMeasurementResult = m_pcCurrModuleIf->measure( apcFrameList );
|
||||
@@ -660,7 +660,7 @@ int CalypTools::ModuleOperation()
|
||||
{
|
||||
while( true )
|
||||
{
|
||||
if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
pcProcessedFrame = m_pcCurrModuleIf->process( apcFrameList );
|
||||
if( !pcProcessedFrame )
|
||||
@@ -670,7 +670,7 @@ int CalypTools::ModuleOperation()
|
||||
}
|
||||
}
|
||||
|
||||
if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameMeasurement )
|
||||
{
|
||||
log( CLP_LOG_INFO, "\n Mean Value: \n %8.3f\n", dAveragedMeasurementResult );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "CalypToolsCmdParser.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
@@ -166,10 +167,13 @@ void CalypToolsCmdParser::listModules()
|
||||
printf( " %-43s", ModuleNameString.c_str() );
|
||||
switch( pcCurrModuleIf->m_iModuleType )
|
||||
{
|
||||
case CLP_FRAME_PROCESSING_MODULE:
|
||||
case ClpModuleType::Invalid:
|
||||
assert( false );
|
||||
break;
|
||||
case ClpModuleType::FrameProcessing:
|
||||
printf( " Processing " );
|
||||
break;
|
||||
case CLP_FRAME_MEASUREMENT_MODULE:
|
||||
case ClpModuleType::FrameMeasurement:
|
||||
printf( " Measurement " );
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user