Modified java wrapping mechanism

pull/3759/head
Maksim Shabunin 10 years ago
parent 5850a9b8c3
commit 457123027e
  1. 33
      cmake/OpenCVModule.cmake
  2. 2
      modules/calib3d/CMakeLists.txt
  3. 0
      modules/calib3d/misc/java/test/Calib3dTest.java
  4. 0
      modules/calib3d/misc/java/test/StereoBMTest.java
  5. 0
      modules/calib3d/misc/java/test/StereoSGBMTest.java
  6. 4
      modules/core/CMakeLists.txt
  7. 2
      modules/core/misc/java/filelist
  8. 8
      modules/core/misc/java/src/cpp/core_manual.cpp
  9. 0
      modules/core/misc/java/src/cpp/core_manual.hpp
  10. 0
      modules/core/misc/java/src/java/core+CvException.java
  11. 0
      modules/core/misc/java/src/java/core+CvType.java
  12. 0
      modules/core/misc/java/src/java/core+DMatch.java
  13. 0
      modules/core/misc/java/src/java/core+KeyPoint.java
  14. 0
      modules/core/misc/java/src/java/core+Mat.java
  15. 0
      modules/core/misc/java/src/java/core+MatOfByte.java
  16. 0
      modules/core/misc/java/src/java/core+MatOfDMatch.java
  17. 0
      modules/core/misc/java/src/java/core+MatOfDouble.java
  18. 0
      modules/core/misc/java/src/java/core+MatOfFloat.java
  19. 0
      modules/core/misc/java/src/java/core+MatOfFloat4.java
  20. 0
      modules/core/misc/java/src/java/core+MatOfFloat6.java
  21. 0
      modules/core/misc/java/src/java/core+MatOfInt.java
  22. 0
      modules/core/misc/java/src/java/core+MatOfInt4.java
  23. 0
      modules/core/misc/java/src/java/core+MatOfKeyPoint.java
  24. 0
      modules/core/misc/java/src/java/core+MatOfPoint.java
  25. 0
      modules/core/misc/java/src/java/core+MatOfPoint2f.java
  26. 0
      modules/core/misc/java/src/java/core+MatOfPoint3.java
  27. 0
      modules/core/misc/java/src/java/core+MatOfPoint3f.java
  28. 0
      modules/core/misc/java/src/java/core+MatOfRect.java
  29. 0
      modules/core/misc/java/src/java/core+Point.java
  30. 0
      modules/core/misc/java/src/java/core+Point3.java
  31. 0
      modules/core/misc/java/src/java/core+Range.java
  32. 0
      modules/core/misc/java/src/java/core+Rect.java
  33. 0
      modules/core/misc/java/src/java/core+RotatedRect.java
  34. 0
      modules/core/misc/java/src/java/core+Scalar.java
  35. 0
      modules/core/misc/java/src/java/core+Size.java
  36. 0
      modules/core/misc/java/src/java/core+TermCriteria.java
  37. 0
      modules/core/misc/java/test/CoreTest.java
  38. 0
      modules/core/misc/java/test/CvTypeTest.java
  39. 0
      modules/core/misc/java/test/DMatchTest.java
  40. 0
      modules/core/misc/java/test/KeyPointTest.java
  41. 0
      modules/core/misc/java/test/MatTest.java
  42. 0
      modules/core/misc/java/test/Point3Test.java
  43. 0
      modules/core/misc/java/test/PointTest.java
  44. 0
      modules/core/misc/java/test/RangeTest.java
  45. 0
      modules/core/misc/java/test/RectTest.java
  46. 0
      modules/core/misc/java/test/RotatedRectTest.java
  47. 0
      modules/core/misc/java/test/ScalarTest.java
  48. 0
      modules/core/misc/java/test/SizeTest.java
  49. 0
      modules/core/misc/java/test/TermCriteriaTest.java
  50. 2
      modules/features2d/CMakeLists.txt
  51. 1
      modules/features2d/misc/java/filelist
  52. 112
      modules/features2d/misc/java/src/cpp/features2d_converters.cpp
  53. 22
      modules/features2d/misc/java/src/cpp/features2d_converters.hpp
  54. 1
      modules/features2d/misc/java/src/cpp/features2d_manual.hpp
  55. 0
      modules/features2d/misc/java/test/BRIEFDescriptorExtractorTest.java
  56. 0
      modules/features2d/misc/java/test/BruteForceDescriptorMatcherTest.java
  57. 0
      modules/features2d/misc/java/test/BruteForceHammingDescriptorMatcherTest.java
  58. 0
      modules/features2d/misc/java/test/BruteForceHammingLUTDescriptorMatcherTest.java
  59. 0
      modules/features2d/misc/java/test/BruteForceL1DescriptorMatcherTest.java
  60. 0
      modules/features2d/misc/java/test/BruteForceSL2DescriptorMatcherTest.java
  61. 0
      modules/features2d/misc/java/test/DENSEFeatureDetectorTest.java
  62. 0
      modules/features2d/misc/java/test/DynamicDENSEFeatureDetectorTest.java
  63. 0
      modules/features2d/misc/java/test/DynamicFASTFeatureDetectorTest.java
  64. 0
      modules/features2d/misc/java/test/DynamicGFTTFeatureDetectorTest.java
  65. 0
      modules/features2d/misc/java/test/DynamicHARRISFeatureDetectorTest.java
  66. 0
      modules/features2d/misc/java/test/DynamicMSERFeatureDetectorTest.java
  67. 0
      modules/features2d/misc/java/test/DynamicORBFeatureDetectorTest.java
  68. 0
      modules/features2d/misc/java/test/DynamicSIFTFeatureDetectorTest.java
  69. 0
      modules/features2d/misc/java/test/DynamicSIMPLEBLOBFeatureDetectorTest.java
  70. 0
      modules/features2d/misc/java/test/DynamicSTARFeatureDetectorTest.java
  71. 0
      modules/features2d/misc/java/test/DynamicSURFFeatureDetectorTest.java
  72. 0
      modules/features2d/misc/java/test/FASTFeatureDetectorTest.java
  73. 0
      modules/features2d/misc/java/test/Features2dTest.java
  74. 0
      modules/features2d/misc/java/test/FernGenericDescriptorMatcherTest.java
  75. 0
      modules/features2d/misc/java/test/FlannBasedDescriptorMatcherTest.java
  76. 0
      modules/features2d/misc/java/test/GFTTFeatureDetectorTest.java
  77. 0
      modules/features2d/misc/java/test/GridDENSEFeatureDetectorTest.java
  78. 0
      modules/features2d/misc/java/test/GridFASTFeatureDetectorTest.java
  79. 0
      modules/features2d/misc/java/test/GridGFTTFeatureDetectorTest.java
  80. 0
      modules/features2d/misc/java/test/GridHARRISFeatureDetectorTest.java
  81. 0
      modules/features2d/misc/java/test/GridMSERFeatureDetectorTest.java
  82. 0
      modules/features2d/misc/java/test/GridORBFeatureDetectorTest.java
  83. 0
      modules/features2d/misc/java/test/GridSIFTFeatureDetectorTest.java
  84. 0
      modules/features2d/misc/java/test/GridSIMPLEBLOBFeatureDetectorTest.java
  85. 0
      modules/features2d/misc/java/test/GridSTARFeatureDetectorTest.java
  86. 0
      modules/features2d/misc/java/test/GridSURFFeatureDetectorTest.java
  87. 0
      modules/features2d/misc/java/test/HARRISFeatureDetectorTest.java
  88. 0
      modules/features2d/misc/java/test/MSERFeatureDetectorTest.java
  89. 0
      modules/features2d/misc/java/test/ORBDescriptorExtractorTest.java
  90. 0
      modules/features2d/misc/java/test/ORBFeatureDetectorTest.java
  91. 0
      modules/features2d/misc/java/test/OneWayGenericDescriptorMatcherTest.java
  92. 0
      modules/features2d/misc/java/test/OpponentBRIEFDescriptorExtractorTest.java
  93. 0
      modules/features2d/misc/java/test/OpponentORBDescriptorExtractorTest.java
  94. 0
      modules/features2d/misc/java/test/OpponentSIFTDescriptorExtractorTest.java
  95. 0
      modules/features2d/misc/java/test/OpponentSURFDescriptorExtractorTest.java
  96. 0
      modules/features2d/misc/java/test/PyramidDENSEFeatureDetectorTest.java
  97. 0
      modules/features2d/misc/java/test/PyramidFASTFeatureDetectorTest.java
  98. 0
      modules/features2d/misc/java/test/PyramidGFTTFeatureDetectorTest.java
  99. 0
      modules/features2d/misc/java/test/PyramidHARRISFeatureDetectorTest.java
  100. 0
      modules/features2d/misc/java/test/PyramidMSERFeatureDetectorTest.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -21,8 +21,25 @@
# OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD
# OPENCV_MODULE_${the_module}_CUDA_OBJECTS - compiled CUDA objects list
# OPENCV_MODULE_${the_module}_CHILDREN - list of submodules for compound modules (cmake >= 2.8.8)
# OPENCV_MODULE_${the_module}_WRAPPERS - list of wrappers supporting this module
# HAVE_${the_module} - for fast check of module availability
# Module layout:
# <module>
# doc - docs
# include
#    opencv2
#    <module> - sub headers
# misc
#    java - additional files for java wrapper
#    python - additional files for python wrapper
# perf - perfomance tests
# samples - sample code
# src - sources
# test - accuracy tests
# tutorials - tutorials
# To control the setup of the module you could also set:
# the_description - text to be used as current module description
# OPENCV_MODULE_TYPE - STATIC|SHARED - set to force override global settings for current module
@ -72,7 +89,7 @@ unset(OPENCV_WORLD_MODULES CACHE)
# adds dependencies to OpenCV module
# Usage:
# add_dependencies(opencv_<name> [REQUIRED] [<list of dependencies>] [OPTIONAL <list of modules>])
# add_dependencies(opencv_<name> [REQUIRED] [<list of dependencies>] [OPTIONAL <list of modules>] [WRAP <list of wrappers>])
# Notes:
# * <list of dependencies> - can include full names of modules or full pathes to shared/static libraries or cmake targets
macro(ocv_add_dependencies full_modname)
@ -87,6 +104,8 @@ macro(ocv_add_dependencies full_modname)
set(__depsvar OPENCV_MODULE_${full_modname}_PRIVATE_REQ_DEPS)
elseif(d STREQUAL "PRIVATE_OPTIONAL")
set(__depsvar OPENCV_MODULE_${full_modname}_PRIVATE_OPT_DEPS)
elseif(d STREQUAL "WRAP")
set(__depsvar OPENCV_MODULE_${full_modname}_WRAPPERS)
else()
list(APPEND ${__depsvar} "${d}")
endif()
@ -97,6 +116,7 @@ macro(ocv_add_dependencies full_modname)
ocv_list_unique(OPENCV_MODULE_${full_modname}_OPT_DEPS)
ocv_list_unique(OPENCV_MODULE_${full_modname}_PRIVATE_REQ_DEPS)
ocv_list_unique(OPENCV_MODULE_${full_modname}_PRIVATE_OPT_DEPS)
ocv_list_unique(OPENCV_MODULE_${full_modname}_WRAPPERS)
set(OPENCV_MODULE_${full_modname}_REQ_DEPS ${OPENCV_MODULE_${full_modname}_REQ_DEPS}
CACHE INTERNAL "Required dependencies of ${full_modname} module")
@ -106,11 +126,13 @@ macro(ocv_add_dependencies full_modname)
CACHE INTERNAL "Required private dependencies of ${full_modname} module")
set(OPENCV_MODULE_${full_modname}_PRIVATE_OPT_DEPS ${OPENCV_MODULE_${full_modname}_PRIVATE_OPT_DEPS}
CACHE INTERNAL "Optional private dependencies of ${full_modname} module")
set(OPENCV_MODULE_${full_modname}_WRAPPERS ${OPENCV_MODULE_${full_modname}_WRAPPERS}
CACHE INTERNAL "List of wrappers supporting module ${full_modname}")
endmacro()
# declare new OpenCV module in current folder
# Usage:
# ocv_add_module(<name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
# ocv_add_module(<name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>] [WRAP <list of wrappers>])
# Example:
# ocv_add_module(yaom INTERNAL opencv_core opencv_highgui opencv_flann OPTIONAL opencv_cudev)
macro(ocv_add_module _name)
@ -181,6 +203,11 @@ macro(ocv_add_module _name)
# add submodules if any
set(OPENCV_MODULE_${the_module}_CHILDREN "${OPENCV_MODULE_CHILDREN}" CACHE INTERNAL "List of ${the_module} submodules")
# add reverse wrapper dependencies
foreach (wrapper ${OPENCV_MODULE_${the_module}_WRAPPERS})
ocv_add_dependencies(opencv_${wrapper} OPTIONAL ${the_module})
endforeach()
# stop processing of current file
return()
else()
@ -796,7 +823,7 @@ endmacro()
# short command for adding simple OpenCV module
# see ocv_add_module for argument details
# Usage:
# ocv_define_module(module_name [INTERNAL] [EXCLUDE_CUDA] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
# ocv_define_module(module_name [INTERNAL] [EXCLUDE_CUDA] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>] [WRAP <list of wrappers>])
macro(ocv_define_module module_name)
ocv_debug_message("ocv_define_module(" ${module_name} ${ARGN} ")")
set(_argn ${ARGN})

@ -1,2 +1,2 @@
set(the_description "Camera Calibration and 3D Reconstruction")
ocv_define_module(calib3d opencv_imgproc opencv_features2d)
ocv_define_module(calib3d opencv_imgproc opencv_features2d WRAP java)

@ -1,5 +1,7 @@
set(the_description "The Core Functionality")
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev)
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}"
OPTIONAL opencv_cudev
WRAP java)
if(HAVE_WINRT_CX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")

@ -1,4 +1,4 @@
include/opencv2/core/base.hpp
include/opencv2/core.hpp
include/opencv2/core/utility.hpp
../java/generator/src/cpp/core_manual.hpp
misc/java/src/cpp/core_manual.hpp

@ -1,6 +1,6 @@
#define LOG_TAG "org.opencv.core.Core"
#include "common.h"
#include "core_manual.hpp"
#include "opencv2/core/utility.hpp"
static int quietCallback( int, const char*, const char*, const char*, int, void* )
@ -8,10 +8,14 @@ static int quietCallback( int, const char*, const char*, const char*, int, void*
return 0;
}
void cv::setErrorVerbosity(bool verbose)
namespace cv {
void setErrorVerbosity(bool verbose)
{
if(verbose)
cv::redirectError(0);
else
cv::redirectError((cv::ErrorCallback)quietCallback);
}
}

@ -1,2 +1,2 @@
set(the_description "2D Features Framework")
ocv_define_module(features2d opencv_imgproc opencv_ml opencv_flann OPTIONAL opencv_highgui)
ocv_define_module(features2d opencv_imgproc opencv_ml opencv_flann OPTIONAL opencv_highgui WRAP java)

@ -0,0 +1 @@
misc/java/src/cpp/features2d_manual.hpp

@ -0,0 +1,112 @@
#define LOG_TAG "org.opencv.utils.Converters"
#include "common.h"
#include "features2d_converters.hpp"
using namespace cv;
#define CHECK_MAT(cond) if(!(cond)){ LOGD("FAILED: " #cond); return; }
//vector_KeyPoint
void Mat_to_vector_KeyPoint(Mat& mat, std::vector<KeyPoint>& v_kp)
{
v_kp.clear();
CHECK_MAT(mat.type()==CV_32FC(7) && mat.cols==1);
for(int i=0; i<mat.rows; i++)
{
Vec<float, 7> v = mat.at< Vec<float, 7> >(i, 0);
KeyPoint kp(v[0], v[1], v[2], v[3], v[4], (int)v[5], (int)v[6]);
v_kp.push_back(kp);
}
return;
}
void vector_KeyPoint_to_Mat(std::vector<KeyPoint>& v_kp, Mat& mat)
{
int count = (int)v_kp.size();
mat.create(count, 1, CV_32FC(7));
for(int i=0; i<count; i++)
{
KeyPoint kp = v_kp[i];
mat.at< Vec<float, 7> >(i, 0) = Vec<float, 7>(kp.pt.x, kp.pt.y, kp.size, kp.angle, kp.response, (float)kp.octave, (float)kp.class_id);
}
}
//vector_DMatch
void Mat_to_vector_DMatch(Mat& mat, std::vector<DMatch>& v_dm)
{
v_dm.clear();
CHECK_MAT(mat.type()==CV_32FC4 && mat.cols==1);
for(int i=0; i<mat.rows; i++)
{
Vec<float, 4> v = mat.at< Vec<float, 4> >(i, 0);
DMatch dm((int)v[0], (int)v[1], (int)v[2], v[3]);
v_dm.push_back(dm);
}
return;
}
void vector_DMatch_to_Mat(std::vector<DMatch>& v_dm, Mat& mat)
{
int count = (int)v_dm.size();
mat.create(count, 1, CV_32FC4);
for(int i=0; i<count; i++)
{
DMatch dm = v_dm[i];
mat.at< Vec<float, 4> >(i, 0) = Vec<float, 4>((float)dm.queryIdx, (float)dm.trainIdx, (float)dm.imgIdx, dm.distance);
}
}
void Mat_to_vector_vector_KeyPoint(Mat& mat, std::vector< std::vector< KeyPoint > >& vv_kp)
{
std::vector<Mat> vm;
vm.reserve( mat.rows );
Mat_to_vector_Mat(mat, vm);
for(size_t i=0; i<vm.size(); i++)
{
std::vector<KeyPoint> vkp;
Mat_to_vector_KeyPoint(vm[i], vkp);
vv_kp.push_back(vkp);
}
}
void vector_vector_KeyPoint_to_Mat(std::vector< std::vector< KeyPoint > >& vv_kp, Mat& mat)
{
std::vector<Mat> vm;
vm.reserve( vv_kp.size() );
for(size_t i=0; i<vv_kp.size(); i++)
{
Mat m;
vector_KeyPoint_to_Mat(vv_kp[i], m);
vm.push_back(m);
}
vector_Mat_to_Mat(vm, mat);
}
void Mat_to_vector_vector_DMatch(Mat& mat, std::vector< std::vector< DMatch > >& vv_dm)
{
std::vector<Mat> vm;
vm.reserve( mat.rows );
Mat_to_vector_Mat(mat, vm);
for(size_t i=0; i<vm.size(); i++)
{
std::vector<DMatch> vdm;
Mat_to_vector_DMatch(vm[i], vdm);
vv_dm.push_back(vdm);
}
}
void vector_vector_DMatch_to_Mat(std::vector< std::vector< DMatch > >& vv_dm, Mat& mat)
{
std::vector<Mat> vm;
vm.reserve( vv_dm.size() );
for(size_t i=0; i<vv_dm.size(); i++)
{
Mat m;
vector_DMatch_to_Mat(vv_dm[i], m);
vm.push_back(m);
}
vector_Mat_to_Mat(vm, mat);
}

@ -0,0 +1,22 @@
#ifndef __FEATURES2D_CONVERTERS_HPP__
#define __FEATURES2D_CONVERTERS_HPP__
#include "opencv2/opencv_modules.hpp"
#include "opencv2/core.hpp"
#include "features2d_manual.hpp"
void Mat_to_vector_KeyPoint(cv::Mat& mat, std::vector<cv::KeyPoint>& v_kp);
void vector_KeyPoint_to_Mat(std::vector<cv::KeyPoint>& v_kp, cv::Mat& mat);
void Mat_to_vector_DMatch(cv::Mat& mat, std::vector<cv::DMatch>& v_dm);
void vector_DMatch_to_Mat(std::vector<cv::DMatch>& v_dm, cv::Mat& mat);
void Mat_to_vector_vector_KeyPoint(cv::Mat& mat, std::vector< std::vector< cv::KeyPoint > >& vv_kp);
void vector_vector_KeyPoint_to_Mat(std::vector< std::vector< cv::KeyPoint > >& vv_kp, cv::Mat& mat);
void Mat_to_vector_vector_DMatch(cv::Mat& mat, std::vector< std::vector< cv::DMatch > >& vv_dm);
void vector_vector_DMatch_to_Mat(std::vector< std::vector< cv::DMatch > >& vv_dm, cv::Mat& mat);
#endif

@ -5,6 +5,7 @@
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d.hpp"
#include "features2d_converters.hpp"
#undef SIMPLEBLOB // to solve conflict with wincrypt.h on windows

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save