From c880b7ea4d2b43d077c15c222cd04a4371750aba Mon Sep 17 00:00:00 2001 From: Hamdi Sahloul Date: Thu, 6 Sep 2018 17:01:57 +0900 Subject: [PATCH 1/2] Utilize CV_UNUSED macro --- modules/bioinspired/src/templatebuffer.hpp | 2 +- .../opencv2/face/predict_collector.hpp | 4 ++-- modules/face/src/facerec.cpp | 4 ++-- modules/optflow/src/sparse_matching_gpc.cpp | 2 +- .../include/opencv2/stereo/descriptor.hpp | 10 ++++----- .../src/sinusoidalpattern.cpp | 22 +++++++++---------- modules/text/src/ocr_tesseract.cpp | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/bioinspired/src/templatebuffer.hpp b/modules/bioinspired/src/templatebuffer.hpp index e52a9b707..8eab1198a 100644 --- a/modules/bioinspired/src/templatebuffer.hpp +++ b/modules/bioinspired/src/templatebuffer.hpp @@ -293,7 +293,7 @@ public: * @param sensitivity: strenght of the sigmoide * @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) { CV_UNUSED(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 diff --git a/modules/face/include/opencv2/face/predict_collector.hpp b/modules/face/include/opencv2/face/predict_collector.hpp index 53bf118d9..dba3c7e3b 100644 --- a/modules/face/include/opencv2/face/predict_collector.hpp +++ b/modules/face/include/opencv2/face/predict_collector.hpp @@ -50,7 +50,7 @@ the use of this software, even if advised of the possibility of such damage. #include #include -#include "opencv2/core/cvstd.hpp" +#include "opencv2/core/base.hpp" namespace cv { namespace face { @@ -66,7 +66,7 @@ public: /** @brief Interface method called by face recognizer before results processing @param size total size of prediction evaluation that recognizer could perform */ - virtual void init(size_t size) { (void)size; } + virtual void init(size_t size) { CV_UNUSED(size); } /** @brief Interface method called by face recognizer for each result @param label current prediction label diff --git a/modules/face/src/facerec.cpp b/modules/face/src/facerec.cpp index b811eb3a2..d3fae8078 100644 --- a/modules/face/src/facerec.cpp +++ b/modules/face/src/facerec.cpp @@ -48,8 +48,8 @@ void FaceRecognizer::setLabelInfo(int label, const String &strInfo) void FaceRecognizer::update(InputArrayOfArrays src, InputArray labels) { - (void)src; - (void)labels; + CV_UNUSED(src); + CV_UNUSED(labels); String error_msg = format("This FaceRecognizer does not support updating, you have to use FaceRecognizer::train to update it."); CV_Error(Error::StsNotImplemented, error_msg); } diff --git a/modules/optflow/src/sparse_matching_gpc.cpp b/modules/optflow/src/sparse_matching_gpc.cpp index 46cfede69..e22bf84fb 100644 --- a/modules/optflow/src/sparse_matching_gpc.cpp +++ b/modules/optflow/src/sparse_matching_gpc.cpp @@ -292,7 +292,7 @@ void getAllDCTDescriptorsForImage( const Mat *imgCh, std::vector< GPCPatchDescri const Size sz = imgCh[0].size(); descr.reserve( ( sz.height - 2 * patchRadius ) * ( sz.width - 2 * patchRadius ) ); - (void)mp; // Fix unused parameter warning in case OpenCL is not available + CV_UNUSED(mp); // Fix unused parameter warning in case OpenCL is not available CV_OCL_RUN( mp.useOpenCL, ocl_getAllDCTDescriptorsForImage( imgCh, descr ) ) descr.resize( ( sz.height - 2 * patchRadius ) * ( sz.width - 2 * patchRadius ) ); diff --git a/modules/stereo/include/opencv2/stereo/descriptor.hpp b/modules/stereo/include/opencv2/stereo/descriptor.hpp index 19928fe49..397fd315a 100644 --- a/modules/stereo/include/opencv2/stereo/descriptor.hpp +++ b/modules/stereo/include/opencv2/stereo/descriptor.hpp @@ -79,7 +79,7 @@ namespace cv } void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const { - (void)w2; + CV_UNUSED(w2); for (int i = 0; i < stop; i++) { if (image[i][rrWidth + jj] > image[i][rWidth + j]) @@ -114,7 +114,7 @@ namespace cv } void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const { - (void)w2; + CV_UNUSED(w2); for(int i = 0; i < imageStop; i++) { if (image[i][rrWidth + jj] > image[i][rWidth + j] - t) @@ -154,8 +154,8 @@ namespace cv } void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const { - (void)j; - (void)rWidth; + CV_UNUSED(j); + CV_UNUSED(rWidth); for(int i = 0; i < imageStop; i++) { if (image[i][(rrWidth + jj)] > image[i][(w2 + (jj + n2))]) @@ -181,7 +181,7 @@ namespace cv } void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const { - (void)w2; + CV_UNUSED(w2); for(int i = 0; i < imageStop; i++) { ////compare a pixel with the center from the kernel diff --git a/modules/structured_light/src/sinusoidalpattern.cpp b/modules/structured_light/src/sinusoidalpattern.cpp index 38820b9bd..49b4e5acf 100644 --- a/modules/structured_light/src/sinusoidalpattern.cpp +++ b/modules/structured_light/src/sinusoidalpattern.cpp @@ -263,11 +263,11 @@ bool SinusoidalPatternProfilometry_Impl::decode(const std::vector< std::vector(pattern_.size()); std::vector filteredPatterns(nbrOfPatterns); @@ -425,9 +425,9 @@ void SinusoidalPatternProfilometry_Impl::findProCamMatches( InputArray projUnwra InputArray camUnwrappedPhaseMap, OutputArrayOfArrays matches ) { - (void) projUnwrappedPhaseMap; - (void) camUnwrappedPhaseMap; - (void) matches; + CV_UNUSED(projUnwrappedPhaseMap); + CV_UNUSED(camUnwrappedPhaseMap); + CV_UNUSED(matches); } void SinusoidalPatternProfilometry_Impl::computeDft( InputArray patternImage, @@ -896,8 +896,8 @@ void SinusoidalPatternProfilometry_Impl::convertToAbsolutePhaseMap( InputArrayOf InputArray fundamentalMatrix ) { std::vector &camPatterns_ = *(std::vector*) camPatterns.getObj(); - (void) unwrappedCamPhaseMap; - (void) unwrappedProjPhaseMap; + CV_UNUSED(unwrappedCamPhaseMap); + CV_UNUSED(unwrappedProjPhaseMap); Mat &fundamental = *(Mat*) fundamentalMatrix.getObj(); diff --git a/modules/text/src/ocr_tesseract.cpp b/modules/text/src/ocr_tesseract.cpp index 8696f4b79..07aad1ff7 100644 --- a/modules/text/src/ocr_tesseract.cpp +++ b/modules/text/src/ocr_tesseract.cpp @@ -262,7 +262,7 @@ public: #ifdef HAVE_TESSERACT tess.SetVariable("tessedit_char_whitelist", char_whitelist.c_str()); #else - (void)char_whitelist; + CV_UNUSED(char_whitelist); #endif } }; From c64f925a50f149ce831b60397f4dad471a868a7b Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Fri, 7 Sep 2018 16:52:12 +0200 Subject: [PATCH 2/2] ovis: Camera - allow manually setting zNear and zFar --- modules/ovis/include/opencv2/ovis.hpp | 10 ++++++++-- modules/ovis/src/ovis.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/ovis/include/opencv2/ovis.hpp b/modules/ovis/include/opencv2/ovis.hpp index d9f684c07..3d55103c1 100644 --- a/modules/ovis/include/opencv2/ovis.hpp +++ b/modules/ovis/include/opencv2/ovis.hpp @@ -204,10 +204,16 @@ public: /** * set intrinsics of the camera - * @param K intrinsic matrix + * + * @param K intrinsic matrix or noArray(). If noArray() is specified, imsize + * is ignored and zNear/ zFar can be set separately. * @param imsize image size + * @param zNear near clip distance or -1 to keep the current + * @param zFar far clip distance or -1 to keep the current */ - CV_WRAP virtual void setCameraIntrinsics(InputArray K, const Size& imsize) = 0; + CV_WRAP virtual void setCameraIntrinsics(InputArray K, const Size& imsize, + float zNear = -1, + float zFar = -1) = 0; }; /** diff --git a/modules/ovis/src/ovis.cpp b/modules/ovis/src/ovis.cpp index ccf389289..2707f9694 100644 --- a/modules/ovis/src/ovis.cpp +++ b/modules/ovis/src/ovis.cpp @@ -641,10 +641,13 @@ public: } } - void setCameraIntrinsics(InputArray K, const Size& imsize) + void setCameraIntrinsics(InputArray K, const Size& imsize, float zNear, float zFar) { Camera* cam = sceneMgr->getCamera(title); - _setCameraIntrinsics(cam, K, imsize); + + if(zNear >= 0) cam->setNearClipDistance(zNear); + if(zFar >= 0) cam->setFarClipDistance(zFar); + if(!K.empty()) _setCameraIntrinsics(cam, K, imsize); } void setCameraLookAt(const String& target, InputArray offset)