jlcv.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. // Copyright (C) 2020 by Archit Rungta
  5. // This header files hacks into the mapping code of CxxWrap to support automatic conversion between types from OpenCV and Julia
  6. #include <vector>
  7. #include "jlcxx/jlcxx.hpp"
  8. #include "jlcxx/functions.hpp"
  9. #include "jlcxx/stl.hpp"
  10. #include "jlcxx/array.hpp"
  11. #include "jlcxx/tuple.hpp"
  12. #include <opencv2/core.hpp>
  13. #include <opencv2/core/utility.hpp>
  14. #include <opencv2/core/ocl.hpp>
  15. #include <opencv2/core/bindings_utils.hpp>
  16. #include <opencv2/opencv_modules.hpp>
  17. #include <type_traits>
  18. using namespace cv;
  19. using namespace std;
  20. using namespace jlcxx;
  21. #ifdef HAVE_OPENCV_HIGHGUI
  22. #include <opencv2/highgui.hpp>
  23. #endif
  24. #ifdef HAVE_OPENCV_IMGPROC
  25. #include <opencv2/imgproc.hpp>
  26. #endif
  27. #ifdef HAVE_OPENCV_VIDEOIO
  28. #include <opencv2/videoio.hpp>
  29. #endif
  30. #ifdef HAVE_OPENCV_FEATURES2D
  31. #include <opencv2/features2d.hpp>
  32. typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
  33. typedef AKAZE::DescriptorType AKAZE_DescriptorType;
  34. typedef AgastFeatureDetector::DetectorType AgastFeatureDetector_DetectorType;
  35. typedef FastFeatureDetector::DetectorType FastFeatureDetector_DetectorType;
  36. typedef DescriptorMatcher::MatcherType DescriptorMatcher_MatcherType;
  37. typedef KAZE::DiffusivityType KAZE_DiffusivityType;
  38. typedef ORB::ScoreType ORB_ScoreType;
  39. #endif
  40. #ifdef HAVE_OPENCV_OBJDETECT
  41. #include <opencv2/objdetect.hpp>
  42. typedef HOGDescriptor::HistogramNormType HOGDescriptor_HistogramNormType;
  43. typedef HOGDescriptor::DescriptorStorageFormat HOGDescriptor_DescriptorStorageFormat;
  44. #endif
  45. #ifdef HAVE_OPENCV_FLANN
  46. typedef cvflann::flann_distance_t cvflann_flann_distance_t;
  47. typedef cvflann::flann_algorithm_t cvflann_flann_algorithm_t;
  48. typedef flann::IndexParams flann_IndexParams;
  49. typedef flann::SearchParams flann_SearchParams;
  50. #endif
  51. #ifdef HAVE_OPENCV_DNN
  52. #include <opencv2/dnn.hpp>
  53. typedef cv::dnn::DictValue LayerId;
  54. typedef cv::dnn::Backend dnn_Backend;
  55. typedef cv::dnn::Target dnn_Target;
  56. #endif
  57. #ifdef HAVE_OPENCV_CALIB3D
  58. #include <opencv2/calib3d.hpp>
  59. #endif
  60. template <typename C>
  61. struct get_template_type;
  62. template <typename C>
  63. struct get_template_type_vec;
  64. template <template <typename> class C, typename T>
  65. struct get_template_type<C<T>> {
  66. using type = T;
  67. };
  68. template <template <typename, int> class C, typename T, int N>
  69. struct get_template_type_vec<C<T, N>> {
  70. using type = T;
  71. int dim = N;
  72. };
  73. template<typename T, bool v>
  74. struct force_enum{};
  75. template<typename T>
  76. struct force_enum<T, false>{
  77. using Type = T;
  78. };
  79. template<typename T>
  80. struct force_enum<T, true>{
  81. using Type = int64_t;
  82. };
  83. template<typename T>
  84. struct force_enum_int{
  85. using Type = typename force_enum<T, std::is_enum<T>::value>::Type;
  86. };
  87. typedef vector<Mat> vector_Mat;
  88. typedef vector<UMat> vector_UMat;
  89. typedef char* c_string;
  90. #include "jlcv_types.hpp"