Browse Source

Added CvInvoke.SetBreakOnError

pull/910/head
Canming Huang 2 years ago
parent
commit
b02cef1ab6
  1. 9
      Emgu.CV.Extern/core/core_c.cpp
  2. 3
      Emgu.CV.Extern/core/core_c_extra.h
  3. 15
      Emgu.CV/PInvoke/CvInvokeCore.cs

9
Emgu.CV.Extern/core/core_c.cpp

@ -6,9 +6,14 @@
#include "core_c_extra.h"
CvErrorCallback cveRedirectError(CvErrorCallback error_handler, void* userdata, void** prev_userdata)
bool cveSetBreakOnError(bool flag)
{
return cvRedirectError(error_handler, userdata, prev_userdata);
return cv::setBreakOnError(flag);
}
cv::ErrorCallback cveRedirectError(cv::ErrorCallback errorHandler, void* userdata, void** prevUserdata)
{
return cv::redirectError(errorHandler, userdata, prevUserdata);
}
int cveGetErrMode()

3
Emgu.CV.Extern/core/core_c_extra.h

@ -18,7 +18,8 @@
#include "opencv2/core/utils/logger.hpp"
#include "registry_parallel.hpp"
CVAPI(CvErrorCallback) cveRedirectError(CvErrorCallback error_handler, void* userdata, void** prev_userdata);
CVAPI(bool) cveSetBreakOnError(bool flag);
CVAPI(cv::ErrorCallback) cveRedirectError(cv::ErrorCallback errorHandler, void* userdata, void** prevUserdata);
CVAPI(int) cveGetErrMode();
CVAPI(int) cveSetErrMode(int mode);
CVAPI(int) cveGetErrStatus();

15
Emgu.CV/PInvoke/CvInvokeCore.cs

@ -87,7 +87,7 @@ namespace Emgu.CV
}
/// <summary>
/// Define an error callback that can be registered using cvRedirectError function
/// Define an error callback that can be registered using RedirectError function
/// </summary>
/// <param name="status">The numeric code for error status</param>
/// <param name="funcName">The source file name where error is encountered</param>
@ -184,6 +184,19 @@ namespace Emgu.CV
IntPtr userdata,
IntPtr prevUserdata);
/// <summary>
/// When the break-on-error mode is set, the default error handler issues a hardware exception, which
/// can make debugging more convenient.
/// </summary>
/// <param name="flag">The flag</param>
/// <returns>The previous state</returns>
[DllImport(ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "cveSetBreakOnError")]
[return:MarshalAs(CvInvoke.BoolMarshalType)]
public static extern bool SetBreakOnError(
[MarshalAs(CvInvoke.BoolMarshalType)]
bool flag
);
/// <summary>
/// Sets the specified error mode.
/// </summary>

Loading…
Cancel
Save