Fix warnings to build with Werror flag
This commit is contained in:
51 files changed
+338
-407
No files matched your search
@@ -70,6 +70,7 @@ ADD_MODULE_USE_OPENCV(SaliencyDetectionFineGrained "SaliencyDetection" VERSION 3
|
||||
ADD_MODULE_USE_OPENCV(SaliencyDetectionBinWangApr2014 "SaliencyDetection" VERSION 3.3.0 MODULES saliency)
|
||||
|
||||
ADD_MODULE_USE_OPENCV(FrameResampling "FrameResampling" VERSION 3.3.0 MODULES core)
|
||||
ADD_MODULE_USE_OPENCV(SaliencyBasedFiltering "SaliencyBasedFiltering" VERSION 3.1.0 MODULES core)
|
||||
|
||||
ADD_MODULE_USE_OPENCV(ThreeSixtySpatialtoTemporal "ThreeSixtySpatialtoTemporal" VERSION 3.1.0 MODULES core)
|
||||
ADD_MODULE_USE_OPENCV(ThreeSixtyFaceExtraction "ThreeSixtyFaceExtraction" VERSION 3.1.0 MODULES core)
|
||||
|
||||
@@ -80,26 +80,24 @@ bool FrameResampling::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
m_iHeight = apcFrameList[0]->getHeight() * double( m_iWidth ) / double( apcFrameList[0]->getWidth() );
|
||||
}
|
||||
m_pcOutputFrame = new CalypFrame( m_iWidth, m_iHeight, apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() );
|
||||
return m_pcOutputFrame;
|
||||
m_resamplingFrame = std::make_unique<CalypFrame>( m_iWidth, m_iHeight, apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() );
|
||||
return true;
|
||||
}
|
||||
|
||||
CalypFrame* FrameResampling::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
m_pcOutputFrame->reset();
|
||||
m_resamplingFrame->reset();
|
||||
for( unsigned ch = 0; ch < apcFrameList[0]->getNumberChannels(); ch++ )
|
||||
{
|
||||
Mat inputFrame, outputFrame;
|
||||
cv::Size outSize( m_pcOutputFrame->getWidth( ch ), m_pcOutputFrame->getHeight( ch ) );
|
||||
cv::Size outSize( m_resamplingFrame->getWidth( ch ), m_resamplingFrame->getHeight( ch ) );
|
||||
apcFrameList[0]->toMat( inputFrame, true, false, ch );
|
||||
cv::resize( inputFrame, outputFrame, outSize, 0, 0, m_iInterpolation );
|
||||
m_pcOutputFrame->fromMat( outputFrame, ch );
|
||||
m_resamplingFrame->fromMat( outputFrame, ch );
|
||||
}
|
||||
return m_pcOutputFrame;
|
||||
return m_resamplingFrame.get();
|
||||
}
|
||||
|
||||
void FrameResampling::destroy()
|
||||
{
|
||||
if( m_pcOutputFrame )
|
||||
delete m_pcOutputFrame;
|
||||
}
|
||||
@@ -43,6 +43,7 @@ private:
|
||||
int m_iWidth;
|
||||
int m_iHeight;
|
||||
int m_iInterpolation;
|
||||
std::unique_ptr<CalypFrame> m_resamplingFrame;
|
||||
|
||||
public:
|
||||
FrameResampling();
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "lib/LibMemory.h"
|
||||
|
||||
HEVCIntraPrediction::HEVCIntraPrediction()
|
||||
{
|
||||
/* Module Definition */
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include "InterFrameVariance.h"
|
||||
|
||||
#include "lib/LibMemory.h"
|
||||
|
||||
InterFrameVariance::InterFrameVariance()
|
||||
{
|
||||
/* Module Definition */
|
||||
@@ -56,7 +54,8 @@ bool InterFrameVariance::create( std::vector<CalypFrame*> apcFrameList )
|
||||
|
||||
m_pcFrameVariance =
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, 8 );
|
||||
getMem2D( &m_pVariance, apcFrameList[0]->getHeight(), apcFrameList[0]->getWidth() );
|
||||
|
||||
m_pVariance = CalypPlane<double>{ apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight() };
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -105,9 +104,6 @@ CalypFrame* InterFrameVariance::process( std::vector<CalypFrame*> apcFrameList )
|
||||
|
||||
void InterFrameVariance::destroy()
|
||||
{
|
||||
if( m_pVariance )
|
||||
freeMem2D( m_pVariance );
|
||||
m_pVariance = NULL;
|
||||
if( m_pcFrameVariance )
|
||||
delete m_pcFrameVariance;
|
||||
m_pcFrameVariance = NULL;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
// CalypLib
|
||||
#include "lib/CalypModuleIf.h"
|
||||
#include "lib/CalypPlane.h"
|
||||
|
||||
class InterFrameVariance : public CalypModuleIf
|
||||
{
|
||||
@@ -34,7 +35,7 @@ class InterFrameVariance : public CalypModuleIf
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcFrameVariance;
|
||||
double** m_pVariance;
|
||||
CalypPlane<double> m_pVariance;
|
||||
|
||||
public:
|
||||
InterFrameVariance();
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "lib/LibMemory.h"
|
||||
|
||||
OptimiseDisplay::OptimiseDisplay()
|
||||
{
|
||||
/* Module Definition */
|
||||
@@ -53,11 +51,11 @@ bool OptimiseDisplay::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
|
||||
m_pcOptimisedFrame = new CalypFrame{ apcFrameList[0]->getWidth(),
|
||||
apcFrameList[0]->getHeight(),
|
||||
apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel(),
|
||||
apcFrameList[0]->getHasNegativeValues() };
|
||||
m_pcOptimisedFrame = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(),
|
||||
apcFrameList[0]->getHeight(),
|
||||
apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel(),
|
||||
apcFrameList[0]->getHasNegativeValues() );
|
||||
m_pcOptimisedFrame->reset();
|
||||
|
||||
return true;
|
||||
@@ -95,11 +93,9 @@ CalypFrame* OptimiseDisplay::process( std::vector<CalypFrame*> apcFrameList )
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_pcOptimisedFrame;
|
||||
return m_pcOptimisedFrame.get();
|
||||
}
|
||||
|
||||
void OptimiseDisplay::destroy()
|
||||
{
|
||||
delete m_pcOptimisedFrame;
|
||||
m_pcOptimisedFrame = nullptr;
|
||||
}
|
||||
@@ -34,14 +34,14 @@ class OptimiseDisplay : public CalypModuleIf
|
||||
REGISTER_CLASS_FACTORY( OptimiseDisplay )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcOptimisedFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcOptimisedFrame;
|
||||
|
||||
public:
|
||||
OptimiseDisplay();
|
||||
virtual ~OptimiseDisplay() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
bool create( std::vector<CalypFrame*> apcFrameList ) final;
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList ) final;
|
||||
void destroy() final;
|
||||
};
|
||||
|
||||
#endif // __OPTIMISEDISPLAY_H__
|
||||
@@ -32,55 +32,61 @@
|
||||
SaliencyBasedFiltering::SaliencyBasedFiltering()
|
||||
{
|
||||
/* 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 = "Quality";
|
||||
m_pchModuleName = "SaliencyBasedFiltering";
|
||||
m_pchModuleTooltip = "Image filter based on a map";
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
|
||||
m_uiNumberOfFrames = 2;
|
||||
|
||||
m_pcProcessedFrame = NULL;
|
||||
}
|
||||
|
||||
Bool SaliencyBasedFiltering::create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
bool SaliencyBasedFiltering::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
|
||||
for( UInt i = 0; i < apcFrameList.size(); i++ )
|
||||
for( unsigned 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[1]->getNumberChannels() != 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_pcProcessedFrame = new PlaYUVerFrame( apcFrameList[0] );
|
||||
|
||||
m_pcProcessedFrame = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(),
|
||||
apcFrameList[0]->getHeight(),
|
||||
apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel(),
|
||||
apcFrameList[0]->getHasNegativeValues() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static cv::Mat* getCvFrame( Pel* pInputPel, UInt uiWidth, UInt uiHeight )
|
||||
static cv::Mat* getCvFrame( ClpPel* pInputPel, unsigned uiWidth, unsigned uiHeight )
|
||||
{
|
||||
cv::Mat* cvInput = new cv::Mat( uiHeight, uiWidth, CV_MAKETYPE( CV_8U, 1 ) );
|
||||
UChar* pCvPel = cvInput->data;
|
||||
for( UInt i = 0; i < uiWidth * uiHeight; i++ )
|
||||
unsigned char* pCvPel = cvInput->data;
|
||||
for( unsigned i = 0; i < uiWidth * uiHeight; i++ )
|
||||
{
|
||||
*pCvPel++ = *pInputPel++;
|
||||
}
|
||||
return cvInput;
|
||||
}
|
||||
|
||||
static cv::Mat* filterframe( cv::Mat* cvFrame, UInt kernelSize )
|
||||
static cv::Mat* filterframe( cv::Mat* cvFrame, unsigned kernelSize )
|
||||
{
|
||||
cv::Mat* cvFiltered = new cv::Mat( cvFrame->rows, cvFrame->cols, CV_MAKETYPE( CV_8U, 1 ) );
|
||||
/// Initialize arguments for the filter
|
||||
cv::Point anchor = cv::Point( -1, -1 );
|
||||
Double delta = 0;
|
||||
Int ddepth = -1;
|
||||
double delta = 0;
|
||||
int ddepth = -1;
|
||||
|
||||
/// Update kernel size for a normalized box filter
|
||||
cv::Mat kernel = cv::Mat::ones( kernelSize, kernelSize, CV_32F ) / (Double)( kernelSize * kernelSize );
|
||||
cv::Mat kernel = cv::Mat::ones( kernelSize, kernelSize, CV_32F ) / static_cast<double>( kernelSize * kernelSize );
|
||||
|
||||
/// Apply filter
|
||||
cv::filter2D( *cvFrame, *cvFiltered, ddepth, kernel, anchor, delta, cv::BORDER_DEFAULT );
|
||||
@@ -88,44 +94,42 @@ static cv::Mat* filterframe( cv::Mat* cvFrame, UInt kernelSize )
|
||||
return cvFiltered;
|
||||
}
|
||||
|
||||
static void filterComponent( PlaYUVerFrame* pInput, PlaYUVerFrame* pOutput, PlaYUVerFrame* Map, UInt uiComp )
|
||||
static void filterComponent( CalypFrame* pInput, CalypFrame* pOutput, CalypFrame* Map, unsigned uiComp )
|
||||
{
|
||||
Pel* pMapPel = Map->getPelBufferYUV()[0][0];
|
||||
Int iMapStep = 1;
|
||||
Pel* pInputPel = pInput->getPelBufferYUV()[uiComp][0];
|
||||
Pel* pOutputPel = pOutput->getPelBufferYUV()[uiComp][0];
|
||||
Int iHeight = pInput->getHeight();
|
||||
Int iWidth = pInput->getWidth();
|
||||
ClpPel* pMapPel = Map->getPelBufferYUV()[0][0];
|
||||
int iMapStep = 1;
|
||||
ClpPel* pInputPel = pInput->getPelBufferYUV()[uiComp][0];
|
||||
ClpPel* pOutputPel = pOutput->getPelBufferYUV()[uiComp][0];
|
||||
std::int64_t iHeight = pInput->getHeight( uiComp );
|
||||
std::int64_t iWidth = pInput->getWidth( uiComp );
|
||||
|
||||
if( uiComp > 0 )
|
||||
{
|
||||
iHeight = pInput->getChromaHeight();
|
||||
iWidth = pInput->getChromaWidth();
|
||||
iMapStep = 2;
|
||||
}
|
||||
|
||||
cv::Mat* cvInput = getCvFrame( pInputPel, iWidth, iHeight );
|
||||
|
||||
UInt numberFilters = 1;
|
||||
UChar* pCvPel[3];
|
||||
unsigned numberFilters = 1;
|
||||
unsigned char* pCvPel[3];
|
||||
cv::Mat* cvOutput[3];
|
||||
for( UInt i = 0; i < numberFilters; i++ )
|
||||
for( unsigned i = 0; i < numberFilters; i++ )
|
||||
{
|
||||
cvOutput[i] = filterframe( cvInput, ( 1 << ( 2 * i + 7 ) ) + 1 );
|
||||
pCvPel[i] = cvOutput[i]->data;
|
||||
}
|
||||
|
||||
Int iCheckNeighbour = 8;
|
||||
UInt uiRelevance = 0;
|
||||
for( Int y = 0; y < iHeight; y++ )
|
||||
int iCheckNeighbour = 8;
|
||||
unsigned uiRelevance = 0;
|
||||
for( int y = 0; y < iHeight; y++ )
|
||||
{
|
||||
for( Int x = 0; x < iWidth; x++ )
|
||||
for( int x = 0; x < iWidth; x++ )
|
||||
{
|
||||
uiRelevance = 0;
|
||||
// uiRelevance = *pMapPel;
|
||||
for( Int j = CLAMP_RANGE( y - iCheckNeighbour, 0, iHeight ); j < CLAMP_RANGE( y + iCheckNeighbour + 1, 0, iHeight ); j++ )
|
||||
for( std::int64_t j = CLAMP_RANGE( y - iCheckNeighbour, 0, iHeight ); j < CLAMP_RANGE( y + iCheckNeighbour + 1, 0, iHeight ); j++ )
|
||||
{
|
||||
for( Int i = CLAMP_RANGE( x - iCheckNeighbour, 0, iWidth ); i < CLAMP_RANGE( x + iCheckNeighbour + 1, 0, iWidth ); i++ )
|
||||
for( std::int64_t i = CLAMP_RANGE( x - iCheckNeighbour, 0, iWidth ); i < CLAMP_RANGE( x + iCheckNeighbour + 1, 0, iWidth ); i++ )
|
||||
{
|
||||
uiRelevance += *( pMapPel + ( ( j - y ) * iWidth ) + ( i - x ) );
|
||||
}
|
||||
@@ -141,7 +145,7 @@ static void filterComponent( PlaYUVerFrame* pInput, PlaYUVerFrame* pOutput, PlaY
|
||||
//*pOutputPel = 0;
|
||||
}
|
||||
|
||||
for( UInt i = 0; i < numberFilters; i++ )
|
||||
for( unsigned i = 0; i < numberFilters; i++ )
|
||||
pCvPel[i]++;
|
||||
pInputPel++;
|
||||
pOutputPel++;
|
||||
@@ -151,16 +155,16 @@ static void filterComponent( PlaYUVerFrame* pInput, PlaYUVerFrame* pOutput, PlaY
|
||||
}
|
||||
}
|
||||
|
||||
PlaYUVerFrame* SaliencyBasedFiltering::process( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
CalypFrame* SaliencyBasedFiltering::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
PlaYUVerFrame* pcInputFrame = apcFrameList[0];
|
||||
CalypFrame* pcInputFrame = apcFrameList[0];
|
||||
|
||||
for( UInt c = 0; c < pcInputFrame->getNumberChannels(); c++ )
|
||||
filterComponent( pcInputFrame, m_pcProcessedFrame, apcFrameList[1], c );
|
||||
for( unsigned c = 0; c < pcInputFrame->getNumberChannels(); c++ )
|
||||
filterComponent( pcInputFrame, m_pcProcessedFrame.get(), apcFrameList[1], c );
|
||||
|
||||
return m_pcProcessedFrame;
|
||||
return m_pcProcessedFrame.get();
|
||||
}
|
||||
|
||||
Void SaliencyBasedFiltering::destroy()
|
||||
void SaliencyBasedFiltering::destroy()
|
||||
{
|
||||
}
|
||||
@@ -24,25 +24,21 @@
|
||||
#ifndef __SALIENCYBASEDFILTERING_H__
|
||||
#define __SALIENCYBASEDFILTERING_H__
|
||||
|
||||
#include <cassert>
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
#include "lib/PlaYUVerModuleIf.h"
|
||||
|
||||
class SaliencyBasedFiltering : public PlaYUVerModuleIf
|
||||
class SaliencyBasedFiltering : public CalypModuleIf
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( SaliencyBasedFiltering )
|
||||
|
||||
private:
|
||||
PlaYUVerFrame* m_pcProcessedFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcProcessedFrame;
|
||||
|
||||
public:
|
||||
SaliencyBasedFiltering();
|
||||
virtual ~SaliencyBasedFiltering()
|
||||
{
|
||||
}
|
||||
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
Void destroy();
|
||||
virtual ~SaliencyBasedFiltering() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
};
|
||||
|
||||
#endif // __SALIENCYBASEDFILTERING_H__
|
||||
@@ -45,7 +45,6 @@ SaliencyDetectionModule::SaliencyDetectionModule()
|
||||
|
||||
void SaliencyDetectionModule::destroy_using_opencv()
|
||||
{
|
||||
delete m_pcvSaliency;
|
||||
}
|
||||
|
||||
SaliencyDetectionSpectral::SaliencyDetectionSpectral()
|
||||
@@ -63,17 +62,17 @@ SaliencyDetectionSpectral::SaliencyDetectionSpectral()
|
||||
m_bBinaryMap = false;
|
||||
}
|
||||
|
||||
cv::Mat* SaliencyDetectionSpectral::create_using_opencv( std::vector<Mat*> apcMatList )
|
||||
cv::Mat* SaliencyDetectionSpectral::create_using_opencv( const std::vector<Mat>& apcMatList )
|
||||
{
|
||||
m_ptrSaliencyAlgorithm = StaticSaliencySpectralResidual::create();
|
||||
m_pcvSaliency = new Mat( apcMatList[0]->rows, apcMatList[0]->cols, CV_8UC1 );
|
||||
return m_pcvSaliency;
|
||||
m_pcvSaliency = std::make_unique<Mat>( apcMatList[0].rows, apcMatList[0].cols, CV_8UC1 );
|
||||
return m_pcvSaliency.get();
|
||||
}
|
||||
|
||||
Mat* SaliencyDetectionSpectral::process_using_opencv( std::vector<Mat*> apcMatList )
|
||||
Mat* SaliencyDetectionSpectral::process_using_opencv( const std::vector<Mat>& apcMatList )
|
||||
{
|
||||
Mat cvSaliency;
|
||||
m_ptrSaliencyAlgorithm->computeSaliency( *apcMatList[0], cvSaliency );
|
||||
m_ptrSaliencyAlgorithm->computeSaliency( apcMatList[0], cvSaliency );
|
||||
Mat cvBinaryMap;
|
||||
StaticSaliencySpectralResidual spec;
|
||||
spec.computeBinaryMap( cvSaliency, *m_pcvSaliency );
|
||||
@@ -82,7 +81,7 @@ Mat* SaliencyDetectionSpectral::process_using_opencv( std::vector<Mat*> apcMatLi
|
||||
cvSaliency *= 255;
|
||||
cvSaliency.convertTo( *m_pcvSaliency, CV_8UC1 );
|
||||
}
|
||||
return m_pcvSaliency;
|
||||
return m_pcvSaliency.get();
|
||||
}
|
||||
|
||||
SaliencyDetectionFineGrained::SaliencyDetectionFineGrained()
|
||||
@@ -93,17 +92,17 @@ SaliencyDetectionFineGrained::SaliencyDetectionFineGrained()
|
||||
m_pchModuleTooltip = "Measure saliency using fine grained method";
|
||||
}
|
||||
|
||||
Mat* SaliencyDetectionFineGrained::create_using_opencv( std::vector<Mat*> apcMatList )
|
||||
Mat* SaliencyDetectionFineGrained::create_using_opencv( const std::vector<Mat>& apcMatList )
|
||||
{
|
||||
m_ptrSaliencyAlgorithm = cv::saliency::StaticSaliencyFineGrained::create();
|
||||
m_pcvSaliency = new Mat( apcMatList[0]->rows, apcMatList[0]->cols, CV_8UC1 );
|
||||
return m_pcvSaliency;
|
||||
m_pcvSaliency = std::make_unique<Mat>( apcMatList[0].rows, apcMatList[0].cols, CV_8UC1 );
|
||||
return m_pcvSaliency.get();
|
||||
}
|
||||
|
||||
Mat* SaliencyDetectionFineGrained::process_using_opencv( std::vector<Mat*> apcMatList )
|
||||
Mat* SaliencyDetectionFineGrained::process_using_opencv( const std::vector<Mat>& apcMatList )
|
||||
{
|
||||
m_ptrSaliencyAlgorithm->computeSaliency( *apcMatList[0], *m_pcvSaliency );
|
||||
return m_pcvSaliency;
|
||||
m_ptrSaliencyAlgorithm->computeSaliency( apcMatList[0], *m_pcvSaliency );
|
||||
return m_pcvSaliency.get();
|
||||
}
|
||||
|
||||
SaliencyDetectionBinWangApr2014::SaliencyDetectionBinWangApr2014()
|
||||
@@ -114,22 +113,22 @@ SaliencyDetectionBinWangApr2014::SaliencyDetectionBinWangApr2014()
|
||||
m_pchModuleTooltip = "Measure saliency using a fast self-tuning background subtraction algorithm";
|
||||
}
|
||||
|
||||
Mat* SaliencyDetectionBinWangApr2014::create_using_opencv( std::vector<Mat*> apcMatList )
|
||||
Mat* SaliencyDetectionBinWangApr2014::create_using_opencv( const std::vector<Mat>& apcMatList )
|
||||
{
|
||||
m_ptrSaliencyAlgorithm = MotionSaliencyBinWangApr2014::create();
|
||||
m_ptrSaliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->setImagesize( apcMatList[0]->cols, apcMatList[0]->rows );
|
||||
m_ptrSaliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->setImagesize( apcMatList[0].cols, apcMatList[0].rows );
|
||||
m_ptrSaliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->init();
|
||||
m_pcvSaliency = new Mat( apcMatList[0]->rows, apcMatList[0]->cols, CV_8UC1 );
|
||||
return m_pcvSaliency;
|
||||
m_pcvSaliency = std::make_unique<Mat>( apcMatList[0].rows, apcMatList[0].cols, CV_8UC1 );
|
||||
return m_pcvSaliency.get();
|
||||
}
|
||||
|
||||
Mat* SaliencyDetectionBinWangApr2014::process_using_opencv( std::vector<Mat*> apcMatList )
|
||||
Mat* SaliencyDetectionBinWangApr2014::process_using_opencv( const std::vector<Mat>& apcMatList )
|
||||
{
|
||||
if( m_ptrSaliencyAlgorithm->computeSaliency( *apcMatList[0], *m_pcvSaliency ) )
|
||||
if( m_ptrSaliencyAlgorithm->computeSaliency( apcMatList[0], *m_pcvSaliency ) )
|
||||
{
|
||||
*m_pcvSaliency *= 255;
|
||||
m_pcvSaliency->convertTo( *m_pcvSaliency, CV_8UC1 );
|
||||
//cv::cvtColor(m_matSaliency, m_matSaliency, cv::COLOR_BGR2GRAY);
|
||||
}
|
||||
return m_pcvSaliency;
|
||||
return m_pcvSaliency.get();
|
||||
}
|
||||
@@ -32,8 +32,6 @@
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/saliency.hpp>
|
||||
|
||||
using cv::Mat;
|
||||
|
||||
/**
|
||||
* \ingroup Calyp_Modules
|
||||
* @defgroup Calyp_Modules_Saliency Saliency
|
||||
@@ -44,8 +42,10 @@ using cv::Mat;
|
||||
|
||||
class SaliencyDetectionModule : public CalypOpenCVModuleIf
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
protected:
|
||||
Mat* m_pcvSaliency;
|
||||
std::unique_ptr<Mat> m_pcvSaliency;
|
||||
cv::Ptr<cv::saliency::Saliency> m_ptrSaliencyAlgorithm;
|
||||
|
||||
public:
|
||||
@@ -68,6 +68,8 @@ public:
|
||||
*/
|
||||
class SaliencyDetectionSpectral : public SaliencyDetectionModule
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
REGISTER_CLASS_FACTORY( SaliencyDetectionSpectral )
|
||||
private:
|
||||
bool m_bBinaryMap;
|
||||
@@ -75,8 +77,8 @@ private:
|
||||
public:
|
||||
SaliencyDetectionSpectral();
|
||||
virtual ~SaliencyDetectionSpectral() {}
|
||||
Mat* create_using_opencv( std::vector<Mat*> apcMatList );
|
||||
Mat* process_using_opencv( std::vector<Mat*> apcMatList );
|
||||
Mat* create_using_opencv( const std::vector<Mat>& apcMatList ) override;
|
||||
Mat* process_using_opencv( const std::vector<Mat>& apcMatList ) override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -91,12 +93,14 @@ public:
|
||||
*/
|
||||
class SaliencyDetectionFineGrained : public SaliencyDetectionModule
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
REGISTER_CLASS_FACTORY( SaliencyDetectionFineGrained )
|
||||
public:
|
||||
SaliencyDetectionFineGrained();
|
||||
virtual ~SaliencyDetectionFineGrained() {}
|
||||
Mat* create_using_opencv( std::vector<Mat*> apcMatList );
|
||||
Mat* process_using_opencv( std::vector<Mat*> apcMatList );
|
||||
Mat* create_using_opencv( const std::vector<Mat>& apcMatList ) override;
|
||||
Mat* process_using_opencv( const std::vector<Mat>& apcMatList ) override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -108,12 +112,14 @@ public:
|
||||
*/
|
||||
class SaliencyDetectionBinWangApr2014 : public SaliencyDetectionModule
|
||||
{
|
||||
using Mat = cv::Mat;
|
||||
|
||||
REGISTER_CLASS_FACTORY( SaliencyDetectionBinWangApr2014 )
|
||||
public:
|
||||
SaliencyDetectionBinWangApr2014();
|
||||
virtual ~SaliencyDetectionBinWangApr2014() {}
|
||||
Mat* create_using_opencv( std::vector<Mat*> apcMatList );
|
||||
Mat* process_using_opencv( std::vector<Mat*> apcMatList );
|
||||
Mat* create_using_opencv( const std::vector<Mat>& apcMatList ) override;
|
||||
Mat* process_using_opencv( const std::vector<Mat>& apcMatList ) override;
|
||||
};
|
||||
|
||||
#endif // __SALIENCYDETECTION_H__
|
||||
@@ -75,7 +75,7 @@ ThreeSixtyDownsampling::ThreeSixtyDownsampling()
|
||||
m_bForceIntSlope = 0;
|
||||
m_iRearrange = 0;
|
||||
m_iWidth = -1;
|
||||
m_pcOutputFrame = NULL;
|
||||
m_pcResultedFrame = NULL;
|
||||
m_pcDownsampled = NULL;
|
||||
m_dPixelRatio = 0;
|
||||
|
||||
@@ -589,17 +589,17 @@ bool ThreeSixtyDownsampling::createDownsamplingMask( CalypFrame* pcInputFrame )
|
||||
switch( m_uiDownsampling )
|
||||
{
|
||||
case 0:
|
||||
m_pcOutputFrame = new CalypFrame( m_pcDownsampled->getWidth(), m_pcDownsampled->getHeight(), pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
|
||||
m_pcResultedFrame = new CalypFrame( m_pcDownsampled->getWidth(), m_pcDownsampled->getHeight(), pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
|
||||
break;
|
||||
case 1:
|
||||
m_pcOutputFrame = new CalypFrame( m_cvReshapePoints[0]->cols, m_cvReshapePoints[0]->rows, pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
|
||||
m_pcResultedFrame = new CalypFrame( m_cvReshapePoints[0]->cols, m_cvReshapePoints[0]->rows, pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
|
||||
break;
|
||||
case 2:
|
||||
m_pcOutputFrame = new CalypFrame{ pcInputFrame->getWidth(),
|
||||
pcInputFrame->getHeight(),
|
||||
pcInputFrame->getPelFormat(),
|
||||
pcInputFrame->getBitsPel(),
|
||||
pcInputFrame->getHasNegativeValues() };
|
||||
m_pcResultedFrame = new CalypFrame{ pcInputFrame->getWidth(),
|
||||
pcInputFrame->getHeight(),
|
||||
pcInputFrame->getPelFormat(),
|
||||
pcInputFrame->getBitsPel(),
|
||||
pcInputFrame->getHasNegativeValues() };
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
@@ -609,7 +609,7 @@ void ThreeSixtyDownsampling::downsamplingOperation( CalypFrame* pcInputFrame )
|
||||
{
|
||||
unsigned numBytes = m_pcDownsampled->getBitsPel() > 8 ? 2 : 1;
|
||||
m_pcDownsampled->reset();
|
||||
m_pcOutputFrame->reset();
|
||||
m_pcResultedFrame->reset();
|
||||
for( unsigned ch = 0; ch < m_pcDownsampled->getNumberChannels(); ch++ )
|
||||
{
|
||||
int imH = int( m_pcDownsampled->getHeight( ch ) );
|
||||
@@ -640,12 +640,12 @@ void ThreeSixtyDownsampling::downsamplingOperation( CalypFrame* pcInputFrame )
|
||||
}
|
||||
Mat_<Point> reshapePoints = *( m_cvReshapePoints[ch] );
|
||||
ClpPel** downSampPelBuff = m_pcDownsampled->getPelBufferYUV()[ch];
|
||||
ClpPel* pelOutputPtr = m_pcOutputFrame->getPelBufferYUV()[ch][0];
|
||||
ClpPel* pelOutputPtr = m_pcResultedFrame->getPelBufferYUV()[ch][0];
|
||||
|
||||
Mat outputMask( m_pcOutputFrame->getHeight( ch ), m_pcOutputFrame->getWidth( ch ), CV_8UC1, Scalar( 1 ) );
|
||||
for( unsigned y = 0; y < m_pcOutputFrame->getHeight( ch ); y++ )
|
||||
Mat outputMask( m_pcResultedFrame->getHeight( ch ), m_pcResultedFrame->getWidth( ch ), CV_8UC1, Scalar( 1 ) );
|
||||
for( unsigned y = 0; y < m_pcResultedFrame->getHeight( ch ); y++ )
|
||||
{
|
||||
for( unsigned x = 0; x < m_pcOutputFrame->getWidth( ch ); x++ )
|
||||
for( unsigned x = 0; x < m_pcResultedFrame->getWidth( ch ); x++ )
|
||||
{
|
||||
Point pt = reshapePoints.at<Point>( y, x );
|
||||
if( pt.x > -1 )
|
||||
@@ -659,9 +659,9 @@ void ThreeSixtyDownsampling::downsamplingOperation( CalypFrame* pcInputFrame )
|
||||
if( m_iInpaintMethod )
|
||||
{
|
||||
Mat outputFrameUnfilled, outputFrame;
|
||||
m_pcOutputFrame->toMat( outputFrameUnfilled, true, false, ch );
|
||||
m_pcResultedFrame->toMat( outputFrameUnfilled, true, false, ch );
|
||||
cv::inpaint( outputFrameUnfilled, outputMask, outputFrame, 16, m_iInpaintMethod );
|
||||
m_pcOutputFrame->fromMat( outputFrame, ch );
|
||||
m_pcResultedFrame->fromMat( outputFrame, ch );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,7 +670,7 @@ void ThreeSixtyDownsampling::upsamplingOperation( CalypFrame* pcInputFrame )
|
||||
{
|
||||
unsigned numBytes = m_pcDownsampled->getBitsPel() > 8 ? 2 : 1;
|
||||
m_pcDownsampled->reset();
|
||||
m_pcOutputFrame->reset();
|
||||
m_pcResultedFrame->reset();
|
||||
for( unsigned ch = 0; ch < m_pcDownsampled->getNumberChannels(); ch++ )
|
||||
{
|
||||
Mat_<Point> reshapePoints = *( m_cvReshapePoints[ch] );
|
||||
@@ -689,7 +689,7 @@ void ThreeSixtyDownsampling::upsamplingOperation( CalypFrame* pcInputFrame )
|
||||
|
||||
Mat cvDownsampled;
|
||||
m_pcDownsampled->toMat( cvDownsampled, true, false, ch );
|
||||
int imH = m_pcOutputFrame->getHeight( ch );
|
||||
int imH = m_pcResultedFrame->getHeight( ch );
|
||||
Mat cvUpsample( 1, 2 * imH, numBytes > 2 ? CV_16UC1 : CV_8UC1 );
|
||||
for( int y = 0; y < imH; y++ )
|
||||
{
|
||||
@@ -700,7 +700,7 @@ void ThreeSixtyDownsampling::upsamplingOperation( CalypFrame* pcInputFrame )
|
||||
cv::resize( cvDownsampled.row( y ).colRange( xpos, xpos + lineWidth ), cvUpsample, cvUpsample.size(), 0, 0, m_iInterpolation );
|
||||
|
||||
// copy to output
|
||||
ClpPel* outpel = &m_pcOutputFrame->getPelBufferYUV()[ch][y][0];
|
||||
ClpPel* outpel = &m_pcResultedFrame->getPelBufferYUV()[ch][y][0];
|
||||
unsigned char* cv_data = cvUpsample.data;
|
||||
for( int i = 0; i < 2 * imH; i++ )
|
||||
{
|
||||
@@ -713,7 +713,7 @@ void ThreeSixtyDownsampling::upsamplingOperation( CalypFrame* pcInputFrame )
|
||||
}
|
||||
}
|
||||
}
|
||||
//m_pcOutputFrame->copyFrom( m_pcDownsampled );
|
||||
//m_pcResultedFrame->copyFrom( m_pcDownsampled );
|
||||
}
|
||||
|
||||
CalypFrame* ThreeSixtyDownsampling::process( std::vector<CalypFrame*> apcFrameList )
|
||||
@@ -725,9 +725,9 @@ CalypFrame* ThreeSixtyDownsampling::process( std::vector<CalypFrame*> apcFrameLi
|
||||
}
|
||||
if( m_uiDownsampling == 0 || m_uiDownsampling == 2 )
|
||||
{
|
||||
upsamplingOperation( m_uiDownsampling == 2 ? m_pcOutputFrame : apcFrameList[0] );
|
||||
upsamplingOperation( m_uiDownsampling == 2 ? m_pcResultedFrame : apcFrameList[0] );
|
||||
}
|
||||
return m_pcOutputFrame;
|
||||
return m_pcResultedFrame;
|
||||
}
|
||||
|
||||
bool ThreeSixtyDownsampling::keyPressed( enum Module_Key_Supported value )
|
||||
@@ -761,7 +761,7 @@ void ThreeSixtyDownsampling::destroy()
|
||||
if( m_pcDownsampled )
|
||||
delete m_pcDownsampled;
|
||||
m_pcDownsampled = NULL;
|
||||
if( m_pcOutputFrame )
|
||||
delete m_pcOutputFrame;
|
||||
m_pcOutputFrame = NULL;
|
||||
if( m_pcResultedFrame )
|
||||
delete m_pcResultedFrame;
|
||||
m_pcResultedFrame = NULL;
|
||||
}
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
|
||||
double m_dPixelRatio;
|
||||
|
||||
CalypFrame* m_pcResultedFrame;
|
||||
CalypFrame* m_pcDownsampled;
|
||||
|
||||
// Values one per channel
|
||||
|
||||
@@ -55,6 +55,8 @@ private:
|
||||
unsigned m_uiFaceWidth;
|
||||
unsigned m_uiFaceHeight;
|
||||
|
||||
CalypFrame* m_pcOutputFrame;
|
||||
|
||||
public:
|
||||
ThreeSixtyDynamicDownsampling();
|
||||
virtual ~ThreeSixtyDynamicDownsampling() {}
|
||||
|
||||
@@ -56,8 +56,6 @@ ThreeSixtyFaceConcatenation::ThreeSixtyFaceConcatenation()
|
||||
m_uiNumberOfPartitionsPerFace = 1;
|
||||
m_uiFacesX = 0;
|
||||
m_uiFacesY = 0;
|
||||
|
||||
m_pcTmpFrame = NULL;
|
||||
}
|
||||
|
||||
bool ThreeSixtyFaceConcatenation::create( std::vector<CalypFrame*> apcFrameList )
|
||||
@@ -90,14 +88,14 @@ bool ThreeSixtyFaceConcatenation::create( std::vector<CalypFrame*> apcFrameList
|
||||
unsigned int width = apcFrameList[0]->getWidth() * m_uiFacesX;
|
||||
unsigned int height = apcFrameList[0]->getHeight() * m_uiFacesY;
|
||||
|
||||
m_pcOutputFrame = new CalypFrame( width, height, apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() );
|
||||
m_pcConcatenatedFaces = std::make_unique<CalypFrame>( width, height, apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CalypFrame* ThreeSixtyFaceConcatenation::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
m_pcOutputFrame->reset();
|
||||
m_pcConcatenatedFaces->reset();
|
||||
|
||||
switch( m_uiProjectionType )
|
||||
{
|
||||
@@ -107,19 +105,16 @@ CalypFrame* ThreeSixtyFaceConcatenation::process( std::vector<CalypFrame*> apcFr
|
||||
CalypFrame* pcFrame = apcFrameList[i];
|
||||
unsigned x = i % m_uiFacesX * pcFrame->getWidth();
|
||||
unsigned y = i / m_uiFacesX * pcFrame->getHeight();
|
||||
m_pcOutputFrame->copyTo( pcFrame, x, y );
|
||||
m_pcConcatenatedFaces->copyTo( pcFrame, x, y );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
return m_pcOutputFrame;
|
||||
return m_pcConcatenatedFaces.get();
|
||||
}
|
||||
|
||||
void ThreeSixtyFaceConcatenation::destroy()
|
||||
{
|
||||
if( m_pcOutputFrame )
|
||||
delete m_pcOutputFrame;
|
||||
m_pcOutputFrame = NULL;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class ThreeSixtyFaceConcatenation : public CalypModuleIf
|
||||
REGISTER_CLASS_FACTORY( ThreeSixtyFaceConcatenation )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcTmpFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcConcatenatedFaces;
|
||||
unsigned m_uiProjectionType;
|
||||
unsigned m_uiNumberOfPartitionsPerFace;
|
||||
unsigned m_uiFacesX;
|
||||
|
||||
@@ -77,14 +77,14 @@ bool ThreeSixtyFaceExtraction::create( std::vector<CalypFrame*> apcFrameList )
|
||||
unsigned int width = apcFrameList[0]->getWidth() / m_uiFacesX;
|
||||
unsigned int height = apcFrameList[0]->getHeight() / m_uiFacesY;
|
||||
|
||||
m_pcOutputFrame = new CalypFrame( width, height, apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() );
|
||||
m_pcFrameExtractionFrame = std::make_unique<CalypFrame>( width, height, apcFrameList[0]->getPelFormat(), apcFrameList[0]->getBitsPel() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CalypFrame* ThreeSixtyFaceExtraction::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
m_pcOutputFrame->reset();
|
||||
m_pcFrameExtractionFrame->reset();
|
||||
|
||||
unsigned x = -1;
|
||||
unsigned y = -1;
|
||||
@@ -92,20 +92,17 @@ CalypFrame* ThreeSixtyFaceExtraction::process( std::vector<CalypFrame*> apcFrame
|
||||
switch( m_uiProjectionType )
|
||||
{
|
||||
case 1: // Cube-map
|
||||
x = m_uiFaceNum % m_uiFacesX * m_pcOutputFrame->getWidth();
|
||||
y = ( m_uiFaceNum / m_uiFacesX ) * m_pcOutputFrame->getHeight();
|
||||
x = m_uiFaceNum % m_uiFacesX * m_pcFrameExtractionFrame->getWidth();
|
||||
y = ( m_uiFaceNum / m_uiFacesX ) * m_pcFrameExtractionFrame->getHeight();
|
||||
break;
|
||||
default:
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
m_pcOutputFrame->copyFrom( apcFrameList[0], x, y );
|
||||
return m_pcOutputFrame;
|
||||
m_pcFrameExtractionFrame->copyFrom( apcFrameList[0], x, y );
|
||||
return m_pcFrameExtractionFrame.get();
|
||||
}
|
||||
|
||||
void ThreeSixtyFaceExtraction::destroy()
|
||||
{
|
||||
if( m_pcOutputFrame )
|
||||
delete m_pcOutputFrame;
|
||||
m_pcOutputFrame = NULL;
|
||||
}
|
||||
@@ -32,7 +32,8 @@ class ThreeSixtyFaceExtraction : public CalypModuleIf
|
||||
REGISTER_CLASS_FACTORY( ThreeSixtyFaceExtraction )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcTmpFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcFrameExtractionFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcTmpFrame;
|
||||
unsigned m_uiFaceNum;
|
||||
unsigned m_uiProjectionType;
|
||||
unsigned m_uiNumberOfPartitionsPerFace;
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
#include "ThreeSixtyNxN.h"
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
#include "lib/LibMemory.h"
|
||||
//#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/photo.hpp>
|
||||
#include <vector>
|
||||
|
||||
//using cv::InputArray;
|
||||
//using cv::OutputArray;
|
||||
using cv::Rect;
|
||||
using cv::Scalar;
|
||||
using cv::Size;
|
||||
@@ -147,7 +143,6 @@ void ThreeSixtyNxN::downsamplingOperation( const CalypFrame* pcInputFrame )
|
||||
ClpPel* in = &pcInputFrame->getPelBufferYUV()[ch][0][0];
|
||||
ClpPel* out = &m_pcOutputFrame->getPelBufferYUV()[ch][0][0];
|
||||
|
||||
unsigned long nn = N * N;
|
||||
int n_2 = N / 2;
|
||||
int n1 = N - 1;
|
||||
double dist_y;
|
||||
@@ -175,7 +170,6 @@ void ThreeSixtyNxN::downsamplingOperation( const CalypFrame* pcInputFrame )
|
||||
rx = x + y * N + out;
|
||||
|
||||
*( rx ) = interpol_lanczos3( tx_y, tx_x, N * 2, max_value );
|
||||
//*( rx ) = interpol_cub( tx_y, tx_x, N * 2, max_value );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,9 +196,7 @@ void ThreeSixtyNxN::upsamplingOperation( const CalypFrame* pcInputFrame )
|
||||
double Dj;
|
||||
double tx;
|
||||
ClpPel* rx;
|
||||
ClpPel* linhaY;
|
||||
|
||||
getMem1D( &linhaY, n2 );
|
||||
std::vector<ClpPel> linhaY( n2, 0 );
|
||||
|
||||
for( y = 0; y < N; y++ )
|
||||
{
|
||||
@@ -220,7 +212,7 @@ void ThreeSixtyNxN::upsamplingOperation( const CalypFrame* pcInputFrame )
|
||||
novo_x = ( dist_x > dist_y ? dist_y : ( dist_x + 1 < -dist_y ? -dist_y - 1 : dist_x ) ) + N / 2;
|
||||
novo_y = abs( dist_x ) > dist_y ? ( y < N / 2 ? dist_Lj : N - dist_Lj - 1 ) : y;
|
||||
|
||||
*( linhaY + x ) = *( in + (int)novo_x + (int)novo_y * N );
|
||||
linhaY[x] = *( in + (int)novo_x + (int)novo_y * N );
|
||||
}
|
||||
|
||||
for( x = 0; x < n2; x++ )
|
||||
@@ -228,10 +220,9 @@ void ThreeSixtyNxN::upsamplingOperation( const CalypFrame* pcInputFrame )
|
||||
tx = ( x + 1 ) / Dj - 1;
|
||||
rx = x + y * n2 + out;
|
||||
|
||||
*( rx ) = interpol_lanczos3( linhaY, tx, Lj, max_value );
|
||||
*( rx ) = interpol_lanczos3( linhaY.data(), tx, Lj, max_value );
|
||||
}
|
||||
}
|
||||
freeMem1D( linhaY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class ThreeSixtyNxN : public CalypModuleIf
|
||||
REGISTER_CLASS_FACTORY( ThreeSixtyNxN )
|
||||
private:
|
||||
unsigned m_uiDownsampling;
|
||||
CalypFrame* m_pcOutputFrame;
|
||||
void downsamplingOperation( const CalypFrame* pcInputFrame );
|
||||
void upsamplingOperation( const CalypFrame* pcInputFrame );
|
||||
|
||||
|
||||
@@ -75,12 +75,17 @@ bool ThreeSixtySpatialtoTemporal::needFrame()
|
||||
return false;
|
||||
}
|
||||
|
||||
CalypFrame* ThreeSixtySpatialtoTemporal::getProcessedFrame()
|
||||
{
|
||||
return m_pcTempSpatialFrame != nullptr ? m_pcTempSpatialFrame.get() : nullptr;
|
||||
}
|
||||
|
||||
bool ThreeSixtySpatialtoTemporal::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
|
||||
unsigned int iWidth;
|
||||
unsigned int iHeight;
|
||||
unsigned int iWidth{ 0 };
|
||||
unsigned int iHeight{ 0 };
|
||||
|
||||
if( m_uiSpatial2Temporal )
|
||||
{
|
||||
@@ -93,10 +98,10 @@ bool ThreeSixtySpatialtoTemporal::create( std::vector<CalypFrame*> apcFrameList
|
||||
iWidth = apcFrameList[0]->getWidth() / m_uiFacesX;
|
||||
iHeight = apcFrameList[0]->getHeight() / m_uiFacesY;
|
||||
|
||||
m_pcTmpInputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
m_pcTmpFace = new CalypFrame( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
m_pcTmpInputFrame = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
m_pcTmpFace = std::make_unique<CalypFrame>( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
iWidth *= m_uiFacesPerFrame;
|
||||
}
|
||||
else
|
||||
@@ -104,8 +109,8 @@ bool ThreeSixtySpatialtoTemporal::create( std::vector<CalypFrame*> apcFrameList
|
||||
iWidth = apcFrameList[0]->getWidth() * m_uiFacesX / m_uiFacesPerFrame;
|
||||
iHeight = apcFrameList[0]->getHeight() * m_uiFacesY;
|
||||
}
|
||||
m_pcOutputFrame = new CalypFrame( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
m_pcTempSpatialFrame = std::make_unique<CalypFrame>( iWidth, iHeight, apcFrameList[0]->getPelFormat(),
|
||||
apcFrameList[0]->getBitsPel() );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -125,8 +130,8 @@ CalypFrame* ThreeSixtySpatialtoTemporal::process( std::vector<CalypFrame*> apcFr
|
||||
|
||||
for( unsigned i = 0; i < m_uiFacesPerFrame; i++ )
|
||||
{
|
||||
m_pcTmpFace->copyFrom( m_pcTmpInputFrame, m_uiCopyX, m_uiCopyY );
|
||||
m_pcOutputFrame->copyTo( m_pcTmpFace, m_pcTmpFace->getWidth() * i, 0 );
|
||||
m_pcTmpFace->copyFrom( *m_pcTmpInputFrame, m_uiCopyX, m_uiCopyY );
|
||||
m_pcTempSpatialFrame->copyTo( *m_pcTmpFace, m_pcTmpFace->getWidth() * i, 0 );
|
||||
m_iFrameBufferCount--;
|
||||
m_uiCopyX += m_pcTmpFace->getWidth();
|
||||
if( m_uiCopyX >= m_pcTmpInputFrame->getWidth() )
|
||||
@@ -138,40 +143,28 @@ CalypFrame* ThreeSixtySpatialtoTemporal::process( std::vector<CalypFrame*> apcFr
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcOutputFrame->copyTo( apcFrameList[0], m_uiCopyX, m_uiCopyY );
|
||||
m_pcTempSpatialFrame->copyTo( apcFrameList[0], m_uiCopyX, m_uiCopyY );
|
||||
m_uiFacesCount += m_uiFacesPerFrame;
|
||||
|
||||
m_uiCopyX += apcFrameList[0]->getWidth();
|
||||
if( m_uiCopyX >= m_pcOutputFrame->getWidth() )
|
||||
if( m_uiCopyX >= m_pcTempSpatialFrame->getWidth() )
|
||||
{
|
||||
m_uiCopyX = 0;
|
||||
m_uiCopyY += apcFrameList[0]->getHeight();
|
||||
}
|
||||
if( m_uiFacesCount < ( m_uiFacesX * m_uiFacesY ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
m_iFrameBufferCount = 0;
|
||||
m_uiCopyX = 0;
|
||||
m_uiCopyY = 0;
|
||||
m_uiFacesCount = 0;
|
||||
return m_pcOutputFrame;
|
||||
}
|
||||
|
||||
return m_pcOutputFrame;
|
||||
return m_pcTempSpatialFrame.get();
|
||||
}
|
||||
|
||||
void ThreeSixtySpatialtoTemporal::destroy()
|
||||
{
|
||||
if( m_pcOutputFrame )
|
||||
delete m_pcOutputFrame;
|
||||
m_pcOutputFrame = NULL;
|
||||
|
||||
if( m_pcTmpInputFrame )
|
||||
delete m_pcTmpInputFrame;
|
||||
m_pcTmpInputFrame = NULL;
|
||||
|
||||
if( m_pcTmpFace )
|
||||
delete m_pcTmpFace;
|
||||
m_pcTmpFace = NULL;
|
||||
}
|
||||
@@ -33,8 +33,9 @@ class ThreeSixtySpatialtoTemporal : public CalypModuleIf
|
||||
REGISTER_CLASS_FACTORY( ThreeSixtySpatialtoTemporal )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcTmpInputFrame;
|
||||
CalypFrame* m_pcTmpFace;
|
||||
std::unique_ptr<CalypFrame> m_pcTempSpatialFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcTmpInputFrame;
|
||||
std::unique_ptr<CalypFrame> m_pcTmpFace;
|
||||
bool m_uiSpatial2Temporal;
|
||||
unsigned int m_uiFacesX;
|
||||
unsigned int m_uiFacesY;
|
||||
@@ -46,11 +47,12 @@ private:
|
||||
public:
|
||||
ThreeSixtySpatialtoTemporal();
|
||||
virtual ~ThreeSixtySpatialtoTemporal() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
bool needFrame();
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
bool flush();
|
||||
void destroy();
|
||||
bool create( std::vector<CalypFrame*> apcFrameList ) override;
|
||||
CalypFrame* getProcessedFrame() override;
|
||||
bool needFrame() override;
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList ) override;
|
||||
bool flush() override;
|
||||
void destroy() override;
|
||||
};
|
||||
|
||||
#endif // __THREESIXTYSPATIALTOTEMPORAL_H__
|
||||
Reference in new issue
Block a user