Merge branch 'master' into private

This commit is contained in:
2019-03-11 23:53:29 +00:00
22 changed files with 285 additions and 52 deletions
+135
View File
@@ -0,0 +1,135 @@
# Created by https://www.gitignore.io/api/c++,clion,linux
# Edit at https://www.gitignore.io/?templates=c++,clion,linux
### C++ ###
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### CLion ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
bin/
build/
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# End of https://www.gitignore.io/api/c++,clion,linux
+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/calyp.iml" filepath="$PROJECT_DIR$/.idea/calyp.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+2 -1
View File
@@ -157,7 +157,7 @@ IF (NOT CMAKE_BUILD_TYPE )
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations" )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
#-DQT_NO_CAST_FROM_ASCII
@@ -175,6 +175,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
endif()
IF( USE_WERROR )
+29 -7
View File
@@ -321,8 +321,9 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
{
m_pCurrStream = new CalypStream;
}
bool bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog;
bool bConfig = true;
if( !bForceDialog )
bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
bool bRet = false;
for( int iPass = 0; iPass < 2 && !bRet; iPass++ )
{
@@ -334,8 +335,15 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
return false;
}
}
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate,
true );
try
{
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, true );
}
catch( CalypFailure& e )
{
if( iPass == 1 )
throw( e );
}
}
m_sStreamInfo.m_cFilename = cFilename;
@@ -435,7 +443,7 @@ void VideoSubWindow::updateVideoWindowInfo()
}
bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
int& rEndianness )
int& rEndianness, unsigned int& rFrameRate )
{
std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes();
bool bGuessed = true;
@@ -483,7 +491,7 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
if( resolutionMatch.hasMatch() )
{
QString resolutionString = resolutionMatch.captured( 0 );
QString resolutionString = resolutionMatch.captured( resolutionMatch.lastCapturedIndex() );
if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) )
{
resolutionString.remove( "_" );
@@ -532,7 +540,7 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort );
if( BppMatch.hasMatch() )
{
QString matchString = BppMatch.captured( 0 );
QString matchString = BppMatch.captured( BppMatch.lastCapturedIndex() );
matchString.remove( "_" );
matchString.remove( "bpp" );
rBitsPerPixel = matchString.toUInt();
@@ -542,6 +550,20 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
}
}
// Guess frame rate - match %dbpp
QRegularExpressionMatch FpsMatch = QRegularExpression( "_\\d*fps" ).match( FilenameShort );
if( FpsMatch.hasMatch() )
{
QString matchString = FpsMatch.captured( FpsMatch.lastCapturedIndex() );
matchString.remove( "_" );
matchString.remove( "fps" );
rFrameRate = matchString.toUInt();
if( rFrameRate < 0 )
{
rFrameRate = 30;
}
}
// Guess Endianness
if( FilenameShort.contains( QStringLiteral( "be" ), Qt::CaseInsensitive ) )
{
+1 -1
View File
@@ -192,7 +192,7 @@ private:
bool goToNextFrame( bool bThreaded = false );
static bool guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
int& rEndianness );
int& rEndianness, unsigned int& rFrameRate );
bool hasRunningModule();
+14 -7
View File
@@ -81,6 +81,11 @@ int CalypFrame::findPixelFormat( const ClpString& name )
return -1;
}
int CalypFrame::pelformatColorSpace( const int idx )
{
return g_CalypPixFmtDescriptorsMap.at( idx ).colorSpace;
}
struct CalypFramePrivate
{
public:
@@ -346,6 +351,8 @@ bool CalypFrame::haveSameFmt( const CalypFrame& other, unsigned int match ) cons
bRet &= ( getBitsPel() == other.getBitsPel() );
if( match & MATCH_COLOR_SPACE_IGNORE_GRAY )
bRet &= ( getColorSpace() == CLP_COLOR_GRAY || getColorSpace() == other.getColorSpace() );
if( match & MATCH_BYTES_PER_FRAME )
bRet &= ( getBytesPerFrame() == other.getBytesPerFrame() );
return bRet;
}
@@ -423,7 +430,7 @@ unsigned int CalypFrame::getBitsPel() const
return d->m_uiBitsPel;
}
ClpULong CalypFrame::getBytesPerFrame()
ClpULong CalypFrame::getBytesPerFrame() const
{
return getBytesPerFrame( d->m_uiWidth, d->m_uiHeight, d->m_iPixelFormat, d->m_uiBitsPel );
}
@@ -432,10 +439,10 @@ ClpULong CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeig
{
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( iPixelFormat ) );
unsigned int bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1;
unsigned long long int numberBytes = uiWidth * uiHeight;
ClpULong numberBytes = uiWidth * uiHeight;
if( pcPelFormat->numberChannels > 1 )
{
unsigned long long int numberBytesChroma =
ClpULong numberBytesChroma =
CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight );
numberBytes += ( pcPelFormat->numberChannels - 1 ) * numberBytesChroma;
}
@@ -524,11 +531,11 @@ void CalypFrame::setPixel( unsigned int xPos, unsigned int yPos, CalypPixel pixe
void CalypFrame::copyFrom( const CalypFrame& other )
{
if( !haveSameFmt( other, MATCH_ALL ) )
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_BYTES_PER_FRAME | MATCH_BITS ) )
return;
d->m_bHasRGBPel = false;
d->m_bHasHistogram = false;
memcpy( &( d->m_pppcInputPel[CLP_LUMA][0][0]), &(other.getPelBufferYUV()[CLP_LUMA][0][0]), getTotalNumberOfPixels() * sizeof( ClpPel ) );
memcpy( &( d->m_pppcInputPel[0][0][0]), &(other.getPelBufferYUV()[0][0][0]), getTotalNumberOfPixels() * sizeof( ClpPel ) );
}
void CalypFrame::copyFrom( const CalypFrame* other )
@@ -539,7 +546,7 @@ void CalypFrame::copyFrom( const CalypFrame* other )
void CalypFrame::copyFrom( const CalypFrame& other, unsigned int xPos, unsigned int yPos )
{
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_PEL_FMT | MATCH_BITS ) )
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_BYTES_PER_FRAME | MATCH_BITS ) )
return;
// TODO: Protect width and height
ClpPel*** pInput = other.getPelBufferYUV();
@@ -699,7 +706,7 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel;
pTmpPel = d->m_pppcInputPel[ch][0];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel;
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
{
+3 -1
View File
@@ -100,6 +100,7 @@ public:
static std::vector<ClpString> supportedPixelFormatListNames( int colorSpace );
static int numberOfFormats();
static int findPixelFormat( const ClpString& name );
static int pelformatColorSpace( const int idx );
/**
* Creates a new frame using the following configuration
@@ -145,6 +146,7 @@ public:
MATCH_PEL_FMT = 4,
MATCH_BITS = 8,
MATCH_COLOR_SPACE_IGNORE_GRAY = 16,
MATCH_BYTES_PER_FRAME = 32,
MATCH_ALL = 0xFFFF,
};
@@ -236,7 +238,7 @@ public:
* Get number of bytes per frame of an existing frame
* @return number of bytes per frame
*/
ClpULong getBytesPerFrame();
ClpULong getBytesPerFrame() const;
/**
* Get number of bytes per frame of a specific pixel format
+1
View File
@@ -78,6 +78,7 @@ std::vector<CalypStandardResolution> CalypStream::stdResolutionSizes()
std::vector<CalypStandardResolution> stdResList;
CalypStandardResolution stdResElement;
REGIST_CALYP_STANDARD_RESOLUTION( "QCIF", 176, 144 );
REGIST_CALYP_STANDARD_RESOLUTION( "CIF", 352, 288 );
REGIST_CALYP_STANDARD_RESOLUTION( "VGA", 640, 480 );
REGIST_CALYP_STANDARD_RESOLUTION( "WVGA", 832, 480 );
+1 -1
View File
@@ -31,7 +31,7 @@
#include <cstdio>
#include <iostream>
#if( ( LIBAVCODEC_VERSION_MAJOR >= 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) )
#if( ( LIBAVCODEC_VERSION_MAJOR > 57 ) || ( LIBAVCODEC_VERSION_MAJOR == 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) )
#define FF_SEND_RECEIVE_API
#define FF_USER_CODEC_PARAM
#endif
+8 -1
View File
@@ -29,6 +29,9 @@
#include <cstdio>
#include <opencv2/opencv.hpp>
#if CV_MAJOR_VERSION >= 4
#include <opencv2/videoio.hpp>
#endif
using cv::Mat;
using cv::VideoCapture;
@@ -45,7 +48,6 @@ std::vector<CalypStreamFormat> StreamHandlerOpenCV::supportedReadFormats()
std::vector<CalypStreamFormat> StreamHandlerOpenCV::supportedWriteFormats()
{
INI_REGIST_CALYP_SUPPORTED_FMT;
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable PixMap ", "ppm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable Network Graphics", "png" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Joint Photographic Experts Group", "jpg" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Windows Bitmap", "bmp" );
@@ -78,8 +80,13 @@ bool StreamHandlerOpenCV::openHandler( ClpString strFilename, bool bInput )
m_strFormatName = "DEV";
m_strCodecName = "Raw Video";
pcVideoCapture = new VideoCapture( iDeviceId );
#if CV_MAJOR_VERSION >= 4
m_uiWidth = pcVideoCapture->get( cv::CAP_PROP_FRAME_WIDTH );
m_uiHeight = pcVideoCapture->get( cv::CAP_PROP_FRAME_HEIGHT );
#else
m_uiWidth = pcVideoCapture->get( CV_CAP_PROP_FRAME_WIDTH );
m_uiHeight = pcVideoCapture->get( CV_CAP_PROP_FRAME_HEIGHT );
#endif
m_dFrameRate = 25;
}
else
+12 -5
View File
@@ -33,7 +33,7 @@
std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedReadFormats()
{
INI_REGIST_CALYP_SUPPORTED_FMT;
//REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" );
END_REGIST_CALYP_SUPPORTED_FMT;
@@ -42,7 +42,9 @@ std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedReadFormats()
std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedWriteFormats()
{
INI_REGIST_CALYP_SUPPORTED_FMT;
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" );
END_REGIST_CALYP_SUPPORTED_FMT;
}
@@ -84,18 +86,20 @@ bool StreamHandlerPortableMap::openHandler( ClpString strFilename, bool bInput )
}
else
{
int colorSpace = CalypFrame::pelformatColorSpace( m_iPixelFormat );
m_iMaxValue = ( 1 << m_uiBitsPerPixel ) - 1;
if( m_uiBitsPerPixel == 1 )
{
m_iMagicNumber = 4;
}
else if( m_iPixelFormat == CLP_GRAY )
else if( colorSpace == CLP_COLOR_GRAY )
{
m_iMagicNumber = 5;
}
else if( m_iPixelFormat == CLP_RGB24 )
else if( colorSpace == CLP_COLOR_RGB )
{
m_iMagicNumber = 6;
m_iPixelFormat = CalypFrame::findPixelFormat("RGB");
}
else
{
@@ -103,7 +107,7 @@ bool StreamHandlerPortableMap::openHandler( ClpString strFilename, bool bInput )
return false;
}
}
m_iEndianness = 0;
m_iEndianness = CLP_BIG_ENDIAN;
m_dFrameRate = 1;
m_uiTotalNumberFrames = 1;
return true;
@@ -141,13 +145,16 @@ bool StreamHandlerPortableMap::read( CalypFrame* pcFrame )
bool StreamHandlerPortableMap::write( CalypFrame* pcFrame )
{
CalypFrame pcRGBFrame( pcFrame->getWidth(), pcFrame->getHeight(),
m_iPixelFormat, pcFrame->getBitsPel() );
pcRGBFrame.copyFrom( pcFrame );
fseek( m_pFile, 0, SEEK_SET );
fprintf( m_pFile, "P%d\n%d %d\n", m_iMagicNumber, m_uiWidth, m_uiHeight );
if( m_iMagicNumber > 4 )
{
fprintf( m_pFile, "%d\n", m_iMaxValue );
}
pcFrame->frameToBuffer( m_pStreamBuffer, CLP_BIG_ENDIAN );
pcRGBFrame.frameToBuffer( m_pStreamBuffer, m_iEndianness );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
+13 -10
View File
@@ -49,13 +49,11 @@ bool AbsoluteFrameDifference::create( std::vector<CalypFrame*> apcFrameList )
_BASIC_MODULE_API_2_CHECK_
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 ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE_IGNORE_GRAY
| CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION | CalypFrame::MATCH_BITS ) )
return false;
m_pcFrameDifference =
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
m_pcFrameDifference = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, apcFrameList[0]->getBitsPel() );
return true;
}
@@ -68,13 +66,18 @@ CalypFrame* AbsoluteFrameDifference::process( std::vector<CalypFrame*> apcFrameL
ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
int aux_pel_1, aux_pel_2;
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ )
for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ )
for( unsigned int ch = 0; ch < m_pcFrameDifference->getNumberChannels(); ch++ )
{
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ )
{
aux_pel_1 = *pInput1PelYUV++;
aux_pel_2 = *pInput2PelYUV++;
*pOutputPelYUV++ = abs( aux_pel_1 - aux_pel_2 );
for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ )
{
aux_pel_1 = *pInput1PelYUV++;
aux_pel_2 = *pInput2PelYUV++;
*pOutputPelYUV++ = abs( aux_pel_1 - aux_pel_2 );
}
}
}
return m_pcFrameDifference;
}
+2 -2
View File
@@ -58,7 +58,7 @@ bool DisparityStereoSGBM::create( std::vector<CalypFrame*> apcFrameList )
}
m_uiNumberOfDisparities = ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16;
int cn = apcFrameList[0]->getNumberChannels();
#if( CV_MAJOR_VERSION == 3 )
#if( CV_MAJOR_VERSION >= 3 )
m_cStereoMatch = cv::StereoSGBM::create( 0, 16, m_uiBlockSize );
m_cStereoMatch->setPreFilterCap( 63 );
@@ -99,7 +99,7 @@ CalypFrame* DisparityStereoSGBM::process( std::vector<CalypFrame*> apcFrameList
return m_pcDisparityFrame;
}
cv::Mat disparityImage, disparityImage8;
#if( CV_MAJOR_VERSION == 3 )
#if( CV_MAJOR_VERSION >= 3 )
m_cStereoMatch->compute( leftImage, rightImage, disparityImage );
#else
m_cStereoMatch( leftImage, rightImage, disparityImage );
+1 -1
View File
@@ -60,7 +60,7 @@ private:
bool m_bUseHH;
int m_uiNumberOfDisparities;
unsigned int m_uiBlockSize;
#if( CV_MAJOR_VERSION == 3 )
#if( CV_MAJOR_VERSION >= 3 )
cv::Ptr<cv::StereoSGBM> m_cStereoMatch;
#else
cv::StereoSGBM m_cStereoMatch;
+15 -15
View File
@@ -52,8 +52,7 @@ bool FrameDifference::create( std::vector<CalypFrame*> apcFrameList )
unsigned int uiMaxBitsPixel = 0;
for( unsigned int i = 0; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_PEL_FMT | CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION ) )
return false;
if( apcFrameList[i]->getBitsPel() > uiMaxBitsPixel )
{
@@ -70,7 +69,7 @@ bool FrameDifference::create( std::vector<CalypFrame*> apcFrameList )
m_iMaxDiffValue = ( 1 << ( m_uiBitsPixel - 1 ) );
m_pcFrameDifference = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
CLP_GRAY, m_uiBitsPixel );
apcFrameList[0]->getPelFormat(), m_uiBitsPixel );
return true;
}
@@ -82,19 +81,20 @@ CalypFrame* FrameDifference::process( std::vector<CalypFrame*> apcFrameList )
int aux_pel_1, aux_pel_2;
int diff = 0;
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++;
diff = aux_pel_1 - aux_pel_2;
diff = m_iDiffBitShift > 0 ? diff >> m_iDiffBitShift : diff << m_iDiffBitShift;
diff = std::min( diff, m_iMaxDiffValue - 1 );
diff = std::max( diff, -m_iMaxDiffValue );
for( unsigned int ch = 0; ch < m_pcFrameDifference->getNumberChannels(); ch++ )
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++;
diff = aux_pel_1 - aux_pel_2;
diff = m_iDiffBitShift > 0 ? diff >> m_iDiffBitShift : diff << m_iDiffBitShift;
diff = std::min( diff, m_iMaxDiffValue - 1 );
diff = std::max( diff, -m_iMaxDiffValue );
diff += m_iMaxDiffValue;
*pOutputPelYUV++ = diff;
}
diff += m_iMaxDiffValue;
*pOutputPelYUV++ = diff;
}
return m_pcFrameDifference;
}
+7
View File
@@ -23,6 +23,9 @@
*/
#include "MeasureOpticalFlowDualTVL1.h"
#if CV_MAJOR_VERSION >= 4
#include <opencv2/optflow.hpp>
#endif
using cv::Mat;
using cv::Mat_;
@@ -61,7 +64,11 @@ bool MeasureOpticalFlowDualTVL1::create( std::vector<CalypFrame*> apcFrameList )
return false;
m_iStep = 16;
#if CV_MAJOR_VERSION >= 4
m_cTvl1 = cv::optflow::createOptFlow_DualTVL1();
#else
m_cTvl1 = cv::createOptFlow_DualTVL1();
#endif
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
return true;
+4
View File
@@ -166,7 +166,11 @@ bool OpticalFlowDualTVL1::create( std::vector<CalypFrame*> apcFrameList )
bool bRet = commonCreate( apcFrameList );
if( !bRet )
return bRet;
#if CV_MAJOR_VERSION >= 4
m_cOpticalFlow = cv::optflow::createOptFlow_DualTVL1();
#else
m_cOpticalFlow = cv::createOptFlow_DualTVL1();
#endif
return bRet;
}
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
git checkout upstream
git pull https://github.com/pixlra/calyp.git master
git push origin upstream
git checkout master
git pull origin master
git merge upstream
git push origin master