bindings_utils.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #ifndef OPENCV_CORE_BINDINGS_UTILS_HPP
  5. #define OPENCV_CORE_BINDINGS_UTILS_HPP
  6. #include <opencv2/core/async.hpp>
  7. #include <opencv2/core/detail/async_promise.hpp>
  8. namespace cv { namespace utils {
  9. //! @addtogroup core_utils
  10. //! @{
  11. CV_EXPORTS_W String dumpInputArray(InputArray argument);
  12. CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument);
  13. CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument);
  14. CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argument);
  15. CV_WRAP static inline
  16. AsyncArray testAsyncArray(InputArray argument)
  17. {
  18. AsyncPromise p;
  19. p.setValue(argument);
  20. return p.getArrayResult();
  21. }
  22. CV_WRAP static inline
  23. AsyncArray testAsyncException()
  24. {
  25. AsyncPromise p;
  26. try
  27. {
  28. CV_Error(Error::StsOk, "Test: Generated async error");
  29. }
  30. catch (const cv::Exception& e)
  31. {
  32. p.setException(e);
  33. }
  34. return p.getArrayResult();
  35. }
  36. //! @}
  37. }} // namespace
  38. #endif // OPENCV_CORE_BINDINGS_UTILS_HPP