Refactor Playuver into Calyp

commit 1fd9cf34f06ba2a156919b5c9b73c31d4c6c6257
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Mon Mar 12 18:06:39 2018 +0000

    Remove code style

commit 165588840126a7ab35b32e5be47f00c613829ef3
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Mon Mar 12 18:06:25 2018 +0000

    Update Mainpage.dox

commit 5b1a2773c48697346c7b0b64519b81a5aecc0150
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Mon Feb 19 03:46:24 2018 +0000

    Re-add CalypPixel.cpp but keep include with frame class

commit 2343be49ff4906c3171d2df7791e3cf34494eb21
Author: Joao Santos <joaompssantos@gmail.com>
Date:   Sun Feb 18 21:06:57 2018 +0000

    Fixed several things:
    - Removed unused define
    - Added: #include <cassert> to MainWindow.cpp
    - Fixed compilation issue when USE_FFMPEG is OFF on CalypStream.cpp

commit 8d1d64bac828a6bcdfa6af977a5d17d0792acb69
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 15 02:14:13 2018 +0000

    Fix several things:
    - Fix examples
    - Improve code formatting script
    - Change generated cmake config file

commit ea1d0265f1e9300f76fd3f0c8ca03d110ec13eaa
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 15 01:28:50 2018 +0000

    Fix dump of the module list: remove the use of char arrays

commit b4d19dda169715113a74713ca62d05f5a18fd0b5
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 23:20:56 2018 +0000

    Increase linesize of tools help

commit 8b3eab54e376863276b0d7e032f9e1de8aaf90e5
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 23:20:35 2018 +0000

    Fix CalypPixel

commit 1c6ba03c379518acf5fc6f1fdf328ca740a8851d
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 22:24:10 2018 +0000

    Enums CalypPixelFormats and CalypColorSpace are now class independent

commit 5dcc35e1716a70095e1720b01823c2e3a3980576
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 02:04:31 2018 +0000

    Change functions input and return types

commit 5514e3e24f9b428d5db71156561b2d8b6f61dd23
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 02:04:31 2018 +0000

    Change functions input and return types

commit fae7a9a91e1899e7a2833c634221f970d44b8fb6
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 01:39:14 2018 +0000

    Replace custom types with std ones

commit 0c3b62b8ea01903e213d9e8dd73a5b49c7c8c36e
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 00:37:18 2018 +0000

    Refactoring entries with Playuver name with Calyp
    Replace number of frames and add CLP tag into public definitions

commit e8cd8d7a219446513a5dda2c183dd892ec25a6f1
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Sat Feb 10 14:42:15 2018 +0000

    Fix min opencv version and missing ffmpeg module

commit 1233598af8ac15c88fa84569942cc6f865325452
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Sat Feb 10 03:10:12 2018 +0000

    Change version to 0.999.0 untill finishing refactoring

commit 1fe0cac8f0e70f352bf6c63b8cb2e06ab43fb633
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Sat Feb 10 00:21:47 2018 +0000

    Change project library

commit 44e9d330bc63b8b8a1687a14ff0be05af0bf2eb5
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Fri Feb 9 01:42:58 2018 +0000

    Change doxygen files and upload new ico

commit 0d6f3408a2682cfac1533a57a2f1b4e2cc1f0f29
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 21:25:31 2018 +0000

    Fix logos - different when it is icon or the full logo

commit 9f3561acd4b51c7de5f21d63d7e8f2b43c253148
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 01:25:39 2018 +0000

    fix install files

commit 832154e3e40f17a863898a77c929a6c6850ffded
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 01:21:23 2018 +0000

    rename calip to calyp

commit 341b32bfcc0133fdbceea9b8390d59190e495b79
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 00:58:29 2018 +0000

    Refactor lib, modules and tools

commit b4b988cf80052fdcfe0e1f9099d5435ef7945584
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 00:02:33 2018 +0000

    Refactor classes and filename in app

commit 6b4ab728202531ad00db1e6299ee69a01f3594ba
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 7 17:49:53 2018 +0000

    Refactor about dialog and background logo

commit d5c954d39fb89d735c4feddf62f529077840ab6c
Author: João Santos <joaompssantos@gmail.com>
Date:   Wed Feb 7 15:05:19 2018 +0000

    Added the misteriously missing new logo.

commit f40d81f765bfdd2dc89c0647cf5f4a80eef845c7
Author: João Santos <joaompssantos@gmail.com>
Date:   Wed Feb 7 14:45:08 2018 +0000

    Added new logo to resource folder.

commit 52dc6d60d6590995d32de33f8199e954e0a6e120
Author: João Santos <joaompssantos@gmail.com>
Date:   Wed Feb 7 14:41:13 2018 +0000

    Added new logo where it was previously forgotten.

commit 6d8e064c3154e5202f01b1b10ba6ab3637383ecd
Author: João Santos <joaompssantos@gmail.com>
Date:   Tue Feb 6 17:44:11 2018 +0000

    About window no longer resizable. Added new logo.
This commit is contained in:
jfmcarreira committed 2018-03-12 18:21:07 +00:00
1 parent 5a701c83e7
commit 0b429a0c34
157 files changed
+16532 -17759

No files matched your search

+23 -25
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,51 +27,49 @@
AbsoluteFrameDifference::AbsoluteFrameDifference()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2; // Use API version 2 (recommended).
m_iModuleAPI = CLP_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
m_iModuleType = CLP_FRAME_PROCESSING_MODULE; // 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 = MODULE_REQUIRES_TWO_FRAMES; // Number of Frames required
// (ONE_FRAME, TWO_FRAMES,
// THREE_FRAMES)
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW; // Module requirements
// (check
// PlaYUVerModulesIf.h).
m_uiNumberOfFrames = 2; // Number of frames required
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW; // Module requirements
// (check
// CalypModulesIf.h).
// Several requirements should be "or" between each others.
m_pcFrameDifference = NULL;
}
Bool AbsoluteFrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool AbsoluteFrameDifference::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE |
CalypFrame::MATCH_RESOLUTION |
CalypFrame::MATCH_BITS ) )
return false;
m_pcFrameDifference =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
return true;
}
PlaYUVerFrame* AbsoluteFrameDifference::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* AbsoluteFrameDifference::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* Input1 = apcFrameList[0];
PlaYUVerFrame* Input2 = apcFrameList[1];
Pel* pInput1PelYUV = Input1->getPelBufferYUV()[0][0];
Pel* pInput2PelYUV = Input2->getPelBufferYUV()[0][0];
Pel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
Int aux_pel_1, aux_pel_2;
CalypFrame* Input1 = apcFrameList[0];
CalypFrame* Input2 = apcFrameList[1];
ClpPel* pInput1PelYUV = Input1->getPelBufferYUV()[0][0];
ClpPel* pInput2PelYUV = Input2->getPelBufferYUV()[0][0];
ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
int aux_pel_1, aux_pel_2;
for( UInt y = 0; y < m_pcFrameDifference->getHeight(); y++ )
for( UInt x = 0; x < m_pcFrameDifference->getWidth(); x++ )
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ )
for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ )
{
aux_pel_1 = *pInput1PelYUV++;
aux_pel_2 = *pInput2PelYUV++;
@@ -80,7 +78,7 @@ PlaYUVerFrame* AbsoluteFrameDifference::process( std::vector<PlaYUVerFrame*> apc
return m_pcFrameDifference;
}
Void AbsoluteFrameDifference::destroy()
void AbsoluteFrameDifference::destroy()
{
if( m_pcFrameDifference )
delete m_pcFrameDifference;
+8 -8
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,22 +25,22 @@
#ifndef __ABSOLUTEFRAMEDIFFERENCE_H__
#define __ABSOLUTEFRAMEDIFFERENCE_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class AbsoluteFrameDifference : public PlaYUVerModuleIf
class AbsoluteFrameDifference : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( AbsoluteFrameDifference )
private:
PlaYUVerFrame* m_pcFrameDifference;
CalypFrame* m_pcFrameDifference;
public:
AbsoluteFrameDifference();
virtual ~AbsoluteFrameDifference() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __FRAMEDIFFERENCE_H__
+10 -10
View File
@@ -1,13 +1,13 @@
###
### CMakeLists for playuver modules component
### CMakeLists for calyp modules component
###
OPTION( MODULE_THREADED_MODULES "Use threads for modules" OFF )
OPTION( CALYP_THREADED_MODULES "Use threads for modules" OFF )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
set(plaYUver_Mod_SRCS
PlaYUVerModuleFactory.cpp
set(Calyp_Mod_SRCS
CalypModulesFactory.cpp
)
#
@@ -36,9 +36,9 @@ ADD_MODULE_USE_OPENCV( OpticalFlowDualTVL1 "OpticalFlow" VERSION 3.1.0 MODULES
ADD_MODULE_USE_OPENCV( OpticalFlowSparseToDense "OpticalFlow" VERSION 3.1.0 MODULES optflow )
ADD_MODULE_USE_OPENCV( OpticalFlowFarneback "OpticalFlow" VERSION 3.1.0 MODULES video optflow )
ADD_MODULE_USE_OPENCV( OpticalDeepFlow "OpticalFlow" VERSION 3.1.0 MODULES video optflow )
ADD_MODULE_USE_OPENCV( SaliencyDetectionSpectral "SaliencyDetection" VERSION 3.1.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( SaliencyDetectionFineGrained "SaliencyDetection" VERSION 3.1.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( SaliencyDetectionBinWangApr2014 "SaliencyDetection" VERSION 3.1.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( SaliencyDetectionSpectral "SaliencyDetection" VERSION 3.3.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( SaliencyDetectionFineGrained "SaliencyDetection" VERSION 3.3.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( SaliencyDetectionBinWangApr2014 "SaliencyDetection" VERSION 3.3.0 MODULES saliency )
#
@@ -46,8 +46,8 @@ ADD_MODULE_USE_OPENCV( SaliencyDetectionBinWangApr2014 "SaliencyDetection" VERSI
#
CREATE_MODULE_MACROS()
INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} )
ADD_LIBRARY( PlaYUVerModules ${plaYUver_Mod_SRCS} )
TARGET_LINK_LIBRARIES( PlaYUVerModules PlaYUVerLib ${OpenCV_LIBRARIES} )
ADD_LIBRARY( CalypModules ${Calyp_Mod_SRCS} )
TARGET_LINK_LIBRARIES( CalypModules ${PROJECT_LIBRARY} ${OpenCV_LIBRARIES} )
IF( USE_DYNLOAD )
TARGET_LINK_LIBRARIES( PlaYUVerModules -ldl )
TARGET_LINK_LIBRARIES( CalypModules -ldl )
ENDIF()
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -18,35 +18,36 @@
*/
/**
* \file PlaYUVerModuleFactory.cpp
* \brief PlaYUVer modules factory
* \file CalypModuleFactory.cpp
* \brief Calyp modules factory
*/
#include "PlaYUVerModuleFactory.h"
#include "CalypModulesFactory.h"
#include "config.h"
#include <cstring>
#include <functional>
#ifdef USE_DYNLOAD
#include <dlfcn.h>
#include <iostream>
#endif
// Generated by cmake
#include "ModulesListHeader.h"
PlaYUVerModuleFactory::PlaYUVerModuleFactory(){REGISTER_ALL_MODULES}
CalypModulesFactory::CalypModulesFactory(){REGISTER_ALL_MODULES}
PlaYUVerModuleFactory::~PlaYUVerModuleFactory()
CalypModulesFactory::~CalypModulesFactory()
{
m_FactoryMap.clear();
}
Void PlaYUVerModuleFactory::Register( const char* moduleName, CreateModuleFn pfnCreate )
void CalypModulesFactory::Register( const char* moduleName, CreateModuleFn pfnCreate )
{
m_FactoryMap[moduleName] = pfnCreate;
}
Bool PlaYUVerModuleFactory::RegisterDl( const char* dlName )
bool CalypModulesFactory::RegisterDl( const char* dlName )
{
#ifdef USE_DYNLOAD
void* pHndl = dlopen( dlName, RTLD_NOW );
@@ -67,11 +68,11 @@ Bool PlaYUVerModuleFactory::RegisterDl( const char* dlName )
#endif
}
PlaYUVerModuleIf* PlaYUVerModuleFactory::CreateModule( const char* moduleName )
CalypModuleIf* CalypModulesFactory::CreateModule( const char* moduleName )
{
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
for( ; it != PlaYUVerModuleFactoryMap.end(); ++it )
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( ; it != moduleFactoryMap.end(); ++it )
{
if( !strcmp( it->first, moduleName ) )
{
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -18,45 +18,45 @@
*/
/**
* \file PlaYUVerModuleFactory.h
* \brief PlaYUVer modules factory
* \file CalypModuleFactory.h
* \brief Calyp modules factory
*/
#ifndef __PLAYUVERMODULESFACTORY_H__
#define __PLAYUVERMODULESFACTORY_H__
#ifndef __CALYPMODULESFACTORY_H__
#define __CALYPMODULESFACTORY_H__
#include <map>
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
#define REGISTER_MODULE( X ) Register( "X", &( X::Create ) );
typedef PlaYUVerModuleIf* ( *CreateModuleFn )( void );
typedef std::map<const char*, CreateModuleFn> PlaYUVerModuleFactoryMap;
typedef CalypModuleIf* ( *CreateModuleFn )( void );
typedef std::map<const char*, CreateModuleFn> CalypModulesFactoryMap;
// Factory for creating instances of PlaYUVerModuleIf
class PlaYUVerModuleFactory
// Factory for creating instances of CalypModuleIf
class CalypModulesFactory
{
private:
PlaYUVerModuleFactory();
PlaYUVerModuleFactory& operator=( const PlaYUVerModuleFactory& ) { return *this; }
PlaYUVerModuleFactoryMap m_FactoryMap;
CalypModulesFactory();
CalypModulesFactory& operator=( const CalypModulesFactory& ) { return *this; }
CalypModulesFactoryMap m_FactoryMap;
public:
~PlaYUVerModuleFactory();
~CalypModulesFactory();
static PlaYUVerModuleFactory* Get()
static CalypModulesFactory* Get()
{
static PlaYUVerModuleFactory instance;
static CalypModulesFactory instance;
return &instance;
}
Void Register( const char* moduleName, CreateModuleFn pfnCreate );
Bool RegisterDl( const char* dlName );
void Register( const char* moduleName, CreateModuleFn pfnCreate );
bool RegisterDl( const char* dlName );
PlaYUVerModuleIf* CreateModule( const char* moduleName );
PlaYUVerModuleFactoryMap& getMap() { return m_FactoryMap; }
CalypModuleIf* CreateModule( const char* moduleName );
CalypModulesFactoryMap& getMap() { return m_FactoryMap; }
};
#endif // __PLAYUVERMODULESFACTORY_H__
#endif // __CALYPMODULESFACTORY_H__
+11 -11
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -28,15 +28,15 @@
DisparityStereoBM::DisparityStereoBM()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
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 = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 2;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [9]" );
@@ -45,11 +45,11 @@ DisparityStereoBM::DisparityStereoBM()
m_uiBlockSize = 9;
}
Bool DisparityStereoBM::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool DisparityStereoBM::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
if( ( m_uiBlockSize % 2 ) == 0 )
{
m_uiBlockSize++;
@@ -80,10 +80,10 @@ Bool DisparityStereoBM::create( std::vector<PlaYUVerFrame*> apcFrameList )
#endif
return true;
}
PlaYUVerFrame* DisparityStereoBM::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* DisparityStereoBM::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* InputLeft = apcFrameList[0];
PlaYUVerFrame* InputRight = apcFrameList[1];
CalypFrame* InputLeft = apcFrameList[0];
CalypFrame* InputRight = apcFrameList[1];
cv::Mat leftImage, rightImage;
if( !InputLeft->toMat( leftImage, true ) || !InputRight->toMat( rightImage, true ) )
@@ -104,7 +104,7 @@ PlaYUVerFrame* DisparityStereoBM::process( std::vector<PlaYUVerFrame*> apcFrameL
return m_pcDisparityFrame;
}
Void DisparityStereoBM::destroy()
void DisparityStereoBM::destroy()
{
if( m_pcDisparityFrame )
delete m_pcDisparityFrame;
+10 -10
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,17 +29,17 @@
// OpenCV
#include <opencv2/opencv.hpp>
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class DisparityStereoBM : public PlaYUVerModuleIf
class DisparityStereoBM : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( DisparityStereoBM )
private:
PlaYUVerFrame* m_pcDisparityFrame;
Int m_uiNumberOfDisparities;
UInt m_uiBlockSize;
CalypFrame* m_pcDisparityFrame;
int m_uiNumberOfDisparities;
unsigned int m_uiBlockSize;
#if( CV_MAJOR_VERSION == 2 )
cv::StereoBM m_cStereoBM;
#else
@@ -49,9 +49,9 @@ private:
public:
DisparityStereoBM();
virtual ~DisparityStereoBM() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __DISPARITYSTEREOBM_H__
+12 -12
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -28,15 +28,15 @@
DisparityStereoSGBM::DisparityStereoSGBM()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Stereo";
m_pchModuleName = "Disparity-SGBM";
m_pchModuleName = "SGBM based disparity";
m_pchModuleTooltip = "Measure the disparity between two images using the "
"Stereo SGBM method (OpenCV)";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 2;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [3]" )( "HHAlgorithm", m_bUseHH,
@@ -47,17 +47,17 @@ DisparityStereoSGBM::DisparityStereoSGBM()
m_uiNumberOfDisparities = 0;
}
Bool DisparityStereoSGBM::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool DisparityStereoSGBM::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
if( ( m_uiBlockSize % 2 ) == 0 )
{
m_uiBlockSize++;
}
m_uiNumberOfDisparities = ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16;
Int cn = apcFrameList[0]->getNumberChannels();
int cn = apcFrameList[0]->getNumberChannels();
#if( CV_MAJOR_VERSION == 3 )
m_cStereoMatch = cv::StereoSGBM::create( 0, 16, m_uiBlockSize );
m_cStereoMatch->setPreFilterCap( 63 );
@@ -89,10 +89,10 @@ Bool DisparityStereoSGBM::create( std::vector<PlaYUVerFrame*> apcFrameList )
return true;
}
PlaYUVerFrame* DisparityStereoSGBM::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* DisparityStereoSGBM::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* InputLeft = apcFrameList[0];
PlaYUVerFrame* InputRight = apcFrameList[1];
CalypFrame* InputLeft = apcFrameList[0];
CalypFrame* InputRight = apcFrameList[1];
cv::Mat leftImage, rightImage;
if( !InputLeft->toMat( leftImage, true ) || !InputRight->toMat( rightImage, true ) )
{
@@ -109,7 +109,7 @@ PlaYUVerFrame* DisparityStereoSGBM::process( std::vector<PlaYUVerFrame*> apcFram
return m_pcDisparityFrame;
}
Void DisparityStereoSGBM::destroy()
void DisparityStereoSGBM::destroy()
{
if( m_pcDisparityFrame )
delete m_pcDisparityFrame;
+11 -11
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -48,18 +48,18 @@
// OpenCV
#include <opencv2/opencv.hpp>
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class DisparityStereoSGBM : public PlaYUVerModuleIf
class DisparityStereoSGBM : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( DisparityStereoSGBM )
private:
PlaYUVerFrame* m_pcDisparityFrame;
Bool m_bUseHH;
Int m_uiNumberOfDisparities;
UInt m_uiBlockSize;
CalypFrame* m_pcDisparityFrame;
bool m_bUseHH;
int m_uiNumberOfDisparities;
unsigned int m_uiBlockSize;
#if( CV_MAJOR_VERSION == 3 )
cv::Ptr<cv::StereoSGBM> m_cStereoMatch;
#else
@@ -69,9 +69,9 @@ private:
public:
DisparityStereoSGBM();
virtual ~DisparityStereoSGBM() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __DISPARITYSTEREOSGBM_H__
+7 -7
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -53,18 +53,18 @@ DisparityStereoVar::DisparityStereoVar()
m_cStereoVar.USE_MEDIAN_FILTERING;
}
Bool DisparityStereoVar::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool DisparityStereoVar::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CalypFrame::GRAY );
m_cStereoVar.minDisp = -( ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16 );
return true;
}
PlaYUVerFrame* DisparityStereoVar::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* DisparityStereoVar::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* InputLeft = apcFrameList[0];
PlaYUVerFrame* InputRight = apcFrameList[1];
CalypFrame* InputLeft = apcFrameList[0];
CalypFrame* InputRight = apcFrameList[1];
cv::Mat* leftImage = InputLeft->getCvMat();
cv::Mat* rightImage = InputRight->getCvMat();
@@ -77,7 +77,7 @@ PlaYUVerFrame* DisparityStereoVar::process( std::vector<PlaYUVerFrame*> apcFrame
return m_pcDisparityFrame;
}
Void DisparityStereoVar::destroy()
void DisparityStereoVar::destroy()
{
if( m_pcDisparityFrame )
delete m_pcDisparityFrame;
+8 -8
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,23 +29,23 @@
// OpenCV
#include <opencv2/opencv.hpp>
// PlaYUVerLib
#include "PlaYUVerModuleIf.h"
// CalypLib
#include "CalypModuleIf.h"
class DisparityStereoVar : public PlaYUVerModuleIf
class DisparityStereoVar : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( DisparityStereoVar )
private:
PlaYUVerFrame* m_pcDisparityFrame;
CalypFrame* m_pcDisparityFrame;
cv::StereoVar m_cStereoVar;
public:
DisparityStereoVar();
virtual ~DisparityStereoVar() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __DISPARITYSTEREOVAR_H__
+17 -17
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,45 +27,45 @@
EightBitsSampling::EightBitsSampling()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Conversions";
m_pchModuleName = "EightBitsSampling";
m_pchModuleLongName = "8 bit sub-sampling";
m_pchModuleTooltip = "Sub-sampling frame to 8bpp";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
m_pcSubSampledFrame = NULL;
}
Bool EightBitsSampling::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool EightBitsSampling::create( std::vector<CalypFrame*> apcFrameList )
{
if( apcFrameList[0]->getBitsPel() > 8 )
{
m_pcSubSampledFrame = NULL;
m_pcSubSampledFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
apcFrameList[0]->getPelFormat(), 8 );
m_pcSubSampledFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
apcFrameList[0]->getPelFormat(), 8 );
return true;
}
return false;
}
PlaYUVerFrame* EightBitsSampling::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* EightBitsSampling::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* pcFrame = apcFrameList[0];
UInt uiShiftBits = pcFrame->getBitsPel() - 8;
Pel* pPelInput = pcFrame->getPelBufferYUV()[0][0];
Pel* pPelSubSampled = m_pcSubSampledFrame->getPelBufferYUV()[0][0];
Pel pelValue;
CalypFrame* pcFrame = apcFrameList[0];
unsigned int uiShiftBits = pcFrame->getBitsPel() - 8;
ClpPel* pPelInput = pcFrame->getPelBufferYUV()[0][0];
ClpPel* pPelSubSampled = m_pcSubSampledFrame->getPelBufferYUV()[0][0];
ClpPel pelValue;
for( UInt i = 0; i < pcFrame->getHeight() * pcFrame->getWidth(); i++ )
for( unsigned int i = 0; i < pcFrame->getHeight() * pcFrame->getWidth(); i++ )
{
pelValue = *pPelInput++;
pelValue = pelValue >> uiShiftBits;
*pPelSubSampled++ = pelValue;
}
for( UInt i = 0; i < pcFrame->getChromaLength() * 2; i++ )
for( unsigned int i = 0; i < pcFrame->getChromaLength() * 2; i++ )
{
pelValue = *pPelInput++;
pelValue = pelValue >> uiShiftBits;
@@ -74,7 +74,7 @@ PlaYUVerFrame* EightBitsSampling::process( std::vector<PlaYUVerFrame*> apcFrameL
return m_pcSubSampledFrame;
}
Void EightBitsSampling::destroy()
void EightBitsSampling::destroy()
{
if( m_pcSubSampledFrame )
delete m_pcSubSampledFrame;
+8 -8
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,22 +25,22 @@
#ifndef __EIGHTBITSSAMPLING_H__
#define __EIGHTBITSSAMPLING_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class EightBitsSampling : public PlaYUVerModuleIf
class EightBitsSampling : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( EightBitsSampling )
private:
PlaYUVerFrame* m_pcSubSampledFrame;
CalypFrame* m_pcSubSampledFrame;
public:
EightBitsSampling();
virtual ~EightBitsSampling() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __EIGHTBITSSAMPLING_H__
+24 -24
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,32 +29,32 @@
FilterComponentModule::FilterComponentModule()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
m_pchModuleCategory = "Filtering";
m_pcFilteredFrame = NULL;
}
Bool FilterComponentModule::createFilter( UInt uiWidth, UInt uiHeight, UInt bitsPixel )
bool FilterComponentModule::createFilter( unsigned int uiWidth, unsigned int uiHeight, unsigned int bitsPixel )
{
m_pcFilteredFrame = NULL;
m_pcFilteredFrame = new PlaYUVerFrame( uiWidth, uiHeight, PlaYUVerFrame::GRAY, bitsPixel );
m_pcFilteredFrame = new CalypFrame( uiWidth, uiHeight, CLP_GRAY, bitsPixel );
return true;
}
PlaYUVerFrame* FilterComponentModule::filterComponent( PlaYUVerFrame* InputFrame, Int Component )
CalypFrame* FilterComponentModule::filterComponent( CalypFrame* InputFrame, int Component )
{
Pel*** pppOutputPelYUV = m_pcFilteredFrame->getPelBufferYUV();
Pel*** pppInputPelYUV = InputFrame->getPelBufferYUV();
memcpy( pppOutputPelYUV[LUMA][0], pppInputPelYUV[Component][0],
m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof( Pel ) );
ClpPel*** pppOutputPelYUV = m_pcFilteredFrame->getPelBufferYUV();
ClpPel*** pppInputPelYUV = InputFrame->getPelBufferYUV();
memcpy( pppOutputPelYUV[CLP_LUMA][0], pppInputPelYUV[Component][0],
m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof( ClpPel ) );
return m_pcFilteredFrame;
}
Void FilterComponentModule::destroy()
void FilterComponentModule::destroy()
{
if( m_pcFilteredFrame )
delete m_pcFilteredFrame;
@@ -69,14 +69,14 @@ FilterComponentLuma::FilterComponentLuma()
m_pchModuleTooltip = "Filter Y matrix of YUV frame"; // Description
}
Bool FilterComponentLuma::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FilterComponentLuma::create( std::vector<CalypFrame*> apcFrameList )
{
return createFilter( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getBitsPel() );
}
PlaYUVerFrame* FilterComponentLuma::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FilterComponentLuma::process( std::vector<CalypFrame*> apcFrameList )
{
return filterComponent( apcFrameList[0], LUMA );
return filterComponent( apcFrameList[0], CLP_LUMA );
}
FilterComponentChromaU::FilterComponentChromaU()
@@ -86,19 +86,19 @@ FilterComponentChromaU::FilterComponentChromaU()
m_pchModuleTooltip = "Filter U matrix of YUV frame";
}
Bool FilterComponentChromaU::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FilterComponentChromaU::create( std::vector<CalypFrame*> apcFrameList )
{
if( apcFrameList[0]->getNumberChannels() > 1 )
{
return createFilter( apcFrameList[0]->getWidth( CHROMA_U ), apcFrameList[0]->getHeight( CHROMA_U ),
return createFilter( apcFrameList[0]->getWidth( CLP_CHROMA_U ), apcFrameList[0]->getHeight( CLP_CHROMA_U ),
apcFrameList[0]->getBitsPel() );
}
return false;
}
PlaYUVerFrame* FilterComponentChromaU::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FilterComponentChromaU::process( std::vector<CalypFrame*> apcFrameList )
{
return filterComponent( apcFrameList[0], CHROMA_U );
return filterComponent( apcFrameList[0], CLP_CHROMA_U );
}
FilterComponentChromaV::FilterComponentChromaV()
@@ -109,17 +109,17 @@ FilterComponentChromaV::FilterComponentChromaV()
m_pchModuleTooltip = "Filter V matrix of YUV frame";
}
Bool FilterComponentChromaV::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FilterComponentChromaV::create( std::vector<CalypFrame*> apcFrameList )
{
if( apcFrameList[0]->getNumberChannels() > 1 )
{
return createFilter( apcFrameList[0]->getWidth( CHROMA_V ), apcFrameList[0]->getHeight( CHROMA_V ),
return createFilter( apcFrameList[0]->getWidth( CLP_CHROMA_V ), apcFrameList[0]->getHeight( CLP_CHROMA_V ),
apcFrameList[0]->getBitsPel() );
}
return false;
}
PlaYUVerFrame* FilterComponentChromaV::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FilterComponentChromaV::process( std::vector<CalypFrame*> apcFrameList )
{
return filterComponent( apcFrameList[0], CHROMA_V );
return filterComponent( apcFrameList[0], CLP_CHROMA_V );
}
+16 -16
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,23 +25,23 @@
#ifndef __FILTERCOMPONENT_H__
#define __FILTERCOMPONENT_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FilterComponentModule : public PlaYUVerModuleIf
class FilterComponentModule : public CalypModuleIf
{
private:
PlaYUVerFrame* m_pcFilteredFrame;
CalypFrame* m_pcFilteredFrame;
public:
FilterComponentModule();
virtual ~FilterComponentModule() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList ) = 0;
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList ) = 0;
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList ) = 0;
CalypFrame* process( std::vector<CalypFrame*> apcFrameList ) = 0;
void destroy();
Bool createFilter( UInt uiWidth, UInt uiHeight, UInt bitsPixel );
PlaYUVerFrame* filterComponent( PlaYUVerFrame* InputFrame, Int Component );
bool createFilter( unsigned int uiWidth, unsigned int uiHeight, unsigned int bitsPixel );
CalypFrame* filterComponent( CalypFrame* InputFrame, int Component );
};
class FilterComponentLuma : public FilterComponentModule
@@ -50,8 +50,8 @@ class FilterComponentLuma : public FilterComponentModule
public:
FilterComponentLuma();
virtual ~FilterComponentLuma() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
};
class FilterComponentChromaU : public FilterComponentModule
@@ -60,8 +60,8 @@ class FilterComponentChromaU : public FilterComponentModule
public:
FilterComponentChromaU();
virtual ~FilterComponentChromaU() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
};
class FilterComponentChromaV : public FilterComponentModule
@@ -70,8 +70,8 @@ class FilterComponentChromaV : public FilterComponentModule
public:
FilterComponentChromaV();
virtual ~FilterComponentChromaV() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
};
#endif // __FILTERFRAME_H__
+12 -12
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,13 +27,13 @@
FrameBinarization::FrameBinarization()
{
/* Module Definition */
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Utilities";
m_pchModuleLongName = "Binarization";
m_pchModuleName = "FrameBinarization";
m_pchModuleTooltip = "Binarize frame";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "threshold", m_uiThreshold, "Threshold level for binarization (0-255) [128]" );
@@ -42,25 +42,25 @@ FrameBinarization::FrameBinarization()
m_uiThreshold = 128;
}
Void FrameBinarization::create( PlaYUVerFrame* frame )
void FrameBinarization::create( CalypFrame* frame )
{
m_pcBinFrame = NULL;
m_pcBinFrame = new PlaYUVerFrame( frame->getWidth(), frame->getHeight(), PlaYUVerFrame::GRAY, 8 );
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), CLP_GRAY, 8 );
}
PlaYUVerFrame* FrameBinarization::process( PlaYUVerFrame* frame )
CalypFrame* FrameBinarization::process( CalypFrame* frame )
{
Pel* pPelInput = frame->getPelBufferYUV()[0][0];
Pel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0];
for( UInt y = 0; y < frame->getHeight(); y++ )
for( UInt x = 0; x < frame->getWidth(); x++ )
ClpPel* pPelInput = frame->getPelBufferYUV()[0][0];
ClpPel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0];
for( unsigned int y = 0; y < frame->getHeight(); y++ )
for( unsigned int x = 0; x < frame->getWidth(); x++ )
{
*pPelBin++ = *pPelInput++ >= m_uiThreshold ? 255 : 0;
}
return m_pcBinFrame;
}
Void FrameBinarization::destroy()
void FrameBinarization::destroy()
{
if( m_pcBinFrame )
delete m_pcBinFrame;
+9 -9
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,23 +25,23 @@
#ifndef __FRAMEBINARIZATION_H__
#define __FRAMEBINARIZATION_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FrameBinarization : public PlaYUVerModuleIf
class FrameBinarization : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( FrameBinarization )
private:
PlaYUVerFrame* m_pcBinFrame;
UInt m_uiThreshold;
CalypFrame* m_pcBinFrame;
unsigned int m_uiThreshold;
public:
FrameBinarization();
virtual ~FrameBinarization() {}
Void create( PlaYUVerFrame* );
PlaYUVerFrame* process( PlaYUVerFrame* );
Void destroy();
void create( CalypFrame* );
CalypFrame* process( CalypFrame* );
void destroy();
};
#endif // __FRAMEBINARIZATION_H__
+8 -8
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,13 +27,13 @@
FrameCrop::FrameCrop()
{
/* Module Definition */
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Utilities";
m_pchModuleLongName = "Crop";
m_pchModuleName = "FrameCrop";
m_pchModuleTooltip = "Crop a region of a frame";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "xPosition", m_uiXPosition, "X cordinate of the left-top corner of the crop region [0]" ) /**/
@@ -48,7 +48,7 @@ FrameCrop::FrameCrop()
m_iYSize = -1;
}
Void FrameCrop::create( PlaYUVerFrame* frame )
void FrameCrop::create( CalypFrame* frame )
{
m_pcCropedFrame = NULL;
if( m_uiXPosition >= frame->getWidth() )
@@ -59,16 +59,16 @@ Void FrameCrop::create( PlaYUVerFrame* frame )
m_iXSize = frame->getWidth() - m_uiXPosition;
if( m_iYSize == -1 || ( m_uiYPosition + m_iYSize ) >= frame->getHeight() )
m_iYSize = frame->getHeight() - m_uiYPosition;
m_pcCropedFrame = new PlaYUVerFrame( m_iXSize, m_iYSize, frame->getPelFormat(), frame->getBitsPel() );
m_pcCropedFrame = new CalypFrame( m_iXSize, m_iYSize, frame->getPelFormat(), frame->getBitsPel() );
}
PlaYUVerFrame* FrameCrop::process( PlaYUVerFrame* frame )
CalypFrame* FrameCrop::process( CalypFrame* frame )
{
m_pcCropedFrame->copyFrom( frame, m_uiXPosition, m_uiYPosition );
return m_pcCropedFrame;
}
Void FrameCrop::destroy()
void FrameCrop::destroy()
{
if( m_pcCropedFrame )
delete m_pcCropedFrame;
+12 -12
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,26 +25,26 @@
#ifndef __FRAMECROP_H__
#define __FRAMECROP_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FrameCrop : public PlaYUVerModuleIf
class FrameCrop : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( FrameCrop )
private:
PlaYUVerFrame* m_pcCropedFrame;
UInt m_uiXPosition;
UInt m_uiYPosition;
Int m_iXSize;
Int m_iYSize;
CalypFrame* m_pcCropedFrame;
unsigned int m_uiXPosition;
unsigned int m_uiYPosition;
int m_iXSize;
int m_iYSize;
public:
FrameCrop();
virtual ~FrameCrop() {}
Void create( PlaYUVerFrame* );
PlaYUVerFrame* process( PlaYUVerFrame* );
Void destroy();
void create( CalypFrame* );
CalypFrame* process( CalypFrame* );
void destroy();
};
#endif // __FRAMECROP_H__
+20 -20
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,15 +27,15 @@
FrameDifference::FrameDifference()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Measurements";
m_pchModuleName = "FrameDifference";
m_pchModuleName = "Difference";
m_pchModuleTooltip = "Measure the difference between two images (Y plane), "
"Y1 - Y2, with max absolute diff of 128";
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 2;
m_cModuleOptions.addOptions() /**/
( "Bits per pixel", m_uiBitsPixel, "Bits per pixel (use zero to avoid scaling) [0]" );
@@ -45,15 +45,15 @@ FrameDifference::FrameDifference()
m_pcFrameDifference = NULL;
}
Bool FrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FrameDifference::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
UInt uiMaxBitsPixel = 0;
for( UInt i = 0; i < apcFrameList.size(); i++ )
unsigned int uiMaxBitsPixel = 0;
for( unsigned int i = 0; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION ) )
CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION ) )
return false;
if( apcFrameList[i]->getBitsPel() > uiMaxBitsPixel )
{
@@ -69,21 +69,21 @@ Bool FrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
m_iDiffBitShift = ( uiMaxBitsPixel + 1 ) - m_uiBitsPixel;
m_iMaxDiffValue = ( 1 << ( m_uiBitsPixel - 1 ) );
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY, m_uiBitsPixel );
m_pcFrameDifference = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
CLP_GRAY, m_uiBitsPixel );
return true;
}
PlaYUVerFrame* FrameDifference::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FrameDifference::process( std::vector<CalypFrame*> apcFrameList )
{
Pel* pInput1PelYUV = apcFrameList[0]->getPelBufferYUV()[0][0];
Pel* pInput2PelYUV = apcFrameList[1]->getPelBufferYUV()[0][0];
Pel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
Int aux_pel_1, aux_pel_2;
Int diff = 0;
ClpPel* pInput1PelYUV = apcFrameList[0]->getPelBufferYUV()[0][0];
ClpPel* pInput2PelYUV = apcFrameList[1]->getPelBufferYUV()[0][0];
ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
int aux_pel_1, aux_pel_2;
int diff = 0;
for( UInt y = 0; y < m_pcFrameDifference->getHeight(); y++ )
for( UInt x = 0; x < m_pcFrameDifference->getWidth(); x++ )
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ )
for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ )
{
aux_pel_1 = *pInput1PelYUV++;
aux_pel_2 = *pInput2PelYUV++;
@@ -98,7 +98,7 @@ PlaYUVerFrame* FrameDifference::process( std::vector<PlaYUVerFrame*> apcFrameLis
return m_pcFrameDifference;
}
Void FrameDifference::destroy()
void FrameDifference::destroy()
{
if( m_pcFrameDifference )
delete m_pcFrameDifference;
+11 -11
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,25 +25,25 @@
#ifndef __FRAMEDIFFERENCE_H__
#define __FRAMEDIFFERENCE_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FrameDifference : public PlaYUVerModuleIf
class FrameDifference : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( FrameDifference )
private:
UInt m_uiBitsPixel;
Int m_iDiffBitShift;
Int m_iMaxDiffValue;
PlaYUVerFrame* m_pcFrameDifference;
unsigned int m_uiBitsPixel;
int m_iDiffBitShift;
int m_iMaxDiffValue;
CalypFrame* m_pcFrameDifference;
public:
FrameDifference();
virtual ~FrameDifference() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __FRAMEDIFFERENCE_H__
+31 -31
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,14 +27,14 @@
FrameMask::FrameMask()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Utilities";
m_pchModuleLongName = "Apply mask";
m_pchModuleName = "FrameMask";
m_pchModuleTooltip = "Applies a mask to the selected image (first image)";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS | MODULE_USES_KEYS;
m_uiNumberOfFrames = 2;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS | CLP_MODULE_USES_KEYS;
m_cModuleOptions.addOptions() /**/
( "MaskWeigth", m_iWeight, "Influence of the mask [60%]" );
@@ -44,15 +44,15 @@ FrameMask::FrameMask()
m_pcFrameProcessed = NULL;
}
Bool FrameMask::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FrameMask::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE_IGNORE_GRAY |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE_IGNORE_GRAY |
CalypFrame::MATCH_RESOLUTION |
CalypFrame::MATCH_BITS ) )
{
return false;
}
@@ -61,41 +61,41 @@ Bool FrameMask::create( std::vector<PlaYUVerFrame*> apcFrameList )
m_iWeight = m_iWeight > 100 || m_iWeight < 0 ? 5 : m_iWeight;
m_iWeight = m_iWeight > 10 ? m_iWeight / 10 : m_iWeight;
Int iPelFmt = 0;
Int iColorSpace = apcFrameList[0]->getColorSpace();
if( iColorSpace == PlaYUVerPixel::COLOR_GRAY )
int iPelFmt = 0;
int iColorSpace = apcFrameList[0]->getColorSpace();
if( iColorSpace == CLP_COLOR_GRAY )
{
iColorSpace = apcFrameList[1]->getPelFormat();
}
switch( iColorSpace )
{
case PlaYUVerPixel::COLOR_GRAY:
iPelFmt = PlaYUVerFrame::GRAY;
case CLP_COLOR_GRAY:
iPelFmt = CLP_GRAY;
break;
case PlaYUVerPixel::COLOR_YUV:
iPelFmt = PlaYUVerFrame::YUV444p;
case CLP_COLOR_YUV:
iPelFmt = CLP_YUV444P;
break;
case PlaYUVerPixel::COLOR_RGB:
iPelFmt = PlaYUVerFrame::RGB24;
case CLP_COLOR_RGB:
iPelFmt = CLP_RGB24;
break;
}
m_pcFrameProcessed = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), iPelFmt,
apcFrameList[0]->getBitsPel() );
m_pcFrameProcessed = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), iPelFmt,
apcFrameList[0]->getBitsPel() );
return true;
}
PlaYUVerFrame* FrameMask::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FrameMask::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* InputFrame = apcFrameList[0];
PlaYUVerFrame* MaskFrame = apcFrameList[1];
PlaYUVerPixel pixelImg;
PlaYUVerPixel pixelMask;
PlaYUVerPixel pixelOut;
CalypFrame* InputFrame = apcFrameList[0];
CalypFrame* MaskFrame = apcFrameList[1];
CalypPixel pixelImg;
CalypPixel pixelMask;
CalypPixel pixelOut;
for( UInt y = 0; y < m_pcFrameProcessed->getHeight(); y++ )
for( unsigned int y = 0; y < m_pcFrameProcessed->getHeight(); y++ )
{
for( UInt x = 0; x < m_pcFrameProcessed->getWidth(); x++ )
for( unsigned int x = 0; x < m_pcFrameProcessed->getWidth(); x++ )
{
pixelImg = InputFrame->getPixel( x, y );
pixelMask = MaskFrame->getPixel( x, y );
@@ -107,7 +107,7 @@ PlaYUVerFrame* FrameMask::process( std::vector<PlaYUVerFrame*> apcFrameList )
return m_pcFrameProcessed;
}
Bool FrameMask::keyPressed( enum Module_Key_Supported value )
bool FrameMask::keyPressed( enum Module_Key_Supported value )
{
if( value == MODULE_KEY_UP && m_iWeight < 10 )
{
@@ -122,7 +122,7 @@ Bool FrameMask::keyPressed( enum Module_Key_Supported value )
return false;
}
Void FrameMask::destroy()
void FrameMask::destroy()
{
if( m_pcFrameProcessed )
{
+10 -10
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,24 +25,24 @@
#ifndef __FRAMEMASK_H__
#define __FRAMEMASK_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FrameMask : public PlaYUVerModuleIf
class FrameMask : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( FrameMask )
private:
Int m_iWeight;
PlaYUVerFrame* m_pcFrameProcessed;
int m_iWeight;
CalypFrame* m_pcFrameProcessed;
public:
FrameMask();
virtual ~FrameMask() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Bool keyPressed( enum Module_Key_Supported value );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
bool keyPressed( enum Module_Key_Supported value );
void destroy();
};
#endif // __FRAMEMASK_H__
+20 -20
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,14 +27,14 @@
FrameRotate::FrameRotate()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Utilities";
m_pchModuleLongName = "Rotation";
m_pchModuleName = "FrameRotate";
m_pchModuleTooltip = "Rotates frame";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "Angle", m_iAngle, "Angle to rotate (0, 90, 180, 270)" );
@@ -44,12 +44,12 @@ FrameRotate::FrameRotate()
m_pcFrameProcessed = NULL;
}
Bool FrameRotate::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FrameRotate::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
UInt iWidth;
UInt iHeight;
unsigned int iWidth;
unsigned int iHeight;
switch( m_iAngle )
{
@@ -67,23 +67,23 @@ Bool FrameRotate::create( std::vector<PlaYUVerFrame*> apcFrameList )
return false;
}
m_pcFrameProcessed = new PlaYUVerFrame( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
apcFrameList[0]->getBitsPel() );
m_pcFrameProcessed = new CalypFrame( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
apcFrameList[0]->getBitsPel() );
return true;
}
PlaYUVerFrame* FrameRotate::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FrameRotate::process( std::vector<CalypFrame*> apcFrameList )
{
PlaYUVerFrame* InputFrame = apcFrameList[0];
UInt inWidht = InputFrame->getWidth();
UInt inHeight = InputFrame->getHeight();
PlaYUVerPixel pixel;
UInt inX;
UInt inY;
CalypFrame* InputFrame = apcFrameList[0];
unsigned int inWidht = InputFrame->getWidth();
unsigned int inHeight = InputFrame->getHeight();
CalypPixel pixel;
unsigned int inX;
unsigned int inY;
for( UInt y = 0; y < m_pcFrameProcessed->getHeight(); y++ )
for( unsigned int y = 0; y < m_pcFrameProcessed->getHeight(); y++ )
{
for( UInt x = 0; x < m_pcFrameProcessed->getWidth(); x++ )
for( unsigned int x = 0; x < m_pcFrameProcessed->getWidth(); x++ )
{
inX = x;
inY = y;
@@ -109,7 +109,7 @@ PlaYUVerFrame* FrameRotate::process( std::vector<PlaYUVerFrame*> apcFrameList )
return m_pcFrameProcessed;
}
Void FrameRotate::destroy()
void FrameRotate::destroy()
{
if( m_pcFrameProcessed )
{
+9 -9
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,23 +25,23 @@
#ifndef __FRAMEROTATE_H__
#define __FRAMEROTATE_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FrameRotate : public PlaYUVerModuleIf
class FrameRotate : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( FrameRotate )
private:
Int m_iAngle;
PlaYUVerFrame* m_pcFrameProcessed;
int m_iAngle;
CalypFrame* m_pcFrameProcessed;
public:
FrameRotate();
virtual ~FrameRotate() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __FRAMEROTATE_H__
+26 -26
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,14 +27,14 @@
FrameShift::FrameShift()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Utilities";
m_pchModuleLongName = "Pixel Shift";
m_pchModuleName = "FrameShift";
m_pchModuleTooltip = "Shift frame horizontal and vertical";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS | MODULE_USES_KEYS;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS | CLP_MODULE_USES_KEYS;
m_cModuleOptions.addOptions() /**/
( "ShiftHorizontal", m_iShiftHor, "Amount of pixels to shift in horizontal direction" ) /**/
@@ -45,42 +45,42 @@ FrameShift::FrameShift()
m_iShiftVer = 0;
}
Bool FrameShift::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool FrameShift::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcProcessedFrame = new PlaYUVerFrame( apcFrameList[0] );
m_pcProcessedFrame = new CalypFrame( apcFrameList[0] );
return true;
}
PlaYUVerFrame* FrameShift::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* FrameShift::process( std::vector<CalypFrame*> apcFrameList )
{
Pel* pPelInput;
Pel* pPelOut;
ClpPel* pPelInput;
ClpPel* pPelOut;
m_pcProcessedFrame->clear();
m_pcProcessedFrame->reset();
for( UInt ch = 0; ch < m_pcProcessedFrame->getNumberChannels(); ch++ )
for( unsigned int ch = 0; ch < m_pcProcessedFrame->getNumberChannels(); ch++ )
{
UInt uiWidth = m_pcProcessedFrame->getWidth( ch );
UInt uiHeight = m_pcProcessedFrame->getHeight( ch );
unsigned int uiWidth = m_pcProcessedFrame->getWidth( ch );
unsigned int uiHeight = m_pcProcessedFrame->getHeight( ch );
Int iShiftHor = m_iShiftHor >> ( ch > 0 ? m_pcProcessedFrame->getChromaWidthRatio() : 0 );
Int iShiftVer = m_iShiftVer >> ( ch > 0 ? m_pcProcessedFrame->getChromaHeightRatio() : 0 );
int iShiftHor = m_iShiftHor >> ( ch > 0 ? m_pcProcessedFrame->getChromaWidthRatio() : 0 );
int iShiftVer = m_iShiftVer >> ( ch > 0 ? m_pcProcessedFrame->getChromaHeightRatio() : 0 );
UInt xStartIn = iShiftHor >= 0 ? 0 : -iShiftHor;
UInt yStartIn = iShiftVer >= 0 ? 0 : -iShiftVer;
unsigned int xStartIn = iShiftHor >= 0 ? 0 : -iShiftHor;
unsigned int yStartIn = iShiftVer >= 0 ? 0 : -iShiftVer;
UInt xStartOut = std::max( iShiftHor, 0 );
UInt xEndOut = std::min( uiWidth, uiWidth + iShiftHor );
unsigned int xStartOut = std::max( iShiftHor, 0 );
unsigned int xEndOut = std::min( uiWidth, uiWidth + iShiftHor );
UInt yStartOut = std::max( iShiftVer, 0 );
UInt yEndOut = std::min( uiHeight, uiHeight + iShiftVer );
unsigned int yStartOut = std::max( iShiftVer, 0 );
unsigned int yEndOut = std::min( uiHeight, uiHeight + iShiftVer );
for( UInt y = yStartOut, yIn = yStartIn; y < yEndOut; y++, yIn++ )
for( unsigned int y = yStartOut, yIn = yStartIn; y < yEndOut; y++, yIn++ )
{
pPelInput = &( apcFrameList[0]->getPelBufferYUV()[ch][yIn][xStartIn] );
pPelOut = &( m_pcProcessedFrame->getPelBufferYUV()[ch][y][xStartOut] );
for( UInt x = xStartOut; x < xEndOut; x++ )
for( unsigned int x = xStartOut; x < xEndOut; x++ )
{
*pPelOut = *pPelInput;
pPelInput++;
@@ -91,7 +91,7 @@ PlaYUVerFrame* FrameShift::process( std::vector<PlaYUVerFrame*> apcFrameList )
return m_pcProcessedFrame;
}
Bool FrameShift::keyPressed( enum Module_Key_Supported value )
bool FrameShift::keyPressed( enum Module_Key_Supported value )
{
if( value == MODULE_KEY_LEFT )
{
@@ -117,7 +117,7 @@ Bool FrameShift::keyPressed( enum Module_Key_Supported value )
return false;
}
Void FrameShift::destroy()
void FrameShift::destroy()
{
if( m_pcProcessedFrame )
delete m_pcProcessedFrame;
+11 -11
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,25 +25,25 @@
#ifndef __FRAMESHIFT_H__
#define __FRAMESHIFT_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class FrameShift : public PlaYUVerModuleIf
class FrameShift : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( FrameShift )
private:
PlaYUVerFrame* m_pcProcessedFrame;
Int m_iShiftHor;
Int m_iShiftVer;
CalypFrame* m_pcProcessedFrame;
int m_iShiftHor;
int m_iShiftVer;
public:
FrameShift();
virtual ~FrameShift() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Bool keyPressed( enum Module_Key_Supported value );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
bool keyPressed( enum Module_Key_Supported value );
void destroy();
};
#endif // __FrameShift_H__
+31 -35
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,77 +29,73 @@
InterFrameVariance::InterFrameVariance()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2; // Use API version 2 (recommended).
m_iModuleAPI = CLP_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 = "InterFrameVariance"; // Name
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_pchModuleLongName = "Variance across frames";
m_pchModuleTooltip = "Measure the variance across several frames";
m_uiNumberOfFrames = MODULE_REQUIRES_SEVERAL_FRAMES; // Number of Frames required (This module
// allows a variable number of inputs)
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW; // Module requirements
// (check
// PlaYUVerModulesIf.h).
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;
// Several requirements should be "or" between each others.
m_pcFrameVariance = NULL;
}
Bool InterFrameVariance::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool InterFrameVariance::create( std::vector<CalypFrame*> apcFrameList )
{
m_uiNumberOfFrames = Module_NumberOfFrames( apcFrameList.size() );
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE |
CalypFrame::MATCH_RESOLUTION |
CalypFrame::MATCH_BITS ) )
return false;
m_pcFrameVariance =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY, 8 );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, 8 );
getMem2D( &m_pVariance, apcFrameList[0]->getHeight(), apcFrameList[0]->getWidth() );
return true;
}
PlaYUVerFrame* InterFrameVariance::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* InterFrameVariance::process( std::vector<CalypFrame*> apcFrameList )
{
Int numFrames = apcFrameList.size();
int numFrames = apcFrameList.size();
Pel** pInput = new Pel*[numFrames];
Pel* pOutputPelYUV = m_pcFrameVariance->getPelBufferYUV()[0][0];
ClpPel** pInput = new ClpPel*[numFrames];
ClpPel* pOutputPelYUV = m_pcFrameVariance->getPelBufferYUV()[0][0];
for( Int i = 0; i < numFrames; i++ )
for( int i = 0; i < numFrames; i++ )
{
pInput[i] = apcFrameList[i]->getPelBufferYUV()[0][0];
}
Double maxVariance = 0;
for( UInt y = 0; y < m_pcFrameVariance->getHeight(); y++ )
for( UInt x = 0; x < m_pcFrameVariance->getWidth(); x++ )
double maxVariance = 0;
for( unsigned int y = 0; y < m_pcFrameVariance->getHeight(); y++ )
for( unsigned int x = 0; x < m_pcFrameVariance->getWidth(); x++ )
{
Int sum = 0;
Int v = 0;
int sum = 0;
int v = 0;
m_pVariance[y][x] = 0;
for( Int i = 0; i < numFrames; i++ )
for( int i = 0; i < numFrames; i++ )
{
v = *pInput[i]++;
sum += v;
m_pVariance[y][x] += v * v;
}
// Final result of the variance for one block
m_pVariance[y][x] -= Double( sum * sum ) / Double( numFrames );
m_pVariance[y][x] /= Double( numFrames );
m_pVariance[y][x] -= double( sum * sum ) / double( numFrames );
m_pVariance[y][x] /= double( numFrames );
if( m_pVariance[y][x] > maxVariance )
maxVariance = m_pVariance[y][x];
}
for( UInt y = 0; y < m_pcFrameVariance->getHeight(); y++ )
for( UInt x = 0; x < m_pcFrameVariance->getWidth(); x++ )
for( unsigned int y = 0; y < m_pcFrameVariance->getHeight(); y++ )
for( unsigned int x = 0; x < m_pcFrameVariance->getWidth(); x++ )
{
*pOutputPelYUV++ = m_pVariance[y][x] * 255 / maxVariance;
}
@@ -107,7 +103,7 @@ PlaYUVerFrame* InterFrameVariance::process( std::vector<PlaYUVerFrame*> apcFrame
return m_pcFrameVariance;
}
Void InterFrameVariance::destroy()
void InterFrameVariance::destroy()
{
if( m_pVariance )
freeMem2D( m_pVariance );
+10 -10
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -18,30 +18,30 @@
*/
/**
* \file InterFrameVariance.h
* \file interFrameVariance.h
* \brief Absolute Frame Difference module
*/
#ifndef __INTERFRAMEVARIANCE_H__
#define __INTERFRAMEVARIANCE_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class InterFrameVariance : public PlaYUVerModuleIf
class InterFrameVariance : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( InterFrameVariance )
private:
PlaYUVerFrame* m_pcFrameVariance;
Double** m_pVariance;
CalypFrame* m_pcFrameVariance;
double** m_pVariance;
public:
InterFrameVariance();
virtual ~InterFrameVariance() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __INTERFRAMEVARIANCE_H__
+13 -13
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,35 +27,35 @@
LumaAverage::LumaAverage()
{
/* Module Definition */
m_iModuleType = FRAME_MEASUREMENT_MODULE; // Apply module to the frames or to
m_iModuleType = CLP_FRAME_MEASUREMENT_MODULE; // Apply module to the frames or to
// the whole sequence.
// Currently only support for frame
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
m_pchModuleName = "LumaAverage"; // Name
m_pchModuleLongName = "Average"; // Long name
m_pchModuleTooltip = "Measure the average of luma component"; // Description
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME; // Number of Frames required
m_uiNumberOfFrames = 1; // Number of Frames required
// (ONE_FRAME, TWO_FRAMES,
// THREE_FRAMES)
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING; // Module requirements
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING; // Module requirements
// (check
// PlaYUVerModulesIf.h).
// CalypModulesIf.h).
// Several requirements should be "or" between each others.
}
Void LumaAverage::create( PlaYUVerFrame* frame ) {}
void LumaAverage::create( CalypFrame* frame ) {}
Double LumaAverage::measure( PlaYUVerFrame* frame )
double LumaAverage::measure( CalypFrame* frame )
{
Double average = 0;
Pel* pPel = frame->getPelBufferYUV()[0][0];
for( UInt y = 0; y < frame->getHeight(); y++ )
for( UInt x = 0; x < frame->getWidth(); x++ )
double average = 0;
ClpPel* pPel = frame->getPelBufferYUV()[0][0];
for( unsigned int y = 0; y < frame->getHeight(); y++ )
for( unsigned int x = 0; x < frame->getWidth(); x++ )
{
average += *pPel;
pPel++;
}
return average / Double( frame->getHeight() * frame->getWidth() );
return average / double( frame->getHeight() * frame->getWidth() );
}
Void LumaAverage::destroy() {}
void LumaAverage::destroy() {}
+7 -7
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,10 +25,10 @@
#ifndef __LUMAAVERAGE_H__
#define __LUMAAVERAGE_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class LumaAverage : public PlaYUVerModuleIf
class LumaAverage : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( LumaAverage )
@@ -36,9 +36,9 @@ private:
public:
LumaAverage();
virtual ~LumaAverage() {}
Void create( PlaYUVerFrame* );
Double measure( PlaYUVerFrame* );
Void destroy();
void create( CalypFrame* );
double measure( CalypFrame* );
void destroy();
};
#endif // __LUMAAVERAGE_H__
+21 -21
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -34,14 +34,14 @@ using cv::Scalar;
MeasureOpticalFlowDualTVL1::MeasureOpticalFlowDualTVL1()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Measurements";
m_pchModuleName = "MeasureOpticalFlowDualTVL1";
m_pchModuleLongName = "Optical flow based on DualTVL1";
m_pchModuleTooltip = "Measure optical flow";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 2;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "Show reconstruction", m_bShowReconstruction, "Show reconstructed frame instead of MVs [false]" );
@@ -50,19 +50,19 @@ MeasureOpticalFlowDualTVL1::MeasureOpticalFlowDualTVL1()
m_pcOutputFrame = NULL;
}
Bool MeasureOpticalFlowDualTVL1::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool MeasureOpticalFlowDualTVL1::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE |
CalypFrame::MATCH_RESOLUTION |
CalypFrame::MATCH_BITS ) )
return false;
m_iStep = 16;
m_cTvl1 = cv::createOptFlow_DualTVL1();
m_pcOutputFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
return true;
}
@@ -72,7 +72,7 @@ static inline bool isFlowCorrect( Point2f u )
return !cvIsNaN( u.x ) && !cvIsNaN( u.y ) && fabs( u.x ) < 1e9 && fabs( u.y ) < 1e9;
}
Void MeasureOpticalFlowDualTVL1::drawFlow()
void MeasureOpticalFlowDualTVL1::drawFlow()
{
Mat cvMatAfter;
m_pcFrameAfter->toMat( cvMatAfter, true );
@@ -82,7 +82,7 @@ Void MeasureOpticalFlowDualTVL1::drawFlow()
for( int x = m_iStep / 2; x < m_cvFlow.cols; x += m_iStep )
{
Point2f u( 0, 0 );
Double count = 0;
double count = 0;
for( int i = ( -m_iStep / 2 ); i < ( m_iStep / 2 ); i++ )
{
for( int j = ( -m_iStep / 2 ); j < ( m_iStep / 2 ); j++ )
@@ -105,16 +105,16 @@ Void MeasureOpticalFlowDualTVL1::drawFlow()
m_pcOutputFrame->fromMat( cvMatAfter );
}
Void MeasureOpticalFlowDualTVL1::compensateFlow()
void MeasureOpticalFlowDualTVL1::compensateFlow()
{
for( UInt c = 0; c < m_pcOutputFrame->getNumberChannels(); c++ )
for( unsigned int c = 0; c < m_pcOutputFrame->getNumberChannels(); c++ )
{
Pel** pPelPrev = m_pcFramePrev->getPelBufferYUV()[c];
Pel* pPelOut = m_pcOutputFrame->getPelBufferYUV()[c][0];
ClpPel** pPelPrev = m_pcFramePrev->getPelBufferYUV()[c];
ClpPel* pPelOut = m_pcOutputFrame->getPelBufferYUV()[c][0];
for( UInt y = 0; y < m_pcOutputFrame->getHeight( c ); y++ )
for( unsigned int y = 0; y < m_pcOutputFrame->getHeight( c ); y++ )
{
for( UInt x = 0; x < m_pcOutputFrame->getWidth( c ); x++ )
for( unsigned int x = 0; x < m_pcOutputFrame->getWidth( c ); x++ )
{
Point2f u = m_cvFlow( y, x );
Point p( x + u.x, y + u.y );
@@ -125,7 +125,7 @@ Void MeasureOpticalFlowDualTVL1::compensateFlow()
}
}
PlaYUVerFrame* MeasureOpticalFlowDualTVL1::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* MeasureOpticalFlowDualTVL1::process( std::vector<CalypFrame*> apcFrameList )
{
m_pcFrameAfter = apcFrameList[0];
m_pcFramePrev = apcFrameList[1];
@@ -145,7 +145,7 @@ PlaYUVerFrame* MeasureOpticalFlowDualTVL1::process( std::vector<PlaYUVerFrame*>
return m_pcOutputFrame;
}
Void MeasureOpticalFlowDualTVL1::destroy()
void MeasureOpticalFlowDualTVL1::destroy()
{
if( m_pcOutputFrame )
delete m_pcOutputFrame;
+14 -14
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -28,31 +28,31 @@
#include <opencv2/core/core.hpp>
#include <opencv2/video/video.hpp>
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class MeasureOpticalFlowDualTVL1 : public PlaYUVerModuleIf
class MeasureOpticalFlowDualTVL1 : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( MeasureOpticalFlowDualTVL1 )
private:
Bool m_bShowReconstruction;
Int m_iStep;
bool m_bShowReconstruction;
int m_iStep;
cv::Ptr<cv::DenseOpticalFlow> m_cTvl1;
cv::Mat_<cv::Point2f> m_cvFlow;
PlaYUVerFrame* m_pcFramePrev;
PlaYUVerFrame* m_pcFrameAfter;
PlaYUVerFrame* m_pcOutputFrame;
CalypFrame* m_pcFramePrev;
CalypFrame* m_pcFrameAfter;
CalypFrame* m_pcOutputFrame;
Void drawFlow();
Void compensateFlow();
void drawFlow();
void compensateFlow();
public:
MeasureOpticalFlowDualTVL1();
virtual ~MeasureOpticalFlowDualTVL1() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __MeasureOpticalFlowDualTVL1_H__
+29 -29
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -37,11 +37,11 @@ using cv::Scalar;
OpticalFlowModule::OpticalFlowModule()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "OpticalFlow";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 2;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULE_REQUIRES_NEW_WINDOW | CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "Show reconstruction", m_bShowReconstruction, "Show reconstructed frame instead of MVs [false]" );
@@ -50,18 +50,18 @@ OpticalFlowModule::OpticalFlowModule()
m_pcOutputFrame = NULL;
}
Bool OpticalFlowModule::commonCreate( std::vector<PlaYUVerFrame*> apcFrameList )
bool OpticalFlowModule::commonCreate( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE |
CalypFrame::MATCH_RESOLUTION |
CalypFrame::MATCH_BITS ) )
return false;
m_iStep = 16;
m_pcOutputFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
return true;
}
@@ -71,7 +71,7 @@ static inline bool isFlowCorrect( Point2f u )
return !cvIsNaN( u.x ) && !cvIsNaN( u.y ) && fabs( u.x ) < 1e9 && fabs( u.y ) < 1e9;
}
Void OpticalFlowModule::drawFlow()
void OpticalFlowModule::drawFlow()
{
Mat cvMatAfter;
m_pcFrameAfter->toMat( cvMatAfter, true );
@@ -81,7 +81,7 @@ Void OpticalFlowModule::drawFlow()
for( int x = m_iStep / 2; x < m_cvFlow.cols; x += m_iStep )
{
Point2f u( 0, 0 );
Double count = 0;
double count = 0;
for( int i = ( -m_iStep / 2 ); i < ( m_iStep / 2 ); i++ )
{
for( int j = ( -m_iStep / 2 ); j < ( m_iStep / 2 ); j++ )
@@ -104,16 +104,16 @@ Void OpticalFlowModule::drawFlow()
m_pcOutputFrame->fromMat( cvMatAfter );
}
Void OpticalFlowModule::compensateFlow()
void OpticalFlowModule::compensateFlow()
{
for( UInt c = 0; c < m_pcOutputFrame->getNumberChannels(); c++ )
for( unsigned int c = 0; c < m_pcOutputFrame->getNumberChannels(); c++ )
{
Pel** pPelPrev = m_pcFramePrev->getPelBufferYUV()[c];
Pel* pPelOut = m_pcOutputFrame->getPelBufferYUV()[c][0];
ClpPel** pPelPrev = m_pcFramePrev->getPelBufferYUV()[c];
ClpPel* pPelOut = m_pcOutputFrame->getPelBufferYUV()[c][0];
for( UInt y = 0; y < m_pcOutputFrame->getHeight( c ); y++ )
for( unsigned int y = 0; y < m_pcOutputFrame->getHeight( c ); y++ )
{
for( UInt x = 0; x < m_pcOutputFrame->getWidth( c ); x++ )
for( unsigned int x = 0; x < m_pcOutputFrame->getWidth( c ); x++ )
{
Point2f u = m_cvFlow( y, x );
Point p( x + u.x, y + u.y );
@@ -124,7 +124,7 @@ Void OpticalFlowModule::compensateFlow()
}
}
PlaYUVerFrame* OpticalFlowModule::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* OpticalFlowModule::process( std::vector<CalypFrame*> apcFrameList )
{
m_pcFrameAfter = apcFrameList[0];
m_pcFramePrev = apcFrameList[1];
@@ -144,7 +144,7 @@ PlaYUVerFrame* OpticalFlowModule::process( std::vector<PlaYUVerFrame*> apcFrameL
return m_pcOutputFrame;
}
Void OpticalFlowModule::destroy()
void OpticalFlowModule::destroy()
{
if( m_pcOutputFrame )
delete m_pcOutputFrame;
@@ -161,9 +161,9 @@ OpticalFlowDualTVL1::OpticalFlowDualTVL1()
m_pchModuleTooltip = "Measure optical flow using DualTVL1 method";
}
Bool OpticalFlowDualTVL1::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool OpticalFlowDualTVL1::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
m_cOpticalFlow = cv::createOptFlow_DualTVL1();
@@ -178,9 +178,9 @@ OpticalFlowSparseToDense::OpticalFlowSparseToDense()
m_pchModuleTooltip = "Measure optical flow using SparseToDense method";
}
Bool OpticalFlowSparseToDense::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool OpticalFlowSparseToDense::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
m_cOpticalFlow = cv::optflow::createOptFlow_SparseToDense();
@@ -195,9 +195,9 @@ OpticalFlowFarneback::OpticalFlowFarneback()
m_pchModuleTooltip = "Measure optical flow using Farneback method";
}
Bool OpticalFlowFarneback::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool OpticalFlowFarneback::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
m_cOpticalFlow = cv::optflow::createOptFlow_Farneback();
@@ -212,9 +212,9 @@ OpticalDeepFlow::OpticalDeepFlow()
m_pchModuleTooltip = "Measure optical flow using Farneback method";
}
Bool OpticalDeepFlow::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool OpticalDeepFlow::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
m_cOpticalFlow = cv::optflow::createOptFlow_DeepFlow();
+18 -18
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,28 +29,28 @@
#include <opencv2/core/core.hpp>
#include <opencv2/video/video.hpp>
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class OpticalFlowModule : public PlaYUVerModuleIf
class OpticalFlowModule : public CalypModuleIf
{
protected:
Bool m_bShowReconstruction;
Int m_iStep;
bool m_bShowReconstruction;
int m_iStep;
cv::Ptr<cv::DenseOpticalFlow> m_cOpticalFlow;
cv::Mat_<cv::Point2f> m_cvFlow;
PlaYUVerFrame* m_pcFramePrev;
PlaYUVerFrame* m_pcFrameAfter;
PlaYUVerFrame* m_pcOutputFrame;
Void drawFlow();
Void compensateFlow();
Bool commonCreate( std::vector<PlaYUVerFrame*> apcFrameList );
CalypFrame* m_pcFramePrev;
CalypFrame* m_pcFrameAfter;
CalypFrame* m_pcOutputFrame;
void drawFlow();
void compensateFlow();
bool commonCreate( std::vector<CalypFrame*> apcFrameList );
public:
OpticalFlowModule();
virtual ~OpticalFlowModule() {}
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
class OpticalFlowDualTVL1 : public OpticalFlowModule
@@ -59,7 +59,7 @@ class OpticalFlowDualTVL1 : public OpticalFlowModule
public:
OpticalFlowDualTVL1();
virtual ~OpticalFlowDualTVL1() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
};
class OpticalFlowSparseToDense : public OpticalFlowModule
@@ -68,7 +68,7 @@ class OpticalFlowSparseToDense : public OpticalFlowModule
public:
OpticalFlowSparseToDense();
virtual ~OpticalFlowSparseToDense() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
};
class OpticalFlowFarneback : public OpticalFlowModule
@@ -77,7 +77,7 @@ class OpticalFlowFarneback : public OpticalFlowModule
public:
OpticalFlowFarneback();
virtual ~OpticalFlowFarneback() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
};
class OpticalDeepFlow : public OpticalFlowModule
@@ -86,7 +86,7 @@ class OpticalDeepFlow : public OpticalFlowModule
public:
OpticalDeepFlow();
virtual ~OpticalDeepFlow() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
};
#endif // __OPTICALFLOW_H__
+19 -19
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -35,25 +35,25 @@ using namespace cv::saliency;
SaliencyDetectionModule::SaliencyDetectionModule()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Saliency";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW;
m_pcSaliencyFrame = NULL;
}
Bool SaliencyDetectionModule::commonCreate( std::vector<PlaYUVerFrame*> apcFrameList )
bool SaliencyDetectionModule::commonCreate( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcSaliencyFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
m_pcSaliencyFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
return true;
}
Bool SaliencyDetectionModule::commonProcess( std::vector<PlaYUVerFrame*> apcFrameList )
bool SaliencyDetectionModule::commonProcess( std::vector<CalypFrame*> apcFrameList )
{
Mat cvFrame;
if( !apcFrameList[0]->toMat( cvFrame, true ) )
@@ -64,7 +64,7 @@ Bool SaliencyDetectionModule::commonProcess( std::vector<PlaYUVerFrame*> apcFram
return m_ptrSaliencyAlgorithm->computeSaliency( cvFrame, m_matSaliency );
}
Void SaliencyDetectionModule::destroy()
void SaliencyDetectionModule::destroy()
{
if( m_pcSaliencyFrame )
delete m_pcSaliencyFrame;
@@ -77,7 +77,7 @@ SaliencyDetectionSpectral::SaliencyDetectionSpectral()
m_pchModuleLongName = "Spectral residual";
m_pchModuleTooltip = "Measure saliency using spectral residual method";
m_uiModuleRequirements = m_uiModuleRequirements | MODULE_REQUIRES_OPTIONS;
m_uiModuleRequirements = m_uiModuleRequirements | CLP_MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "Binary map", m_bBinaryMap, "Measure a binary saliency map [false]" );
@@ -85,9 +85,9 @@ SaliencyDetectionSpectral::SaliencyDetectionSpectral()
m_bBinaryMap = false;
}
Bool SaliencyDetectionSpectral::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool SaliencyDetectionSpectral::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
@@ -96,7 +96,7 @@ Bool SaliencyDetectionSpectral::create( std::vector<PlaYUVerFrame*> apcFrameList
return true;
}
PlaYUVerFrame* SaliencyDetectionSpectral::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* SaliencyDetectionSpectral::process( std::vector<CalypFrame*> apcFrameList )
{
if( commonProcess( apcFrameList ) )
{
@@ -125,16 +125,16 @@ SaliencyDetectionFineGrained::SaliencyDetectionFineGrained()
m_pchModuleTooltip = "Measure saliency using fine grained method";
}
Bool SaliencyDetectionFineGrained::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool SaliencyDetectionFineGrained::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
m_ptrSaliencyAlgorithm = cv::saliency::StaticSaliencyFineGrained::create();
return true;
}
PlaYUVerFrame* SaliencyDetectionFineGrained::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* SaliencyDetectionFineGrained::process( std::vector<CalypFrame*> apcFrameList )
{
if( commonProcess( apcFrameList ) )
m_pcSaliencyFrame->fromMat( m_matSaliency );
@@ -149,9 +149,9 @@ SaliencyDetectionBinWangApr2014::SaliencyDetectionBinWangApr2014()
m_pchModuleTooltip = "Measure saliency using a fast self-tuning background subtraction algorithm";
}
Bool SaliencyDetectionBinWangApr2014::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool SaliencyDetectionBinWangApr2014::create( std::vector<CalypFrame*> apcFrameList )
{
Bool bRet = commonCreate( apcFrameList );
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
m_ptrSaliencyAlgorithm = MotionSaliencyBinWangApr2014::create();
@@ -160,7 +160,7 @@ Bool SaliencyDetectionBinWangApr2014::create( std::vector<PlaYUVerFrame*> apcFra
return true;
}
PlaYUVerFrame* SaliencyDetectionBinWangApr2014::process( std::vector<PlaYUVerFrame*> apcFrameList )
CalypFrame* SaliencyDetectionBinWangApr2014::process( std::vector<CalypFrame*> apcFrameList )
{
if( commonProcess( apcFrameList ) )
{
+20 -20
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,36 +29,36 @@
#include <opencv2/core/core.hpp>
#include <opencv2/saliency.hpp>
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
/**
* \ingroup PlaYUVer_Modules
* @defgroup PlaYUVer_Modules_Saliency Saliency
* \ingroup Calyp_Modules
* @defgroup Calyp_Modules_Saliency Saliency
* @{
* Frame processing modules for saliency detection
* @}
*/
class SaliencyDetectionModule : public PlaYUVerModuleIf
class SaliencyDetectionModule : public CalypModuleIf
{
protected:
PlaYUVerFrame* m_pcSaliencyFrame;
CalypFrame* m_pcSaliencyFrame;
cv::Ptr<cv::saliency::Saliency> m_ptrSaliencyAlgorithm;
cv::Mat m_matSaliency;
Bool commonCreate( std::vector<PlaYUVerFrame*> apcFrameList );
Bool commonProcess( std::vector<PlaYUVerFrame*> apcFrameList );
bool commonCreate( std::vector<CalypFrame*> apcFrameList );
bool commonProcess( std::vector<CalypFrame*> apcFrameList );
public:
SaliencyDetectionModule();
virtual ~SaliencyDetectionModule() {}
Void destroy();
void destroy();
};
/**
* \ingroup PlaYUVer_Modules_Saliency
* \ingroup Calyp_Modules_Saliency
* \class SaliencyDetectionSpectral
* \brief Starting from the principle of natural image statistics,
* this method simulate the behavior of pre-attentive visual search.
@@ -73,17 +73,17 @@ class SaliencyDetectionSpectral : public SaliencyDetectionModule
{
REGISTER_CLASS_FACTORY( SaliencyDetectionSpectral )
private:
Bool m_bBinaryMap;
bool m_bBinaryMap;
public:
SaliencyDetectionSpectral();
virtual ~SaliencyDetectionSpectral() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
};
/**
* \ingroup PlaYUVer_Modules_Saliency
* \ingroup Calyp_Modules_Saliency
* \class SaliencyDetectionFineGrained
* \brief This method calculates saliency based on center-surround
* differences. High resolution saliency maps are generated in real
@@ -98,12 +98,12 @@ class SaliencyDetectionFineGrained : public SaliencyDetectionModule
public:
SaliencyDetectionFineGrained();
virtual ~SaliencyDetectionFineGrained() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
};
/**
* \ingroup PlaYUVer_Modules_Saliency
* \ingroup Calyp_Modules_Saliency
* \class SaliencyDetectionBinWangApr2014
* \brief Fast Self-tuning Background Subtraction Algorithm based on the work
* Wang and P. Dudek “A Fast Self-tuning Background Subtraction Algorithm”,
@@ -115,8 +115,8 @@ class SaliencyDetectionBinWangApr2014 : public SaliencyDetectionModule
public:
SaliencyDetectionBinWangApr2014();
virtual ~SaliencyDetectionBinWangApr2014() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
};
#endif // __SALIENCYDETECTION_H__
+14 -14
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -27,42 +27,42 @@
SetChromaHalfScale::SetChromaHalfScale()
{
/* Module Definition */
m_iModuleType = FRAME_PROCESSING_MODULE;
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Conversions";
m_pchModuleName = "SetChromaHalfScale";
m_pchModuleLongName = "Half scale chroma";
m_pchModuleTooltip = "Copy frame only keeping luma component";
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
m_pcProcessedFrame = NULL;
}
Void SetChromaHalfScale::create( PlaYUVerFrame* frame )
void SetChromaHalfScale::create( CalypFrame* frame )
{
m_pcProcessedFrame = NULL;
m_pcProcessedFrame =
new PlaYUVerFrame( frame->getWidth(), frame->getHeight(), frame->getPelFormat(), frame->getBitsPel() );
new CalypFrame( frame->getWidth(), frame->getHeight(), frame->getPelFormat(), frame->getBitsPel() );
}
PlaYUVerFrame* SetChromaHalfScale::process( PlaYUVerFrame* frame )
CalypFrame* SetChromaHalfScale::process( CalypFrame* frame )
{
Pel* pPelInput = frame->getPelBufferYUV()[LUMA][0];
Pel* pPelOut = m_pcProcessedFrame->getPelBufferYUV()[0][0];
Pel halfScaleValue = 1 << ( frame->getBitsPel() - 1 );
for( UInt i = 0; i < frame->getHeight() * frame->getWidth(); i++ )
ClpPel* pPelInput = frame->getPelBufferYUV()[CLP_LUMA][0];
ClpPel* pPelOut = m_pcProcessedFrame->getPelBufferYUV()[0][0];
ClpPel halfScaleValue = 1 << ( frame->getBitsPel() - 1 );
for( unsigned int i = 0; i < frame->getHeight() * frame->getWidth(); i++ )
{
*pPelOut++ = *pPelInput++;
}
pPelInput = frame->getPelBufferYUV()[CHROMA_U][0];
for( UInt i = 0; i < m_pcProcessedFrame->getChromaLength() * 2; i++ )
pPelInput = frame->getPelBufferYUV()[CLP_CHROMA_U][0];
for( unsigned int i = 0; i < m_pcProcessedFrame->getChromaLength() * 2; i++ )
{
*pPelOut++ = halfScaleValue;
}
return m_pcProcessedFrame;
}
Void SetChromaHalfScale::destroy()
void SetChromaHalfScale::destroy()
{
if( m_pcProcessedFrame )
delete m_pcProcessedFrame;
+8 -8
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,22 +25,22 @@
#ifndef _SETCHROMAHALFSCALE_H_
#define _SETCHROMAHALFSCALE_H_
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class SetChromaHalfScale : public PlaYUVerModuleIf
class SetChromaHalfScale : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( SetChromaHalfScale )
private:
PlaYUVerFrame* m_pcProcessedFrame;
CalypFrame* m_pcProcessedFrame;
public:
SetChromaHalfScale();
virtual ~SetChromaHalfScale() {}
Void create( PlaYUVerFrame* );
PlaYUVerFrame* process( PlaYUVerFrame* );
Void destroy();
void create( CalypFrame* );
CalypFrame* process( CalypFrame* );
void destroy();
};
#endif // _SETCHROMAHALFSCALE_H_
+27 -27
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -29,14 +29,14 @@
WeightedPSNR::WeightedPSNR()
{
/* Module Definition */
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_MEASUREMENT_MODULE;
m_iModuleAPI = CLP_MODULE_API_2;
m_iModuleType = CLP_FRAME_MEASUREMENT_MODULE;
m_pchModuleCategory = "Quality";
m_pchModuleName = "WeightedPSNR";
m_pchModuleLongName = "Weighted PSNR";
m_pchModuleTooltip = "Measure the weighted PSNR between two images";
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = MODULE_REQUIRES_THREE_FRAMES;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
m_uiNumberOfFrames = 3;
m_cModuleOptions.addOptions() /**/
( "Component", m_uiComponent, "Select the component to compute quality [0]" );
@@ -44,40 +44,40 @@ WeightedPSNR::WeightedPSNR()
m_uiComponent = 0;
}
Bool WeightedPSNR::create( std::vector<PlaYUVerFrame*> apcFrameList )
bool WeightedPSNR::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 0; i < apcFrameList.size(); i++ )
for( unsigned int i = 0; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_RESOLUTION ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_RESOLUTION ) )
return false;
}
if( apcFrameList[0]->getNumberChannels() != 1 )
{
return false;
}
for( UInt i = 1; i < apcFrameList.size(); i++ )
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt( apcFrameList[1], PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[1], CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_BITS ) )
return false;
}
return true;
}
Double measureWMSE( Int component, PlaYUVerFrame* Org, PlaYUVerFrame* Rec, PlaYUVerFrame* Mask )
double measureWMSE( int component, CalypFrame* Org, CalypFrame* Rec, CalypFrame* Mask )
{
Pel* pMaskPelYUV = Mask->getPelBufferYUV()[0][0];
Pel* pRecPelYUV = Rec->getPelBufferYUV()[component][0];
Pel* pOrgPelYUV = Org->getPelBufferYUV()[component][0];
ClpPel* pMaskPelYUV = Mask->getPelBufferYUV()[0][0];
ClpPel* pRecPelYUV = Rec->getPelBufferYUV()[component][0];
ClpPel* pOrgPelYUV = Org->getPelBufferYUV()[component][0];
Double aux_pel_1, aux_pel_2, aux_pel_mask;
Int diff = 0;
Double ssd = 0;
UInt count = 0;
double aux_pel_1, aux_pel_2, aux_pel_mask;
int diff = 0;
double ssd = 0;
unsigned int count = 0;
UInt numberOfPixels = 0;
if( component == LUMA )
unsigned int numberOfPixels = 0;
if( component == CLP_LUMA )
{
numberOfPixels = Org->getHeight() * Org->getWidth();
}
@@ -86,7 +86,7 @@ Double measureWMSE( Int component, PlaYUVerFrame* Org, PlaYUVerFrame* Rec, PlaYU
numberOfPixels = Rec->getChromaLength();
}
for( UInt i = 0; i < numberOfPixels; i++ )
for( unsigned int i = 0; i < numberOfPixels; i++ )
{
aux_pel_mask = *pMaskPelYUV++;
aux_pel_1 = *pRecPelYUV++;
@@ -99,17 +99,17 @@ Double measureWMSE( Int component, PlaYUVerFrame* Org, PlaYUVerFrame* Rec, PlaYU
{
return 0.0;
}
return ssd / Double( count );
return ssd / double( count );
}
Double WeightedPSNR::measure( std::vector<PlaYUVerFrame*> apcFrameList )
double WeightedPSNR::measure( std::vector<CalypFrame*> apcFrameList )
{
Double dPSNR = 100;
Double dMaxValue = ( 1 << apcFrameList[1]->getBitsPel() ) - 1;
Double dMSE = measureWMSE( m_uiComponent, apcFrameList[1], apcFrameList[2], apcFrameList[0] );
double dPSNR = 100;
double dMaxValue = ( 1 << apcFrameList[1]->getBitsPel() ) - 1;
double dMSE = measureWMSE( m_uiComponent, apcFrameList[1], apcFrameList[2], apcFrameList[0] );
if( dMSE != 0 )
dPSNR = 10 * log10( ( dMaxValue * dMaxValue ) / dMSE );
return dPSNR;
}
Void WeightedPSNR::destroy() {}
void WeightedPSNR::destroy() {}
+8 -8
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -25,22 +25,22 @@
#ifndef __WEIGHTEDPSNR_H__
#define __WEIGHTEDPSNR_H__
// PlaYUVerLib
#include "lib/PlaYUVerModuleIf.h"
// CalypLib
#include "lib/CalypModuleIf.h"
class WeightedPSNR : public PlaYUVerModuleIf
class WeightedPSNR : public CalypModuleIf
{
REGISTER_CLASS_FACTORY( WeightedPSNR )
private:
UInt m_uiComponent;
unsigned int m_uiComponent;
public:
WeightedPSNR();
virtual ~WeightedPSNR() {}
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
Double measure( std::vector<PlaYUVerFrame*> apcFrameList );
Void destroy();
bool create( std::vector<CalypFrame*> apcFrameList );
double measure( std::vector<CalypFrame*> apcFrameList );
void destroy();
};
#endif // __WEIGHTEDPSNR_H__