refactor: don't use CV_ErrorNoReturn() internally

pull/11381/head
Alexander Alekhin 7 years ago
parent 4ec456f0a0
commit 576d2dbac0
  1. 20
      modules/core/include/opencv2/core/base.hpp
  2. 2
      modules/core/include/opencv2/core/opencl/opencl_info.hpp
  3. 2
      modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp
  4. 4
      modules/core/src/directx.cpp
  5. 34
      modules/core/src/ocl.cpp
  6. 2
      modules/core/src/opencl/runtime/opencl_core.cpp
  7. 6
      modules/core/src/opengl.cpp
  8. 2
      modules/core/src/parallel.cpp
  9. 2
      modules/core/src/persistence.cpp
  10. 8
      modules/core/src/system.cpp
  11. 4
      modules/core/src/utils/filesystem.cpp
  12. 2
      modules/core/src/va_intel.cpp
  13. 4
      modules/dnn/src/dnn.cpp
  14. 16
      modules/dnn/src/layers/detection_output_layer.cpp
  15. 2
      modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
  16. 2
      modules/imgcodecs/src/grfmt_bmp.cpp
  17. 2
      modules/imgcodecs/src/grfmt_gdal.cpp
  18. 4
      modules/imgcodecs/src/grfmt_pxm.cpp
  19. 2
      modules/imgcodecs/src/loadsave.cpp
  20. 2
      modules/ts/src/ts.cpp

@ -371,7 +371,7 @@ It is possible to alternate error processing by using redirectError().
@param _func - function name. Available only when the compiler supports getting it @param _func - function name. Available only when the compiler supports getting it
@param _file - source file name where the error has occurred @param _file - source file name where the error has occurred
@param _line - line number in the source file where the error has occurred @param _line - line number in the source file where the error has occurred
@see CV_Error, CV_Error_, CV_ErrorNoReturn, CV_ErrorNoReturn_, CV_Assert, CV_DbgAssert @see CV_Error, CV_Error_, CV_Assert, CV_DbgAssert
*/ */
CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line); CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line);
@ -414,8 +414,6 @@ CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const ch
// We need to use simplified definition for them. // We need to use simplified definition for them.
#define CV_Error(...) do { abort(); } while (0) #define CV_Error(...) do { abort(); } while (0)
#define CV_Error_( code, args ) do { cv::format args; abort(); } while (0) #define CV_Error_( code, args ) do { cv::format args; abort(); } while (0)
#define CV_ErrorNoReturn(...) do { abort(); } while (0)
#define CV_ErrorNoReturn_(...) do { abort(); } while (0)
#define CV_Assert_1( expr ) do { if (!(expr)) abort(); } while (0) #define CV_Assert_1( expr ) do { if (!(expr)) abort(); } while (0)
#else // CV_STATIC_ANALYSIS #else // CV_STATIC_ANALYSIS
@ -446,22 +444,22 @@ for example:
*/ */
#define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ ) #define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )
/** same as CV_Error(code,msg), but does not return */
#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
/** same as CV_Error_(code,args), but does not return */
#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) #define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
//! @cond IGNORED //! @cond IGNORED
#define CV__ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
#define CV__ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#ifdef __OPENCV_BUILD #ifdef __OPENCV_BUILD
#undef CV_Error #undef CV_Error
#define CV_Error CV_ErrorNoReturn #define CV_Error CV__ErrorNoReturn
#undef CV_Error_ #undef CV_Error_
#define CV_Error_ CV_ErrorNoReturn_ #define CV_Error_ CV__ErrorNoReturn_
#undef CV_Assert_1 #undef CV_Assert_1
#define CV_Assert_1( expr ) if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) #define CV_Assert_1( expr ) if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
#else
// backward compatibility
#define CV_ErrorNoReturn CV__ErrorNoReturn
#define CV_ErrorNoReturn_ CV__ErrorNoReturn_
#endif #endif
//! @endcond //! @endcond

@ -93,7 +93,7 @@ static void dumpOpenCLInformation()
const Device& device = Device::getDefault(); const Device& device = Device::getDefault();
if (!device.available()) if (!device.available())
CV_ErrorNoReturn(Error::OpenCLInitError, "OpenCL device is not available"); CV_Error(Error::OpenCLInitError, "OpenCL device is not available");
DUMP_MESSAGE_STDOUT("Current OpenCL device: "); DUMP_MESSAGE_STDOUT("Current OpenCL device: ");

@ -76,7 +76,7 @@
#endif #endif
#ifndef CL_VERSION_1_2 #ifndef CL_VERSION_1_2
#define CV_REQUIRE_OPENCL_1_2_ERROR CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") #define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2")
#endif #endif
#endif // HAVE_OPENCL #endif // HAVE_OPENCL

@ -50,11 +50,11 @@
#include <vector> #include <vector>
# include "directx.inc.hpp" # include "directx.inc.hpp"
#else // HAVE_DIRECTX #else // HAVE_DIRECTX
#define NO_DIRECTX_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without DirectX support") #define NO_DIRECTX_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without DirectX support")
#endif #endif
#ifndef HAVE_OPENCL #ifndef HAVE_OPENCL
# define NO_OPENCL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support") # define NO_OPENCL_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support")
#endif // HAVE_OPENCL #endif // HAVE_OPENCL
namespace cv { namespace directx { namespace cv { namespace directx {

@ -133,7 +133,7 @@ namespace cv { namespace ocl {
int refcount int refcount
#ifndef HAVE_OPENCL #ifndef HAVE_OPENCL
#define CV_OPENCL_NO_SUPPORT() CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "OpenCV build without OpenCL support") #define CV_OPENCL_NO_SUPPORT() CV_Error(cv::Error::OpenCLApiCallError, "OpenCV build without OpenCL support")
namespace { namespace {
struct DummyImpl struct DummyImpl
{ {
@ -2177,7 +2177,7 @@ struct Context::Impl
if (!ptr) if (!ptr)
{ {
CV_OPENCL_SVM_TRACE_ERROR_P("clSVMAlloc returned NULL...\n"); CV_OPENCL_SVM_TRACE_ERROR_P("clSVMAlloc returned NULL...\n");
CV_ErrorNoReturn(Error::StsBadArg, "clSVMAlloc returned NULL"); CV_Error(Error::StsBadArg, "clSVMAlloc returned NULL");
} }
try try
{ {
@ -2186,7 +2186,7 @@ struct Context::Impl
if (CL_SUCCESS != clEnqueueSVMMap(q, CL_TRUE, CL_MAP_WRITE, ptr, 100, 0, NULL, NULL)) if (CL_SUCCESS != clEnqueueSVMMap(q, CL_TRUE, CL_MAP_WRITE, ptr, 100, 0, NULL, NULL))
{ {
CV_OPENCL_SVM_TRACE_ERROR_P("clEnqueueSVMMap failed...\n"); CV_OPENCL_SVM_TRACE_ERROR_P("clEnqueueSVMMap failed...\n");
CV_ErrorNoReturn(Error::StsBadArg, "clEnqueueSVMMap FAILED"); CV_Error(Error::StsBadArg, "clEnqueueSVMMap FAILED");
} }
clFinish(q); clFinish(q);
try try
@ -2201,12 +2201,12 @@ struct Context::Impl
if (CL_SUCCESS != clEnqueueSVMUnmap(q, ptr, 0, NULL, NULL)) if (CL_SUCCESS != clEnqueueSVMUnmap(q, ptr, 0, NULL, NULL))
{ {
CV_OPENCL_SVM_TRACE_ERROR_P("clEnqueueSVMUnmap failed...\n"); CV_OPENCL_SVM_TRACE_ERROR_P("clEnqueueSVMUnmap failed...\n");
CV_ErrorNoReturn(Error::StsBadArg, "clEnqueueSVMUnmap FAILED"); CV_Error(Error::StsBadArg, "clEnqueueSVMUnmap FAILED");
} }
clFinish(q); clFinish(q);
if (error) if (error)
{ {
CV_ErrorNoReturn(Error::StsBadArg, "OpenCL SVM buffer access test was FAILED"); CV_Error(Error::StsBadArg, "OpenCL SVM buffer access test was FAILED");
} }
} }
catch (...) catch (...)
@ -2412,7 +2412,7 @@ void Context::setUseSVM(bool enabled)
i->svmInit(); i->svmInit();
if (enabled && !i->svmAvailable) if (enabled && !i->svmAvailable)
{ {
CV_ErrorNoReturn(Error::StsError, "OpenCL Shared Virtual Memory (SVM) is not supported by OpenCL device"); CV_Error(Error::StsError, "OpenCL Shared Virtual Memory (SVM) is not supported by OpenCL device");
} }
i->svmEnabled = enabled; i->svmEnabled = enabled;
} }
@ -2483,7 +2483,7 @@ void attachContext(const String& platformName, void* platformID, void* context,
CV_OCL_CHECK(clGetPlatformIDs(0, 0, &cnt)); CV_OCL_CHECK(clGetPlatformIDs(0, 0, &cnt));
if (cnt == 0) if (cnt == 0)
CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "no OpenCL platform available!"); CV_Error(cv::Error::OpenCLApiCallError, "no OpenCL platform available!");
std::vector<cl_platform_id> platforms(cnt); std::vector<cl_platform_id> platforms(cnt);
@ -2505,13 +2505,13 @@ void attachContext(const String& platformName, void* platformID, void* context,
} }
if (!platformAvailable) if (!platformAvailable)
CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "No matched platforms available!"); CV_Error(cv::Error::OpenCLApiCallError, "No matched platforms available!");
// check if platformID corresponds to platformName // check if platformID corresponds to platformName
String actualPlatformName; String actualPlatformName;
get_platform_name((cl_platform_id)platformID, actualPlatformName); get_platform_name((cl_platform_id)platformID, actualPlatformName);
if (platformName != actualPlatformName) if (platformName != actualPlatformName)
CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "No matched platforms available!"); CV_Error(cv::Error::OpenCLApiCallError, "No matched platforms available!");
// do not initialize OpenCL context // do not initialize OpenCL context
Context ctx = Context::getDefault(false); Context ctx = Context::getDefault(false);
@ -3305,7 +3305,7 @@ struct ProgramSource::Impl
hash = crc64(sourceAddr_, sourceSize_); hash = crc64(sourceAddr_, sourceSize_);
break; break;
default: default:
CV_ErrorNoReturn(Error::StsInternal, "Internal error"); CV_Error(Error::StsInternal, "Internal error");
} }
sourceHash_ = cv::format("%08llx", hash); sourceHash_ = cv::format("%08llx", hash);
isHashUpdated = true; isHashUpdated = true;
@ -3427,7 +3427,7 @@ const String& ProgramSource::source() const
ProgramSource::hash_t ProgramSource::hash() const ProgramSource::hash_t ProgramSource::hash() const
{ {
CV_ErrorNoReturn(Error::StsNotImplemented, "Removed method: ProgramSource::hash()"); CV_Error(Error::StsNotImplemented, "Removed method: ProgramSource::hash()");
} }
ProgramSource ProgramSource::fromBinary(const String& module, const String& name, ProgramSource ProgramSource::fromBinary(const String& module, const String& name,
@ -3597,11 +3597,11 @@ struct Program::Impl
} }
else if (src_->kind_ == ProgramSource::Impl::PROGRAM_SPIRV) else if (src_->kind_ == ProgramSource::Impl::PROGRAM_SPIRV)
{ {
CV_ErrorNoReturn(Error::StsNotImplemented, "OpenCL: SPIR-V is not supported"); CV_Error(Error::StsNotImplemented, "OpenCL: SPIR-V is not supported");
} }
else else
{ {
CV_ErrorNoReturn(Error::StsInternal, "Internal error"); CV_Error(Error::StsInternal, "Internal error");
} }
CV_Assert(handle != NULL); CV_Assert(handle != NULL);
#if OPENCV_HAVE_FILESYSTEM_SUPPORT #if OPENCV_HAVE_FILESYSTEM_SUPPORT
@ -3948,19 +3948,19 @@ void* Program::ptr() const
#ifndef OPENCV_REMOVE_DEPRECATED_API #ifndef OPENCV_REMOVE_DEPRECATED_API
const ProgramSource& Program::source() const const ProgramSource& Program::source() const
{ {
CV_ErrorNoReturn(Error::StsNotImplemented, "Removed API"); CV_Error(Error::StsNotImplemented, "Removed API");
} }
bool Program::read(const String& bin, const String& buildflags) bool Program::read(const String& bin, const String& buildflags)
{ {
CV_UNUSED(bin); CV_UNUSED(buildflags); CV_UNUSED(bin); CV_UNUSED(buildflags);
CV_ErrorNoReturn(Error::StsNotImplemented, "Removed API"); CV_Error(Error::StsNotImplemented, "Removed API");
} }
bool Program::write(String& bin) const bool Program::write(String& bin) const
{ {
CV_UNUSED(bin); CV_UNUSED(bin);
CV_ErrorNoReturn(Error::StsNotImplemented, "Removed API"); CV_Error(Error::StsNotImplemented, "Removed API");
} }
String Program::getPrefix() const String Program::getPrefix() const
@ -5627,7 +5627,7 @@ public:
} }
if (id != NULL && strcmp(id, "OCL") != 0) if (id != NULL && strcmp(id, "OCL") != 0)
{ {
CV_ErrorNoReturn(cv::Error::StsBadArg, "getBufferPoolController(): unknown BufferPool ID\n"); CV_Error(cv::Error::StsBadArg, "getBufferPoolController(): unknown BufferPool ID\n");
} }
return &bufferPool; return &bufferPool;
} }

@ -316,7 +316,7 @@ static void* opencl_check_fn(int ID)
#endif #endif
else else
{ {
CV_ErrorNoReturn(cv::Error::StsBadArg, "Invalid function ID"); CV_Error(cv::Error::StsBadArg, "Invalid function ID");
} }
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName); void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func) if (!func)

@ -48,7 +48,7 @@
# include <cuda_gl_interop.h> # include <cuda_gl_interop.h>
# endif # endif
#else // HAVE_OPENGL #else // HAVE_OPENGL
# define NO_OPENGL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenGL support") # define NO_OPENGL_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenGL support")
#endif // HAVE_OPENGL #endif // HAVE_OPENGL
using namespace cv; using namespace cv;
@ -1563,10 +1563,10 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala
# ifdef cl_khr_gl_sharing # ifdef cl_khr_gl_sharing
# define HAVE_OPENCL_OPENGL_SHARING # define HAVE_OPENCL_OPENGL_SHARING
# else # else
# define NO_OPENCL_SHARING_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL/OpenGL sharing support") # define NO_OPENCL_SHARING_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenCL/OpenGL sharing support")
# endif # endif
#else // HAVE_OPENCL #else // HAVE_OPENCL
# define NO_OPENCL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support") # define NO_OPENCL_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support")
#endif // HAVE_OPENCL #endif // HAVE_OPENCL
#if defined(HAVE_OPENGL) #if defined(HAVE_OPENGL)

@ -239,7 +239,7 @@ namespace
#if CV__EXCEPTION_PTR #if CV__EXCEPTION_PTR
std::rethrow_exception(pException); std::rethrow_exception(pException);
#else #else
CV_ErrorNoReturn(Error::StsError, "Exception in parallel_for() body: " + exception_message); CV_Error(Error::StsError, "Exception in parallel_for() body: " + exception_message);
#endif #endif
} }
} }

@ -85,7 +85,7 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount )
return ptr; return ptr;
} }
#endif #endif
CV_ErrorNoReturn(CV_StsError, "The storage is not opened"); CV_Error(CV_StsError, "The storage is not opened");
} }
int icvEof( CvFileStorage* fs ) int icvEof( CvFileStorage* fs )

@ -76,7 +76,7 @@ static bool param_dumpErrors = utils::getConfigurationParameterBool("OPENCV_DUMP
# define CV_ERROR_SET_TERMINATE_HANDLER 1 # define CV_ERROR_SET_TERMINATE_HANDLER 1
# endif # endif
#endif #endif
#if CV_ERROR_SET_TERMINATE_HANDLER == 0 #if defined(CV_ERROR_SET_TERMINATE_HANDLER) && !CV_ERROR_SET_TERMINATE_HANDLER
# undef CV_ERROR_SET_TERMINATE_HANDLER # undef CV_ERROR_SET_TERMINATE_HANDLER
#endif #endif
@ -532,7 +532,7 @@ struct HWFeatures
"******************************************************************\n"); "******************************************************************\n");
fprintf(stderr, "\nRequired baseline features:\n"); fprintf(stderr, "\nRequired baseline features:\n");
checkFeatures(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0]), true); checkFeatures(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0]), true);
CV_ErrorNoReturn(cv::Error::StsAssert, "Missing support for required CPU baseline features. Check OpenCV build configuration and required CPU/HW setup."); CV_Error(cv::Error::StsAssert, "Missing support for required CPU baseline features. Check OpenCV build configuration and required CPU/HW setup.");
} }
readSettings(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0])); readSettings(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0]));
@ -1657,7 +1657,7 @@ bool utils::getConfigurationParameterBool(const char* name, bool defaultValue)
{ {
return false; return false;
} }
CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); CV_Error(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str()));
} }
@ -1688,7 +1688,7 @@ size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultVal
return v * 1024 * 1024; return v * 1024 * 1024;
else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb") else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb")
return v * 1024; return v * 1024;
CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); CV_Error(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str()));
} }
cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue) cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue)

@ -265,7 +265,7 @@ struct FileLock::Impl
} }
else else
{ {
CV_ErrorNoReturn_(Error::StsAssert, ("Can't open lock file: %s", fname)); CV_Error_(Error::StsAssert, ("Can't open lock file: %s", fname));
} }
} }
break; break;
@ -517,7 +517,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
} }
#else #else
#define NOT_IMPLEMENTED CV_ErrorNoReturn(Error::StsNotImplemented, ""); #define NOT_IMPLEMENTED CV_Error(Error::StsNotImplemented, "");
CV_EXPORTS bool exists(const cv::String& /*path*/) { NOT_IMPLEMENTED } CV_EXPORTS bool exists(const cv::String& /*path*/) { NOT_IMPLEMENTED }
CV_EXPORTS void remove_all(const cv::String& /*path*/) { NOT_IMPLEMENTED } CV_EXPORTS void remove_all(const cv::String& /*path*/) { NOT_IMPLEMENTED }
CV_EXPORTS bool createDirectory(const cv::String& /*path*/) { NOT_IMPLEMENTED } CV_EXPORTS bool createDirectory(const cv::String& /*path*/) { NOT_IMPLEMENTED }

@ -10,7 +10,7 @@
#ifdef HAVE_VA #ifdef HAVE_VA
# include <va/va.h> # include <va/va.h>
#else // HAVE_VA #else // HAVE_VA
# define NO_VA_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without VA support (libva)") # define NO_VA_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without VA support (libva)")
#endif // HAVE_VA #endif // HAVE_VA
using namespace cv; using namespace cv;

@ -1941,7 +1941,7 @@ Net::Net() : impl(new Net::Impl)
Net Net::readFromModelOptimizer(const String& xml, const String& bin) Net Net::readFromModelOptimizer(const String& xml, const String& bin)
{ {
#ifndef HAVE_INF_ENGINE #ifndef HAVE_INF_ENGINE
CV_ErrorNoReturn(Error::StsError, "Build OpenCV with Inference Engine to enable loading models from Model Optimizer."); CV_Error(Error::StsError, "Build OpenCV with Inference Engine to enable loading models from Model Optimizer.");
#else #else
InferenceEngine::CNNNetReader reader; InferenceEngine::CNNNetReader reader;
reader.ReadNetwork(xml); reader.ReadNetwork(xml);
@ -2930,7 +2930,7 @@ Net readNet(const String& _model, const String& _config, const String& _framewor
std::swap(model, config); std::swap(model, config);
return readNetFromModelOptimizer(config, model); return readNetFromModelOptimizer(config, model);
} }
CV_ErrorNoReturn(Error::StsError, "Cannot determine an origin framework of files: " + CV_Error(Error::StsError, "Cannot determine an origin framework of files: " +
model + (config.empty() ? "" : ", " + config)); model + (config.empty() ? "" : ", " + config));
} }

@ -151,7 +151,7 @@ public:
message += " layer parameter does not contain "; message += " layer parameter does not contain ";
message += parameterName; message += parameterName;
message += " parameter."; message += " parameter.";
CV_ErrorNoReturn(Error::StsBadArg, message); CV_Error(Error::StsBadArg, message);
} }
else else
{ {
@ -471,12 +471,12 @@ public:
{ {
int label = it->first; int label = it->first;
if (confidenceScores.rows <= label) if (confidenceScores.rows <= label)
CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find confidence predictions for label %d", label)); CV_Error_(cv::Error::StsError, ("Could not find confidence predictions for label %d", label));
const std::vector<float>& scores = confidenceScores.row(label); const std::vector<float>& scores = confidenceScores.row(label);
int locLabel = _shareLocation ? -1 : label; int locLabel = _shareLocation ? -1 : label;
LabelBBox::const_iterator label_bboxes = decodeBBoxes.find(locLabel); LabelBBox::const_iterator label_bboxes = decodeBBoxes.find(locLabel);
if (label_bboxes == decodeBBoxes.end()) if (label_bboxes == decodeBBoxes.end())
CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", locLabel)); CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", locLabel));
const std::vector<int>& indices = it->second; const std::vector<int>& indices = it->second;
for (size_t j = 0; j < indices.size(); ++j, ++count) for (size_t j = 0; j < indices.size(); ++j, ++count)
@ -507,14 +507,14 @@ public:
if (c == _backgroundLabelId) if (c == _backgroundLabelId)
continue; // Ignore background class. continue; // Ignore background class.
if (c >= confidenceScores.rows) if (c >= confidenceScores.rows)
CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find confidence predictions for label %d", c)); CV_Error_(cv::Error::StsError, ("Could not find confidence predictions for label %d", c));
const std::vector<float> scores = confidenceScores.row(c); const std::vector<float> scores = confidenceScores.row(c);
int label = _shareLocation ? -1 : c; int label = _shareLocation ? -1 : c;
LabelBBox::const_iterator label_bboxes = decodeBBoxes.find(label); LabelBBox::const_iterator label_bboxes = decodeBBoxes.find(label);
if (label_bboxes == decodeBBoxes.end()) if (label_bboxes == decodeBBoxes.end())
CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", label));
if (_bboxesNormalized) if (_bboxesNormalized)
NMSFast_(label_bboxes->second, scores, _confidenceThreshold, _nmsThreshold, 1.0, _topK, NMSFast_(label_bboxes->second, scores, _confidenceThreshold, _nmsThreshold, 1.0, _topK,
indices[c], util::caffe_norm_box_overlap); indices[c], util::caffe_norm_box_overlap);
@ -532,7 +532,7 @@ public:
int label = it->first; int label = it->first;
const std::vector<int>& labelIndices = it->second; const std::vector<int>& labelIndices = it->second;
if (label >= confidenceScores.rows) if (label >= confidenceScores.rows)
CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", label));
const std::vector<float>& scores = confidenceScores.row(label); const std::vector<float>& scores = confidenceScores.row(label);
for (size_t j = 0; j < labelIndices.size(); ++j) for (size_t j = 0; j < labelIndices.size(); ++j)
{ {
@ -645,7 +645,7 @@ public:
decode_bbox.ymax = decode_bbox_center_y + decode_bbox_height * .5; decode_bbox.ymax = decode_bbox_center_y + decode_bbox_height * .5;
} }
else else
CV_ErrorNoReturn(Error::StsBadArg, "Unknown type."); CV_Error(Error::StsBadArg, "Unknown type.");
if (clip_bbox) if (clip_bbox)
{ {
@ -714,7 +714,7 @@ public:
continue; // Ignore background class. continue; // Ignore background class.
LabelBBox::const_iterator label_loc_preds = loc_preds.find(label); LabelBBox::const_iterator label_loc_preds = loc_preds.find(label);
if (label_loc_preds == loc_preds.end()) if (label_loc_preds == loc_preds.end())
CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", label));
DecodeBBoxes(prior_bboxes, prior_variances, DecodeBBoxes(prior_bboxes, prior_variances,
code_type, variance_encoded_in_target, clip, clip_bounds, code_type, variance_encoded_in_target, clip, clip_bounds,
normalized_bbox, label_loc_preds->second, decode_bboxes[label]); normalized_bbox, label_loc_preds->second, decode_bboxes[label]);

@ -89,7 +89,7 @@ public:
if (net.node(i).name() == name) if (net.node(i).name() == name)
return net.node(i); return net.node(i);
} }
CV_ErrorNoReturn(Error::StsParseError, "Input node with name " + name + " not found"); CV_Error(Error::StsParseError, "Input node with name " + name + " not found");
} }
// Match TensorFlow subgraph starting from <nodeId> with a set of nodes to be fused. // Match TensorFlow subgraph starting from <nodeId> with a set of nodes to be fused.

@ -490,7 +490,7 @@ decode_rle8_bad: ;
result = true; result = true;
break; break;
default: default:
CV_ErrorNoReturn(cv::Error::StsError, "Invalid/unsupported mode"); CV_Error(cv::Error::StsError, "Invalid/unsupported mode");
} }
} }
CV_CATCH_ALL CV_CATCH_ALL

@ -409,7 +409,7 @@ bool GdalDecoder::readData( Mat& img ){
color = 3; color = 3;
break; break;
default: default:
CV_ErrorNoReturn(cv::Error::StsError, "Invalid/unsupported mode"); CV_Error(cv::Error::StsError, "Invalid/unsupported mode");
} }
// make sure the image band has the same dimensions as the image // make sure the image band has the same dimensions as the image

@ -77,7 +77,7 @@ static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
else else
{ {
#if 1 #if 1
CV_ErrorNoReturn_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code)); CV_Error_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
#else #else
code = strm.getByte(); code = strm.getByte();
#endif #endif
@ -354,7 +354,7 @@ bool PxMDecoder::readData( Mat& img )
break; break;
} }
default: default:
CV_ErrorNoReturn(Error::StsError, "m_bpp is not supported"); CV_Error(Error::StsError, "m_bpp is not supported");
} }
} }
CV_CATCH (cv::Exception, e) CV_CATCH (cv::Exception, e)

@ -722,7 +722,7 @@ bool imwrite( const String& filename, InputArray _img,
else if (_img.isMatVector() || _img.isUMatVector()) else if (_img.isMatVector() || _img.isUMatVector())
_img.getMatVector(img_vec); _img.getMatVector(img_vec);
else else
CV_ErrorNoReturn(Error::StsBadArg, "Unknown/unsupported input encountered"); CV_Error(Error::StsBadArg, "Unknown/unsupported input encountered");
CV_Assert(!img_vec.empty()); CV_Assert(!img_vec.empty());
return imwrite_(filename, img_vec, params, false); return imwrite_(filename, img_vec, params, false);

@ -836,7 +836,7 @@ std::string findDataFile(const std::string& relative_path, bool required)
#endif #endif
#endif #endif
if (required) if (required)
CV_ErrorNoReturn(cv::Error::StsError, cv::format("OpenCV tests: Can't find required data file: %s", relative_path.c_str())); CV_Error(cv::Error::StsError, cv::format("OpenCV tests: Can't find required data file: %s", relative_path.c_str()));
throw SkipTestException(cv::format("OpenCV tests: Can't find data file: %s", relative_path.c_str())); throw SkipTestException(cv::format("OpenCV tests: Can't find data file: %s", relative_path.c_str()));
} }

Loading…
Cancel
Save