Updated warning options for GCC; fixed new warnings.

This commit is contained in:
Andrey Kamaev 2012-06-20 12:27:02 +00:00
parent 779f4e39de
commit d48d7b2b46
50 changed files with 2055 additions and 1808 deletions

View File

@ -23,7 +23,7 @@ if(MSVC)
add_definitions(-DJAS_WIN_MSVC_BUILD) add_definitions(-DJAS_WIN_MSVC_BUILD)
endif() endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow -Wsign-compare
/wd4013 /wd4018 /wd4715 /wd4244 /wd4101 /wd4267) /wd4013 /wd4018 /wd4715 /wd4244 /wd4101 /wd4267)
if(UNIX) if(UNIX)

View File

@ -25,7 +25,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1") set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
endif() endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow) ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow -Wunused)
set_target_properties(${JPEG_LIBRARY} set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY} PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}

View File

@ -81,18 +81,15 @@ set(lib_srcs
if(UNIX) if(UNIX)
list(APPEND lib_srcs tif_unix.c) list(APPEND lib_srcs tif_unix.c)
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
set_source_files_properties(tif_unix.c PROPERTIES COMPILE_FLAGS "-w")
endif()
endif() endif()
if(WIN32) if(WIN32)
list(APPEND lib_srcs tif_win32.c) list(APPEND lib_srcs tif_win32.c)
endif(WIN32) endif(WIN32)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast) -Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311)
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)) if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

View File

@ -58,6 +58,7 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
# High level of warnings. # High level of warnings.
add_extra_compiler_option(-W)
add_extra_compiler_option(-Wall) add_extra_compiler_option(-Wall)
add_extra_compiler_option(-Werror=return-type) add_extra_compiler_option(-Werror=return-type)
add_extra_compiler_option(-Werror=non-virtual-dtor) add_extra_compiler_option(-Werror=non-virtual-dtor)
@ -72,6 +73,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Winit-self) add_extra_compiler_option(-Winit-self)
add_extra_compiler_option(-Wpointer-arith) add_extra_compiler_option(-Wpointer-arith)
add_extra_compiler_option(-Wshadow) add_extra_compiler_option(-Wshadow)
add_extra_compiler_option(-Wsign-promo)
if(ENABLE_NOISY_WARNINGS) if(ENABLE_NOISY_WARNINGS)
add_extra_compiler_option(-Wcast-align) add_extra_compiler_option(-Wcast-align)
@ -81,6 +83,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Wno-delete-non-virtual-dtor) add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
add_extra_compiler_option(-Wno-unnamed-type-template-args) add_extra_compiler_option(-Wno-unnamed-type-template-args)
endif() endif()
add_extra_compiler_option(-fdiagnostics-show-option)
# The -Wno-long-long is required in 64bit systems when including sytem headers. # The -Wno-long-long is required in 64bit systems when including sytem headers.
if(X86_64) if(X86_64)

View File

@ -30,10 +30,7 @@
# Advanced variables: # Advanced variables:
# - OpenCV_SHARED # - OpenCV_SHARED
# - OpenCV_CONFIG_PATH # - OpenCV_CONFIG_PATH
# - OpenCV_INSTALL_PATH (not set on Windows)
# - OpenCV_LIB_COMPONENTS # - OpenCV_LIB_COMPONENTS
# - OpenCV_USE_MANGLED_PATHS
# - OpenCV_HAVE_ANDROID_CAMERA
# #
# =================================================================================== # ===================================================================================
# #
@ -41,6 +38,13 @@
# - OpenCV_STATIC # - OpenCV_STATIC
# - OpenCV_CUDA # - OpenCV_CUDA
if(CMAKE_VERSION VERSION_GREATER 2.6)
get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;")
enable_language(CXX)
endif()
endif()
if(NOT DEFINED OpenCV_STATIC) if(NOT DEFINED OpenCV_STATIC)
# look for global setting # look for global setting
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)

View File

@ -34,6 +34,7 @@ endmacro()
set(OCV_COMPILER_FAIL_REGEX set(OCV_COMPILER_FAIL_REGEX
"command line option .* is valid for .* but not for C\\+\\+" # GNU "command line option .* is valid for .* but not for C\\+\\+" # GNU
"command line option .* is valid for .* but not for C" # GNU
"unrecognized .*option" # GNU "unrecognized .*option" # GNU
"unknown .*option" # Clang "unknown .*option" # Clang
"ignoring unknown option" # MSVC "ignoring unknown option" # MSVC

View File

@ -340,7 +340,7 @@ CameraActivity::~CameraActivity()
disconnect(); disconnect();
} }
bool CameraActivity::onFrameBuffer(void* buffer, int bufferSize) bool CameraActivity::onFrameBuffer(void* /*buffer*/, int /*bufferSize*/)
{ {
LOGD("CameraActivity::onFrameBuffer - empty callback"); LOGD("CameraActivity::onFrameBuffer - empty callback");
return true; return true;

View File

@ -426,7 +426,7 @@ void BasicRetinaFilter::_spatiotemporalLPfilter(const float *inputFrame, float *
} }
// run SQUARING LP filter for a new frame input and save result at a specific output adress // run SQUARING LP filter for a new frame input and save result at a specific output adress
const float BasicRetinaFilter::_squaringSpatiotemporalLPfilter(const float *inputFrame, float *outputFrame, const unsigned int filterIndex) float BasicRetinaFilter::_squaringSpatiotemporalLPfilter(const float *inputFrame, float *outputFrame, const unsigned int filterIndex)
{ {
unsigned int coefTableOffset=filterIndex*3; unsigned int coefTableOffset=filterIndex*3;
/**********/ /**********/
@ -597,7 +597,7 @@ void BasicRetinaFilter::_squaringHorizontalCausalFilter(const float *inputFrame,
} }
// vertical anticausal filter that returns the mean value of its result // vertical anticausal filter that returns the mean value of its result
const float BasicRetinaFilter::_verticalAnticausalFilter_returnMeanValue(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd) float BasicRetinaFilter::_verticalAnticausalFilter_returnMeanValue(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd)
{ {
register float meanValue=0; register float meanValue=0;
float* offset=outputFrame+_filterOutput.getNBpixels()-_filterOutput.getNBcolumns(); float* offset=outputFrame+_filterOutput.getNBpixels()-_filterOutput.getNBcolumns();

View File

@ -119,322 +119,322 @@ class BasicRetinaFilter
{ {
public: public:
/** /**
* constructor of the base bio-inspired toolbox, parameters are only linked to imae input size and number of filtering capabilities of the object * constructor of the base bio-inspired toolbox, parameters are only linked to imae input size and number of filtering capabilities of the object
* @param NBrows: number of rows of the input image * @param NBrows: number of rows of the input image
* @param NBcolumns: number of columns of the input image * @param NBcolumns: number of columns of the input image
* @param parametersListSize: specifies the number of parameters set (each parameters set represents a specific low pass spatio-temporal filter) * @param parametersListSize: specifies the number of parameters set (each parameters set represents a specific low pass spatio-temporal filter)
* @param useProgressiveFilter: specifies if the filter has irreguar (progressive) filtering capabilities (this can be activated later using setProgressiveFilterConstants_xxx methods) * @param useProgressiveFilter: specifies if the filter has irreguar (progressive) filtering capabilities (this can be activated later using setProgressiveFilterConstants_xxx methods)
*/ */
BasicRetinaFilter(const unsigned int NBrows, const unsigned int NBcolumns, const unsigned int parametersListSize=1, const bool useProgressiveFilter=false); BasicRetinaFilter(const unsigned int NBrows, const unsigned int NBcolumns, const unsigned int parametersListSize=1, const bool useProgressiveFilter=false);
/** /**
* standrad destructore * standrad destructore
*/ */
~BasicRetinaFilter(); ~BasicRetinaFilter();
/** /**
* function which clears the output buffer of the object * function which clears the output buffer of the object
*/ */
inline void clearOutputBuffer(){_filterOutput=0;}; inline void clearOutputBuffer(){_filterOutput=0;};
/** /**
* function which clears the secondary buffer of the object * function which clears the secondary buffer of the object
*/ */
inline void clearSecondaryBuffer(){_localBuffer=0;}; inline void clearSecondaryBuffer(){_localBuffer=0;};
/** /**
* function which clears the output and the secondary buffer of the object * function which clears the output and the secondary buffer of the object
*/ */
inline void clearAllBuffers(){clearOutputBuffer();clearSecondaryBuffer();}; inline void clearAllBuffers(){clearOutputBuffer();clearSecondaryBuffer();};
/** /**
* resize basic retina filter object (resize all allocated buffers * resize basic retina filter object (resize all allocated buffers
* @param NBrows: the new height size * @param NBrows: the new height size
* @param NBcolumns: the new width size * @param NBcolumns: the new width size
*/ */
void resize(const unsigned int NBrows, const unsigned int NBcolumns); void resize(const unsigned int NBrows, const unsigned int NBcolumns);
/** /**
* forbiden method inherited from parent std::valarray * forbiden method inherited from parent std::valarray
* prefer not to use this method since the filter matrix become vectors * prefer not to use this method since the filter matrix become vectors
*/ */
void resize(const unsigned int){std::cerr<<"error, not accessible method"<<std::endl;}; void resize(const unsigned int){std::cerr<<"error, not accessible method"<<std::endl;};
/** /**
* low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors) * low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @param filterIndex: the offset which specifies the parameter set that should be used for the filtering * @param filterIndex: the offset which specifies the parameter set that should be used for the filtering
* @return the processed image, the output is reachable later by using function getOutput() * @return the processed image, the output is reachable later by using function getOutput()
*/ */
const std::valarray<float> &runFilter_LPfilter(const std::valarray<float> &inputFrame, const unsigned int filterIndex=0); // run the LP filter for a new frame input and save result in _filterOutput const std::valarray<float> &runFilter_LPfilter(const std::valarray<float> &inputFrame, const unsigned int filterIndex=0); // run the LP filter for a new frame input and save result in _filterOutput
/** /**
* low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors) * low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @param outputFrame: the output buffer in which the result is writed * @param outputFrame: the output buffer in which the result is writed
* @param filterIndex: the offset which specifies the parameter set that should be used for the filtering * @param filterIndex: the offset which specifies the parameter set that should be used for the filtering
*/ */
void runFilter_LPfilter(const std::valarray<float> &inputFrame, std::valarray<float> &outputFrame, const unsigned int filterIndex=0); // run LP filter on a specific output adress void runFilter_LPfilter(const std::valarray<float> &inputFrame, std::valarray<float> &outputFrame, const unsigned int filterIndex=0); // run LP filter on a specific output adress
/** /**
* low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors) * low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors)
* @param inputOutputFrame: the input image to be processed on which the result is rewrited * @param inputOutputFrame: the input image to be processed on which the result is rewrited
* @param filterIndex: the offset which specifies the parameter set that should be used for the filtering * @param filterIndex: the offset which specifies the parameter set that should be used for the filtering
*/ */
void runFilter_LPfilter_Autonomous(std::valarray<float> &inputOutputFrame, const unsigned int filterIndex=0);// run LP filter on the input data and rewrite it void runFilter_LPfilter_Autonomous(std::valarray<float> &inputOutputFrame, const unsigned int filterIndex=0);// run LP filter on the input data and rewrite it
/** /**
* local luminance adaptation call and run (contrast enhancement property of the photoreceptors) * local luminance adaptation call and run (contrast enhancement property of the photoreceptors)
* @param inputOutputFrame: the input image to be processed * @param inputOutputFrame: the input image to be processed
* @param localLuminance: an image which represents the local luminance of the inputFrame parameter, in general, it is its low pass spatial filtering * @param localLuminance: an image which represents the local luminance of the inputFrame parameter, in general, it is its low pass spatial filtering
* @return the processed image, the output is reachable later by using function getOutput() * @return the processed image, the output is reachable later by using function getOutput()
*/ */
const std::valarray<float> &runFilter_LocalAdapdation(const std::valarray<float> &inputOutputFrame, const std::valarray<float> &localLuminance);// run local adaptation filter and save result in _filterOutput const std::valarray<float> &runFilter_LocalAdapdation(const std::valarray<float> &inputOutputFrame, const std::valarray<float> &localLuminance);// run local adaptation filter and save result in _filterOutput
/** /**
* local luminance adaptation call and run (contrast enhancement property of the photoreceptors) * local luminance adaptation call and run (contrast enhancement property of the photoreceptors)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @param localLuminance: an image which represents the local luminance of the inputFrame parameter, in general, it is its low pass spatial filtering * @param localLuminance: an image which represents the local luminance of the inputFrame parameter, in general, it is its low pass spatial filtering
* @param outputFrame: the output buffer in which the result is writed * @param outputFrame: the output buffer in which the result is writed
*/ */
void runFilter_LocalAdapdation(const std::valarray<float> &inputFrame, const std::valarray<float> &localLuminance, std::valarray<float> &outputFrame); // run local adaptation filter on a specific output adress void runFilter_LocalAdapdation(const std::valarray<float> &inputFrame, const std::valarray<float> &localLuminance, std::valarray<float> &outputFrame); // run local adaptation filter on a specific output adress
/** /**
* local luminance adaptation call and run (contrast enhancement property of the photoreceptors) * local luminance adaptation call and run (contrast enhancement property of the photoreceptors)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @return the processed image, the output is reachable later by using function getOutput() * @return the processed image, the output is reachable later by using function getOutput()
*/ */
const std::valarray<float> &runFilter_LocalAdapdation_autonomous(const std::valarray<float> &inputFrame);// run local adaptation filter and save result in _filterOutput const std::valarray<float> &runFilter_LocalAdapdation_autonomous(const std::valarray<float> &inputFrame);// run local adaptation filter and save result in _filterOutput
/** /**
* local luminance adaptation call and run (contrast enhancement property of the photoreceptors) * local luminance adaptation call and run (contrast enhancement property of the photoreceptors)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @param outputFrame: the output buffer in which the result is writen * @param outputFrame: the output buffer in which the result is writen
*/ */
void runFilter_LocalAdapdation_autonomous(const std::valarray<float> &inputFrame, std::valarray<float> &outputFrame); // run local adaptation filter on a specific output adress void runFilter_LocalAdapdation_autonomous(const std::valarray<float> &inputFrame, std::valarray<float> &outputFrame); // run local adaptation filter on a specific output adress
/** /**
* run low pass filtering with progressive parameters (models the retina log sampling of the photoreceptors and its low pass filtering effect consequence: more powerfull low pass filtering effect on the corners) * run low pass filtering with progressive parameters (models the retina log sampling of the photoreceptors and its low pass filtering effect consequence: more powerfull low pass filtering effect on the corners)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @param filterIndex: the index which specifies the parameter set that should be used for the filtering * @param filterIndex: the index which specifies the parameter set that should be used for the filtering
* @return the processed image, the output is reachable later by using function getOutput() if outputFrame is NULL * @return the processed image, the output is reachable later by using function getOutput() if outputFrame is NULL
*/ */
inline void runProgressiveFilter(std::valarray<float> &inputFrame, const unsigned int filterIndex=0){_spatiotemporalLPfilter_Irregular(&inputFrame[0], filterIndex);}; inline void runProgressiveFilter(std::valarray<float> &inputFrame, const unsigned int filterIndex=0){_spatiotemporalLPfilter_Irregular(&inputFrame[0], filterIndex);};
/** /**
* run low pass filtering with progressive parameters (models the retina log sampling of the photoreceptors and its low pass filtering effect consequence: more powerfull low pass filtering effect on the corners) * run low pass filtering with progressive parameters (models the retina log sampling of the photoreceptors and its low pass filtering effect consequence: more powerfull low pass filtering effect on the corners)
* @param inputFrame: the input image to be processed * @param inputFrame: the input image to be processed
* @param outputFrame: the output buffer in which the result is writen * @param outputFrame: the output buffer in which the result is writen
* @param filterIndex: the index which specifies the parameter set that should be used for the filtering * @param filterIndex: the index which specifies the parameter set that should be used for the filtering
*/ */
inline void runProgressiveFilter(const std::valarray<float> &inputFrame, inline void runProgressiveFilter(const std::valarray<float> &inputFrame,
std::valarray<float> &outputFrame, std::valarray<float> &outputFrame,
const unsigned int filterIndex=0) const unsigned int filterIndex=0)
{_spatiotemporalLPfilter_Irregular(get_data(inputFrame), &outputFrame[0], filterIndex);}; {_spatiotemporalLPfilter_Irregular(get_data(inputFrame), &outputFrame[0], filterIndex);};
/** /**
* first order spatio-temporal low pass filter setup function * first order spatio-temporal low pass filter setup function
* @param beta: gain of the filter (generally set to zero) * @param beta: gain of the filter (generally set to zero)
* @param tau: time constant of the filter (unit is frame for video processing) * @param tau: time constant of the filter (unit is frame for video processing)
* @param k: spatial constant of the filter (unit is pixels) * @param k: spatial constant of the filter (unit is pixels)
* @param filterIndex: the index which specifies the parameter set that should be used for the filtering * @param filterIndex: the index which specifies the parameter set that should be used for the filtering
*/ */
void setLPfilterParameters(const float beta, const float tau, const float k, const unsigned int filterIndex=0); // change the parameters of the filter void setLPfilterParameters(const float beta, const float tau, const float k, const unsigned int filterIndex=0); // change the parameters of the filter
/** /**
* first order spatio-temporal low pass filter setup function * first order spatio-temporal low pass filter setup function
* @param beta: gain of the filter (generally set to zero) * @param beta: gain of the filter (generally set to zero)
* @param tau: time constant of the filter (unit is frame for video processing) * @param tau: time constant of the filter (unit is frame for video processing)
* @param alpha0: spatial constant of the filter (unit is pixels) on the border of the image * @param alpha0: spatial constant of the filter (unit is pixels) on the border of the image
* @param filterIndex: the index which specifies the parameter set that should be used for the filtering * @param filterIndex: the index which specifies the parameter set that should be used for the filtering
*/ */
void setProgressiveFilterConstants_CentredAccuracy(const float beta, const float tau, const float alpha0, const unsigned int filterIndex=0); void setProgressiveFilterConstants_CentredAccuracy(const float beta, const float tau, const float alpha0, const unsigned int filterIndex=0);
/** /**
* first order spatio-temporal low pass filter setup function * first order spatio-temporal low pass filter setup function
* @param beta: gain of the filter (generally set to zero) * @param beta: gain of the filter (generally set to zero)
* @param tau: time constant of the filter (unit is frame for video processing) * @param tau: time constant of the filter (unit is frame for video processing)
* @param alpha0: spatial constant of the filter (unit is pixels) on the border of the image * @param alpha0: spatial constant of the filter (unit is pixels) on the border of the image
* @param accuracyMap an image (float format) which values range is between 0 and 1, where 0 means, apply no filtering and 1 means apply the filtering as specified in the parameters set, intermediate values allow to smooth variations of the filtering strenght * @param accuracyMap an image (float format) which values range is between 0 and 1, where 0 means, apply no filtering and 1 means apply the filtering as specified in the parameters set, intermediate values allow to smooth variations of the filtering strenght
* @param filterIndex: the index which specifies the parameter set that should be used for the filtering * @param filterIndex: the index which specifies the parameter set that should be used for the filtering
*/ */
void setProgressiveFilterConstants_CustomAccuracy(const float beta, const float tau, const float alpha0, const std::valarray<float> &accuracyMap, const unsigned int filterIndex=0); void setProgressiveFilterConstants_CustomAccuracy(const float beta, const float tau, const float alpha0, const std::valarray<float> &accuracyMap, const unsigned int filterIndex=0);
/** /**
* local luminance adaptation setup, this function should be applied for normal local adaptation (not for tone mapping operation) * local luminance adaptation setup, this function should be applied for normal local adaptation (not for tone mapping operation)
* @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect * @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect
* @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous) * @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous)
* @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI) * @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI)
*/ */
void setV0CompressionParameter(const float v0, const float maxInputValue, const float){ _v0=v0*maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=maxInputValue*(1.0f-v0); _maxInputValue=maxInputValue;}; void setV0CompressionParameter(const float v0, const float maxInputValue, const float){ _v0=v0*maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=maxInputValue*(1.0f-v0); _maxInputValue=maxInputValue;};
/** /**
* update local luminance adaptation setup, initial maxInputValue is kept. This function should be applied for normal local adaptation (not for tone mapping operation) * update local luminance adaptation setup, initial maxInputValue is kept. This function should be applied for normal local adaptation (not for tone mapping operation)
* @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect * @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect
* @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI) * @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI)
*/ */
void setV0CompressionParameter(const float v0, const float meanLuminance){ this->setV0CompressionParameter(v0, _maxInputValue, meanLuminance);}; void setV0CompressionParameter(const float v0, const float meanLuminance){ this->setV0CompressionParameter(v0, _maxInputValue, meanLuminance);};
/** /**
* local luminance adaptation setup, this function should be applied for normal local adaptation (not for tone mapping operation) * local luminance adaptation setup, this function should be applied for normal local adaptation (not for tone mapping operation)
* @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect * @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect
*/ */
void setV0CompressionParameter(const float v0){ _v0=v0*_maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=_maxInputValue*(1.0f-v0);}; void setV0CompressionParameter(const float v0){ _v0=v0*_maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=_maxInputValue*(1.0f-v0);};
/** /**
* local luminance adaptation setup, this function should be applied for local adaptation applied to tone mapping operation * local luminance adaptation setup, this function should be applied for local adaptation applied to tone mapping operation
* @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect * @param v0: compression effect for the local luminance adaptation processing, set a value between 0.6 and 0.9 for best results, a high value yields to a high compression effect
* @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous) * @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous)
* @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI) * @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI)
*/ */
void setV0CompressionParameterToneMapping(const float v0, const float maxInputValue, const float meanLuminance=128.0f){ _v0=v0*maxInputValue; _localLuminanceFactor=1.0f; _localLuminanceAddon=meanLuminance*_v0; _maxInputValue=maxInputValue;}; void setV0CompressionParameterToneMapping(const float v0, const float maxInputValue, const float meanLuminance=128.0f){ _v0=v0*maxInputValue; _localLuminanceFactor=1.0f; _localLuminanceAddon=meanLuminance*_v0; _maxInputValue=maxInputValue;};
/** /**
* update compression parameters while keeping v0 parameter value * update compression parameters while keeping v0 parameter value
* @param meanLuminance the input frame mean luminance * @param meanLuminance the input frame mean luminance
*/ */
inline void updateCompressionParameter(const float meanLuminance){_localLuminanceFactor=1; _localLuminanceAddon=meanLuminance*_v0;}; inline void updateCompressionParameter(const float meanLuminance){_localLuminanceFactor=1; _localLuminanceAddon=meanLuminance*_v0;};
/** /**
* @return the v0 compression parameter used to compute the local adaptation * @return the v0 compression parameter used to compute the local adaptation
*/ */
const float getV0CompressionParameter(){ return _v0/_maxInputValue;}; float getV0CompressionParameter(){ return _v0/_maxInputValue;};
/** /**
* @return the output result of the object * @return the output result of the object
*/ */
inline const std::valarray<float> &getOutput() const {return _filterOutput;}; inline const std::valarray<float> &getOutput() const {return _filterOutput;};
/** /**
* @return number of rows of the filter * @return number of rows of the filter
*/ */
inline const unsigned int getNBrows(){return _filterOutput.getNBrows();}; inline unsigned int getNBrows(){return _filterOutput.getNBrows();};
/** /**
* @return number of columns of the filter * @return number of columns of the filter
*/ */
inline const unsigned int getNBcolumns(){return _filterOutput.getNBcolumns();}; inline unsigned int getNBcolumns(){return _filterOutput.getNBcolumns();};
/** /**
* @return number of pixels of the filter * @return number of pixels of the filter
*/ */
inline const unsigned int getNBpixels(){return _filterOutput.getNBpixels();}; inline unsigned int getNBpixels(){return _filterOutput.getNBpixels();};
/** /**
* force filter output to be normalized between 0 and maxValue * force filter output to be normalized between 0 and maxValue
* @param maxValue: the maximum output value that is required * @param maxValue: the maximum output value that is required
*/ */
inline void normalizeGrayOutput_0_maxOutputValue(const float maxValue){_filterOutput.normalizeGrayOutput_0_maxOutputValue(maxValue);}; inline void normalizeGrayOutput_0_maxOutputValue(const float maxValue){_filterOutput.normalizeGrayOutput_0_maxOutputValue(maxValue);};
/** /**
* force filter output to be normalized around 0 and rescaled with a sigmoide effect (extrem values saturation) * force filter output to be normalized around 0 and rescaled with a sigmoide effect (extrem values saturation)
* @param maxValue: the maximum output value that is required * @param maxValue: the maximum output value that is required
*/ */
inline void normalizeGrayOutputCentredSigmoide(){_filterOutput.normalizeGrayOutputCentredSigmoide();}; inline void normalizeGrayOutputCentredSigmoide(){_filterOutput.normalizeGrayOutputCentredSigmoide();};
/** /**
* force filter output to be normalized : data centering and std normalisation * force filter output to be normalized : data centering and std normalisation
* @param maxValue: the maximum output value that is required * @param maxValue: the maximum output value that is required
*/ */
inline void centerReductImageLuminance(){_filterOutput.centerReductImageLuminance();}; inline void centerReductImageLuminance(){_filterOutput.centerReductImageLuminance();};
/** /**
* @return the maximum input buffer value * @return the maximum input buffer value
*/ */
inline const float getMaxInputValue(){return this->_maxInputValue;}; inline float getMaxInputValue(){return this->_maxInputValue;};
/** /**
* @return the maximum input buffer value * @return the maximum input buffer value
*/ */
inline void setMaxInputValue(const float newMaxInputValue){this->_maxInputValue=newMaxInputValue;}; inline void setMaxInputValue(const float newMaxInputValue){this->_maxInputValue=newMaxInputValue;};
protected: protected:
///////////////////////// /////////////////////////
// data buffers // data buffers
TemplateBuffer<float> _filterOutput; // primary buffer (contains processing outputs) TemplateBuffer<float> _filterOutput; // primary buffer (contains processing outputs)
std::valarray<float> _localBuffer; // local secondary buffer std::valarray<float> _localBuffer; // local secondary buffer
///////////////////////// /////////////////////////
// PARAMETERS // PARAMETERS
unsigned int _halfNBrows; unsigned int _halfNBrows;
unsigned int _halfNBcolumns; unsigned int _halfNBcolumns;
// parameters buffers // parameters buffers
std::valarray <float>_filteringCoeficientsTable; std::valarray <float>_filteringCoeficientsTable;
std::valarray <float>_progressiveSpatialConstant;// pointer to a local table containing local spatial constant (allocated with the object) std::valarray <float>_progressiveSpatialConstant;// pointer to a local table containing local spatial constant (allocated with the object)
std::valarray <float>_progressiveGain;// pointer to a local table containing local spatial constant (allocated with the object) std::valarray <float>_progressiveGain;// pointer to a local table containing local spatial constant (allocated with the object)
// local adaptation filtering parameters // local adaptation filtering parameters
float _v0; //value used for local luminance adaptation function float _v0; //value used for local luminance adaptation function
float _maxInputValue; float _maxInputValue;
float _meanInputValue; float _meanInputValue;
float _localLuminanceFactor; float _localLuminanceFactor;
float _localLuminanceAddon; float _localLuminanceAddon;
// protected data related to standard low pass filters parameters // protected data related to standard low pass filters parameters
float _a; float _a;
float _tau; float _tau;
float _gain; float _gain;
///////////////////////// /////////////////////////
// FILTERS METHODS // FILTERS METHODS
// Basic low pass spation temporal low pass filter used by each retina filters // Basic low pass spation temporal low pass filter used by each retina filters
void _spatiotemporalLPfilter(const float *inputFrame, float *LPfilterOutput, const unsigned int coefTableOffset=0); void _spatiotemporalLPfilter(const float *inputFrame, float *LPfilterOutput, const unsigned int coefTableOffset=0);
const float _squaringSpatiotemporalLPfilter(const float *inputFrame, float *outputFrame, const unsigned int filterIndex=0); float _squaringSpatiotemporalLPfilter(const float *inputFrame, float *outputFrame, const unsigned int filterIndex=0);
// LP filter with an irregular spatial filtering // LP filter with an irregular spatial filtering
// -> rewrites the input buffer // -> rewrites the input buffer
void _spatiotemporalLPfilter_Irregular(float *inputOutputFrame, const unsigned int filterIndex=0); void _spatiotemporalLPfilter_Irregular(float *inputOutputFrame, const unsigned int filterIndex=0);
// writes the output on another buffer // writes the output on another buffer
void _spatiotemporalLPfilter_Irregular(const float *inputFrame, float *outputFrame, const unsigned int filterIndex=0); void _spatiotemporalLPfilter_Irregular(const float *inputFrame, float *outputFrame, const unsigned int filterIndex=0);
// LP filter that squares the input and computes the output ONLY on the areas where the integrationAreas map are TRUE // LP filter that squares the input and computes the output ONLY on the areas where the integrationAreas map are TRUE
void _localSquaringSpatioTemporalLPfilter(const float *inputFrame, float *LPfilterOutput, const unsigned int *integrationAreas, const unsigned int filterIndex=0); void _localSquaringSpatioTemporalLPfilter(const float *inputFrame, float *LPfilterOutput, const unsigned int *integrationAreas, const unsigned int filterIndex=0);
// local luminance adaptation of the input in regard of localLuminance buffer // local luminance adaptation of the input in regard of localLuminance buffer
void _localLuminanceAdaptation(const float *inputFrame, const float *localLuminance, float *outputFrame); void _localLuminanceAdaptation(const float *inputFrame, const float *localLuminance, float *outputFrame);
// local luminance adaptation of the input in regard of localLuminance buffer, the input is rewrited and becomes the output // local luminance adaptation of the input in regard of localLuminance buffer, the input is rewrited and becomes the output
void _localLuminanceAdaptation(float *inputOutputFrame, const float *localLuminance); void _localLuminanceAdaptation(float *inputOutputFrame, const float *localLuminance);
// local adaptation applied on a range of values which can be positive and negative // local adaptation applied on a range of values which can be positive and negative
void _localLuminanceAdaptationPosNegValues(const float *inputFrame, const float *localLuminance, float *outputFrame); void _localLuminanceAdaptationPosNegValues(const float *inputFrame, const float *localLuminance, float *outputFrame);
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// 1D directional filters used for the 2D low pass filtering // 1D directional filters used for the 2D low pass filtering
// 1D filters with image input // 1D filters with image input
void _horizontalCausalFilter_addInput(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _horizontalCausalFilter_addInput(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
// 1D filters with image input that is squared in the function // 1D filters with image input that is squared in the function
void _squaringHorizontalCausalFilter(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _squaringHorizontalCausalFilter(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
// vertical anticausal filter that returns the mean value of its result // vertical anticausal filter that returns the mean value of its result
const float _verticalAnticausalFilter_returnMeanValue(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); float _verticalAnticausalFilter_returnMeanValue(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd);
// most simple functions: only perform 1D filtering with output=input (no add on) // most simple functions: only perform 1D filtering with output=input (no add on)
void _horizontalCausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _horizontalCausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
void _horizontalAnticausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _horizontalAnticausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
void _verticalCausalFilter(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); void _verticalCausalFilter(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd);
void _verticalAnticausalFilter(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); void _verticalAnticausalFilter(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd);
// perform 1D filtering with output with varrying spatial coefficient // perform 1D filtering with output with varrying spatial coefficient
void _horizontalCausalFilter_Irregular(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _horizontalCausalFilter_Irregular(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
void _horizontalCausalFilter_Irregular_addInput(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _horizontalCausalFilter_Irregular_addInput(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
void _horizontalAnticausalFilter_Irregular(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd); void _horizontalAnticausalFilter_Irregular(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd);
void _verticalCausalFilter_Irregular(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); void _verticalCausalFilter_Irregular(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd);
void _verticalAnticausalFilter_Irregular_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); void _verticalAnticausalFilter_Irregular_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd);
// 1D filters in which the output is multiplied by _gain // 1D filters in which the output is multiplied by _gain
void _verticalAnticausalFilter_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); // this functions affects _gain at the output void _verticalAnticausalFilter_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); // this functions affects _gain at the output
void _horizontalAnticausalFilter_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); // this functions affects _gain at the output void _horizontalAnticausalFilter_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd); // this functions affects _gain at the output
// LP filter on specific parts of the picture instead of all the image // LP filter on specific parts of the picture instead of all the image
// same functions (some of them) but take a binary flag to allow integration, false flag means, 0 at the output... // same functions (some of them) but take a binary flag to allow integration, false flag means, 0 at the output...
void _local_squaringHorizontalCausalFilter(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd, const unsigned int *integrationAreas); void _local_squaringHorizontalCausalFilter(const float *inputFrame, float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd, const unsigned int *integrationAreas);
void _local_horizontalAnticausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd, const unsigned int *integrationAreas); void _local_horizontalAnticausalFilter(float *outputFrame, unsigned int IDrowStart, unsigned int IDrowEnd, const unsigned int *integrationAreas);
void _local_verticalCausalFilter(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd, const unsigned int *integrationAreas); void _local_verticalCausalFilter(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd, const unsigned int *integrationAreas);
void _local_verticalAnticausalFilter_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd, const unsigned int *integrationAreas); // this functions affects _gain at the output void _local_verticalAnticausalFilter_multGain(float *outputFrame, unsigned int IDcolumnStart, unsigned int IDcolumnEnd, const unsigned int *integrationAreas); // this functions affects _gain at the output
}; };

View File

@ -46,20 +46,20 @@ using namespace cv;
using namespace std; using namespace std;
CvHybridTrackerParams::CvHybridTrackerParams(float _ft_tracker_weight, float _ms_tracker_weight, CvHybridTrackerParams::CvHybridTrackerParams(float _ft_tracker_weight, float _ms_tracker_weight,
CvFeatureTrackerParams _ft_params, CvFeatureTrackerParams _ft_params,
CvMeanShiftTrackerParams _ms_params, CvMeanShiftTrackerParams _ms_params,
CvMotionModel) CvMotionModel)
{ {
ft_tracker_weight = _ft_tracker_weight; ft_tracker_weight = _ft_tracker_weight;
ms_tracker_weight = _ms_tracker_weight; ms_tracker_weight = _ms_tracker_weight;
ft_params = _ft_params; ft_params = _ft_params;
ms_params = _ms_params; ms_params = _ms_params;
} }
CvMeanShiftTrackerParams::CvMeanShiftTrackerParams(int _tracking_type, CvTermCriteria _term_crit) CvMeanShiftTrackerParams::CvMeanShiftTrackerParams(int _tracking_type, CvTermCriteria _term_crit)
{ {
tracking_type = _tracking_type; tracking_type = _tracking_type;
term_crit = _term_crit; term_crit = _term_crit;
} }
CvHybridTracker::CvHybridTracker() { CvHybridTracker::CvHybridTracker() {
@ -67,148 +67,148 @@ CvHybridTracker::CvHybridTracker() {
} }
CvHybridTracker::CvHybridTracker(HybridTrackerParams _params) : CvHybridTracker::CvHybridTracker(HybridTrackerParams _params) :
params(_params) { params(_params) {
params.ft_params.feature_type = CvFeatureTrackerParams::SIFT; params.ft_params.feature_type = CvFeatureTrackerParams::SIFT;
mstracker = new CvMeanShiftTracker(params.ms_params); mstracker = new CvMeanShiftTracker(params.ms_params);
fttracker = new CvFeatureTracker(params.ft_params); fttracker = new CvFeatureTracker(params.ft_params);
} }
CvHybridTracker::~CvHybridTracker() { CvHybridTracker::~CvHybridTracker() {
if (mstracker != NULL) if (mstracker != NULL)
delete mstracker; delete mstracker;
if (fttracker != NULL) if (fttracker != NULL)
delete fttracker; delete fttracker;
} }
inline float CvHybridTracker::getL2Norm(Point2f p1, Point2f p2) { inline float CvHybridTracker::getL2Norm(Point2f p1, Point2f p2) {
float distance = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y float distance = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y
- p2.y); - p2.y);
return sqrt(distance); return sqrt(distance);
} }
Mat CvHybridTracker::getDistanceProjection(Mat image, Point2f center) { Mat CvHybridTracker::getDistanceProjection(Mat image, Point2f center) {
Mat hist(image.size(), CV_64F); Mat hist(image.size(), CV_64F);
double lu = getL2Norm(Point(0, 0), center); double lu = getL2Norm(Point(0, 0), center);
double ru = getL2Norm(Point(0, image.size().width), center); double ru = getL2Norm(Point(0, image.size().width), center);
double rd = getL2Norm(Point(image.size().height, image.size().width), double rd = getL2Norm(Point(image.size().height, image.size().width),
center); center);
double ld = getL2Norm(Point(image.size().height, 0), center); double ld = getL2Norm(Point(image.size().height, 0), center);
double max = (lu < ru) ? lu : ru; double max = (lu < ru) ? lu : ru;
max = (max < rd) ? max : rd; max = (max < rd) ? max : rd;
max = (max < ld) ? max : ld; max = (max < ld) ? max : ld;
for (int i = 0; i < hist.rows; i++) for (int i = 0; i < hist.rows; i++)
for (int j = 0; j < hist.cols; j++) for (int j = 0; j < hist.cols; j++)
hist.at<double> (i, j) = 1.0 - (getL2Norm(Point(i, j), center) hist.at<double> (i, j) = 1.0 - (getL2Norm(Point(i, j), center)
/ max); / max);
return hist; return hist;
} }
Mat CvHybridTracker::getGaussianProjection(Mat image, int ksize, double sigma, Mat CvHybridTracker::getGaussianProjection(Mat image, int ksize, double sigma,
Point2f center) { Point2f center) {
Mat kernel = getGaussianKernel(ksize, sigma, CV_64F); Mat kernel = getGaussianKernel(ksize, sigma, CV_64F);
double max = kernel.at<double> (ksize / 2); double max = kernel.at<double> (ksize / 2);
Mat hist(image.size(), CV_64F); Mat hist(image.size(), CV_64F);
for (int i = 0; i < hist.rows; i++) for (int i = 0; i < hist.rows; i++)
for (int j = 0; j < hist.cols; j++) { for (int j = 0; j < hist.cols; j++) {
int pos = cvRound(getL2Norm(Point(i, j), center)); int pos = cvRound(getL2Norm(Point(i, j), center));
if (pos < ksize / 2.0) if (pos < ksize / 2.0)
hist.at<double> (i, j) = 1.0 - (kernel.at<double> (pos) / max); hist.at<double> (i, j) = 1.0 - (kernel.at<double> (pos) / max);
} }
return hist; return hist;
} }
void CvHybridTracker::newTracker(Mat image, Rect selection) { void CvHybridTracker::newTracker(Mat image, Rect selection) {
prev_proj = Mat::zeros(image.size(), CV_64FC1); prev_proj = Mat::zeros(image.size(), CV_64FC1);
prev_center = Point2f(selection.x + selection.width / 2.0f, selection.y prev_center = Point2f(selection.x + selection.width / 2.0f, selection.y
+ selection.height / 2.0f); + selection.height / 2.0f);
prev_window = selection; prev_window = selection;
mstracker->newTrackingWindow(image, selection); mstracker->newTrackingWindow(image, selection);
fttracker->newTrackingWindow(image, selection); fttracker->newTrackingWindow(image, selection);
samples = cvCreateMat(2, 1, CV_32FC1); samples = cvCreateMat(2, 1, CV_32FC1);
labels = cvCreateMat(2, 1, CV_32SC1); labels = cvCreateMat(2, 1, CV_32SC1);
ittr = 0; ittr = 0;
} }
void CvHybridTracker::updateTracker(Mat image) { void CvHybridTracker::updateTracker(Mat image) {
ittr++; ittr++;
//copy over clean images: TODO //copy over clean images: TODO
mstracker->updateTrackingWindow(image); mstracker->updateTrackingWindow(image);
fttracker->updateTrackingWindowWithFlow(image); fttracker->updateTrackingWindowWithFlow(image);
if (params.motion_model == CvMotionModel::EM) if (params.motion_model == CvMotionModel::EM)
updateTrackerWithEM(image); updateTrackerWithEM(image);
else else
updateTrackerWithLowPassFilter(image); updateTrackerWithLowPassFilter(image);
// Regression to find new weights // Regression to find new weights
Point2f ms_center = mstracker->getTrackingEllipse().center; Point2f ms_center = mstracker->getTrackingEllipse().center;
Point2f ft_center = fttracker->getTrackingCenter(); Point2f ft_center = fttracker->getTrackingCenter();
#ifdef DEBUG_HYTRACKER #ifdef DEBUG_HYTRACKER
circle(image, ms_center, 3, Scalar(0, 0, 255), -1, 8); circle(image, ms_center, 3, Scalar(0, 0, 255), -1, 8);
circle(image, ft_center, 3, Scalar(255, 0, 0), -1, 8); circle(image, ft_center, 3, Scalar(255, 0, 0), -1, 8);
putText(image, "ms", Point(ms_center.x+2, ms_center.y), FONT_HERSHEY_PLAIN, 0.75, Scalar(255, 255, 255)); putText(image, "ms", Point(ms_center.x+2, ms_center.y), FONT_HERSHEY_PLAIN, 0.75, Scalar(255, 255, 255));
putText(image, "ft", Point(ft_center.x+2, ft_center.y), FONT_HERSHEY_PLAIN, 0.75, Scalar(255, 255, 255)); putText(image, "ft", Point(ft_center.x+2, ft_center.y), FONT_HERSHEY_PLAIN, 0.75, Scalar(255, 255, 255));
#endif #endif
double ms_len = getL2Norm(ms_center, curr_center); double ms_len = getL2Norm(ms_center, curr_center);
double ft_len = getL2Norm(ft_center, curr_center); double ft_len = getL2Norm(ft_center, curr_center);
double total_len = ms_len + ft_len; double total_len = ms_len + ft_len;
params.ms_tracker_weight *= (ittr - 1); params.ms_tracker_weight *= (ittr - 1);
params.ms_tracker_weight += (float)((ms_len / total_len)); params.ms_tracker_weight += (float)((ms_len / total_len));
params.ms_tracker_weight /= ittr; params.ms_tracker_weight /= ittr;
params.ft_tracker_weight *= (ittr - 1); params.ft_tracker_weight *= (ittr - 1);
params.ft_tracker_weight += (float)((ft_len / total_len)); params.ft_tracker_weight += (float)((ft_len / total_len));
params.ft_tracker_weight /= ittr; params.ft_tracker_weight /= ittr;
circle(image, prev_center, 3, Scalar(0, 0, 0), -1, 8); circle(image, prev_center, 3, Scalar(0, 0, 0), -1, 8);
circle(image, curr_center, 3, Scalar(255, 255, 255), -1, 8); circle(image, curr_center, 3, Scalar(255, 255, 255), -1, 8);
prev_center = curr_center; prev_center = curr_center;
prev_window.x = (int)(curr_center.x-prev_window.width/2.0); prev_window.x = (int)(curr_center.x-prev_window.width/2.0);
prev_window.y = (int)(curr_center.y-prev_window.height/2.0); prev_window.y = (int)(curr_center.y-prev_window.height/2.0);
mstracker->setTrackingWindow(prev_window); mstracker->setTrackingWindow(prev_window);
fttracker->setTrackingWindow(prev_window); fttracker->setTrackingWindow(prev_window);
} }
void CvHybridTracker::updateTrackerWithEM(Mat image) { void CvHybridTracker::updateTrackerWithEM(Mat image) {
Mat ms_backproj = mstracker->getHistogramProjection(CV_64F); Mat ms_backproj = mstracker->getHistogramProjection(CV_64F);
Mat ms_distproj = getDistanceProjection(image, mstracker->getTrackingCenter()); Mat ms_distproj = getDistanceProjection(image, mstracker->getTrackingCenter());
Mat ms_proj = ms_backproj.mul(ms_distproj); Mat ms_proj = ms_backproj.mul(ms_distproj);
float dist_err = getL2Norm(mstracker->getTrackingCenter(), fttracker->getTrackingCenter()); float dist_err = getL2Norm(mstracker->getTrackingCenter(), fttracker->getTrackingCenter());
Mat ft_gaussproj = getGaussianProjection(image, cvRound(dist_err), -1, fttracker->getTrackingCenter()); Mat ft_gaussproj = getGaussianProjection(image, cvRound(dist_err), -1, fttracker->getTrackingCenter());
Mat ft_distproj = getDistanceProjection(image, fttracker->getTrackingCenter()); Mat ft_distproj = getDistanceProjection(image, fttracker->getTrackingCenter());
Mat ft_proj = ft_gaussproj.mul(ft_distproj); Mat ft_proj = ft_gaussproj.mul(ft_distproj);
Mat proj = params.ms_tracker_weight * ms_proj + params.ft_tracker_weight * ft_proj + prev_proj; Mat proj = params.ms_tracker_weight * ms_proj + params.ft_tracker_weight * ft_proj + prev_proj;
int sample_count = countNonZero(proj); int sample_count = countNonZero(proj);
cvReleaseMat(&samples); cvReleaseMat(&samples);
cvReleaseMat(&labels); cvReleaseMat(&labels);
samples = cvCreateMat(sample_count, 2, CV_32FC1); samples = cvCreateMat(sample_count, 2, CV_32FC1);
labels = cvCreateMat(sample_count, 1, CV_32SC1); labels = cvCreateMat(sample_count, 1, CV_32SC1);
int count = 0; int count = 0;
for (int i = 0; i < proj.rows; i++) for (int i = 0; i < proj.rows; i++)
for (int j = 0; j < proj.cols; j++) for (int j = 0; j < proj.cols; j++)
if (proj.at<double> (i, j) > 0) { if (proj.at<double> (i, j) > 0) {
samples->data.fl[count * 2] = (float)i; samples->data.fl[count * 2] = (float)i;
samples->data.fl[count * 2 + 1] = (float)j; samples->data.fl[count * 2 + 1] = (float)j;
count++; count++;
} }
cv::Mat lbls; cv::Mat lbls;
@ -218,20 +218,20 @@ void CvHybridTracker::updateTrackerWithEM(Mat image) {
lbls.copyTo(cvarrToMat(labels)); lbls.copyTo(cvarrToMat(labels));
Mat em_means = em_model.get<Mat>("means"); Mat em_means = em_model.get<Mat>("means");
curr_center.x = (float)em_means.at<float>(0, 0); curr_center.x = (float)em_means.at<float>(0, 0);
curr_center.y = (float)em_means.at<float>(0, 1); curr_center.y = (float)em_means.at<float>(0, 1);
} }
void CvHybridTracker::updateTrackerWithLowPassFilter(Mat image) { void CvHybridTracker::updateTrackerWithLowPassFilter(Mat) {
RotatedRect ms_track = mstracker->getTrackingEllipse(); RotatedRect ms_track = mstracker->getTrackingEllipse();
Point2f ft_center = fttracker->getTrackingCenter(); Point2f ft_center = fttracker->getTrackingCenter();
float a = params.low_pass_gain; float a = params.low_pass_gain;
curr_center.x = (1 - a) * prev_center.x + a * (params.ms_tracker_weight * ms_track.center.x + params.ft_tracker_weight * ft_center.x); curr_center.x = (1 - a) * prev_center.x + a * (params.ms_tracker_weight * ms_track.center.x + params.ft_tracker_weight * ft_center.x);
curr_center.y = (1 - a) * prev_center.y + a * (params.ms_tracker_weight * ms_track.center.y + params.ft_tracker_weight * ft_center.y); curr_center.y = (1 - a) * prev_center.y + a * (params.ms_tracker_weight * ms_track.center.y + params.ft_tracker_weight * ft_center.y);
} }
Rect CvHybridTracker::getTrackingWindow() { Rect CvHybridTracker::getTrackingWindow() {
return prev_window; return prev_window;
} }

View File

@ -108,131 +108,131 @@ class ImageLogPolProjection:public BasicRetinaFilter
{ {
public: public:
enum PROJECTIONTYPE{RETINALOGPROJECTION, CORTEXLOGPOLARPROJECTION}; enum PROJECTIONTYPE{RETINALOGPROJECTION, CORTEXLOGPOLARPROJECTION};
/** /**
* constructor, just specifies the image input size and the projection type, no projection initialisation is done * constructor, just specifies the image input size and the projection type, no projection initialisation is done
* -> use initLogRetinaSampling() or initLogPolarCortexSampling() for that * -> use initLogRetinaSampling() or initLogPolarCortexSampling() for that
* @param nbRows: number of rows of the input image * @param nbRows: number of rows of the input image
* @param nbColumns: number of columns of the input image * @param nbColumns: number of columns of the input image
* @param projection: the type of projection, RETINALOGPROJECTION or CORTEXLOGPOLARPROJECTION * @param projection: the type of projection, RETINALOGPROJECTION or CORTEXLOGPOLARPROJECTION
* @param colorMode: specifies if the projection is applied on a grayscale image (false) or color images (3 layers) (true) * @param colorMode: specifies if the projection is applied on a grayscale image (false) or color images (3 layers) (true)
*/ */
ImageLogPolProjection(const unsigned int nbRows, const unsigned int nbColumns, const PROJECTIONTYPE projection, const bool colorMode=false); ImageLogPolProjection(const unsigned int nbRows, const unsigned int nbColumns, const PROJECTIONTYPE projection, const bool colorMode=false);
/** /**
* standard destructor * standard destructor
*/ */
virtual ~ImageLogPolProjection(); virtual ~ImageLogPolProjection();
/** /**
* function that clears all buffers of the object * function that clears all buffers of the object
*/ */
void clearAllBuffers(); void clearAllBuffers();
/** /**
* resize retina color filter object (resize all allocated buffers) * resize retina color filter object (resize all allocated buffers)
* @param NBrows: the new height size * @param NBrows: the new height size
* @param NBcolumns: the new width size * @param NBcolumns: the new width size
*/ */
void resize(const unsigned int NBrows, const unsigned int NBcolumns); void resize(const unsigned int NBrows, const unsigned int NBcolumns);
/** /**
* init function depending on the projection type * init function depending on the projection type
* @param reductionFactor: the size reduction factor of the ouptup image in regard of the size of the input image, must be superior to 1 * @param reductionFactor: the size reduction factor of the ouptup image in regard of the size of the input image, must be superior to 1
* @param samplingStrenght: specifies the strenght of the log compression effect (magnifying coefficient) * @param samplingStrenght: specifies the strenght of the log compression effect (magnifying coefficient)
* @return true if the init was performed without any errors * @return true if the init was performed without any errors
*/ */
bool initProjection(const double reductionFactor, const double samplingStrenght); bool initProjection(const double reductionFactor, const double samplingStrenght);
/** /**
* main funtion of the class: run projection function * main funtion of the class: run projection function
* @param inputFrame: the input frame to be processed * @param inputFrame: the input frame to be processed
* @param colorMode: the input buffer color mode: false=gray levels, true = 3 color channels mode * @param colorMode: the input buffer color mode: false=gray levels, true = 3 color channels mode
* @return the output frame * @return the output frame
*/ */
std::valarray<float> &runProjection(const std::valarray<float> &inputFrame, const bool colorMode=false); std::valarray<float> &runProjection(const std::valarray<float> &inputFrame, const bool colorMode=false);
/** /**
* @return the numbers of rows (height) of the images OUTPUTS of the object * @return the numbers of rows (height) of the images OUTPUTS of the object
*/ */
inline const unsigned int getOutputNBrows(){return _outputNBrows;}; inline unsigned int getOutputNBrows(){return _outputNBrows;};
/** /**
* @return the numbers of columns (width) of the images OUTPUTS of the object * @return the numbers of columns (width) of the images OUTPUTS of the object
*/ */
inline const unsigned int getOutputNBcolumns(){return _outputNBcolumns;}; inline unsigned int getOutputNBcolumns(){return _outputNBcolumns;};
/** /**
* main funtion of the class: run projection function * main funtion of the class: run projection function
* @param size: one of the input frame initial dimensions to be processed * @param size: one of the input frame initial dimensions to be processed
* @return the output frame dimension * @return the output frame dimension
*/ */
inline static const unsigned int predictOutputSize(const unsigned int size, const double reductionFactor){return (unsigned int)((double)size/reductionFactor);}; inline static unsigned int predictOutputSize(const unsigned int size, const double reductionFactor){return (unsigned int)((double)size/reductionFactor);};
/** /**
* @return the output of the filter which applies an irregular Low Pass spatial filter to the imag input (see function * @return the output of the filter which applies an irregular Low Pass spatial filter to the imag input (see function
*/ */
inline const std::valarray<float> &getIrregularLPfilteredInputFrame() const {return _irregularLPfilteredFrame;}; inline const std::valarray<float> &getIrregularLPfilteredInputFrame() const {return _irregularLPfilteredFrame;};
/** /**
* function which allows to retrieve the output frame which was updated after the "runProjection(...) function BasicRetinaFilter::runProgressiveFilter(...) * function which allows to retrieve the output frame which was updated after the "runProjection(...) function BasicRetinaFilter::runProgressiveFilter(...)
* @return the projection result * @return the projection result
*/ */
inline const std::valarray<float> &getSampledFrame() const {return _sampledFrame;}; inline const std::valarray<float> &getSampledFrame() const {return _sampledFrame;};
/** /**
* function which allows gives the tranformation table, its size is (getNBrows()*getNBcolumns()*2) * function which allows gives the tranformation table, its size is (getNBrows()*getNBcolumns()*2)
* @return the transformation matrix [outputPixIndex_i, inputPixIndex_i, outputPixIndex_i+1, inputPixIndex_i+1....] * @return the transformation matrix [outputPixIndex_i, inputPixIndex_i, outputPixIndex_i+1, inputPixIndex_i+1....]
*/ */
inline const std::valarray<unsigned int> &getSamplingMap() const {return _transformTable;}; inline const std::valarray<unsigned int> &getSamplingMap() const {return _transformTable;};
inline const double getOriginalRadiusLength(const double projectedRadiusLength){return _azero/(_alim-projectedRadiusLength*2.0/_minDimension);}; inline double getOriginalRadiusLength(const double projectedRadiusLength){return _azero/(_alim-projectedRadiusLength*2.0/_minDimension);};
// unsigned int getInputPixelIndex(const unsigned int ){ return _transformTable[index*2+1]}; // unsigned int getInputPixelIndex(const unsigned int ){ return _transformTable[index*2+1]};
private: private:
PROJECTIONTYPE _selectedProjection; PROJECTIONTYPE _selectedProjection;
// size of the image output // size of the image output
unsigned int _outputNBrows; unsigned int _outputNBrows;
unsigned int _outputNBcolumns; unsigned int _outputNBcolumns;
unsigned int _outputNBpixels; unsigned int _outputNBpixels;
unsigned int _outputDoubleNBpixels; unsigned int _outputDoubleNBpixels;
unsigned int _inputDoubleNBpixels; unsigned int _inputDoubleNBpixels;
// is the object able to manage color flag // is the object able to manage color flag
bool _colorModeCapable; bool _colorModeCapable;
// sampling strenght factor // sampling strenght factor
double _samplingStrenght; double _samplingStrenght;
// sampling reduction factor // sampling reduction factor
double _reductionFactor; double _reductionFactor;
// log sampling parameters // log sampling parameters
double _azero; double _azero;
double _alim; double _alim;
double _minDimension; double _minDimension;
// template buffers // template buffers
std::valarray<float>_sampledFrame; std::valarray<float>_sampledFrame;
std::valarray<float>&_tempBuffer; std::valarray<float>&_tempBuffer;
std::valarray<unsigned int>_transformTable; std::valarray<unsigned int>_transformTable;
std::valarray<float> &_irregularLPfilteredFrame; // just a reference for easier understanding std::valarray<float> &_irregularLPfilteredFrame; // just a reference for easier understanding
unsigned int _usefullpixelIndex; unsigned int _usefullpixelIndex;
// init transformation tables // init transformation tables
bool _computeLogProjection(); bool _computeLogProjection();
bool _computeLogPolarProjection(); bool _computeLogPolarProjection();
// specifies if init was done correctly // specifies if init was done correctly
bool _initOK; bool _initOK;
// private init projections functions called by "initProjection(...)" function // private init projections functions called by "initProjection(...)" function
bool _initLogRetinaSampling(const double reductionFactor, const double samplingStrenght); bool _initLogRetinaSampling(const double reductionFactor, const double samplingStrenght);
bool _initLogPolarCortexSampling(const double reductionFactor, const double samplingStrenght); bool _initLogPolarCortexSampling(const double reductionFactor, const double samplingStrenght);
ImageLogPolProjection(const ImageLogPolProjection&); ImageLogPolProjection(const ImageLogPolProjection&);
ImageLogPolProjection& operator=(const ImageLogPolProjection&); ImageLogPolProjection& operator=(const ImageLogPolProjection&);
}; };

View File

@ -2,145 +2,147 @@
#include "opencv2/contrib/contrib.hpp" #include "opencv2/contrib/contrib.hpp"
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#else #else
#include <dirent.h> #include <dirent.h>
#endif #endif
namespace cv namespace cv
{ {
std::vector<std::string> Directory::GetListFiles( const std::string& path, const std::string & exten, bool addPath ) std::vector<std::string> Directory::GetListFiles( const std::string& path, const std::string & exten, bool addPath )
{ {
std::vector<std::string> list; std::vector<std::string> list;
list.clear(); list.clear();
std::string path_f = path + "/" + exten; std::string path_f = path + "/" + exten;
#ifdef WIN32 #ifdef WIN32
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
HANDLE hFind; HANDLE hFind;
hFind = FindFirstFile((LPCSTR)path_f.c_str(), &FindFileData); hFind = FindFirstFile((LPCSTR)path_f.c_str(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) if (hFind == INVALID_HANDLE_VALUE)
{ {
return list; return list;
} }
else else
{ {
do do
{ {
if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL || if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL ||
FindFileData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE || FindFileData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE ||
FindFileData.dwFileAttributes == FILE_ATTRIBUTE_HIDDEN || FindFileData.dwFileAttributes == FILE_ATTRIBUTE_HIDDEN ||
FindFileData.dwFileAttributes == FILE_ATTRIBUTE_SYSTEM || FindFileData.dwFileAttributes == FILE_ATTRIBUTE_SYSTEM ||
FindFileData.dwFileAttributes == FILE_ATTRIBUTE_READONLY) FindFileData.dwFileAttributes == FILE_ATTRIBUTE_READONLY)
{ {
if (addPath) if (addPath)
list.push_back(path + "/" + FindFileData.cFileName); list.push_back(path + "/" + FindFileData.cFileName);
else else
list.push_back(FindFileData.cFileName); list.push_back(FindFileData.cFileName);
} }
} }
while(FindNextFile(hFind, &FindFileData)); while(FindNextFile(hFind, &FindFileData));
FindClose(hFind); FindClose(hFind);
} }
#else #else
DIR *dp; (void)addPath;
struct dirent *dirp; DIR *dp;
if((dp = opendir(path.c_str())) == NULL) struct dirent *dirp;
{ if((dp = opendir(path.c_str())) == NULL)
return list; {
} return list;
}
while ((dirp = readdir(dp)) != NULL) while ((dirp = readdir(dp)) != NULL)
{ {
if (dirp->d_type == DT_REG) if (dirp->d_type == DT_REG)
{ {
if (exten.compare("*") == 0) if (exten.compare("*") == 0)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<std::string>(dirp->d_name));
else else
if (std::string(dirp->d_name).find(exten) != std::string::npos) if (std::string(dirp->d_name).find(exten) != std::string::npos)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<std::string>(dirp->d_name));
} }
} }
closedir(dp); closedir(dp);
#endif #endif
return list; return list;
} }
std::vector<std::string> Directory::GetListFolders( const std::string& path, const std::string & exten, bool addPath ) std::vector<std::string> Directory::GetListFolders( const std::string& path, const std::string & exten, bool addPath )
{ {
std::vector<std::string> list; std::vector<std::string> list;
std::string path_f = path + "/" + exten; std::string path_f = path + "/" + exten;
list.clear(); list.clear();
#ifdef WIN32 #ifdef WIN32
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
HANDLE hFind; HANDLE hFind;
hFind = FindFirstFile((LPCSTR)path_f.c_str(), &FindFileData); hFind = FindFirstFile((LPCSTR)path_f.c_str(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) if (hFind == INVALID_HANDLE_VALUE)
{ {
return list; return list;
} }
else else
{ {
do do
{ {
if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY && if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY &&
strcmp(FindFileData.cFileName, ".") != 0 && strcmp(FindFileData.cFileName, ".") != 0 &&
strcmp(FindFileData.cFileName, "..") != 0) strcmp(FindFileData.cFileName, "..") != 0)
{ {
if (addPath) if (addPath)
list.push_back(path + "/" + FindFileData.cFileName); list.push_back(path + "/" + FindFileData.cFileName);
else else
list.push_back(FindFileData.cFileName); list.push_back(FindFileData.cFileName);
} }
} }
while(FindNextFile(hFind, &FindFileData)); while(FindNextFile(hFind, &FindFileData));
FindClose(hFind); FindClose(hFind);
} }
#else #else
DIR *dp; (void)addPath;
struct dirent *dirp; DIR *dp;
if((dp = opendir(path_f.c_str())) == NULL) struct dirent *dirp;
{ if((dp = opendir(path_f.c_str())) == NULL)
return list; {
} return list;
}
while ((dirp = readdir(dp)) != NULL) while ((dirp = readdir(dp)) != NULL)
{ {
if (dirp->d_type == DT_DIR && if (dirp->d_type == DT_DIR &&
strcmp(dirp->d_name, ".") != 0 && strcmp(dirp->d_name, ".") != 0 &&
strcmp(dirp->d_name, "..") != 0 ) strcmp(dirp->d_name, "..") != 0 )
{ {
if (exten.compare("*") == 0) if (exten.compare("*") == 0)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<std::string>(dirp->d_name));
else else
if (std::string(dirp->d_name).find(exten) != std::string::npos) if (std::string(dirp->d_name).find(exten) != std::string::npos)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<std::string>(dirp->d_name));
} }
} }
closedir(dp); closedir(dp);
#endif #endif
return list; return list;
} }
std::vector<std::string> Directory::GetListFilesR ( const std::string& path, const std::string & exten, bool addPath ) std::vector<std::string> Directory::GetListFilesR ( const std::string& path, const std::string & exten, bool addPath )
{ {
std::vector<std::string> list = Directory::GetListFiles(path, exten, addPath); std::vector<std::string> list = Directory::GetListFiles(path, exten, addPath);
std::vector<std::string> dirs = Directory::GetListFolders(path, exten, addPath); std::vector<std::string> dirs = Directory::GetListFolders(path, exten, addPath);
std::vector<std::string>::const_iterator it; std::vector<std::string>::const_iterator it;
for (it = dirs.begin(); it != dirs.end(); ++it) for (it = dirs.begin(); it != dirs.end(); ++it)
{ {
std::vector<std::string> cl = Directory::GetListFiles(*it, exten, addPath); std::vector<std::string> cl = Directory::GetListFiles(*it, exten, addPath);
list.insert(list.end(), cl.begin(), cl.end()); list.insert(list.end(), cl.begin(), cl.end());
} }
return list; return list;
} }
} }

View File

@ -103,95 +103,95 @@ namespace cv
class MagnoRetinaFilter: public BasicRetinaFilter class MagnoRetinaFilter: public BasicRetinaFilter
{ {
public: public:
/** /**
* constructor parameters are only linked to image input size * constructor parameters are only linked to image input size
* @param NBrows: number of rows of the input image * @param NBrows: number of rows of the input image
* @param NBcolumns: number of columns of the input image * @param NBcolumns: number of columns of the input image
*/ */
MagnoRetinaFilter(const unsigned int NBrows, const unsigned int NBcolumns); MagnoRetinaFilter(const unsigned int NBrows, const unsigned int NBcolumns);
/** /**
* destructor * destructor
*/ */
virtual ~MagnoRetinaFilter(); virtual ~MagnoRetinaFilter();
/** /**
* function that clears all buffers of the object * function that clears all buffers of the object
*/ */
void clearAllBuffers(); void clearAllBuffers();
/** /**
* resize retina magno filter object (resize all allocated buffers) * resize retina magno filter object (resize all allocated buffers)
* @param NBrows: the new height size * @param NBrows: the new height size
* @param NBcolumns: the new width size * @param NBcolumns: the new width size
*/ */
void resize(const unsigned int NBrows, const unsigned int NBcolumns); void resize(const unsigned int NBrows, const unsigned int NBcolumns);
/** /**
* set parameters values * set parameters values
* @param parasolCells_beta: the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0 * @param parasolCells_beta: the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0
* @param parasolCells_tau: the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response) * @param parasolCells_tau: the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response)
* @param parasolCells_k: the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5 * @param parasolCells_k: the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5
* @param amacrinCellsTemporalCutFrequency: the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5 * @param amacrinCellsTemporalCutFrequency: the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5
* @param localAdaptIntegration_tau: specifies the temporal constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation * @param localAdaptIntegration_tau: specifies the temporal constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation
* @param localAdaptIntegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation * @param localAdaptIntegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation
*/ */
void setCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float localAdaptIntegration_tau, const float localAdaptIntegration_k); void setCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float localAdaptIntegration_tau, const float localAdaptIntegration_k);
/** /**
* launch filter that runs all the IPL magno filter (model of the magnocellular channel of the Inner Plexiform Layer of the retina) * launch filter that runs all the IPL magno filter (model of the magnocellular channel of the Inner Plexiform Layer of the retina)
* @param OPL_ON: the output of the bipolar ON cells of the retina (available from the ParvoRetinaFilter class (getBipolarCellsON() function) * @param OPL_ON: the output of the bipolar ON cells of the retina (available from the ParvoRetinaFilter class (getBipolarCellsON() function)
* @param OPL_OFF: the output of the bipolar OFF cells of the retina (available from the ParvoRetinaFilter class (getBipolarCellsOFF() function) * @param OPL_OFF: the output of the bipolar OFF cells of the retina (available from the ParvoRetinaFilter class (getBipolarCellsOFF() function)
* @return the processed result without post-processing * @return the processed result without post-processing
*/ */
const std::valarray<float> &runFilter(const std::valarray<float> &OPL_ON, const std::valarray<float> &OPL_OFF); const std::valarray<float> &runFilter(const std::valarray<float> &OPL_ON, const std::valarray<float> &OPL_OFF);
/** /**
* @return the Magnocellular ON channel filtering output * @return the Magnocellular ON channel filtering output
*/ */
inline const std::valarray<float> &getMagnoON() const {return _magnoXOutputON;}; inline const std::valarray<float> &getMagnoON() const {return _magnoXOutputON;};
/** /**
* @return the Magnocellular OFF channel filtering output * @return the Magnocellular OFF channel filtering output
*/ */
inline const std::valarray<float> &getMagnoOFF() const {return _magnoXOutputOFF;}; inline const std::valarray<float> &getMagnoOFF() const {return _magnoXOutputOFF;};
/** /**
* @return the Magnocellular Y (sum of the ON and OFF magno channels) filtering output * @return the Magnocellular Y (sum of the ON and OFF magno channels) filtering output
*/ */
inline const std::valarray<float> &getMagnoYsaturated() const {return *_magnoYsaturated;}; inline const std::valarray<float> &getMagnoYsaturated() const {return *_magnoYsaturated;};
/** /**
* applies an image normalization which saturates the high output values by the use of an assymetric sigmoide * applies an image normalization which saturates the high output values by the use of an assymetric sigmoide
*/ */
inline void normalizeGrayOutputNearZeroCentreredSigmoide(){_filterOutput.normalizeGrayOutputNearZeroCentreredSigmoide(&(*_magnoYOutput)[0], &(*_magnoYsaturated)[0]);}; inline void normalizeGrayOutputNearZeroCentreredSigmoide(){_filterOutput.normalizeGrayOutputNearZeroCentreredSigmoide(&(*_magnoYOutput)[0], &(*_magnoYsaturated)[0]);};
/** /**
* @return the horizontal cells' temporal constant * @return the horizontal cells' temporal constant
*/ */
inline const float getTemporalConstant(){return this->_filteringCoeficientsTable[2];}; inline float getTemporalConstant(){return this->_filteringCoeficientsTable[2];};
private: private:
// related pointers to these buffers // related pointers to these buffers
std::valarray<float> _previousInput_ON; std::valarray<float> _previousInput_ON;
std::valarray<float> _previousInput_OFF; std::valarray<float> _previousInput_OFF;
std::valarray<float> _amacrinCellsTempOutput_ON; std::valarray<float> _amacrinCellsTempOutput_ON;
std::valarray<float> _amacrinCellsTempOutput_OFF; std::valarray<float> _amacrinCellsTempOutput_OFF;
std::valarray<float> _magnoXOutputON; std::valarray<float> _magnoXOutputON;
std::valarray<float> _magnoXOutputOFF; std::valarray<float> _magnoXOutputOFF;
std::valarray<float> _localProcessBufferON; std::valarray<float> _localProcessBufferON;
std::valarray<float> _localProcessBufferOFF; std::valarray<float> _localProcessBufferOFF;
// reference to parent buffers and allow better readability // reference to parent buffers and allow better readability
TemplateBuffer<float> *_magnoYOutput; TemplateBuffer<float> *_magnoYOutput;
std::valarray<float> *_magnoYsaturated; std::valarray<float> *_magnoYsaturated;
// varialbles // varialbles
float _temporalCoefficient; float _temporalCoefficient;
// amacrine cells filter : high pass temporal filter // amacrine cells filter : high pass temporal filter
void _amacrineCellsComputing(const float *ONinput, const float *OFFinput); void _amacrineCellsComputing(const float *ONinput, const float *OFFinput);
}; };

View File

@ -195,12 +195,12 @@ public:
/** /**
* @return the photoreceptors's temporal constant * @return the photoreceptors's temporal constant
*/ */
inline const float getPhotoreceptorsTemporalConstant(){return this->_filteringCoeficientsTable[2];}; inline float getPhotoreceptorsTemporalConstant(){return this->_filteringCoeficientsTable[2];};
/** /**
* @return the horizontal cells' temporal constant * @return the horizontal cells' temporal constant
*/ */
inline const float getHcellsTemporalConstant(){return this->_filteringCoeficientsTable[5];}; inline float getHcellsTemporalConstant(){return this->_filteringCoeficientsTable[5];};
private: private:
// template buffers // template buffers

View File

@ -687,7 +687,7 @@ void RetinaColor::_computeGradient(const float *luminance)
} }
} }
const bool RetinaColor::applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float> &result) bool RetinaColor::applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float> &result)
{ {
bool processSuccess=true; bool processSuccess=true;
// basic preliminary error check // basic preliminary error check
@ -703,7 +703,7 @@ const bool RetinaColor::applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float>
return processSuccess; return processSuccess;
} }
const bool RetinaColor::applyLMS2LabTransform(std::valarray<float> &result) bool RetinaColor::applyLMS2LabTransform(std::valarray<float> &result)
{ {
bool processSuccess=true; bool processSuccess=true;
// basic preliminary error check // basic preliminary error check

View File

@ -163,14 +163,14 @@ public:
* @param result: the input buffer to fill with the transformed colorspace retina output * @param result: the input buffer to fill with the transformed colorspace retina output
* @return true if process ended successfully * @return true if process ended successfully
*/ */
const bool applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float> &result); bool applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float> &result);
/** /**
* apply to the retina color output the CIE Lab color transformation * apply to the retina color output the CIE Lab color transformation
* @param result: the input buffer to fill with the transformed colorspace retina output * @param result: the input buffer to fill with the transformed colorspace retina output
* @return true if process ended successfully * @return true if process ended successfully
*/ */
const bool applyLMS2LabTransform(std::valarray<float> &result); bool applyLMS2LabTransform(std::valarray<float> &result);
/** /**
* @return the multiplexed frame result (use this after function runColorMultiplexing) * @return the multiplexed frame result (use this after function runColorMultiplexing)

View File

@ -126,7 +126,7 @@ namespace cv
clearAllBuffers(); clearAllBuffers();
// std::cout<<"RetinaFilter::size( "<<this->getNBrows()<<", "<<this->getNBcolumns()<<")"<<_filterOutput.size()<<" =? "<<_filterOutput.getNBpixels()<<std::endl; // std::cout<<"RetinaFilter::size( "<<this->getNBrows()<<", "<<this->getNBcolumns()<<")"<<_filterOutput.size()<<" =? "<<_filterOutput.getNBpixels()<<std::endl;
} }
@ -240,7 +240,7 @@ namespace cv
_setInitPeriodCount(); _setInitPeriodCount();
} }
const bool RetinaFilter::checkInput(const std::valarray<float> &input, const bool) bool RetinaFilter::checkInput(const std::valarray<float> &input, const bool)
{ {
BasicRetinaFilter *inputTarget=&_photoreceptorsPrefilter; BasicRetinaFilter *inputTarget=&_photoreceptorsPrefilter;
@ -259,7 +259,7 @@ namespace cv
} }
// main function that runs the filter for a given input frame // main function that runs the filter for a given input frame
const bool RetinaFilter::runFilter(const std::valarray<float> &imageInput, const bool useAdaptiveFiltering, const bool processRetinaParvoMagnoMapping, const bool useColorMode, const bool inputIsColorMultiplexed) bool RetinaFilter::runFilter(const std::valarray<float> &imageInput, const bool useAdaptiveFiltering, const bool processRetinaParvoMagnoMapping, const bool useColorMode, const bool inputIsColorMultiplexed)
{ {
// preliminary check // preliminary check
bool processSuccess=true; bool processSuccess=true;
@ -488,7 +488,7 @@ namespace cv
} }
const bool RetinaFilter::getParvoFoveaResponse(std::valarray<float> &parvoFovealResponse) bool RetinaFilter::getParvoFoveaResponse(std::valarray<float> &parvoFovealResponse)
{ {
if (!_useParvoOutput) if (!_useParvoOutput)
return false; return false;
@ -508,7 +508,7 @@ namespace cv
} }
// method to retrieve the parafoveal magnocellular pathway response (no energy motion in fovea) // method to retrieve the parafoveal magnocellular pathway response (no energy motion in fovea)
const bool RetinaFilter::getMagnoParaFoveaResponse(std::valarray<float> &magnoParafovealResponse) bool RetinaFilter::getMagnoParaFoveaResponse(std::valarray<float> &magnoParafovealResponse)
{ {
if (!_useMagnoOutput) if (!_useMagnoOutput)
return false; return false;

View File

@ -116,427 +116,427 @@ class RetinaFilter//: public BasicRetinaFilter
{ {
public: public:
/** /**
* constructor of the retina filter model with log sampling of the input frame (models the photoreceptors log sampling (central high resolution fovea and lower precision borders)) * constructor of the retina filter model with log sampling of the input frame (models the photoreceptors log sampling (central high resolution fovea and lower precision borders))
* @param sizeRows: number of rows of the input image * @param sizeRows: number of rows of the input image
* @param sizeColumns: number of columns of the input image * @param sizeColumns: number of columns of the input image
* @param colorMode: specifies if the retina works with color (true) of stays in grayscale processing (false), can be adjusted online by the use of setColorMode method * @param colorMode: specifies if the retina works with color (true) of stays in grayscale processing (false), can be adjusted online by the use of setColorMode method
* @param samplingMethod: specifies which kind of color sampling will be used * @param samplingMethod: specifies which kind of color sampling will be used
* @param useRetinaLogSampling: activate retina log sampling, if true, the 2 following parameters can be used * @param useRetinaLogSampling: activate retina log sampling, if true, the 2 following parameters can be used
* @param reductionFactor: only usefull if param useRetinaLogSampling=true, specifies the reduction factor of the output frame (as the center (fovea) is high resolution and corners can be underscaled, then a reduction of the output is allowed without precision leak * @param reductionFactor: only usefull if param useRetinaLogSampling=true, specifies the reduction factor of the output frame (as the center (fovea) is high resolution and corners can be underscaled, then a reduction of the output is allowed without precision leak
* @param samplingStrenght: only usefull if param useRetinaLogSampling=true, specifies the strenght of the log scale that is applied * @param samplingStrenght: only usefull if param useRetinaLogSampling=true, specifies the strenght of the log scale that is applied
*/ */
RetinaFilter(const unsigned int sizeRows, const unsigned int sizeColumns, const bool colorMode=false, const RETINA_COLORSAMPLINGMETHOD samplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); RetinaFilter(const unsigned int sizeRows, const unsigned int sizeColumns, const bool colorMode=false, const RETINA_COLORSAMPLINGMETHOD samplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0);
/** /**
* standard destructor * standard destructor
*/ */
~RetinaFilter(); ~RetinaFilter();
/** /**
* function that clears all buffers of the object * function that clears all buffers of the object
*/ */
void clearAllBuffers(); void clearAllBuffers();
/** /**
* resize retina parvo filter object (resize all allocated buffers) * resize retina parvo filter object (resize all allocated buffers)
* @param NBrows: the new height size * @param NBrows: the new height size
* @param NBcolumns: the new width size * @param NBcolumns: the new width size
*/ */
void resize(const unsigned int NBrows, const unsigned int NBcolumns); void resize(const unsigned int NBrows, const unsigned int NBcolumns);
/** /**
* Input buffer checker: allows to check if the passed image buffer corresponds to retina filter expectations * Input buffer checker: allows to check if the passed image buffer corresponds to retina filter expectations
* @param input: the input image buffer * @param input: the input image buffer
* @param colorMode: specifiy if the input should be considered by the retina as colored of not * @param colorMode: specifiy if the input should be considered by the retina as colored of not
* @return false if not compatible or it returns true if OK * @return false if not compatible or it returns true if OK
*/ */
const bool checkInput(const std::valarray<float> &input, const bool colorMode); bool checkInput(const std::valarray<float> &input, const bool colorMode);
/** /**
* run the initilized retina filter, after this call all retina outputs are updated * run the initilized retina filter, after this call all retina outputs are updated
* @param imageInput: image input buffer, can be grayscale or RGB image respecting the size specified at the constructor level * @param imageInput: image input buffer, can be grayscale or RGB image respecting the size specified at the constructor level
* @param useAdaptiveFiltering: set true if you want to use adaptive color demultilexing (solve some color artefact problems), see RetinaColor for citation references * @param useAdaptiveFiltering: set true if you want to use adaptive color demultilexing (solve some color artefact problems), see RetinaColor for citation references
* @param processRetinaParvoMagnoMapping: tels if the main outputs takes into account the mapping of the Parvo and Magno channels on the retina (centred parvo (fovea) and magno outside (parafovea)) * @param processRetinaParvoMagnoMapping: tels if the main outputs takes into account the mapping of the Parvo and Magno channels on the retina (centred parvo (fovea) and magno outside (parafovea))
* @param useColorMode: color information is used if true, warning, if input is only gray level, a buffer overflow error will occur * @param useColorMode: color information is used if true, warning, if input is only gray level, a buffer overflow error will occur
-> note that if color mode is activated and processRetinaParvoMagnoMapping==true, then the demultiplexed color frame (accessible throw getColorOutput() will be a color contours frame in the fovea and gray level moving contours outside -> note that if color mode is activated and processRetinaParvoMagnoMapping==true, then the demultiplexed color frame (accessible throw getColorOutput() will be a color contours frame in the fovea and gray level moving contours outside
@param inputIsColorMultiplexed: set trus if the input data is a multiplexed color image (using Bayer sampling for example), the color sampling method must correspond to the RETINA_COLORSAMPLINGMETHOD passed at constructor! @param inputIsColorMultiplexed: set trus if the input data is a multiplexed color image (using Bayer sampling for example), the color sampling method must correspond to the RETINA_COLORSAMPLINGMETHOD passed at constructor!
* @return true if process ran well, false in case of failure * @return true if process ran well, false in case of failure
*/ */
const bool runFilter(const std::valarray<float> &imageInput, const bool useAdaptiveFiltering=true, const bool processRetinaParvoMagnoMapping=false, const bool useColorMode=false, const bool inputIsColorMultiplexed=false); bool runFilter(const std::valarray<float> &imageInput, const bool useAdaptiveFiltering=true, const bool processRetinaParvoMagnoMapping=false, const bool useColorMode=false, const bool inputIsColorMultiplexed=false);
/** /**
* run the initilized retina filter in order to perform color tone mapping applied on an RGB image, after this call the color output of the retina is updated (use function getColorOutput() to grab it) * run the initilized retina filter in order to perform color tone mapping applied on an RGB image, after this call the color output of the retina is updated (use function getColorOutput() to grab it)
* the algorithm is based on David Alleyson, Sabine Susstruck and Laurence Meylan's work, please cite: * the algorithm is based on David Alleyson, Sabine Susstruck and Laurence Meylan's work, please cite:
* -> Meylan L., Alleysson D., and S<EFBFBD>sstrunk S., A Model of Retinal Local Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of America, A, Vol. 24, N<EFBFBD> 9, September, 1st, 2007, pp. 2807-2816 * -> Meylan L., Alleysson D., and S<EFBFBD>sstrunk S., A Model of Retinal Local Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of America, A, Vol. 24, N<EFBFBD> 9, September, 1st, 2007, pp. 2807-2816
* get the resulting gray frame by calling function getParvoColor() * get the resulting gray frame by calling function getParvoColor()
* @param grayImageInput: RGB image input buffer respecting the size specified at the constructor level * @param grayImageInput: RGB image input buffer respecting the size specified at the constructor level
* @param PhotoreceptorsCompression: sets the log compression parameters applied at the photoreceptors level (enhance luminance in dark areas) * @param PhotoreceptorsCompression: sets the log compression parameters applied at the photoreceptors level (enhance luminance in dark areas)
* @param ganglionCellsCompression: sets the log compression applied at the gnaglion cells output (enhance contrast) * @param ganglionCellsCompression: sets the log compression applied at the gnaglion cells output (enhance contrast)
*/ */
void runGrayToneMapping(const std::valarray<float> &grayImageInput, std::valarray<float> &grayImageOutput, const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6); void runGrayToneMapping(const std::valarray<float> &grayImageInput, std::valarray<float> &grayImageOutput, const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6);
/** /**
* run the initilized retina filter in order to perform color tone mapping applied on an RGB image, after this call the color output of the retina is updated (use function getColorOutput() to grab it) * run the initilized retina filter in order to perform color tone mapping applied on an RGB image, after this call the color output of the retina is updated (use function getColorOutput() to grab it)
* the algorithm is based on David Alleyson, Sabine Susstruck and Laurence Meylan's work, please cite: * the algorithm is based on David Alleyson, Sabine Susstruck and Laurence Meylan's work, please cite:
* -> Meylan L., Alleysson D., and S<EFBFBD>sstrunk S., A Model of Retinal Local Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of America, A, Vol. 24, N<EFBFBD> 9, September, 1st, 2007, pp. 2807-2816 * -> Meylan L., Alleysson D., and S<EFBFBD>sstrunk S., A Model of Retinal Local Adaptation for the Tone Mapping of Color Filter Array Images, Journal of Optical Society of America, A, Vol. 24, N<EFBFBD> 9, September, 1st, 2007, pp. 2807-2816
* get the resulting RGB frame by calling function getParvoColor() * get the resulting RGB frame by calling function getParvoColor()
* @param RGBimageInput: RGB image input buffer respecting the size specified at the constructor level * @param RGBimageInput: RGB image input buffer respecting the size specified at the constructor level
* @param useAdaptiveFiltering: set true if you want to use adaptive color demultilexing (solve some color artefact problems), see RetinaColor for citation references * @param useAdaptiveFiltering: set true if you want to use adaptive color demultilexing (solve some color artefact problems), see RetinaColor for citation references
* @param PhotoreceptorsCompression: sets the log compression parameters applied at the photoreceptors level (enhance luminance in dark areas) * @param PhotoreceptorsCompression: sets the log compression parameters applied at the photoreceptors level (enhance luminance in dark areas)
* @param ganglionCellsCompression: sets the log compression applied at the ganglion cells output (enhance contrast) * @param ganglionCellsCompression: sets the log compression applied at the ganglion cells output (enhance contrast)
*/ */
void runRGBToneMapping(const std::valarray<float> &RGBimageInput, std::valarray<float> &imageOutput, const bool useAdaptiveFiltering, const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6); void runRGBToneMapping(const std::valarray<float> &RGBimageInput, std::valarray<float> &imageOutput, const bool useAdaptiveFiltering, const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6);
/** /**
* run the initilized retina filter in order to perform color tone mapping applied on an RGB image, after this call the color output of the retina is updated (use function getColorOutput() to grab it) * run the initilized retina filter in order to perform color tone mapping applied on an RGB image, after this call the color output of the retina is updated (use function getColorOutput() to grab it)
* get the resulting RGB frame by calling function getParvoColor() * get the resulting RGB frame by calling function getParvoColor()
* @param LMSimageInput: RGB image input buffer respecting the size specified at the constructor level * @param LMSimageInput: RGB image input buffer respecting the size specified at the constructor level
* @param useAdaptiveFiltering: set true if you want to use adaptive color demultilexing (solve some color artefact problems), see RetinaColor for citation references * @param useAdaptiveFiltering: set true if you want to use adaptive color demultilexing (solve some color artefact problems), see RetinaColor for citation references
* @param PhotoreceptorsCompression: sets the log compression parameters applied at the photoreceptors level (enhance luminance in dark areas) * @param PhotoreceptorsCompression: sets the log compression parameters applied at the photoreceptors level (enhance luminance in dark areas)
* @param ganglionCellsCompression: sets the log compression applied at the gnaglion cells output (enhance contrast) * @param ganglionCellsCompression: sets the log compression applied at the gnaglion cells output (enhance contrast)
*/ */
void runLMSToneMapping(const std::valarray<float> &LMSimageInput, std::valarray<float> &imageOutput, const bool useAdaptiveFiltering, const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6); void runLMSToneMapping(const std::valarray<float> &LMSimageInput, std::valarray<float> &imageOutput, const bool useAdaptiveFiltering, const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6);
/** /**
* set up function of the retina filter: all the retina is initialized at this step, some specific parameters are set by default, use setOPLandParvoCoefficientsTable() and setMagnoCoefficientsTable in order to setup the retina with more options * set up function of the retina filter: all the retina is initialized at this step, some specific parameters are set by default, use setOPLandParvoCoefficientsTable() and setMagnoCoefficientsTable in order to setup the retina with more options
* @param OPLspatialResponse1: (equal to k1 in setOPLandParvoCoefficientsTable() function) the spatial constant of the first order low pass filter of the photoreceptors, use it to cut high spatial frequencies (noise or thick contours), unit is pixels, typical value is 1 pixel * @param OPLspatialResponse1: (equal to k1 in setOPLandParvoCoefficientsTable() function) the spatial constant of the first order low pass filter of the photoreceptors, use it to cut high spatial frequencies (noise or thick contours), unit is pixels, typical value is 1 pixel
* @param OPLtemporalresponse1: (equal to tau1 in setOPLandParvoCoefficientsTable() function) the time constant of the first order low pass filter of the photoreceptors, use it to cut high temporal frequencies (noise or fast motion), unit is frames, typical value is 1 frame * @param OPLtemporalresponse1: (equal to tau1 in setOPLandParvoCoefficientsTable() function) the time constant of the first order low pass filter of the photoreceptors, use it to cut high temporal frequencies (noise or fast motion), unit is frames, typical value is 1 frame
* @param OPLassymetryGain: (equal to beta2 in setOPLandParvoCoefficientsTable() function) gain of the horizontal cells network, if 0, then the mean value of the output is zero, if the parameter is near 1, then, the luminance is not filtered and is still reachable at the output, typicall value is 0 * @param OPLassymetryGain: (equal to beta2 in setOPLandParvoCoefficientsTable() function) gain of the horizontal cells network, if 0, then the mean value of the output is zero, if the parameter is near 1, then, the luminance is not filtered and is still reachable at the output, typicall value is 0
* @param OPLspatialResponse2: (equal to k2 in setOPLandParvoCoefficientsTable() function) the spatial constant of the first order low pass filter of the horizontal cells, use it to cut low spatial frequencies (local luminance), unit is pixels, typical value is 5 pixel * @param OPLspatialResponse2: (equal to k2 in setOPLandParvoCoefficientsTable() function) the spatial constant of the first order low pass filter of the horizontal cells, use it to cut low spatial frequencies (local luminance), unit is pixels, typical value is 5 pixel
* @param OPLtemporalresponse2: (equal to tau2 in setOPLandParvoCoefficientsTable() function) the time constant of the first order low pass filter of the horizontal cells, use it to cut low temporal frequencies (local luminance variations), unit is frames, typical value is 1 frame, as the photoreceptors * @param OPLtemporalresponse2: (equal to tau2 in setOPLandParvoCoefficientsTable() function) the time constant of the first order low pass filter of the horizontal cells, use it to cut low temporal frequencies (local luminance variations), unit is frames, typical value is 1 frame, as the photoreceptors
* @param LPfilterSpatialResponse: (equal to parasolCells_k in setMagnoCoefficientsTable() function) the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5 * @param LPfilterSpatialResponse: (equal to parasolCells_k in setMagnoCoefficientsTable() function) the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5
* @param LPfilterGain: (equal to parasolCells_beta in setMagnoCoefficientsTable() function) the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0 * @param LPfilterGain: (equal to parasolCells_beta in setMagnoCoefficientsTable() function) the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0
* @param LPfilterTemporalresponse: (equal to parasolCells_tau in setMagnoCoefficientsTable() function) the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response) * @param LPfilterTemporalresponse: (equal to parasolCells_tau in setMagnoCoefficientsTable() function) the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response)
* @param MovingContoursExtractorCoefficient: (equal to amacrinCellsTemporalCutFrequency in setMagnoCoefficientsTable() function)the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5 * @param MovingContoursExtractorCoefficient: (equal to amacrinCellsTemporalCutFrequency in setMagnoCoefficientsTable() function)the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5
* @param normalizeParvoOutput_0_maxOutputValue: specifies if the Parvo cellular output should be normalized between 0 and maxOutputValue (true) or not (false) in order to remain at a null mean value, true value is recommended for visualisation * @param normalizeParvoOutput_0_maxOutputValue: specifies if the Parvo cellular output should be normalized between 0 and maxOutputValue (true) or not (false) in order to remain at a null mean value, true value is recommended for visualisation
* @param normalizeMagnoOutput_0_maxOutputValue: specifies if the Magno cellular output should be normalized between 0 and maxOutputValue (true) or not (false), setting true may be hazardous because it can enhace the noise response when nothing is moving * @param normalizeMagnoOutput_0_maxOutputValue: specifies if the Magno cellular output should be normalized between 0 and maxOutputValue (true) or not (false), setting true may be hazardous because it can enhace the noise response when nothing is moving
* @param maxOutputValue: the maximum amplitude value of the normalized outputs (generally 255 for 8bit per channel pictures) * @param maxOutputValue: the maximum amplitude value of the normalized outputs (generally 255 for 8bit per channel pictures)
* @param maxInputValue: the maximum pixel value of the input picture (generally 255 for 8bit per channel pictures), specify it in other case (for example High Dynamic Range Images) * @param maxInputValue: the maximum pixel value of the input picture (generally 255 for 8bit per channel pictures), specify it in other case (for example High Dynamic Range Images)
* @param meanValue: the global mean value of the input data usefull for local adaptation setup * @param meanValue: the global mean value of the input data usefull for local adaptation setup
*/ */
void setGlobalParameters(const float OPLspatialResponse1=0.7, const float OPLtemporalresponse1=1, const float OPLassymetryGain=0, const float OPLspatialResponse2=5, const float OPLtemporalresponse2=1, const float LPfilterSpatialResponse=5, const float LPfilterGain=0, const float LPfilterTemporalresponse=0, const float MovingContoursExtractorCoefficient=5, const bool normalizeParvoOutput_0_maxOutputValue=false, const bool normalizeMagnoOutput_0_maxOutputValue=false, const float maxOutputValue=255.0, const float maxInputValue=255.0, const float meanValue=128.0); void setGlobalParameters(const float OPLspatialResponse1=0.7, const float OPLtemporalresponse1=1, const float OPLassymetryGain=0, const float OPLspatialResponse2=5, const float OPLtemporalresponse2=1, const float LPfilterSpatialResponse=5, const float LPfilterGain=0, const float LPfilterTemporalresponse=0, const float MovingContoursExtractorCoefficient=5, const bool normalizeParvoOutput_0_maxOutputValue=false, const bool normalizeMagnoOutput_0_maxOutputValue=false, const float maxOutputValue=255.0, const float maxInputValue=255.0, const float meanValue=128.0);
/** /**
* setup the local luminance adaptation capability * setup the local luminance adaptation capability
* @param V0CompressionParameter: the compression strengh of the photoreceptors local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160 * @param V0CompressionParameter: the compression strengh of the photoreceptors local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160
*/ */
inline void setPhotoreceptorsLocalAdaptationSensitivity(const float V0CompressionParameter){_photoreceptorsPrefilter.setV0CompressionParameter(1-V0CompressionParameter);_setInitPeriodCount();}; inline void setPhotoreceptorsLocalAdaptationSensitivity(const float V0CompressionParameter){_photoreceptorsPrefilter.setV0CompressionParameter(1-V0CompressionParameter);_setInitPeriodCount();};
/** /**
* setup the local luminance adaptation capability * setup the local luminance adaptation capability
* @param V0CompressionParameter: the compression strengh of the parvocellular pathway (details) local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160 * @param V0CompressionParameter: the compression strengh of the parvocellular pathway (details) local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160
*/ */
inline void setParvoGanglionCellsLocalAdaptationSensitivity(const float V0CompressionParameter){_ParvoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();}; inline void setParvoGanglionCellsLocalAdaptationSensitivity(const float V0CompressionParameter){_ParvoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();};
/** /**
* setup the local luminance adaptation area of integration * setup the local luminance adaptation area of integration
* @param spatialResponse: the spatial constant of the low pass filter applied on the bipolar cells output in order to compute local contrast mean values * @param spatialResponse: the spatial constant of the low pass filter applied on the bipolar cells output in order to compute local contrast mean values
* @param temporalResponse: the spatial constant of the low pass filter applied on the bipolar cells output in order to compute local contrast mean values (generally set to zero: immediate response) * @param temporalResponse: the spatial constant of the low pass filter applied on the bipolar cells output in order to compute local contrast mean values (generally set to zero: immediate response)
*/ */
inline void setGanglionCellsLocalAdaptationLPfilterParameters(const float spatialResponse, const float temporalResponse){_ParvoRetinaFilter.setGanglionCellsLocalAdaptationLPfilterParameters(temporalResponse, spatialResponse);_setInitPeriodCount();}; inline void setGanglionCellsLocalAdaptationLPfilterParameters(const float spatialResponse, const float temporalResponse){_ParvoRetinaFilter.setGanglionCellsLocalAdaptationLPfilterParameters(temporalResponse, spatialResponse);_setInitPeriodCount();};
/** /**
* setup the local luminance adaptation capability * setup the local luminance adaptation capability
* @param V0CompressionParameter: the compression strengh of the magnocellular pathway (motion) local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160 * @param V0CompressionParameter: the compression strengh of the magnocellular pathway (motion) local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 160
*/ */
inline void setMagnoGanglionCellsLocalAdaptationSensitivity(const float V0CompressionParameter){_MagnoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();}; inline void setMagnoGanglionCellsLocalAdaptationSensitivity(const float V0CompressionParameter){_MagnoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();};
/** /**
* setup the OPL and IPL parvo channels * setup the OPL and IPL parvo channels
* @param beta1: gain of the horizontal cells network, if 0, then the mean value of the output is zero (default value), if the parameter is near 1, the amplitude is boosted but it should only be used for values rescaling... if needed * @param beta1: gain of the horizontal cells network, if 0, then the mean value of the output is zero (default value), if the parameter is near 1, the amplitude is boosted but it should only be used for values rescaling... if needed
* @param tau1: the time constant of the first order low pass filter of the photoreceptors, use it to cut high temporal frequencies (noise or fast motion), unit is frames, typical value is 1 frame * @param tau1: the time constant of the first order low pass filter of the photoreceptors, use it to cut high temporal frequencies (noise or fast motion), unit is frames, typical value is 1 frame
* @param k1: the spatial constant of the first order low pass filter of the photoreceptors, use it to cut high spatial frequencies (noise or thick contours), unit is pixels, typical value is 1 pixel * @param k1: the spatial constant of the first order low pass filter of the photoreceptors, use it to cut high spatial frequencies (noise or thick contours), unit is pixels, typical value is 1 pixel
* @param beta2: gain of the horizontal cells network, if 0, then the mean value of the output is zero, if the parameter is near 1, then, the luminance is not filtered and is still reachable at the output, typicall value is 0 * @param beta2: gain of the horizontal cells network, if 0, then the mean value of the output is zero, if the parameter is near 1, then, the luminance is not filtered and is still reachable at the output, typicall value is 0
* @param tau2: the time constant of the first order low pass filter of the horizontal cells, use it to cut low temporal frequencies (local luminance variations), unit is frames, typical value is 1 frame, as the photoreceptors * @param tau2: the time constant of the first order low pass filter of the horizontal cells, use it to cut low temporal frequencies (local luminance variations), unit is frames, typical value is 1 frame, as the photoreceptors
* @param k2: the spatial constant of the first order low pass filter of the horizontal cells, use it to cut low spatial frequencies (local luminance), unit is pixels, typical value is 5 pixel, this value is also used for local contrast computing when computing the local contrast adaptation at the ganglion cells level (Inner Plexiform Layer parvocellular channel model) * @param k2: the spatial constant of the first order low pass filter of the horizontal cells, use it to cut low spatial frequencies (local luminance), unit is pixels, typical value is 5 pixel, this value is also used for local contrast computing when computing the local contrast adaptation at the ganglion cells level (Inner Plexiform Layer parvocellular channel model)
* @param V0CompressionParameter: the compression strengh of the ganglion cells local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 230 * @param V0CompressionParameter: the compression strengh of the ganglion cells local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 230
*/ */
void setOPLandParvoParameters(const float beta1, const float tau1, const float k1, const float beta2, const float tau2, const float k2, const float V0CompressionParameter){_ParvoRetinaFilter.setOPLandParvoFiltersParameters(beta1, tau1, k1, beta2, tau2, k2);_ParvoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();}; void setOPLandParvoParameters(const float beta1, const float tau1, const float k1, const float beta2, const float tau2, const float k2, const float V0CompressionParameter){_ParvoRetinaFilter.setOPLandParvoFiltersParameters(beta1, tau1, k1, beta2, tau2, k2);_ParvoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();};
/** /**
* set parameters values for the Inner Plexiform Layer (IPL) magnocellular channel * set parameters values for the Inner Plexiform Layer (IPL) magnocellular channel
* @param parasolCells_beta: the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0 * @param parasolCells_beta: the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0
* @param parasolCells_tau: the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response) * @param parasolCells_tau: the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response)
* @param parasolCells_k: the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5 * @param parasolCells_k: the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5
* @param amacrinCellsTemporalCutFrequency: the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5 * @param amacrinCellsTemporalCutFrequency: the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5
* @param V0CompressionParameter: the compression strengh of the ganglion cells local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 200 * @param V0CompressionParameter: the compression strengh of the ganglion cells local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 200
* @param localAdaptintegration_tau: specifies the temporal constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation * @param localAdaptintegration_tau: specifies the temporal constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation
* @param localAdaptintegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation * @param localAdaptintegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation
*/ */
void setMagnoCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float V0CompressionParameter, const float localAdaptintegration_tau, const float localAdaptintegration_k){_MagnoRetinaFilter.setCoefficientsTable(parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, localAdaptintegration_tau, localAdaptintegration_k);_MagnoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();}; void setMagnoCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float V0CompressionParameter, const float localAdaptintegration_tau, const float localAdaptintegration_k){_MagnoRetinaFilter.setCoefficientsTable(parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, localAdaptintegration_tau, localAdaptintegration_k);_MagnoRetinaFilter.setV0CompressionParameter(V0CompressionParameter);_setInitPeriodCount();};
/** /**
* set if the parvo output should be or not normalized between 0 and 255 (for display purpose generally) * set if the parvo output should be or not normalized between 0 and 255 (for display purpose generally)
* @param normalizeParvoOutput_0_maxOutputValue: true if normalization should be done * @param normalizeParvoOutput_0_maxOutputValue: true if normalization should be done
*/ */
inline void activateNormalizeParvoOutput_0_maxOutputValue(const bool normalizeParvoOutput_0_maxOutputValue){_normalizeParvoOutput_0_maxOutputValue=normalizeParvoOutput_0_maxOutputValue;}; inline void activateNormalizeParvoOutput_0_maxOutputValue(const bool normalizeParvoOutput_0_maxOutputValue){_normalizeParvoOutput_0_maxOutputValue=normalizeParvoOutput_0_maxOutputValue;};
/** /**
* set if the magno output should be or not normalized between 0 and 255 (for display purpose generally), take care, if nothing is moving, then, the noise will be enanced !!! * set if the magno output should be or not normalized between 0 and 255 (for display purpose generally), take care, if nothing is moving, then, the noise will be enanced !!!
* @param normalizeMagnoOutput_0_maxOutputValue: true if normalization should be done * @param normalizeMagnoOutput_0_maxOutputValue: true if normalization should be done
*/ */
inline void activateNormalizeMagnoOutput_0_maxOutputValue(const bool normalizeMagnoOutput_0_maxOutputValue){_normalizeMagnoOutput_0_maxOutputValue=normalizeMagnoOutput_0_maxOutputValue;}; inline void activateNormalizeMagnoOutput_0_maxOutputValue(const bool normalizeMagnoOutput_0_maxOutputValue){_normalizeMagnoOutput_0_maxOutputValue=normalizeMagnoOutput_0_maxOutputValue;};
/** /**
* setup the maximum amplitude value of the normalized outputs (generally 255 for 8bit per channel pictures) * setup the maximum amplitude value of the normalized outputs (generally 255 for 8bit per channel pictures)
* @param maxOutputValue: maximum amplitude value of the normalized outputs (generally 255 for 8bit per channel pictures) * @param maxOutputValue: maximum amplitude value of the normalized outputs (generally 255 for 8bit per channel pictures)
*/ */
inline void setMaxOutputValue(const float maxOutputValue){_maxOutputValue=maxOutputValue;}; inline void setMaxOutputValue(const float maxOutputValue){_maxOutputValue=maxOutputValue;};
/** /**
* sets the color mode of the frame grabber * sets the color mode of the frame grabber
* @param desiredColorMode: true if the user needs color information, false for graylevels * @param desiredColorMode: true if the user needs color information, false for graylevels
*/ */
void setColorMode(const bool desiredColorMode){_useColorMode=desiredColorMode;}; void setColorMode(const bool desiredColorMode){_useColorMode=desiredColorMode;};
/** /**
* activate color saturation as the final step of the color demultiplexing process * activate color saturation as the final step of the color demultiplexing process
* -> this saturation is a sigmoide function applied to each channel of the demultiplexed image. * -> this saturation is a sigmoide function applied to each channel of the demultiplexed image.
* @param saturateColors: boolean that activates color saturation (if true) or desactivate (if false) * @param saturateColors: boolean that activates color saturation (if true) or desactivate (if false)
* @param colorSaturationValue: the saturation factor * @param colorSaturationValue: the saturation factor
* */ * */
inline void setColorSaturation(const bool saturateColors=true, const float colorSaturationValue=4.0){_colorEngine.setColorSaturation(saturateColors, colorSaturationValue);}; inline void setColorSaturation(const bool saturateColors=true, const float colorSaturationValue=4.0){_colorEngine.setColorSaturation(saturateColors, colorSaturationValue);};
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// function that retrieve the main retina outputs, one by one, or all in a structure // function that retrieve the main retina outputs, one by one, or all in a structure
/** /**
* @return the input image sampled by the photoreceptors spatial sampling * @return the input image sampled by the photoreceptors spatial sampling
*/ */
inline const std::valarray<float> &getPhotoreceptorsSampledFrame() const inline const std::valarray<float> &getPhotoreceptorsSampledFrame() const
{ {
CV_Assert(_photoreceptorsLogSampling); CV_Assert(_photoreceptorsLogSampling);
return _photoreceptorsLogSampling->getSampledFrame(); return _photoreceptorsLogSampling->getSampledFrame();
}; };
/** /**
* @return photoreceptors output, locally adapted luminance only, no high frequency spatio-temporal noise reduction at the next retina processing stages, use getPhotoreceptors method to get complete photoreceptors output * @return photoreceptors output, locally adapted luminance only, no high frequency spatio-temporal noise reduction at the next retina processing stages, use getPhotoreceptors method to get complete photoreceptors output
*/ */
inline const std::valarray<float> &getLocalAdaptation() const {return _photoreceptorsPrefilter.getOutput();}; inline const std::valarray<float> &getLocalAdaptation() const {return _photoreceptorsPrefilter.getOutput();};
/** /**
* @return photoreceptors output: locally adapted luminance and high frequency spatio-temporal noise reduction, high luminance is a little saturated at this stage, but this is corrected naturally at the next retina processing stages * @return photoreceptors output: locally adapted luminance and high frequency spatio-temporal noise reduction, high luminance is a little saturated at this stage, but this is corrected naturally at the next retina processing stages
*/ */
inline const std::valarray<float> &getPhotoreceptors() const {return _ParvoRetinaFilter.getPhotoreceptorsLPfilteringOutput();}; inline const std::valarray<float> &getPhotoreceptors() const {return _ParvoRetinaFilter.getPhotoreceptorsLPfilteringOutput();};
/** /**
* @return the local luminance of the processed frame (it is the horizontal cells output) * @return the local luminance of the processed frame (it is the horizontal cells output)
*/ */
inline const std::valarray<float> &getHorizontalCells() const {return _ParvoRetinaFilter.getHorizontalCellsOutput();}; inline const std::valarray<float> &getHorizontalCells() const {return _ParvoRetinaFilter.getHorizontalCellsOutput();};
///////// CONTOURS part, PARVOCELLULAR RETINA PATHWAY ///////// CONTOURS part, PARVOCELLULAR RETINA PATHWAY
/** /**
* @return true if Parvocellular output is activated, false if not * @return true if Parvocellular output is activated, false if not
*/ */
inline const bool areContoursProcessed(){return _useParvoOutput;}; inline bool areContoursProcessed(){return _useParvoOutput;};
/** /**
* method to retrieve the foveal parvocellular pathway response (no details energy in parafovea) * method to retrieve the foveal parvocellular pathway response (no details energy in parafovea)
* @param parvoParafovealResponse: buffer that will be filled with the response of the magnocellular pathway in the parafoveal area * @param parvoParafovealResponse: buffer that will be filled with the response of the magnocellular pathway in the parafoveal area
* @return true if process succeeded (if buffer exists, is its size matches retina size, if magno channel is activated and if mapping is initialized * @return true if process succeeded (if buffer exists, is its size matches retina size, if magno channel is activated and if mapping is initialized
*/ */
const bool getParvoFoveaResponse(std::valarray<float> &parvoFovealResponse); bool getParvoFoveaResponse(std::valarray<float> &parvoFovealResponse);
/** /**
* @param useParvoOutput: true if Parvocellular output should be activated, false if not * @param useParvoOutput: true if Parvocellular output should be activated, false if not
*/ */
inline void activateContoursProcessing(const bool useParvoOutput){_useParvoOutput=useParvoOutput;}; inline void activateContoursProcessing(const bool useParvoOutput){_useParvoOutput=useParvoOutput;};
/** /**
* @return the parvocellular contours information (details), should be used at the fovea level * @return the parvocellular contours information (details), should be used at the fovea level
*/ */
const std::valarray<float> &getContours(); // Parvocellular output const std::valarray<float> &getContours(); // Parvocellular output
/** /**
* @return the parvocellular contours ON information (details), should be used at the fovea level * @return the parvocellular contours ON information (details), should be used at the fovea level
*/ */
inline const std::valarray<float> &getContoursON() const {return _ParvoRetinaFilter.getParvoON();};// Parvocellular ON output inline const std::valarray<float> &getContoursON() const {return _ParvoRetinaFilter.getParvoON();};// Parvocellular ON output
/** /**
* @return the parvocellular contours OFF information (details), should be used at the fovea level * @return the parvocellular contours OFF information (details), should be used at the fovea level
*/ */
inline const std::valarray<float> &getContoursOFF() const {return _ParvoRetinaFilter.getParvoOFF();};// Parvocellular OFF output inline const std::valarray<float> &getContoursOFF() const {return _ParvoRetinaFilter.getParvoOFF();};// Parvocellular OFF output
///////// MOVING CONTOURS part, MAGNOCELLULAR RETINA PATHWAY ///////// MOVING CONTOURS part, MAGNOCELLULAR RETINA PATHWAY
/** /**
* @return true if Magnocellular output is activated, false if not * @return true if Magnocellular output is activated, false if not
*/ */
inline const bool areMovingContoursProcessed(){return _useMagnoOutput;}; inline bool areMovingContoursProcessed(){return _useMagnoOutput;};
/** /**
* method to retrieve the parafoveal magnocellular pathway response (no motion energy in fovea) * method to retrieve the parafoveal magnocellular pathway response (no motion energy in fovea)
* @param magnoParafovealResponse: buffer that will be filled with the response of the magnocellular pathway in the parafoveal area * @param magnoParafovealResponse: buffer that will be filled with the response of the magnocellular pathway in the parafoveal area
* @return true if process succeeded (if buffer exists, is its size matches retina size, if magno channel is activated and if mapping is initialized * @return true if process succeeded (if buffer exists, is its size matches retina size, if magno channel is activated and if mapping is initialized
*/ */
const bool getMagnoParaFoveaResponse(std::valarray<float> &magnoParafovealResponse); bool getMagnoParaFoveaResponse(std::valarray<float> &magnoParafovealResponse);
/** /**
* @param useMagnoOutput: true if Magnoocellular output should be activated, false if not * @param useMagnoOutput: true if Magnoocellular output should be activated, false if not
*/ */
inline void activateMovingContoursProcessing(const bool useMagnoOutput){_useMagnoOutput=useMagnoOutput;}; inline void activateMovingContoursProcessing(const bool useMagnoOutput){_useMagnoOutput=useMagnoOutput;};
/** /**
* @return the magnocellular moving contours information (motion), should be used at the parafovea level without post-processing * @return the magnocellular moving contours information (motion), should be used at the parafovea level without post-processing
*/ */
inline const std::valarray<float> &getMovingContours() const {return _MagnoRetinaFilter.getOutput();};// Magnocellular output inline const std::valarray<float> &getMovingContours() const {return _MagnoRetinaFilter.getOutput();};// Magnocellular output
/** /**
* @return the magnocellular moving contours information (motion), should be used at the parafovea level with assymetric sigmoide post-processing which saturates motion information * @return the magnocellular moving contours information (motion), should be used at the parafovea level with assymetric sigmoide post-processing which saturates motion information
*/ */
inline const std::valarray<float> &getMovingContoursSaturated() const {return _MagnoRetinaFilter.getMagnoYsaturated();};// Saturated Magnocellular output inline const std::valarray<float> &getMovingContoursSaturated() const {return _MagnoRetinaFilter.getMagnoYsaturated();};// Saturated Magnocellular output
/** /**
* @return the magnocellular moving contours ON information (motion), should be used at the parafovea level without post-processing * @return the magnocellular moving contours ON information (motion), should be used at the parafovea level without post-processing
*/ */
inline const std::valarray<float> &getMovingContoursON() const {return _MagnoRetinaFilter.getMagnoON();};// Magnocellular ON output inline const std::valarray<float> &getMovingContoursON() const {return _MagnoRetinaFilter.getMagnoON();};// Magnocellular ON output
/** /**
* @return the magnocellular moving contours OFF information (motion), should be used at the parafovea level without post-processing * @return the magnocellular moving contours OFF information (motion), should be used at the parafovea level without post-processing
*/ */
inline const std::valarray<float> &getMovingContoursOFF() const {return _MagnoRetinaFilter.getMagnoOFF();};// Magnocellular OFF output inline const std::valarray<float> &getMovingContoursOFF() const {return _MagnoRetinaFilter.getMagnoOFF();};// Magnocellular OFF output
/** /**
* @return a gray level image with center Parvo and peripheral Magno X channels, WARNING, the result will be ok if you called previously fucntion runFilter(imageInput, processRetinaParvoMagnoMapping=true); * @return a gray level image with center Parvo and peripheral Magno X channels, WARNING, the result will be ok if you called previously fucntion runFilter(imageInput, processRetinaParvoMagnoMapping=true);
* -> will be accessible even if color mode is activated (but the image is color sampled so quality is poor), but get the same thing but in color by the use of function getParvoColor() * -> will be accessible even if color mode is activated (but the image is color sampled so quality is poor), but get the same thing but in color by the use of function getParvoColor()
*/ */
inline const std::valarray<float> &getRetinaParvoMagnoMappedOutput() const {return _retinaParvoMagnoMappedFrame;};// return image with center Parvo and peripheral Magno channels inline const std::valarray<float> &getRetinaParvoMagnoMappedOutput() const {return _retinaParvoMagnoMappedFrame;};// return image with center Parvo and peripheral Magno channels
/** /**
* color processing dedicated functions * color processing dedicated functions
* @return the parvo channel (contours, details) of the processed frame, grayscale output * @return the parvo channel (contours, details) of the processed frame, grayscale output
*/ */
inline const std::valarray<float> &getParvoContoursChannel() const {return _colorEngine.getLuminance();}; inline const std::valarray<float> &getParvoContoursChannel() const {return _colorEngine.getLuminance();};
/** /**
* color processing dedicated functions * color processing dedicated functions
* @return the chrominance of the processed frame (same colorspace as the input output, usually RGB) * @return the chrominance of the processed frame (same colorspace as the input output, usually RGB)
*/ */
inline const std::valarray<float> &getParvoChrominance() const {return _colorEngine.getChrominance();}; // only retreive chrominance inline const std::valarray<float> &getParvoChrominance() const {return _colorEngine.getChrominance();}; // only retreive chrominance
/** /**
* color processing dedicated functions * color processing dedicated functions
* @return the parvo + chrominance channels of the processed frame (same colorspace as the input output, usually RGB) * @return the parvo + chrominance channels of the processed frame (same colorspace as the input output, usually RGB)
*/ */
inline const std::valarray<float> &getColorOutput() const {return _colorEngine.getDemultiplexedColorFrame();};// retrieve luminance+chrominance inline const std::valarray<float> &getColorOutput() const {return _colorEngine.getDemultiplexedColorFrame();};// retrieve luminance+chrominance
/** /**
* apply to the retina color output the Krauskopf transformation which leads to an opponent color system: output colorspace if Acr1cr2 if input of the retina was LMS color space * apply to the retina color output the Krauskopf transformation which leads to an opponent color system: output colorspace if Acr1cr2 if input of the retina was LMS color space
* @param result: the input buffer to fill with the transformed colorspace retina output * @param result: the input buffer to fill with the transformed colorspace retina output
* @return true if process ended successfully * @return true if process ended successfully
*/ */
inline const bool applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float> &result){return _colorEngine.applyKrauskopfLMS2Acr1cr2Transform(result);}; inline bool applyKrauskopfLMS2Acr1cr2Transform(std::valarray<float> &result){return _colorEngine.applyKrauskopfLMS2Acr1cr2Transform(result);};
/** /**
* apply to the retina color output the Krauskopf transformation which leads to an opponent color system: output colorspace if Acr1cr2 if input of the retina was LMS color space * apply to the retina color output the Krauskopf transformation which leads to an opponent color system: output colorspace if Acr1cr2 if input of the retina was LMS color space
* @param result: the input buffer to fill with the transformed colorspace retina output * @param result: the input buffer to fill with the transformed colorspace retina output
* @return true if process ended successfully * @return true if process ended successfully
*/ */
inline const bool applyLMS2LabTransform(std::valarray<float> &result){return _colorEngine.applyLMS2LabTransform(result);}; inline bool applyLMS2LabTransform(std::valarray<float> &result){return _colorEngine.applyLMS2LabTransform(result);};
/** /**
* color processing dedicated functions * color processing dedicated functions
* @return the retina initialized mode, true if color mode (RGB), false if grayscale * @return the retina initialized mode, true if color mode (RGB), false if grayscale
*/ */
inline const bool isColorMode(){return _useColorMode;}; // return true if RGB mode, false if gray level mode inline bool isColorMode(){return _useColorMode;}; // return true if RGB mode, false if gray level mode
/** /**
* @return the irregular low pass filter ouput at the photoreceptors level * @return the irregular low pass filter ouput at the photoreceptors level
*/ */
inline const std::valarray<float> &getIrregularLPfilteredInputFrame() const {return _photoreceptorsLogSampling->getIrregularLPfilteredInputFrame();}; inline const std::valarray<float> &getIrregularLPfilteredInputFrame() const {return _photoreceptorsLogSampling->getIrregularLPfilteredInputFrame();};
/** /**
* @return true if color mode is activated, false if gray levels processing * @return true if color mode is activated, false if gray levels processing
*/ */
const bool getColorMode(){return _useColorMode;}; bool getColorMode(){return _useColorMode;};
/** /**
* *
* @return true if a sufficient number of processed frames has been done since the last parameters update in order to get the stable state (r<EFBFBD>gime permanent) * @return true if a sufficient number of processed frames has been done since the last parameters update in order to get the stable state (r<EFBFBD>gime permanent)
*/ */
inline const bool isInitTransitionDone(){if (_ellapsedFramesSinceLastReset<_globalTemporalConstant)return false; return true;}; inline bool isInitTransitionDone(){if (_ellapsedFramesSinceLastReset<_globalTemporalConstant)return false; return true;};
/** /**
* find a distance in the image input space when the distance is known in the retina log sampled space...read again if it is not clear enough....sorry, i should sleep * find a distance in the image input space when the distance is known in the retina log sampled space...read again if it is not clear enough....sorry, i should sleep
* @param projectedRadiusLength: the distance to image center in the retina log sampled space * @param projectedRadiusLength: the distance to image center in the retina log sampled space
* @return the distance to image center in the input image space * @return the distance to image center in the input image space
*/ */
inline const float getRetinaSamplingBackProjection(const float projectedRadiusLength) inline float getRetinaSamplingBackProjection(const float projectedRadiusLength)
{ {
if (_photoreceptorsLogSampling) if (_photoreceptorsLogSampling)
return (float)_photoreceptorsLogSampling->getOriginalRadiusLength(projectedRadiusLength); return (float)_photoreceptorsLogSampling->getOriginalRadiusLength(projectedRadiusLength);
return projectedRadiusLength; return projectedRadiusLength;
}; };
/////////////////: /////////////////:
// retina dimensions getters // retina dimensions getters
/** /**
* @return number of rows of the filter * @return number of rows of the filter
*/ */
inline const unsigned int getInputNBrows(){if (_photoreceptorsLogSampling) return _photoreceptorsLogSampling->getNBrows();else return _photoreceptorsPrefilter.getNBrows();}; inline unsigned int getInputNBrows(){if (_photoreceptorsLogSampling) return _photoreceptorsLogSampling->getNBrows();else return _photoreceptorsPrefilter.getNBrows();};
/** /**
* @return number of columns of the filter * @return number of columns of the filter
*/ */
inline const unsigned int getInputNBcolumns(){if (_photoreceptorsLogSampling) return _photoreceptorsLogSampling->getNBcolumns();else return _photoreceptorsPrefilter.getNBcolumns();}; inline unsigned int getInputNBcolumns(){if (_photoreceptorsLogSampling) return _photoreceptorsLogSampling->getNBcolumns();else return _photoreceptorsPrefilter.getNBcolumns();};
/** /**
* @return number of pixels of the filter * @return number of pixels of the filter
*/ */
inline const unsigned int getInputNBpixels(){if (_photoreceptorsLogSampling) return _photoreceptorsLogSampling->getNBpixels();else return _photoreceptorsPrefilter.getNBpixels();}; inline unsigned int getInputNBpixels(){if (_photoreceptorsLogSampling) return _photoreceptorsLogSampling->getNBpixels();else return _photoreceptorsPrefilter.getNBpixels();};
/** /**
* @return the height of the frame output * @return the height of the frame output
*/ */
inline const unsigned int getOutputNBrows(){return _photoreceptorsPrefilter.getNBrows();}; inline unsigned int getOutputNBrows(){return _photoreceptorsPrefilter.getNBrows();};
/** /**
* @return the width of the frame output * @return the width of the frame output
*/ */
inline const unsigned int getOutputNBcolumns(){return _photoreceptorsPrefilter.getNBcolumns();}; inline unsigned int getOutputNBcolumns(){return _photoreceptorsPrefilter.getNBcolumns();};
/** /**
* @return the numbers of output pixels (width*height) of the images used by the object * @return the numbers of output pixels (width*height) of the images used by the object
*/ */
inline const unsigned int getOutputNBpixels(){return _photoreceptorsPrefilter.getNBpixels();}; inline unsigned int getOutputNBpixels(){return _photoreceptorsPrefilter.getNBpixels();};
private: private:
// processing activation flags // processing activation flags
bool _useParvoOutput; bool _useParvoOutput;
bool _useMagnoOutput; bool _useMagnoOutput;
// filter stability controls // filter stability controls
unsigned int _ellapsedFramesSinceLastReset; unsigned int _ellapsedFramesSinceLastReset;
unsigned int _globalTemporalConstant; unsigned int _globalTemporalConstant;
// private template buffers and related access pointers // private template buffers and related access pointers
std::valarray<float> _retinaParvoMagnoMappedFrame; std::valarray<float> _retinaParvoMagnoMappedFrame;
std::valarray<float> _retinaParvoMagnoMapCoefTable; std::valarray<float> _retinaParvoMagnoMapCoefTable;
// private objects of the class // private objects of the class
BasicRetinaFilter _photoreceptorsPrefilter; BasicRetinaFilter _photoreceptorsPrefilter;
ParvoRetinaFilter _ParvoRetinaFilter; ParvoRetinaFilter _ParvoRetinaFilter;
MagnoRetinaFilter _MagnoRetinaFilter; MagnoRetinaFilter _MagnoRetinaFilter;
RetinaColor _colorEngine; RetinaColor _colorEngine;
ImageLogPolProjection *_photoreceptorsLogSampling; ImageLogPolProjection *_photoreceptorsLogSampling;
bool _useMinimalMemoryForToneMappingONLY; bool _useMinimalMemoryForToneMappingONLY;
bool _normalizeParvoOutput_0_maxOutputValue; bool _normalizeParvoOutput_0_maxOutputValue;
bool _normalizeMagnoOutput_0_maxOutputValue; bool _normalizeMagnoOutput_0_maxOutputValue;
float _maxOutputValue; float _maxOutputValue;
bool _useColorMode; bool _useColorMode;
// private functions // private functions
void _setInitPeriodCount(); void _setInitPeriodCount();
void _createHybridTable(); void _createHybridTable();
void _processRetinaParvoMagnoMapping(); void _processRetinaParvoMagnoMapping();
void _runGrayToneMapping(const std::valarray<float> &grayImageInput, std::valarray<float> &grayImageOutput ,const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6); void _runGrayToneMapping(const std::valarray<float> &grayImageInput, std::valarray<float> &grayImageOutput ,const float PhotoreceptorsCompression=0.6, const float ganglionCellsCompression=0.6);
}; };

View File

@ -85,303 +85,303 @@ template <class type> class TemplateBuffer : public std::valarray<type>
{ {
public: public:
/** /**
* constructor for monodimensional array * constructor for monodimensional array
* @param dim: the size of the vector * @param dim: the size of the vector
*/ */
TemplateBuffer(const size_t dim=0) TemplateBuffer(const size_t dim=0)
: std::valarray<type>((type)0, dim) : std::valarray<type>((type)0, dim)
{ {
_NBrows=1; _NBrows=1;
_NBcolumns=dim; _NBcolumns=dim;
_NBdepths=1; _NBdepths=1;
_NBpixels=dim; _NBpixels=dim;
_doubleNBpixels=2*dim; _doubleNBpixels=2*dim;
} }
/** /**
* constructor by copy for monodimensional array * constructor by copy for monodimensional array
* @param pVal: the pointer to a buffer to copy * @param pVal: the pointer to a buffer to copy
* @param dim: the size of the vector * @param dim: the size of the vector
*/ */
TemplateBuffer(const type* pVal, const size_t dim) TemplateBuffer(const type* pVal, const size_t dim)
: std::valarray<type>(pVal, dim) : std::valarray<type>(pVal, dim)
{ {
_NBrows=1; _NBrows=1;
_NBcolumns=dim; _NBcolumns=dim;
_NBdepths=1; _NBdepths=1;
_NBpixels=dim; _NBpixels=dim;
_doubleNBpixels=2*dim; _doubleNBpixels=2*dim;
} }
/** /**
* constructor for bidimensional array * constructor for bidimensional array
* @param dimRows: the size of the vector * @param dimRows: the size of the vector
* @param dimColumns: the size of the vector * @param dimColumns: the size of the vector
* @param depth: the number of layers of the buffer in its third dimension (3 of color images, 1 for gray images. * @param depth: the number of layers of the buffer in its third dimension (3 of color images, 1 for gray images.
*/ */
TemplateBuffer(const size_t dimRows, const size_t dimColumns, const size_t depth=1) TemplateBuffer(const size_t dimRows, const size_t dimColumns, const size_t depth=1)
: std::valarray<type>((type)0, dimRows*dimColumns*depth) : std::valarray<type>((type)0, dimRows*dimColumns*depth)
{ {
#ifdef TEMPLATEBUFFERDEBUG #ifdef TEMPLATEBUFFERDEBUG
std::cout<<"TemplateBuffer::TemplateBuffer: new buffer, size="<<dimRows<<", "<<dimColumns<<", "<<depth<<"valarraySize="<<this->size()<<std::endl; std::cout<<"TemplateBuffer::TemplateBuffer: new buffer, size="<<dimRows<<", "<<dimColumns<<", "<<depth<<"valarraySize="<<this->size()<<std::endl;
#endif #endif
_NBrows=dimRows; _NBrows=dimRows;
_NBcolumns=dimColumns; _NBcolumns=dimColumns;
_NBdepths=depth; _NBdepths=depth;
_NBpixels=dimRows*dimColumns; _NBpixels=dimRows*dimColumns;
_doubleNBpixels=2*dimRows*dimColumns; _doubleNBpixels=2*dimRows*dimColumns;
//_createTableIndex(); //_createTableIndex();
#ifdef TEMPLATEBUFFERDEBUG #ifdef TEMPLATEBUFFERDEBUG
std::cout<<"TemplateBuffer::TemplateBuffer: construction successful"<<std::endl; std::cout<<"TemplateBuffer::TemplateBuffer: construction successful"<<std::endl;
#endif #endif
} }
/** /**
* copy constructor * copy constructor
* @param toCopy * @param toCopy
* @return thenconstructed instance * @return thenconstructed instance
*emplateBuffer(const TemplateBuffer &toCopy) *emplateBuffer(const TemplateBuffer &toCopy)
:_NBrows(toCopy.getNBrows()),_NBcolumns(toCopy.getNBcolumns()),_NBdepths(toCopy.getNBdephs()), _NBpixels(toCopy.getNBpixels()), _doubleNBpixels(toCopy.getNBpixels()*2) :_NBrows(toCopy.getNBrows()),_NBcolumns(toCopy.getNBcolumns()),_NBdepths(toCopy.getNBdephs()), _NBpixels(toCopy.getNBpixels()), _doubleNBpixels(toCopy.getNBpixels()*2)
//std::valarray<type>(toCopy) //std::valarray<type>(toCopy)
{ {
memcpy(Buffer(), toCopy.Buffer(), this->size()); memcpy(Buffer(), toCopy.Buffer(), this->size());
}*/ }*/
/** /**
* destructor * destructor
*/ */
virtual ~TemplateBuffer() virtual ~TemplateBuffer()
{ {
#ifdef TEMPLATEBUFFERDEBUG #ifdef TEMPLATEBUFFERDEBUG
std::cout<<"~TemplateBuffer"<<std::endl; std::cout<<"~TemplateBuffer"<<std::endl;
#endif #endif
} }
/** /**
* delete the buffer content (set zeros) * delete the buffer content (set zeros)
*/ */
inline void setZero(){std::valarray<type>::operator=(0);};//memset(Buffer(), 0, sizeof(type)*_NBpixels);}; inline void setZero(){std::valarray<type>::operator=(0);};//memset(Buffer(), 0, sizeof(type)*_NBpixels);};
/** /**
* @return the numbers of rows (height) of the images used by the object * @return the numbers of rows (height) of the images used by the object
*/ */
inline unsigned int getNBrows(){return (unsigned int)_NBrows;}; inline unsigned int getNBrows(){return (unsigned int)_NBrows;};
/** /**
* @return the numbers of columns (width) of the images used by the object * @return the numbers of columns (width) of the images used by the object
*/ */
inline unsigned int getNBcolumns(){return (unsigned int)_NBcolumns;}; inline unsigned int getNBcolumns(){return (unsigned int)_NBcolumns;};
/** /**
* @return the numbers of pixels (width*height) of the images used by the object * @return the numbers of pixels (width*height) of the images used by the object
*/ */
inline unsigned int getNBpixels(){return (unsigned int)_NBpixels;}; inline unsigned int getNBpixels(){return (unsigned int)_NBpixels;};
/** /**
* @return the numbers of pixels (width*height) of the images used by the object * @return the numbers of pixels (width*height) of the images used by the object
*/ */
inline unsigned int getDoubleNBpixels(){return (unsigned int)_doubleNBpixels;}; inline unsigned int getDoubleNBpixels(){return (unsigned int)_doubleNBpixels;};
/** /**
* @return the numbers of depths (3rd dimension: 1 for gray images, 3 for rgb images) of the images used by the object * @return the numbers of depths (3rd dimension: 1 for gray images, 3 for rgb images) of the images used by the object
*/ */
inline unsigned int getDepthSize(){return (unsigned int)_NBdepths;}; inline unsigned int getDepthSize(){return (unsigned int)_NBdepths;};
/** /**
* resize the buffer and recompute table index etc. * resize the buffer and recompute table index etc.
*/ */
void resizeBuffer(const size_t dimRows, const size_t dimColumns, const size_t depth=1) void resizeBuffer(const size_t dimRows, const size_t dimColumns, const size_t depth=1)
{ {
this->resize(dimRows*dimColumns*depth); this->resize(dimRows*dimColumns*depth);
_NBrows=dimRows; _NBrows=dimRows;
_NBcolumns=dimColumns; _NBcolumns=dimColumns;
_NBdepths=depth; _NBdepths=depth;
_NBpixels=dimRows*dimColumns; _NBpixels=dimRows*dimColumns;
_doubleNBpixels=2*dimRows*dimColumns; _doubleNBpixels=2*dimRows*dimColumns;
} }
inline TemplateBuffer<type> & operator=(const std::valarray<type> &b) inline TemplateBuffer<type> & operator=(const std::valarray<type> &b)
{ {
//std::cout<<"TemplateBuffer<type> & operator= affect vector: "<<std::endl; //std::cout<<"TemplateBuffer<type> & operator= affect vector: "<<std::endl;
std::valarray<type>::operator=(b); std::valarray<type>::operator=(b);
return *this; return *this;
} }
inline TemplateBuffer<type> & operator=(const type &b) inline TemplateBuffer<type> & operator=(const type &b)
{ {
//std::cout<<"TemplateBuffer<type> & operator= affect value: "<<b<<std::endl; //std::cout<<"TemplateBuffer<type> & operator= affect value: "<<b<<std::endl;
std::valarray<type>::operator=(b); std::valarray<type>::operator=(b);
return *this; return *this;
} }
/* inline const type &operator[](const unsigned int &b) /* inline const type &operator[](const unsigned int &b)
{ {
return (*this)[b]; return (*this)[b];
} }
*/ */
/** /**
* @return the buffer adress in non const mode * @return the buffer adress in non const mode
*/ */
inline type* Buffer() { return &(*this)[0]; } inline type* Buffer() { return &(*this)[0]; }
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// Standard Image manipulation functions // Standard Image manipulation functions
/** /**
* standard 0 to 255 image normalization function * standard 0 to 255 image normalization function
* @param inputOutputBuffer: the image to be normalized (rewrites the input), if no parameter, then, the built in buffer reachable by getOutput() function is normalized * @param inputOutputBuffer: the image to be normalized (rewrites the input), if no parameter, then, the built in buffer reachable by getOutput() function is normalized
* @param nbPixels: specifies the number of pixel on which the normalization should be performed, if 0, then all pixels specified in the constructor are processed * @param nbPixels: specifies the number of pixel on which the normalization should be performed, if 0, then all pixels specified in the constructor are processed
* @param maxOutputValue: the maximum output value * @param maxOutputValue: the maximum output value
*/ */
static void normalizeGrayOutput_0_maxOutputValue(type *inputOutputBuffer, const size_t nbPixels, const type maxOutputValue=(type)255.0); static void normalizeGrayOutput_0_maxOutputValue(type *inputOutputBuffer, const size_t nbPixels, const type maxOutputValue=(type)255.0);
/** /**
* standard 0 to 255 image normalization function * standard 0 to 255 image normalization function
* @param inputOutputBuffer: the image to be normalized (rewrites the input), if no parameter, then, the built in buffer reachable by getOutput() function is normalized * @param inputOutputBuffer: the image to be normalized (rewrites the input), if no parameter, then, the built in buffer reachable by getOutput() function is normalized
* @param nbPixels: specifies the number of pixel on which the normalization should be performed, if 0, then all pixels specified in the constructor are processed * @param nbPixels: specifies the number of pixel on which the normalization should be performed, if 0, then all pixels specified in the constructor are processed
* @param maxOutputValue: the maximum output value * @param maxOutputValue: the maximum output value
*/ */
void normalizeGrayOutput_0_maxOutputValue(const type maxOutputValue=(type)255.0){normalizeGrayOutput_0_maxOutputValue(this->Buffer(), this->size(), maxOutputValue);}; void normalizeGrayOutput_0_maxOutputValue(const type maxOutputValue=(type)255.0){normalizeGrayOutput_0_maxOutputValue(this->Buffer(), this->size(), maxOutputValue);};
/** /**
* sigmoide image normalization function (saturates min and max values) * sigmoide image normalization function (saturates min and max values)
* @param meanValue: specifies the mean value of th pixels to be processed * @param meanValue: specifies the mean value of th pixels to be processed
* @param sensitivity: strenght of the sigmoide * @param sensitivity: strenght of the sigmoide
* @param inputPicture: the image to be normalized if no parameter, then, the built in buffer reachable by getOutput() function is normalized * @param inputPicture: the image to be normalized if no parameter, then, the built in buffer reachable by getOutput() function is normalized
* @param outputBuffer: the ouput buffer on which the result is writed, if no parameter, then, the built in buffer reachable by getOutput() function is normalized * @param outputBuffer: the ouput buffer on which the result is writed, if no parameter, then, the built in buffer reachable by getOutput() function is normalized
* @param maxOutputValue: the maximum output value * @param maxOutputValue: the maximum output value
*/ */
static void normalizeGrayOutputCentredSigmoide(const type meanValue, const type sensitivity, const type maxOutputValue, type *inputPicture, type *outputBuffer, const unsigned int nbPixels); static void normalizeGrayOutputCentredSigmoide(const type meanValue, const type sensitivity, const type maxOutputValue, type *inputPicture, type *outputBuffer, const unsigned int nbPixels);
/** /**
* sigmoide image normalization function on the current buffer (saturates min and max values) * sigmoide image normalization function on the current buffer (saturates min and max values)
* @param meanValue: specifies the mean value of th pixels to be processed * @param meanValue: specifies the mean value of th pixels to be processed
* @param sensitivity: strenght of the sigmoide * @param sensitivity: strenght of the sigmoide
* @param maxOutputValue: the maximum output value * @param maxOutputValue: the maximum output value
*/ */
inline void normalizeGrayOutputCentredSigmoide(const type meanValue=(type)0.0, const type sensitivity=(type)2.0, const type maxOutputValue=(type)255.0){ (void)maxOutputValue; normalizeGrayOutputCentredSigmoide(meanValue, sensitivity, 255.0, this->Buffer(), this->Buffer(), this->getNBpixels());}; inline void normalizeGrayOutputCentredSigmoide(const type meanValue=(type)0.0, const type sensitivity=(type)2.0, const type maxOutputValue=(type)255.0){ (void)maxOutputValue; normalizeGrayOutputCentredSigmoide(meanValue, sensitivity, 255.0, this->Buffer(), this->Buffer(), this->getNBpixels());};
/** /**
* sigmoide image normalization function (saturates min and max values), in this function, the sigmoide is centered on low values (high saturation of the medium and high values * sigmoide image normalization function (saturates min and max values), in this function, the sigmoide is centered on low values (high saturation of the medium and high values
* @param inputPicture: the image to be normalized if no parameter, then, the built in buffer reachable by getOutput() function is normalized * @param inputPicture: the image to be normalized if no parameter, then, the built in buffer reachable by getOutput() function is normalized
* @param outputBuffer: the ouput buffer on which the result is writed, if no parameter, then, the built in buffer reachable by getOutput() function is normalized * @param outputBuffer: the ouput buffer on which the result is writed, if no parameter, then, the built in buffer reachable by getOutput() function is normalized
* @param sensitivity: strenght of the sigmoide * @param sensitivity: strenght of the sigmoide
* @param maxOutputValue: the maximum output value * @param maxOutputValue: the maximum output value
*/ */
void normalizeGrayOutputNearZeroCentreredSigmoide(type *inputPicture=(type*)NULL, type *outputBuffer=(type*)NULL, const type sensitivity=(type)40, const type maxOutputValue=(type)255.0); void normalizeGrayOutputNearZeroCentreredSigmoide(type *inputPicture=(type*)NULL, type *outputBuffer=(type*)NULL, const type sensitivity=(type)40, const type maxOutputValue=(type)255.0);
/** /**
* center and reduct the image (image-mean)/std * center and reduct the image (image-mean)/std
* @param inputOutputBuffer: the image to be normalized if no parameter, the result is rewrited on it * @param inputOutputBuffer: the image to be normalized if no parameter, the result is rewrited on it
*/ */
void centerReductImageLuminance(type *inputOutputBuffer=(type*)NULL); void centerReductImageLuminance(type *inputOutputBuffer=(type*)NULL);
/** /**
* @return standard deviation of the buffer * @return standard deviation of the buffer
*/ */
const double getStandardDeviation() double getStandardDeviation()
{ {
double standardDeviation=0; double standardDeviation=0;
double meanValue=getMean(); double meanValue=getMean();
type *bufferPTR=Buffer(); type *bufferPTR=Buffer();
for (unsigned int i=0;i<this->size();++i) for (unsigned int i=0;i<this->size();++i)
{ {
double diff=(*(bufferPTR++)-meanValue); double diff=(*(bufferPTR++)-meanValue);
standardDeviation+=diff*diff; standardDeviation+=diff*diff;
} }
return sqrt(standardDeviation/this->size()); return sqrt(standardDeviation/this->size());
}; };
/** /**
* Clip buffer histogram * Clip buffer histogram
* @param minRatio: the minimum ratio of the lower pixel values, range=[0,1] and lower than maxRatio * @param minRatio: the minimum ratio of the lower pixel values, range=[0,1] and lower than maxRatio
* @param maxRatio: the aximum ratio of the higher pixel values, range=[0,1] and higher than minRatio * @param maxRatio: the aximum ratio of the higher pixel values, range=[0,1] and higher than minRatio
*/ */
void clipHistogram(double minRatio, double maxRatio, double maxOutputValue) void clipHistogram(double minRatio, double maxRatio, double maxOutputValue)
{ {
if (minRatio>=maxRatio) if (minRatio>=maxRatio)
{ {
std::cerr<<"TemplateBuffer::clipHistogram: minRatio must be inferior to maxRatio, buffer unchanged"<<std::endl; std::cerr<<"TemplateBuffer::clipHistogram: minRatio must be inferior to maxRatio, buffer unchanged"<<std::endl;
return; return;
} }
/* minRatio=min(max(minRatio, 1.0),0.0); /* minRatio=min(max(minRatio, 1.0),0.0);
maxRatio=max(max(maxRatio, 0.0),1.0); maxRatio=max(max(maxRatio, 0.0),1.0);
*/ */
// find the pixel value just above the threshold // find the pixel value just above the threshold
const double maxThreshold=this->max()*maxRatio; const double maxThreshold=this->max()*maxRatio;
const double minThreshold=(this->max()-this->min())*minRatio+this->min(); const double minThreshold=(this->max()-this->min())*minRatio+this->min();
type *bufferPTR=this->Buffer(); type *bufferPTR=this->Buffer();
double deltaH=maxThreshold; double deltaH=maxThreshold;
double deltaL=maxThreshold; double deltaL=maxThreshold;
double updatedHighValue=maxThreshold; double updatedHighValue=maxThreshold;
double updatedLowValue=maxThreshold; double updatedLowValue=maxThreshold;
for (unsigned int i=0;i<this->size();++i) for (unsigned int i=0;i<this->size();++i)
{ {
double curentValue=(double)*(bufferPTR++); double curentValue=(double)*(bufferPTR++);
// updating "closest to the high threshold" pixel value // updating "closest to the high threshold" pixel value
double highValueTest=maxThreshold-curentValue; double highValueTest=maxThreshold-curentValue;
if (highValueTest>0) if (highValueTest>0)
{ {
if (deltaH>highValueTest) if (deltaH>highValueTest)
{ {
deltaH=highValueTest; deltaH=highValueTest;
updatedHighValue=curentValue; updatedHighValue=curentValue;
} }
} }
// updating "closest to the low threshold" pixel value // updating "closest to the low threshold" pixel value
double lowValueTest=curentValue-minThreshold; double lowValueTest=curentValue-minThreshold;
if (lowValueTest>0) if (lowValueTest>0)
{ {
if (deltaL>lowValueTest) if (deltaL>lowValueTest)
{ {
deltaL=lowValueTest; deltaL=lowValueTest;
updatedLowValue=curentValue; updatedLowValue=curentValue;
} }
} }
} }
std::cout<<"Tdebug"<<std::endl; std::cout<<"Tdebug"<<std::endl;
std::cout<<"deltaL="<<deltaL<<", deltaH="<<deltaH<<std::endl; std::cout<<"deltaL="<<deltaL<<", deltaH="<<deltaH<<std::endl;
std::cout<<"this->max()"<<this->max()<<"maxThreshold="<<maxThreshold<<"updatedHighValue="<<updatedHighValue<<std::endl; std::cout<<"this->max()"<<this->max()<<"maxThreshold="<<maxThreshold<<"updatedHighValue="<<updatedHighValue<<std::endl;
std::cout<<"this->min()"<<this->min()<<"minThreshold="<<minThreshold<<"updatedLowValue="<<updatedLowValue<<std::endl; std::cout<<"this->min()"<<this->min()<<"minThreshold="<<minThreshold<<"updatedLowValue="<<updatedLowValue<<std::endl;
// clipping values outside than the updated thresholds // clipping values outside than the updated thresholds
bufferPTR=this->Buffer(); bufferPTR=this->Buffer();
for (unsigned int i=0;i<this->size();++i, ++bufferPTR) for (unsigned int i=0;i<this->size();++i, ++bufferPTR)
{ {
if (*bufferPTR<updatedLowValue) if (*bufferPTR<updatedLowValue)
*bufferPTR=updatedLowValue; *bufferPTR=updatedLowValue;
else if (*bufferPTR>updatedHighValue) else if (*bufferPTR>updatedHighValue)
*bufferPTR=updatedHighValue; *bufferPTR=updatedHighValue;
} }
normalizeGrayOutput_0_maxOutputValue(this->Buffer(), this->size(), maxOutputValue); normalizeGrayOutput_0_maxOutputValue(this->Buffer(), this->size(), maxOutputValue);
} }
/** /**
* @return the mean value of the vector * @return the mean value of the vector
*/ */
inline const double getMean(){return this->sum()/this->size();}; inline double getMean(){return this->sum()/this->size();};
protected: protected:
size_t _NBrows; size_t _NBrows;
size_t _NBcolumns; size_t _NBcolumns;
size_t _NBdepths; size_t _NBdepths;
size_t _NBpixels; size_t _NBpixels;
size_t _doubleNBpixels; size_t _doubleNBpixels;
// utilities // utilities
static type _abs(const type x); static type _abs(const type x);
}; };
@ -390,48 +390,48 @@ protected:
template <class type> template <class type>
void TemplateBuffer<type>::normalizeGrayOutput_0_maxOutputValue(type *inputOutputBuffer, const size_t processedPixels, const type maxOutputValue) void TemplateBuffer<type>::normalizeGrayOutput_0_maxOutputValue(type *inputOutputBuffer, const size_t processedPixels, const type maxOutputValue)
{ {
type maxValue=inputOutputBuffer[0], minValue=inputOutputBuffer[0]; type maxValue=inputOutputBuffer[0], minValue=inputOutputBuffer[0];
// get the min and max value // get the min and max value
register type *inputOutputBufferPTR=inputOutputBuffer; register type *inputOutputBufferPTR=inputOutputBuffer;
for (register size_t j = 0; j<processedPixels; ++j) for (register size_t j = 0; j<processedPixels; ++j)
{ {
type pixValue = *(inputOutputBufferPTR++); type pixValue = *(inputOutputBufferPTR++);
if (maxValue < pixValue) if (maxValue < pixValue)
maxValue = pixValue; maxValue = pixValue;
else if (minValue > pixValue) else if (minValue > pixValue)
minValue = pixValue; minValue = pixValue;
} }
// change the range of the data to 0->255 // change the range of the data to 0->255
type factor = maxOutputValue/(maxValue-minValue); type factor = maxOutputValue/(maxValue-minValue);
type offset = (type)(-minValue*factor); type offset = (type)(-minValue*factor);
inputOutputBufferPTR=inputOutputBuffer; inputOutputBufferPTR=inputOutputBuffer;
for (register size_t j = 0; j < processedPixels; ++j, ++inputOutputBufferPTR) for (register size_t j = 0; j < processedPixels; ++j, ++inputOutputBufferPTR)
*inputOutputBufferPTR=*(inputOutputBufferPTR)*factor+offset; *inputOutputBufferPTR=*(inputOutputBufferPTR)*factor+offset;
} }
// normalize data with a sigmoide close to 0 (saturates values for those superior to 0) // normalize data with a sigmoide close to 0 (saturates values for those superior to 0)
template <class type> template <class type>
void TemplateBuffer<type>::normalizeGrayOutputNearZeroCentreredSigmoide(type *inputBuffer, type *outputBuffer, const type sensitivity, const type maxOutputValue) void TemplateBuffer<type>::normalizeGrayOutputNearZeroCentreredSigmoide(type *inputBuffer, type *outputBuffer, const type sensitivity, const type maxOutputValue)
{ {
if (inputBuffer==NULL) if (inputBuffer==NULL)
inputBuffer=Buffer(); inputBuffer=Buffer();
if (outputBuffer==NULL) if (outputBuffer==NULL)
outputBuffer=Buffer(); outputBuffer=Buffer();
type X0cube=sensitivity*sensitivity*sensitivity; type X0cube=sensitivity*sensitivity*sensitivity;
register type *inputBufferPTR=inputBuffer; register type *inputBufferPTR=inputBuffer;
register type *outputBufferPTR=outputBuffer; register type *outputBufferPTR=outputBuffer;
for (register size_t j = 0; j < _NBpixels; ++j, ++inputBufferPTR) for (register size_t j = 0; j < _NBpixels; ++j, ++inputBufferPTR)
{ {
type currentCubeLuminance=*inputBufferPTR**inputBufferPTR**inputBufferPTR; type currentCubeLuminance=*inputBufferPTR**inputBufferPTR**inputBufferPTR;
*(outputBufferPTR++)=maxOutputValue*currentCubeLuminance/(currentCubeLuminance+X0cube); *(outputBufferPTR++)=maxOutputValue*currentCubeLuminance/(currentCubeLuminance+X0cube);
} }
} }
// normalize and adjust luminance with a centered to 128 sigmode // normalize and adjust luminance with a centered to 128 sigmode
@ -439,20 +439,20 @@ template <class type>
void TemplateBuffer<type>::normalizeGrayOutputCentredSigmoide(const type meanValue, const type sensitivity, const type maxOutputValue, type *inputBuffer, type *outputBuffer, const unsigned int nbPixels) void TemplateBuffer<type>::normalizeGrayOutputCentredSigmoide(const type meanValue, const type sensitivity, const type maxOutputValue, type *inputBuffer, type *outputBuffer, const unsigned int nbPixels)
{ {
if (sensitivity==1.0) if (sensitivity==1.0)
{ {
std::cerr<<"TemplateBuffer::TemplateBuffer<type>::normalizeGrayOutputCentredSigmoide error: 2nd parameter (sensitivity) must not equal 0, copying original data..."<<std::endl; std::cerr<<"TemplateBuffer::TemplateBuffer<type>::normalizeGrayOutputCentredSigmoide error: 2nd parameter (sensitivity) must not equal 0, copying original data..."<<std::endl;
memcpy(outputBuffer, inputBuffer, sizeof(type)*nbPixels); memcpy(outputBuffer, inputBuffer, sizeof(type)*nbPixels);
return; return;
} }
type X0=maxOutputValue/(sensitivity-(type)1.0); type X0=maxOutputValue/(sensitivity-(type)1.0);
register type *inputBufferPTR=inputBuffer; register type *inputBufferPTR=inputBuffer;
register type *outputBufferPTR=outputBuffer; register type *outputBufferPTR=outputBuffer;
for (register size_t j = 0; j < nbPixels; ++j, ++inputBufferPTR) for (register size_t j = 0; j < nbPixels; ++j, ++inputBufferPTR)
*(outputBufferPTR++)=(meanValue+(meanValue+X0)*(*(inputBufferPTR)-meanValue)/(_abs(*(inputBufferPTR)-meanValue)+X0)); *(outputBufferPTR++)=(meanValue+(meanValue+X0)*(*(inputBufferPTR)-meanValue)/(_abs(*(inputBufferPTR)-meanValue)+X0));
} }
@ -460,29 +460,29 @@ void TemplateBuffer<type>::normalizeGrayOutputCentredSigmoide(const type meanVal
template <class type> template <class type>
void TemplateBuffer<type>::centerReductImageLuminance(type *inputOutputBuffer) void TemplateBuffer<type>::centerReductImageLuminance(type *inputOutputBuffer)
{ {
// if outputBuffer unsassigned, the rewrite the buffer // if outputBuffer unsassigned, the rewrite the buffer
if (inputOutputBuffer==NULL) if (inputOutputBuffer==NULL)
inputOutputBuffer=Buffer(); inputOutputBuffer=Buffer();
type meanValue=0, stdValue=0; type meanValue=0, stdValue=0;
// compute mean value // compute mean value
for (register size_t j = 0; j < _NBpixels; ++j) for (register size_t j = 0; j < _NBpixels; ++j)
meanValue+=inputOutputBuffer[j]; meanValue+=inputOutputBuffer[j];
meanValue/=((type)_NBpixels); meanValue/=((type)_NBpixels);
// compute std value // compute std value
register type *inputOutputBufferPTR=inputOutputBuffer; register type *inputOutputBufferPTR=inputOutputBuffer;
for (size_t index=0;index<_NBpixels;++index) for (size_t index=0;index<_NBpixels;++index)
{ {
type inputMinusMean=*(inputOutputBufferPTR++)-meanValue; type inputMinusMean=*(inputOutputBufferPTR++)-meanValue;
stdValue+=inputMinusMean*inputMinusMean; stdValue+=inputMinusMean*inputMinusMean;
} }
stdValue=sqrt(stdValue/((type)_NBpixels)); stdValue=sqrt(stdValue/((type)_NBpixels));
// adjust luminance in regard of mean and std value; // adjust luminance in regard of mean and std value;
inputOutputBufferPTR=inputOutputBuffer; inputOutputBufferPTR=inputOutputBuffer;
for (size_t index=0;index<_NBpixels;++index, ++inputOutputBufferPTR) for (size_t index=0;index<_NBpixels;++index, ++inputOutputBufferPTR)
*inputOutputBufferPTR=(*(inputOutputBufferPTR)-meanValue)/stdValue; *inputOutputBufferPTR=(*(inputOutputBufferPTR)-meanValue)/stdValue;
} }
@ -490,27 +490,27 @@ template <class type>
type TemplateBuffer<type>::_abs(const type x) type TemplateBuffer<type>::_abs(const type x)
{ {
if (x>0) if (x>0)
return x; return x;
else else
return -x; return -x;
} }
template < > template < >
inline int TemplateBuffer<int>::_abs(const int x) inline int TemplateBuffer<int>::_abs(const int x)
{ {
return std::abs(x); return std::abs(x);
} }
template < > template < >
inline double TemplateBuffer<double>::_abs(const double x) inline double TemplateBuffer<double>::_abs(const double x)
{ {
return std::fabs(x); return std::fabs(x);
} }
template < > template < >
inline float TemplateBuffer<float>::_abs(const float x) inline float TemplateBuffer<float>::_abs(const float x)
{ {
return std::fabs(x); return std::fabs(x);
} }
} }

View File

@ -1,3 +1,7 @@
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wsign-promo"
#endif
#ifndef _OPENCV_FLANN_PRECOMP_HPP_ #ifndef _OPENCV_FLANN_PRECOMP_HPP_
#define _OPENCV_FLANN_PRECOMP_HPP_ #define _OPENCV_FLANN_PRECOMP_HPP_

View File

@ -380,7 +380,6 @@ int my_jpeg_load_dht (struct jpeg_decompress_struct *info, unsigned char *dht,
bool JpegDecoder::readData( Mat& img ) bool JpegDecoder::readData( Mat& img )
{ {
bool result = false; bool result = false;
uchar* data = img.data;
int step = (int)img.step; int step = (int)img.step;
bool color = img.channels() > 1; bool color = img.channels() > 1;
JpegState* state = (JpegState*)m_state; JpegState* state = (JpegState*)m_state;
@ -439,6 +438,7 @@ bool JpegDecoder::readData( Mat& img )
buffer = (*cinfo->mem->alloc_sarray)((j_common_ptr)cinfo, buffer = (*cinfo->mem->alloc_sarray)((j_common_ptr)cinfo,
JPOOL_IMAGE, m_width*4, 1 ); JPOOL_IMAGE, m_width*4, 1 );
uchar* data = img.data;
for( ; m_height--; data += step ) for( ; m_height--; data += step )
{ {
jpeg_read_scanlines( cinfo, buffer, 1 ); jpeg_read_scanlines( cinfo, buffer, 1 );
@ -533,19 +533,15 @@ ImageEncoder JpegEncoder::newEncoder() const
bool JpegEncoder::write( const Mat& img, const vector<int>& params ) bool JpegEncoder::write( const Mat& img, const vector<int>& params )
{ {
int quality = 95; struct fileWrapper
for( size_t i = 0; i < params.size(); i += 2 )
{ {
if( params[i] == CV_IMWRITE_JPEG_QUALITY ) FILE* f;
{
quality = params[i+1];
quality = MIN(MAX(quality, 0), 100);
}
}
fileWrapper() : f(0) {}
~fileWrapper() { if(f) fclose(f); }
};
bool result = false; bool result = false;
FILE* f = 0; fileWrapper fw;
int _channels = img.channels(); int _channels = img.channels();
int channels = _channels > 1 ? 3 : 1; int channels = _channels > 1 ? 3 : 1;
int width = img.cols, height = img.rows; int width = img.cols, height = img.rows;
@ -564,10 +560,10 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
if( !m_buf ) if( !m_buf )
{ {
f = fopen( m_filename.c_str(), "wb" ); fw.f = fopen( m_filename.c_str(), "wb" );
if( !f ) if( !fw.f )
goto _exit_; goto _exit_;
jpeg_stdio_dest( &cinfo, f ); jpeg_stdio_dest( &cinfo, fw.f );
} }
else else
{ {
@ -587,6 +583,17 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
cinfo.input_components = channels; cinfo.input_components = channels;
cinfo.in_color_space = channels > 1 ? JCS_RGB : JCS_GRAYSCALE; cinfo.in_color_space = channels > 1 ? JCS_RGB : JCS_GRAYSCALE;
int quality = 95;
for( size_t i = 0; i < params.size(); i += 2 )
{
if( params[i] == CV_IMWRITE_JPEG_QUALITY )
{
quality = params[i+1];
quality = MIN(MAX(quality, 0), 100);
}
}
jpeg_set_defaults( &cinfo ); jpeg_set_defaults( &cinfo );
jpeg_set_quality( &cinfo, quality, jpeg_set_quality( &cinfo, quality,
TRUE /* limit to baseline-JPEG values */ ); TRUE /* limit to baseline-JPEG values */ );
@ -619,7 +626,6 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
} }
_exit_: _exit_:
if(f) fclose(f);
jpeg_destroy_compress( &cinfo ); jpeg_destroy_compress( &cinfo );
return result; return result;

View File

@ -317,23 +317,6 @@ void PngEncoder::flushBuf(void*)
bool PngEncoder::write( const Mat& img, const vector<int>& params ) bool PngEncoder::write( const Mat& img, const vector<int>& params )
{ {
int compression_level = 0;
int compression_strategy = Z_RLE;
for( size_t i = 0; i < params.size(); i += 2 )
{
if( params[i] == CV_IMWRITE_PNG_COMPRESSION )
{
compression_level = params[i+1];
compression_level = MIN(MAX(compression_level, 0), MAX_MEM_LEVEL);
}
if( params[i] == CV_IMWRITE_PNG_STRATEGY )
{
compression_strategy = params[i+1];
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
}
}
png_structp png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 ); png_structp png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
png_infop info_ptr = 0; png_infop info_ptr = 0;
FILE* f = 0; FILE* f = 0;
@ -365,6 +348,23 @@ bool PngEncoder::write( const Mat& img, const vector<int>& params )
png_init_io( png_ptr, f ); png_init_io( png_ptr, f );
} }
int compression_level = 0;
int compression_strategy = Z_RLE;
for( size_t i = 0; i < params.size(); i += 2 )
{
if( params[i] == CV_IMWRITE_PNG_COMPRESSION )
{
compression_level = params[i+1];
compression_level = MIN(MAX(compression_level, 0), MAX_MEM_LEVEL);
}
if( params[i] == CV_IMWRITE_PNG_STRATEGY )
{
compression_strategy = params[i+1];
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
}
}
if( m_buf || f ) if( m_buf || f )
{ {
if( compression_level > 0 ) if( compression_level > 0 )

View File

@ -635,9 +635,9 @@ cvCreateTrackbar( const char*, const char*,
} }
CV_IMPL int CV_IMPL int
cvCreateTrackbar2( const char* trackbar_name, const char* window_name, cvCreateTrackbar2( const char* /*trackbar_name*/, const char* /*window_name*/,
int* val, int count, CvTrackbarCallback2 on_notify2, int* /*val*/, int /*count*/, CvTrackbarCallback2 /*on_notify2*/,
void* userdata ) void* /*userdata*/ )
{ {
CV_NO_GUI_ERROR( "cvCreateTrackbar2" ); CV_NO_GUI_ERROR( "cvCreateTrackbar2" );
return -1; return -1;
@ -678,7 +678,7 @@ CV_IMPL int cvWaitKey( int )
return -1; return -1;
} }
CV_IMPL int cvInitSystem( int argc, char** argv ) CV_IMPL int cvInitSystem( int , char** )
{ {
CV_NO_GUI_ERROR( "cvInitSystem" ); CV_NO_GUI_ERROR( "cvInitSystem" );
@ -693,23 +693,24 @@ CV_IMPL int cvStartWindowThread()
} }
//-------- Qt --------- //-------- Qt ---------
CV_IMPL void cvAddText( const CvArr*, const char*, CvPoint org, CvFont* font) CV_IMPL void cvAddText( const CvArr*, const char*, CvPoint , CvFont* )
{ {
CV_NO_GUI_ERROR("cvAddText"); CV_NO_GUI_ERROR("cvAddText");
} }
CV_IMPL void cvDisplayStatusBar(const char* name, const char* arg2, int arg3) CV_IMPL void cvDisplayStatusBar(const char* , const char* , int )
{ {
CV_NO_GUI_ERROR("cvDisplayStatusBar"); CV_NO_GUI_ERROR("cvDisplayStatusBar");
} }
CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms) CV_IMPL void cvDisplayOverlay(const char* , const char* , int )
{ {
CV_NO_GUI_ERROR("cvNamedWindow"); CV_NO_GUI_ERROR("cvNamedWindow");
} }
CV_IMPL int cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]) CV_IMPL int cvStartLoop(int (*)(int argc, char *argv[]), int , char* argv[])
{ {
(void)argv;
CV_NO_GUI_ERROR("cvStartLoop"); CV_NO_GUI_ERROR("cvStartLoop");
return -1; return -1;
} }
@ -719,7 +720,7 @@ CV_IMPL void cvStopLoop()
CV_NO_GUI_ERROR("cvStopLoop"); CV_NO_GUI_ERROR("cvStopLoop");
} }
CV_IMPL void cvSaveWindowParameters(const char* name) CV_IMPL void cvSaveWindowParameters(const char* )
{ {
CV_NO_GUI_ERROR("cvSaveWindowParameters"); CV_NO_GUI_ERROR("cvSaveWindowParameters");
} }

View File

@ -162,8 +162,6 @@ else()
endif() endif()
add_dependencies(${the_module} ${api_target}) add_dependencies(${the_module} ${api_target})
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
# Additional target properties # Additional target properties
set_target_properties(${the_module} PROPERTIES set_target_properties(${the_module} PROPERTIES
OUTPUT_NAME "${the_module}" OUTPUT_NAME "${the_module}"

View File

@ -362,7 +362,7 @@ ManualFuncs = {
// C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray()) // C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
(JNIEnv* env, jclass cls, jlong src_nativeObj, jlong mask_nativeObj) (JNIEnv* env, jclass, jlong src_nativeObj, jlong mask_nativeObj)
{ {
try { try {
LOGD("Core::n_1minMaxLoc()"); LOGD("Core::n_1minMaxLoc()");
@ -432,7 +432,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
// C++: Size getTextSize(const string& text, int fontFace, double fontScale, int thickness, int* baseLine); // C++: Size getTextSize(const string& text, int fontFace, double fontScale, int thickness, int* baseLine);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
(JNIEnv* env, jclass cls, jstring text, jint fontFace, jdouble fontScale, jint thickness, jintArray baseLine) (JNIEnv* env, jclass, jstring text, jint fontFace, jdouble fontScale, jint thickness, jintArray baseLine)
{ {
try { try {
LOGD("Core::n_1getTextSize()"); LOGD("Core::n_1getTextSize()");
@ -1010,7 +1010,7 @@ extern "C" {
# java native method args # java native method args
jn_args = [] jn_args = []
# jni (cpp) function args # jni (cpp) function args
jni_args = [ArgInfo([ "env", "env", "", [], "" ]), ArgInfo([ "cls", "cls", "", [], "" ])] jni_args = [ArgInfo([ "env", "env", "", [], "" ]), ArgInfo([ "cls", "", "", [], "" ])]
j_prologue = [] j_prologue = []
j_epilogue = [] j_epilogue = []
c_prologue = [] c_prologue = []
@ -1375,7 +1375,7 @@ JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname
JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete(JNIEnv*, jclass, jlong); JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete(JNIEnv*, jclass, jlong);
JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete
(JNIEnv* env, jclass cls, jlong self) (JNIEnv*, jclass, jlong self)
{ {
delete (%(cls)s*) self; delete (%(cls)s*) self;
} }

View File

@ -24,7 +24,10 @@ extern "C" {
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__
(JNIEnv* env, jclass cls) (JNIEnv*, jclass);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__
(JNIEnv*, jclass)
{ {
LOGD("Mat::n_1Mat__()"); LOGD("Mat::n_1Mat__()");
return (jlong) new cv::Mat(); return (jlong) new cv::Mat();
@ -36,9 +39,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__
// Mat::Mat(int rows, int cols, int type) // Mat::Mat(int rows, int cols, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III
(JNIEnv* env, jclass, jint rows, jint cols, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III
(JNIEnv* env, jclass cls, jint rows, jint cols, jint type) (JNIEnv* env, jclass, jint rows, jint cols, jint type)
{ {
try { try {
LOGD("Mat::n_1Mat__III()"); LOGD("Mat::n_1Mat__III()");
@ -66,9 +71,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III
// Mat::Mat(Size size, int type) // Mat::Mat(Size size, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI
(JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI
(JNIEnv* env, jclass cls, jdouble size_width, jdouble size_height, jint type) (JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type)
{ {
try { try {
LOGD("Mat::n_1Mat__DDI()"); LOGD("Mat::n_1Mat__DDI()");
@ -96,9 +103,12 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI
// Mat::Mat(int rows, int cols, int type, Scalar s) // Mat::Mat(int rows, int cols, int type, Scalar s)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD
(JNIEnv* env, jclass, jint rows, jint cols, jint type, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD
(JNIEnv* env, jclass cls, jint rows, jint cols, jint type, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3) (JNIEnv* env, jclass, jint rows, jint cols, jint type, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3)
{ {
try { try {
LOGD("Mat::n_1Mat__IIIDDDD()"); LOGD("Mat::n_1Mat__IIIDDDD()");
@ -126,9 +136,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD
// Mat::Mat(Size size, int type, Scalar s) // Mat::Mat(Size size, int type, Scalar s)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD
(JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD
(JNIEnv* env, jclass cls, jdouble size_width, jdouble size_height, jint type, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3) (JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3)
{ {
try { try {
LOGD("Mat::n_1Mat__DDIDDDD()"); LOGD("Mat::n_1Mat__DDIDDDD()");
@ -157,9 +169,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD
// Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all()) // Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all())
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII
(JNIEnv* env, jclass, jlong m_nativeObj, jint rowRange_start, jint rowRange_end, jint colRange_start, jint colRange_end);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII
(JNIEnv* env, jclass cls, jlong m_nativeObj, jint rowRange_start, jint rowRange_end, jint colRange_start, jint colRange_end) (JNIEnv* env, jclass, jlong m_nativeObj, jint rowRange_start, jint rowRange_end, jint colRange_start, jint colRange_end)
{ {
try { try {
LOGD("Mat::n_1Mat__JIIII()"); LOGD("Mat::n_1Mat__JIIII()");
@ -183,10 +197,12 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII
} }
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII
(JNIEnv* env, jclass, jlong m_nativeObj, jint rowRange_start, jint rowRange_end);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII
(JNIEnv* env, jclass cls, jlong m_nativeObj, jint rowRange_start, jint rowRange_end) (JNIEnv* env, jclass, jlong m_nativeObj, jint rowRange_start, jint rowRange_end)
{ {
try { try {
LOGD("Mat::n_1Mat__JII()"); LOGD("Mat::n_1Mat__JII()");
@ -213,9 +229,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII
// Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright) // Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI
(JNIEnv* env, jclass, jlong self, jint dtop, jint dbottom, jint dleft, jint dright);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI
(JNIEnv* env, jclass cls, jlong self, jint dtop, jint dbottom, jint dleft, jint dright) (JNIEnv* env, jclass, jlong self, jint dtop, jint dbottom, jint dleft, jint dright)
{ {
try { try {
LOGD("Mat::n_1adjustROI()"); LOGD("Mat::n_1adjustROI()");
@ -243,9 +261,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI
// void Mat::assignTo(Mat m, int type = -1) // void Mat::assignTo(Mat m, int type = -1)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint type);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj, jint type) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint type)
{ {
try { try {
LOGD("Mat::n_1assignTo__JJI()"); LOGD("Mat::n_1assignTo__JJI()");
@ -268,10 +288,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI
} }
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj)
{ {
try { try {
LOGD("Mat::n_1assignTo__JJ()"); LOGD("Mat::n_1assignTo__JJ()");
@ -299,9 +320,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ
// int Mat::channels() // int Mat::channels()
// //
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1channels()"); LOGD("Mat::n_1channels()");
@ -329,9 +352,11 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels
// int Mat::checkVector(int elemChannels, int depth = -1, bool requireContinuous = true) // int Mat::checkVector(int elemChannels, int depth = -1, bool requireContinuous = true)
// //
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ
(JNIEnv* env, jclass, jlong self, jint elemChannels, jint depth, jboolean requireContinuous);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ
(JNIEnv* env, jclass cls, jlong self, jint elemChannels, jint depth, jboolean requireContinuous) (JNIEnv* env, jclass, jlong self, jint elemChannels, jint depth, jboolean requireContinuous)
{ {
try { try {
LOGD("Mat::n_1checkVector__JIIZ()"); LOGD("Mat::n_1checkVector__JIIZ()");
@ -355,9 +380,11 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII
(JNIEnv* env, jclass, jlong self, jint elemChannels, jint depth);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII
(JNIEnv* env, jclass cls, jlong self, jint elemChannels, jint depth) (JNIEnv* env, jclass, jlong self, jint elemChannels, jint depth)
{ {
try { try {
LOGD("Mat::n_1checkVector__JII()"); LOGD("Mat::n_1checkVector__JII()");
@ -380,10 +407,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI
(JNIEnv* env, jclass, jlong self, jint elemChannels);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI
(JNIEnv* env, jclass cls, jlong self, jint elemChannels) (JNIEnv* env, jclass, jlong self, jint elemChannels)
{ {
try { try {
LOGD("Mat::n_1checkVector__JI()"); LOGD("Mat::n_1checkVector__JI()");
@ -411,9 +440,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI
// Mat Mat::clone() // Mat Mat::clone()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1clone()"); LOGD("Mat::n_1clone()");
@ -441,9 +473,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone
// Mat Mat::col(int x) // Mat Mat::col(int x)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col
(JNIEnv* env, jclass, jlong self, jint x);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col
(JNIEnv* env, jclass cls, jlong self, jint x) (JNIEnv* env, jclass, jlong self, jint x)
{ {
try { try {
LOGD("Mat::n_1col()"); LOGD("Mat::n_1col()");
@ -471,9 +505,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col
// Mat Mat::colRange(int startcol, int endcol) // Mat Mat::colRange(int startcol, int endcol)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
(JNIEnv* env, jclass, jlong self, jint startcol, jint endcol);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
(JNIEnv* env, jclass cls, jlong self, jint startcol, jint endcol) (JNIEnv* env, jclass, jlong self, jint startcol, jint endcol)
{ {
try { try {
LOGD("Mat::n_1colRange()"); LOGD("Mat::n_1colRange()");
@ -501,9 +537,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
// int Mat::cols() // int Mat::cols()
// //
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1cols()"); LOGD("Mat::n_1cols()");
@ -531,9 +569,11 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols
// void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta = 0) // void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta = 0)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint rtype, jdouble alpha, jdouble beta);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj, jint rtype, jdouble alpha, jdouble beta) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint rtype, jdouble alpha, jdouble beta)
{ {
try { try {
LOGD("Mat::n_1convertTo__JJIDD()"); LOGD("Mat::n_1convertTo__JJIDD()");
@ -557,10 +597,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD
} }
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint rtype, jdouble alpha);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj, jint rtype, jdouble alpha) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint rtype, jdouble alpha)
{ {
try { try {
LOGD("Mat::n_1convertTo__JJID()"); LOGD("Mat::n_1convertTo__JJID()");
@ -584,10 +625,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID
} }
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint rtype);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj, jint rtype) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jint rtype)
{ {
try { try {
LOGD("Mat::n_1convertTo__JJI()"); LOGD("Mat::n_1convertTo__JJI()");
@ -616,9 +658,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI
// void Mat::copyTo(Mat& m) // void Mat::copyTo(Mat& m)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj)
{ {
try { try {
LOGD("Mat::n_1copyTo__JJ()"); LOGD("Mat::n_1copyTo__JJ()");
@ -647,9 +691,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ
// void Mat::copyTo(Mat& m, Mat mask) // void Mat::copyTo(Mat& m, Mat mask)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jlong mask_nativeObj);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj, jlong mask_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jlong mask_nativeObj)
{ {
try { try {
LOGD("Mat::n_1copyTo__JJJ()"); LOGD("Mat::n_1copyTo__JJJ()");
@ -679,9 +725,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ
// void Mat::create(int rows, int cols, int type) // void Mat::create(int rows, int cols, int type)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII
(JNIEnv* env, jclass, jlong self, jint rows, jint cols, jint type);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII
(JNIEnv* env, jclass cls, jlong self, jint rows, jint cols, jint type) (JNIEnv* env, jclass, jlong self, jint rows, jint cols, jint type)
{ {
try { try {
LOGD("Mat::n_1create__JIII()"); LOGD("Mat::n_1create__JIII()");
@ -709,9 +757,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII
// void Mat::create(Size size, int type) // void Mat::create(Size size, int type)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI
(JNIEnv* env, jclass, jlong self, jdouble size_width, jdouble size_height, jint type);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI
(JNIEnv* env, jclass cls, jlong self, jdouble size_width, jdouble size_height, jint type) (JNIEnv* env, jclass, jlong self, jdouble size_width, jdouble size_height, jint type)
{ {
try { try {
LOGD("Mat::n_1create__JDDI()"); LOGD("Mat::n_1create__JDDI()");
@ -740,9 +790,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI
// Mat Mat::cross(Mat m) // Mat Mat::cross(Mat m)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj)
{ {
try { try {
LOGD("Mat::n_1cross()"); LOGD("Mat::n_1cross()");
@ -771,9 +823,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross
// long Mat::dataAddr() // long Mat::dataAddr()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1dataAddr
(JNIEnv*, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1dataAddr JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1dataAddr
(JNIEnv* env, jclass cls, jlong self) (JNIEnv*, jclass, jlong self)
{ {
LOGD("Mat::n_1dataAddr()"); LOGD("Mat::n_1dataAddr()");
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
@ -786,9 +840,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1dataAddr
// int Mat::depth() // int Mat::depth()
// //
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1depth()"); LOGD("Mat::n_1depth()");
@ -816,9 +872,11 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth
// Mat Mat::diag(int d = 0) // Mat Mat::diag(int d = 0)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI
(JNIEnv* env, jclass, jlong self, jint d);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI
(JNIEnv* env, jclass cls, jlong self, jint d) (JNIEnv* env, jclass, jlong self, jint d)
{ {
try { try {
LOGD("Mat::n_1diag__JI()"); LOGD("Mat::n_1diag__JI()");
@ -847,9 +905,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI
// static Mat Mat::diag(Mat d) // static Mat Mat::diag(Mat d)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J
(JNIEnv* env, jclass, jlong d_nativeObj);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J
(JNIEnv* env, jclass cls, jlong d_nativeObj) (JNIEnv* env, jclass, jlong d_nativeObj)
{ {
try { try {
LOGD("Mat::n_1diag__J()"); LOGD("Mat::n_1diag__J()");
@ -877,9 +937,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J
// double Mat::dot(Mat m) // double Mat::dot(Mat m)
// //
JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj);
JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj)
{ {
try { try {
LOGD("Mat::n_1dot()"); LOGD("Mat::n_1dot()");
@ -908,9 +970,11 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot
// size_t Mat::elemSize() // size_t Mat::elemSize()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1elemSize()"); LOGD("Mat::n_1elemSize()");
@ -938,9 +1002,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize
// size_t Mat::elemSize1() // size_t Mat::elemSize1()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1 JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1elemSize1()"); LOGD("Mat::n_1elemSize1()");
@ -968,9 +1034,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1
// bool Mat::empty() // bool Mat::empty()
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1empty()"); LOGD("Mat::n_1empty()");
@ -998,9 +1066,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty
// static Mat Mat::eye(int rows, int cols, int type) // static Mat Mat::eye(int rows, int cols, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III
(JNIEnv* env, jclass, jint rows, jint cols, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III
(JNIEnv* env, jclass cls, jint rows, jint cols, jint type) (JNIEnv* env, jclass, jint rows, jint cols, jint type)
{ {
try { try {
LOGD("Mat::n_1eye__III()"); LOGD("Mat::n_1eye__III()");
@ -1028,9 +1098,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III
// static Mat Mat::eye(Size size, int type) // static Mat Mat::eye(Size size, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI
(JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI
(JNIEnv* env, jclass cls, jdouble size_width, jdouble size_height, jint type) (JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type)
{ {
try { try {
LOGD("Mat::n_1eye__DDI()"); LOGD("Mat::n_1eye__DDI()");
@ -1058,9 +1130,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI
// Mat Mat::inv(int method = DECOMP_LU) // Mat Mat::inv(int method = DECOMP_LU)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI
(JNIEnv* env, jclass, jlong self, jint method);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI
(JNIEnv* env, jclass cls, jlong self, jint method) (JNIEnv* env, jclass, jlong self, jint method)
{ {
try { try {
LOGD("Mat::n_1inv__JI()"); LOGD("Mat::n_1inv__JI()");
@ -1083,10 +1157,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI
} }
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1inv__J()"); LOGD("Mat::n_1inv__J()");
@ -1114,9 +1189,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J
// bool Mat::isContinuous() // bool Mat::isContinuous()
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1isContinuous()"); LOGD("Mat::n_1isContinuous()");
@ -1144,9 +1221,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous
// bool Mat::isSubmatrix() // bool Mat::isSubmatrix()
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1isSubmatrix()"); LOGD("Mat::n_1isSubmatrix()");
@ -1174,9 +1253,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix
// void Mat::locateROI(Size wholeSize, Point ofs) // void Mat::locateROI(Size wholeSize, Point ofs)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10
(JNIEnv* env, jclass, jlong self, jdoubleArray wholeSize_out, jdoubleArray ofs_out);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10 JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10
(JNIEnv* env, jclass cls, jlong self, jdoubleArray wholeSize_out, jdoubleArray ofs_out) (JNIEnv* env, jclass, jlong self, jdoubleArray wholeSize_out, jdoubleArray ofs_out)
{ {
try { try {
LOGD("core::locateROI_10()"); LOGD("core::locateROI_10()");
@ -1206,9 +1287,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10
// Mat Mat::mul(Mat m, double scale = 1) // Mat Mat::mul(Mat m, double scale = 1)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jdouble scale);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj, jdouble scale) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj, jdouble scale)
{ {
try { try {
LOGD("Mat::n_1mul__JJD()"); LOGD("Mat::n_1mul__JJD()");
@ -1233,9 +1316,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj)
{ {
try { try {
LOGD("Mat::n_1mul__JJ()"); LOGD("Mat::n_1mul__JJ()");
@ -1264,9 +1349,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ
// static Mat Mat::ones(int rows, int cols, int type) // static Mat Mat::ones(int rows, int cols, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III
(JNIEnv* env, jclass, jint rows, jint cols, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III
(JNIEnv* env, jclass cls, jint rows, jint cols, jint type) (JNIEnv* env, jclass, jint rows, jint cols, jint type)
{ {
try { try {
LOGD("Mat::n_1ones__III()"); LOGD("Mat::n_1ones__III()");
@ -1294,9 +1381,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III
// static Mat Mat::ones(Size size, int type) // static Mat Mat::ones(Size size, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI
(JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI
(JNIEnv* env, jclass cls, jdouble size_width, jdouble size_height, jint type) (JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type)
{ {
try { try {
LOGD("Mat::n_1ones__DDI()"); LOGD("Mat::n_1ones__DDI()");
@ -1324,9 +1413,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI
// void Mat::push_back(Mat m) // void Mat::push_back(Mat m)
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back
(JNIEnv* env, jclass, jlong self, jlong m_nativeObj);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back
(JNIEnv* env, jclass cls, jlong self, jlong m_nativeObj) (JNIEnv* env, jclass, jlong self, jlong m_nativeObj)
{ {
try { try {
LOGD("Mat::n_1push_1back()"); LOGD("Mat::n_1push_1back()");
@ -1354,9 +1445,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back
// void Mat::release() // void Mat::release()
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release
(JNIEnv* env, jclass, jlong self);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1release()"); LOGD("Mat::n_1release()");
@ -1384,9 +1477,11 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release
// Mat Mat::reshape(int cn, int rows = 0) // Mat Mat::reshape(int cn, int rows = 0)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII
(JNIEnv* env, jclass, jlong self, jint cn, jint rows);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII
(JNIEnv* env, jclass cls, jlong self, jint cn, jint rows) (JNIEnv* env, jclass, jlong self, jint cn, jint rows)
{ {
try { try {
LOGD("Mat::n_1reshape__JII()"); LOGD("Mat::n_1reshape__JII()");
@ -1410,9 +1505,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI
(JNIEnv* env, jclass, jlong self, jint cn);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI
(JNIEnv* env, jclass cls, jlong self, jint cn) (JNIEnv* env, jclass, jlong self, jint cn)
{ {
try { try {
LOGD("Mat::n_1reshape__JI()"); LOGD("Mat::n_1reshape__JI()");
@ -1440,9 +1537,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI
// Mat Mat::row(int y) // Mat Mat::row(int y)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row
(JNIEnv* env, jclass, jlong self, jint y);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row
(JNIEnv* env, jclass cls, jlong self, jint y) (JNIEnv* env, jclass, jlong self, jint y)
{ {
try { try {
LOGD("Mat::n_1row()"); LOGD("Mat::n_1row()");
@ -1470,9 +1569,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row
// Mat Mat::rowRange(int startrow, int endrow) // Mat Mat::rowRange(int startrow, int endrow)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange
(JNIEnv* env, jclass, jlong self, jint startrow, jint endrow);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange
(JNIEnv* env, jclass cls, jlong self, jint startrow, jint endrow) (JNIEnv* env, jclass, jlong self, jint startrow, jint endrow)
{ {
try { try {
LOGD("Mat::n_1rowRange()"); LOGD("Mat::n_1rowRange()");
@ -1500,9 +1601,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange
// int Mat::rows() // int Mat::rows()
// //
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1rows()"); LOGD("Mat::n_1rows()");
@ -1530,9 +1633,11 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows
// Mat Mat::operator =(Scalar s) // Mat Mat::operator =(Scalar s)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD
(JNIEnv* env, jclass, jlong self, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD
(JNIEnv* env, jclass cls, jlong self, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3) (JNIEnv* env, jclass, jlong self, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3)
{ {
try { try {
LOGD("Mat::n_1setTo__JDDDD()"); LOGD("Mat::n_1setTo__JDDDD()");
@ -1561,9 +1666,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD
// Mat Mat::setTo(Scalar value, Mat mask = Mat()) // Mat Mat::setTo(Scalar value, Mat mask = Mat())
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ
(JNIEnv* env, jclass, jlong self, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3, jlong mask_nativeObj);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ
(JNIEnv* env, jclass cls, jlong self, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3, jlong mask_nativeObj) (JNIEnv* env, jclass, jlong self, jdouble s_val0, jdouble s_val1, jdouble s_val2, jdouble s_val3, jlong mask_nativeObj)
{ {
try { try {
LOGD("Mat::n_1setTo__JDDDDJ()"); LOGD("Mat::n_1setTo__JDDDDJ()");
@ -1593,9 +1700,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ
// Mat Mat::setTo(Mat value, Mat mask = Mat()) // Mat Mat::setTo(Mat value, Mat mask = Mat())
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ
(JNIEnv* env, jclass, jlong self, jlong value_nativeObj, jlong mask_nativeObj);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ
(JNIEnv* env, jclass cls, jlong self, jlong value_nativeObj, jlong mask_nativeObj) (JNIEnv* env, jclass, jlong self, jlong value_nativeObj, jlong mask_nativeObj)
{ {
try { try {
LOGD("Mat::n_1setTo__JJJ()"); LOGD("Mat::n_1setTo__JJJ()");
@ -1621,9 +1730,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ
(JNIEnv* env, jclass, jlong self, jlong value_nativeObj);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ
(JNIEnv* env, jclass cls, jlong self, jlong value_nativeObj) (JNIEnv* env, jclass, jlong self, jlong value_nativeObj)
{ {
try { try {
LOGD("Mat::n_1setTo__JJ()"); LOGD("Mat::n_1setTo__JJ()");
@ -1652,9 +1763,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ
// Size Mat::size() // Size Mat::size()
// //
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1size()"); LOGD("Mat::n_1size()");
@ -1682,9 +1795,11 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size
// size_t Mat::step1(int i = 0) // size_t Mat::step1(int i = 0)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI
(JNIEnv* env, jclass, jlong self, jint i);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI
(JNIEnv* env, jclass cls, jlong self, jint i) (JNIEnv* env, jclass, jlong self, jint i)
{ {
try { try {
LOGD("Mat::n_1step1__JI()"); LOGD("Mat::n_1step1__JI()");
@ -1708,9 +1823,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1step1__J()"); LOGD("Mat::n_1step1__J()");
@ -1736,9 +1853,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J
// Mat Mat::operator()(Range rowRange, Range colRange) // Mat Mat::operator()(Range rowRange, Range colRange)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr
(JNIEnv* env, jclass, jlong self, jint rowRange_start, jint rowRange_end, jint colRange_start, jint colRange_end);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr
(JNIEnv* env, jclass cls, jlong self, jint rowRange_start, jint rowRange_end, jint colRange_start, jint colRange_end) (JNIEnv* env, jclass, jlong self, jint rowRange_start, jint rowRange_end, jint colRange_start, jint colRange_end)
{ {
try { try {
LOGD("Mat::n_1submat_1rr()"); LOGD("Mat::n_1submat_1rr()");
@ -1768,9 +1887,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr
// Mat Mat::operator()(Rect roi) // Mat Mat::operator()(Rect roi)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat
(JNIEnv* env, jclass, jlong self, jint roi_x, jint roi_y, jint roi_width, jint roi_height);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat
(JNIEnv* env, jclass cls, jlong self, jint roi_x, jint roi_y, jint roi_width, jint roi_height) (JNIEnv* env, jclass, jlong self, jint roi_x, jint roi_y, jint roi_width, jint roi_height)
{ {
try { try {
LOGD("Mat::n_1submat()"); LOGD("Mat::n_1submat()");
@ -1799,9 +1920,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat
// Mat Mat::t() // Mat Mat::t()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1t()"); LOGD("Mat::n_1t()");
@ -1829,9 +1952,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t
// size_t Mat::total() // size_t Mat::total()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1total()"); LOGD("Mat::n_1total()");
@ -1859,9 +1984,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total
// int Mat::type() // int Mat::type()
// //
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
LOGD("Mat::n_1type()"); LOGD("Mat::n_1type()");
@ -1889,9 +2016,11 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type
// static Mat Mat::zeros(int rows, int cols, int type) // static Mat Mat::zeros(int rows, int cols, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III
(JNIEnv* env, jclass, jint rows, jint cols, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III
(JNIEnv* env, jclass cls, jint rows, jint cols, jint type) (JNIEnv* env, jclass, jint rows, jint cols, jint type)
{ {
try { try {
LOGD("Mat::n_1zeros__III()"); LOGD("Mat::n_1zeros__III()");
@ -1919,9 +2048,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III
// static Mat Mat::zeros(Size size, int type) // static Mat Mat::zeros(Size size, int type)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI
(JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI
(JNIEnv* env, jclass cls, jdouble size_width, jdouble size_height, jint type) (JNIEnv* env, jclass, jdouble size_width, jdouble size_height, jint type)
{ {
try { try {
LOGD("Mat::n_1zeros__DDI()"); LOGD("Mat::n_1zeros__DDI()");
@ -1951,7 +2082,10 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI
// //
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1delete JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1delete
(JNIEnv* env, jclass cls, jlong self) (JNIEnv*, jclass, jlong self);
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1delete
(JNIEnv*, jclass, jlong self)
{ {
delete (Mat*) self; delete (Mat*) self;
} }
@ -1960,7 +2094,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1delete
#define PUT_ITEM(T, R, C) { T*dst = (T*)me->ptr(R, C); for(int ch=0; ch<me->channels() && count>0; count--,ch++,src++,dst++) *dst = cv::saturate_cast<T>(*src); } #define PUT_ITEM(T, R, C) { T*dst = (T*)me->ptr(R, C); for(int ch=0; ch<me->channels() && count>0; count--,ch++,src++,dst++) *dst = cv::saturate_cast<T>(*src); }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jdoubleArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jdoubleArray vals)
{ {
try { try {
LOGD("Mat::nPutD()"); LOGD("Mat::nPutD()");
@ -2054,7 +2191,10 @@ template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count,
extern "C" { extern "C" {
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jbyteArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jbyteArray vals)
{ {
try { try {
LOGD("Mat::nPutB()"); LOGD("Mat::nPutB()");
@ -2082,7 +2222,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jshortArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jshortArray vals)
{ {
try { try {
LOGD("Mat::nPutS()"); LOGD("Mat::nPutS()");
@ -2110,7 +2253,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jintArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jintArray vals)
{ {
try { try {
LOGD("Mat::nPutI()"); LOGD("Mat::nPutI()");
@ -2138,7 +2284,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jfloatArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jfloatArray vals)
{ {
try { try {
LOGD("Mat::nPutF()"); LOGD("Mat::nPutF()");
@ -2201,7 +2350,10 @@ template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char*
extern "C" { extern "C" {
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jbyteArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jbyteArray vals)
{ {
try { try {
LOGD("Mat::nGetB()"); LOGD("Mat::nGetB()");
@ -2229,7 +2381,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jshortArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jshortArray vals)
{ {
try { try {
LOGD("Mat::nGetS()"); LOGD("Mat::nGetS()");
@ -2257,7 +2412,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jintArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jintArray vals)
{ {
try { try {
LOGD("Mat::nGetI()"); LOGD("Mat::nGetI()");
@ -2285,7 +2443,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jfloatArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jfloatArray vals)
{ {
try { try {
LOGD("Mat::nGetF()"); LOGD("Mat::nGetF()");
@ -2313,7 +2474,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jdoubleArray vals);
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count, jdoubleArray vals)
{ {
try { try {
LOGD("Mat::nGetD()"); LOGD("Mat::nGetD()");
@ -2341,7 +2505,10 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
} }
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count) (JNIEnv* env, jclass, jlong self, jint row, jint col, jint count);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
(JNIEnv* env, jclass, jlong self, jint row, jint col, jint count)
{ {
try { try {
LOGD("Mat::nGet()"); LOGD("Mat::nGet()");
@ -2380,7 +2547,10 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
} }
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
(JNIEnv *env, jclass cls, jlong self) (JNIEnv *env, jclass, jlong self);
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
(JNIEnv *env, jclass, jlong self)
{ {
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
std::stringstream s; std::stringstream s;

View File

@ -20,9 +20,11 @@ extern "C" {
// VideoCapture::VideoCapture() // VideoCapture::VideoCapture()
// //
JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__
(JNIEnv* env, jclass);
JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__ JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__
(JNIEnv* env, jclass cls) (JNIEnv* env, jclass)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -55,9 +57,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__
// VideoCapture::VideoCapture(int device) // VideoCapture::VideoCapture(int device)
// //
JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__I
(JNIEnv* env, jclass, jint device);
JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__I JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__I
(JNIEnv* env, jclass cls, jint device) (JNIEnv* env, jclass, jint device)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -91,9 +95,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__I
// double VideoCapture::get(int propId) // double VideoCapture::get(int propId)
// //
JNIEXPORT jdouble JNICALL Java_org_opencv_highgui_VideoCapture_n_1get
(JNIEnv* env, jclass, jlong self, jint propId);
JNIEXPORT jdouble JNICALL Java_org_opencv_highgui_VideoCapture_n_1get JNIEXPORT jdouble JNICALL Java_org_opencv_highgui_VideoCapture_n_1get
(JNIEnv* env, jclass cls, jlong self, jint propId) (JNIEnv* env, jclass, jlong self, jint propId)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -127,9 +133,11 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_highgui_VideoCapture_n_1get
// bool VideoCapture::grab() // bool VideoCapture::grab()
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1grab
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1grab JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1grab
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -163,9 +171,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1grab
// bool VideoCapture::isOpened() // bool VideoCapture::isOpened()
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1isOpened
(JNIEnv* env, jclass, jlong self);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1isOpened JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1isOpened
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -198,9 +208,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1isOpened
// bool VideoCapture::open(int device) // bool VideoCapture::open(int device)
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1open__JI
(JNIEnv* env, jclass, jlong self, jint device);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1open__JI JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1open__JI
(JNIEnv* env, jclass cls, jlong self, jint device) (JNIEnv* env, jclass, jlong self, jint device)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -234,9 +246,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1open__JI
// bool VideoCapture::read(Mat image) // bool VideoCapture::read(Mat image)
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1read
(JNIEnv* env, jclass, jlong self, jlong image_nativeObj);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1read JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1read
(JNIEnv* env, jclass cls, jlong self, jlong image_nativeObj) (JNIEnv* env, jclass, jlong self, jlong image_nativeObj)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -271,9 +285,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1read
// void VideoCapture::release() // void VideoCapture::release()
// //
JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1release
(JNIEnv* env, jclass, jlong self);
JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1release JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1release
(JNIEnv* env, jclass cls, jlong self) (JNIEnv* env, jclass, jlong self)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -307,9 +323,11 @@ JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1release
// bool VideoCapture::retrieve(Mat image, int channel = 0) // bool VideoCapture::retrieve(Mat image, int channel = 0)
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJI
(JNIEnv* env, jclass, jlong self, jlong image_nativeObj, jint channel);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJI JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJI
(JNIEnv* env, jclass cls, jlong self, jlong image_nativeObj, jint channel) (JNIEnv* env, jclass, jlong self, jlong image_nativeObj, jint channel)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -340,9 +358,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJI
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJ
(JNIEnv* env, jclass, jlong self, jlong image_nativeObj);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJ
(JNIEnv* env, jclass cls, jlong self, jlong image_nativeObj) (JNIEnv* env, jclass, jlong self, jlong image_nativeObj)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -377,9 +397,11 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJ
// bool VideoCapture::set(int propId, double value) // bool VideoCapture::set(int propId, double value)
// //
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1set
(JNIEnv* env, jclass, jlong self, jint propId, jdouble value);
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1set JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1set
(JNIEnv* env, jclass cls, jlong self, jint propId, jdouble value) (JNIEnv* env, jclass, jlong self, jint propId, jdouble value)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
@ -408,14 +430,17 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1set
} }
JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPreviewSizes JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPreviewSizes
(JNIEnv *env, jclass cls, jlong self) (JNIEnv *env, jclass, jlong self);
JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPreviewSizes
(JNIEnv *env, jclass, jlong self)
{ {
try { try {
#ifdef DEBUG #ifdef DEBUG
LOGD("highgui::VideoCapture_n_1set()"); LOGD("highgui::VideoCapture_n_1set()");
#endif // DEBUG #endif // DEBUG
VideoCapture* me = (VideoCapture*) self; //TODO: check for NULL VideoCapture* me = (VideoCapture*) self; //TODO: check for NULL
union {double prop; const char* name;} u; union {double prop; const char* name;} u;
u.prop = me->get(CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING); u.prop = me->get(CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING);
return env->NewStringUTF(u.name); return env->NewStringUTF(u.name);
} catch(cv::Exception e) { } catch(cv::Exception e) {
@ -444,7 +469,10 @@ JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPr
// //
JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1delete JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1delete
(JNIEnv* env, jclass cls, jlong self) (JNIEnv*, jclass, jlong self);
JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1delete
(JNIEnv*, jclass, jlong self)
{ {
delete (VideoCapture*) self; delete (VideoCapture*) self;
} }

View File

@ -21,7 +21,7 @@
extern "C" { extern "C" {
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
JNI_OnLoad(JavaVM* vm, void* reserved) JNI_OnLoad(JavaVM* vm, void* )
{ {
JNIEnv* env; JNIEnv* env;
if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK) if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK)
@ -51,7 +51,7 @@ JNI_OnLoad(JavaVM* vm, void* reserved)
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
JNI_OnUnload(JavaVM *vm, void *reserved) JNI_OnUnload(JavaVM*, void*)
{ {
//do nothing //do nothing
} }

View File

@ -25,7 +25,10 @@ extern "C" {
*/ */
JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nBitmapToMat JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nBitmapToMat
(JNIEnv * env, jclass cls, jobject bitmap, jlong m_addr) (JNIEnv * env, jclass, jobject bitmap, jlong m_addr);
JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nBitmapToMat
(JNIEnv * env, jclass, jobject bitmap, jlong m_addr)
{ {
AndroidBitmapInfo info; AndroidBitmapInfo info;
void* pixels = 0; void* pixels = 0;
@ -73,7 +76,10 @@ JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nBitmapToMat
* Method: void nMatToBitmap(long m_addr, Bitmap b) * Method: void nMatToBitmap(long m_addr, Bitmap b)
*/ */
JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nMatToBitmap JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nMatToBitmap
(JNIEnv * env, jclass cls, jlong m_addr, jobject bitmap) (JNIEnv * env, jclass, jlong m_addr, jobject bitmap);
JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nMatToBitmap
(JNIEnv * env, jclass, jlong m_addr, jobject bitmap)
{ {
AndroidBitmapInfo info; AndroidBitmapInfo info;
void* pixels = 0; void* pixels = 0;

View File

@ -75,7 +75,7 @@ public:
}; };
inline void AddPoint(float x, float y, float r) inline void AddPoint(float x, float y, float r)
{ {
DefTrackPoint p = {x,y,r,0}; DefTrackPoint p = {x,y,r,0,0,0};
int Num = GetPointNum(); int Num = GetPointNum();
if(Num > 0) if(Num > 0)

View File

@ -273,6 +273,9 @@ inline void sum_50t_176c(uchar **pp, uchar *sig, unsigned short *temp)
ssig[9] =_mm_packus_epi16(_mm_srai_epi16(ttemp[18],2),_mm_srai_epi16(ttemp[19],2)); ssig[9] =_mm_packus_epi16(_mm_srai_epi16(ttemp[18],2),_mm_srai_epi16(ttemp[19],2));
ssig[10] =_mm_packus_epi16(_mm_srai_epi16(ttemp[20],2),_mm_srai_epi16(ttemp[21],2)); ssig[10] =_mm_packus_epi16(_mm_srai_epi16(ttemp[20],2),_mm_srai_epi16(ttemp[21],2));
#else #else
(void)pp;
(void)sig;
(void)temp;
CV_Error( CV_StsNotImplemented, "Not supported without SSE2" ); CV_Error( CV_StsNotImplemented, "Not supported without SSE2" );
#endif #endif
} }

View File

@ -3078,8 +3078,8 @@ static int _cvFindOppositSiteCW(pCvVoronoiHole pHole, CvVoronoiDiagramInt* pVoro
pCvVoronoiEdge pEdge_left = pSite_left->edge2->next_edge; pCvVoronoiEdge pEdge_left = pSite_left->edge2->next_edge;
pCvVoronoiEdge pEdge_right = &Edge_right; pCvVoronoiEdge pEdge_right = &Edge_right;
CvVoronoiEdgeInt Edge = {NULL,pNode,pSite_right,NULL,NULL,NULL,NULL,NULL}; CvVoronoiEdgeInt Edge = {NULL,pNode,pSite_right,NULL,NULL,NULL,NULL,NULL};
CvVoronoiEdgeInt Edge_cur = {NULL,NULL,NULL,NULL,NULL,NULL,NULL}; CvVoronoiEdgeInt Edge_cur = {NULL,NULL, NULL, NULL,NULL,NULL,NULL,NULL};
pCvVoronoiEdge pEdge = &Edge; pCvVoronoiEdge pEdge = &Edge;
float radius1, radius2,dist1, dist2; float radius1, radius2,dist1, dist2;
@ -3133,8 +3133,8 @@ static int _cvFindOppositSiteCCW(pCvVoronoiHole pHole,CvVoronoiDiagramInt* pVoro
pCvVoronoiEdge pEdge_left = &Edge_left; pCvVoronoiEdge pEdge_left = &Edge_left;
pCvVoronoiEdge pEdge_right = pSite_right->edge1->prev_edge; pCvVoronoiEdge pEdge_right = pSite_right->edge1->prev_edge;
CvVoronoiEdgeInt Edge = {NULL,pNode,pSite_left,NULL,NULL,NULL,NULL}; CvVoronoiEdgeInt Edge = {NULL,pNode,pSite_left,NULL,NULL,NULL,NULL,NULL};
CvVoronoiEdgeInt Edge_cur = {NULL,NULL,NULL,NULL,NULL,NULL,NULL}; CvVoronoiEdgeInt Edge_cur = {NULL,NULL, NULL, NULL,NULL,NULL,NULL,NULL};
pCvVoronoiEdge pEdge = &Edge; pCvVoronoiEdge pEdge = &Edge;
double dist1, dist2; double dist1, dist2;

View File

@ -105,7 +105,9 @@ void generateData( Mat& data, Mat& labels, const vector<int>& sizes, const Mat&
else if( labelType == CV_32SC1 ) else if( labelType == CV_32SC1 )
labels.at<int>(p, 0) = l; labels.at<int>(p, 0) = l;
else else
{
CV_DbgAssert(0); CV_DbgAssert(0);
}
} }
} }
} }

View File

@ -105,7 +105,9 @@ void generateData( Mat& data, Mat& labels, const vector<int>& sizes, const Mat&
else if( labelType == CV_32SC1 ) else if( labelType == CV_32SC1 )
labels.at<int>(p, 0) = l; labels.at<int>(p, 0) = l;
else else
{
CV_DbgAssert(0); CV_DbgAssert(0);
}
} }
} }
} }

View File

@ -486,6 +486,7 @@ endo: ; // end search for this o
} }
return rc; return rc;
#else #else
(void)im;
deque <CvDataMatrixCode> rc; deque <CvDataMatrixCode> rc;
return rc; return rc;
#endif #endif

View File

@ -1,5 +1,9 @@
#include "perf_precomp.hpp" #include "perf_precomp.hpp"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wsign-promo"
#endif
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/internal.hpp" #include "opencv2/core/internal.hpp"
#include "opencv2/flann/flann.hpp" #include "opencv2/flann/flann.hpp"

View File

@ -192,6 +192,7 @@ MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands, int weight_type)
#ifdef HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
can_use_gpu_ = try_gpu && gpu::getCudaEnabledDeviceCount(); can_use_gpu_ = try_gpu && gpu::getCudaEnabledDeviceCount();
#else #else
(void)try_gpu;
can_use_gpu_ = false; can_use_gpu_ = false;
#endif #endif
CV_Assert(weight_type == CV_32F || weight_type == CV_16S); CV_Assert(weight_type == CV_32F || weight_type == CV_16S);
@ -507,6 +508,10 @@ void createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
} }
gpu_pyr[num_levels].download(pyr[num_levels]); gpu_pyr[num_levels].download(pyr[num_levels]);
#else
(void)img;
(void)num_levels;
(void)pyr;
#endif #endif
} }
@ -542,6 +547,8 @@ void restoreImageFromLaplacePyrGpu(vector<Mat> &pyr)
} }
gpu_pyr[0].download(pyr[0]); gpu_pyr[0].download(pyr[0]);
#else
(void)pyr;
#endif #endif
} }

View File

@ -534,6 +534,8 @@ BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu, float match_conf,
if (try_use_gpu && getCudaEnabledDeviceCount() > 0) if (try_use_gpu && getCudaEnabledDeviceCount() > 0)
impl_ = new GpuMatcher(match_conf); impl_ = new GpuMatcher(match_conf);
else else
#else
(void)try_use_gpu;
#endif #endif
impl_ = new CpuMatcher(match_conf); impl_ = new CpuMatcher(match_conf);

View File

@ -1129,26 +1129,26 @@ norm_(const _Tp* src, size_t total, int cn, int normType, double startval, const
{ {
if( !mask ) if( !mask )
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
result = std::max(result, (double)std::abs(src[i])); result = std::max(result, (double)std::abs(int(src[i])));
else else
for( int c = 0; c < cn; c++ ) for( int c = 0; c < cn; c++ )
{ {
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
if( mask[i] ) if( mask[i] )
result = std::max(result, (double)std::abs(src[i*cn + c])); result = std::max(result, (double)std::abs(int(src[i*cn + c])));
} }
} }
else if( normType == NORM_L1 ) else if( normType == NORM_L1 )
{ {
if( !mask ) if( !mask )
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
result += std::abs(src[i]); result += std::abs(int(src[i]));
else else
for( int c = 0; c < cn; c++ ) for( int c = 0; c < cn; c++ )
{ {
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
if( mask[i] ) if( mask[i] )
result += std::abs(src[i*cn + c]); result += std::abs(int(src[i*cn + c]));
} }
} }
else else

View File

@ -19,7 +19,7 @@ inline void vector_Rect_to_Mat(vector<Rect>& v_rect, Mat& mat)
} }
JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeCreateObject JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeCreateObject
(JNIEnv * jenv, jclass jobj, jstring jFileName, jint faceSize) (JNIEnv * jenv, jclass, jstring jFileName, jint faceSize)
{ {
const char* jnamestr = jenv->GetStringUTFChars(jFileName, NULL); const char* jnamestr = jenv->GetStringUTFChars(jFileName, NULL);
string stdFileName(jnamestr); string stdFileName(jnamestr);
@ -27,153 +27,153 @@ JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeC
try try
{ {
DetectionBasedTracker::Parameters DetectorParams; DetectionBasedTracker::Parameters DetectorParams;
if (faceSize > 0) if (faceSize > 0)
DetectorParams.minObjectSize = faceSize; DetectorParams.minObjectSize = faceSize;
result = (jlong)new DetectionBasedTracker(stdFileName, DetectorParams); result = (jlong)new DetectionBasedTracker(stdFileName, DetectorParams);
} }
catch(cv::Exception e) catch(cv::Exception e)
{ {
LOGD("nativeCreateObject catched cv::Exception: %s", e.what()); LOGD("nativeCreateObject catched cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
if(!je) if(!je)
je = jenv->FindClass("java/lang/Exception"); je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, e.what()); jenv->ThrowNew(je, e.what());
} }
catch (...) catch (...)
{ {
LOGD("nativeCreateObject catched unknown exception"); LOGD("nativeCreateObject catched unknown exception");
jclass je = jenv->FindClass("java/lang/Exception"); jclass je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"); jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}");
return 0; return 0;
} }
return result; return result;
} }
JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeDestroyObject JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeDestroyObject
(JNIEnv * jenv, jclass jobj, jlong thiz) (JNIEnv * jenv, jclass, jlong thiz)
{ {
try try
{ {
((DetectionBasedTracker*)thiz)->stop(); ((DetectionBasedTracker*)thiz)->stop();
delete (DetectionBasedTracker*)thiz; delete (DetectionBasedTracker*)thiz;
} }
catch(cv::Exception e) catch(cv::Exception e)
{ {
LOGD("nativeestroyObject catched cv::Exception: %s", e.what()); LOGD("nativeestroyObject catched cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
if(!je) if(!je)
je = jenv->FindClass("java/lang/Exception"); je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, e.what()); jenv->ThrowNew(je, e.what());
} }
catch (...) catch (...)
{ {
LOGD("nativeDestroyObject catched unknown exception"); LOGD("nativeDestroyObject catched unknown exception");
jclass je = jenv->FindClass("java/lang/Exception"); jclass je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"); jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}");
} }
} }
JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeStart JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeStart
(JNIEnv * jenv, jclass jobj, jlong thiz) (JNIEnv * jenv, jclass, jlong thiz)
{ {
try try
{ {
((DetectionBasedTracker*)thiz)->run(); ((DetectionBasedTracker*)thiz)->run();
} }
catch(cv::Exception e) catch(cv::Exception e)
{ {
LOGD("nativeStart catched cv::Exception: %s", e.what()); LOGD("nativeStart catched cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
if(!je) if(!je)
je = jenv->FindClass("java/lang/Exception"); je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, e.what()); jenv->ThrowNew(je, e.what());
} }
catch (...) catch (...)
{ {
LOGD("nativeStart catched unknown exception"); LOGD("nativeStart catched unknown exception");
jclass je = jenv->FindClass("java/lang/Exception"); jclass je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"); jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}");
} }
} }
JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeStop JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeStop
(JNIEnv * jenv, jclass jobj, jlong thiz) (JNIEnv * jenv, jclass, jlong thiz)
{ {
try try
{ {
((DetectionBasedTracker*)thiz)->stop(); ((DetectionBasedTracker*)thiz)->stop();
} }
catch(cv::Exception e) catch(cv::Exception e)
{ {
LOGD("nativeStop catched cv::Exception: %s", e.what()); LOGD("nativeStop catched cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
if(!je) if(!je)
je = jenv->FindClass("java/lang/Exception"); je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, e.what()); jenv->ThrowNew(je, e.what());
} }
catch (...) catch (...)
{ {
LOGD("nativeStop catched unknown exception"); LOGD("nativeStop catched unknown exception");
jclass je = jenv->FindClass("java/lang/Exception"); jclass je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"); jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}");
} }
} }
JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeSetFaceSize JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeSetFaceSize
(JNIEnv * jenv, jclass jobj, jlong thiz, jint faceSize) (JNIEnv * jenv, jclass, jlong thiz, jint faceSize)
{ {
try try
{ {
if (faceSize > 0) if (faceSize > 0)
{ {
DetectionBasedTracker::Parameters DetectorParams = \ DetectionBasedTracker::Parameters DetectorParams = \
((DetectionBasedTracker*)thiz)->getParameters(); ((DetectionBasedTracker*)thiz)->getParameters();
DetectorParams.minObjectSize = faceSize; DetectorParams.minObjectSize = faceSize;
((DetectionBasedTracker*)thiz)->setParameters(DetectorParams); ((DetectionBasedTracker*)thiz)->setParameters(DetectorParams);
} }
} }
catch(cv::Exception e) catch(cv::Exception e)
{ {
LOGD("nativeStop catched cv::Exception: %s", e.what()); LOGD("nativeStop catched cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
if(!je) if(!je)
je = jenv->FindClass("java/lang/Exception"); je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, e.what()); jenv->ThrowNew(je, e.what());
} }
catch (...) catch (...)
{ {
LOGD("nativeSetFaceSize catched unknown exception"); LOGD("nativeSetFaceSize catched unknown exception");
jclass je = jenv->FindClass("java/lang/Exception"); jclass je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"); jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}");
} }
} }
JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeDetect JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBasedTracker_nativeDetect
(JNIEnv * jenv, jclass jobj, jlong thiz, jlong imageGray, jlong faces) (JNIEnv * jenv, jclass, jlong thiz, jlong imageGray, jlong faces)
{ {
try try
{ {
vector<Rect> RectFaces; vector<Rect> RectFaces;
((DetectionBasedTracker*)thiz)->process(*((Mat*)imageGray)); ((DetectionBasedTracker*)thiz)->process(*((Mat*)imageGray));
((DetectionBasedTracker*)thiz)->getObjects(RectFaces); ((DetectionBasedTracker*)thiz)->getObjects(RectFaces);
vector_Rect_to_Mat(RectFaces, *((Mat*)faces)); vector_Rect_to_Mat(RectFaces, *((Mat*)faces));
} }
catch(cv::Exception e) catch(cv::Exception e)
{ {
LOGD("nativeCreateObject catched cv::Exception: %s", e.what()); LOGD("nativeCreateObject catched cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
if(!je) if(!je)
je = jenv->FindClass("java/lang/Exception"); je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, e.what()); jenv->ThrowNew(je, e.what());
} }
catch (...) catch (...)
{ {
LOGD("nativeDetect catched unknown exception"); LOGD("nativeDetect catched unknown exception");
jclass je = jenv->FindClass("java/lang/Exception"); jclass je = jenv->FindClass("java/lang/Exception");
jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"); jenv->ThrowNew(je, "Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}");
} }
} }

View File

@ -6,6 +6,7 @@ const char* message = "Hello Android!";
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
(void)argc; (void)argv;
// print message to console // print message to console
printf("%s\n", message); printf("%s\n", message);

View File

@ -8,7 +8,7 @@ using namespace std;
using namespace cv; using namespace cv;
extern "C" { extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures(JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray yuv, jintArray bgra) JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures(JNIEnv* env, jobject, jint width, jint height, jbyteArray yuv, jintArray bgra)
{ {
jbyte* _yuv = env->GetByteArrayElements(yuv, 0); jbyte* _yuv = env->GetByteArrayElements(yuv, 0);
jint* _bgra = env->GetIntArrayElements(bgra, 0); jint* _bgra = env->GetIntArrayElements(bgra, 0);

View File

@ -8,7 +8,7 @@ using namespace std;
using namespace cv; using namespace cv;
extern "C" { extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial4_Sample4View_FindFeatures(JNIEnv* env, jobject thiz, jlong addrGray, jlong addrRgba) JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial4_Sample4View_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
{ {
Mat* pMatGr=(Mat*)addrGray; Mat* pMatGr=(Mat*)addrGray;
Mat* pMatRgb=(Mat*)addrRgba; Mat* pMatRgb=(Mat*)addrRgba;

View File

@ -368,7 +368,7 @@ static void print_params(CvVSModule* pM, const char* module, const char* log_nam
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ /* Main function: */ { /* Main function: */
CvCapture* pCap = NULL; CvCapture* pCap = NULL;
CvBlobTrackerAutoParam1 param = {0}; CvBlobTrackerAutoParam1 param = {0,0,0,0,0,0,0,0};
CvBlobTrackerAuto* pTracker = NULL; CvBlobTrackerAuto* pTracker = NULL;
//float scale = 1; //float scale = 1;

View File

@ -19,6 +19,7 @@ CvSeq* contours = 0;
static void on_trackbar(int pos) static void on_trackbar(int pos)
{ {
(void)pos;
IplImage* cnt_img = cvCreateImage( cvSize(w,w), 8, 3 ); IplImage* cnt_img = cvCreateImage( cvSize(w,w), 8, 3 );
CvSeq* _contours = contours; CvSeq* _contours = contours;
int _levels = levels - 3; int _levels = levels - 3;
@ -52,6 +53,7 @@ static void findCComp( IplImage* img )
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
(void)argc; (void)argv;
int i, j; int i, j;
CvMemStorage* storage = cvCreateMemStorage(0); CvMemStorage* storage = cvCreateMemStorage(0);
IplImage* img = cvCreateImage( cvSize(w,w), 8, 1 ); IplImage* img = cvCreateImage( cvSize(w,w), 8, 1 );

View File

@ -231,9 +231,7 @@ static void run(void)
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
#ifdef _MSC_VER (void)argc; (void)argv;
argc, argv;
#endif
help(); help();
run(); run();
return 0; return 0;

View File

@ -16,6 +16,7 @@ static void help(void)
static void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step, static void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step,
double scale, CvScalar color) double scale, CvScalar color)
{ {
(void)scale;
int x, y; int x, y;
for( y = 0; y < cflowmap->rows; y += step) for( y = 0; y < cflowmap->rows; y += step)
for( x = 0; x < cflowmap->cols; x += step) for( x = 0; x < cflowmap->cols; x += step)
@ -29,6 +30,7 @@ static void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step,
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
(void)argc; (void)argv;
CvCapture* capture = cvCreateCameraCapture(0); CvCapture* capture = cvCreateCameraCapture(0);
CvMat* prevgray = 0, *gray = 0, *flow = 0, *cflow = 0; CvMat* prevgray = 0, *gray = 0, *flow = 0, *cflow = 0;

View File

@ -17,6 +17,7 @@ int erode_dilate_pos = 0;
// callback function for open/close trackbar // callback function for open/close trackbar
static void OpenClose(int pos) static void OpenClose(int pos)
{ {
(void)pos;
int n = open_close_pos - max_iters; int n = open_close_pos - max_iters;
int an = n > 0 ? n : -n; int an = n > 0 ? n : -n;
element = cvCreateStructuringElementEx( an*2+1, an*2+1, an, an, element_shape, 0 ); element = cvCreateStructuringElementEx( an*2+1, an*2+1, an, an, element_shape, 0 );
@ -37,6 +38,7 @@ static void OpenClose(int pos)
// callback function for erode/dilate trackbar // callback function for erode/dilate trackbar
static void ErodeDilate(int pos) static void ErodeDilate(int pos)
{ {
(void)pos;
int n = erode_dilate_pos - max_iters; int n = erode_dilate_pos - max_iters;
int an = n > 0 ? n : -n; int an = n > 0 ? n : -n;
element = cvCreateStructuringElementEx( an*2+1, an*2+1, an, an, element_shape, 0 ); element = cvCreateStructuringElementEx( an*2+1, an*2+1, an, an, element_shape, 0 );

View File

@ -34,6 +34,7 @@ CvPoint pt1, pt2;
static void ON_SEGMENT(int a) static void ON_SEGMENT(int a)
{ {
(void)a;
cvPyrSegmentation(image0, image1, storage, &comp, cvPyrSegmentation(image0, image1, storage, &comp,
level, threshold1+1, threshold2+1); level, threshold1+1, threshold2+1);

View File

@ -66,7 +66,7 @@ int main(int argc, char* argv[])
if (status != Stitcher::OK) if (status != Stitcher::OK)
{ {
cout << "Can't stitch images, error code = " << status << endl; cout << "Can't stitch images, error code = " << int(status) << endl;
return -1; return -1;
} }