Commit 45712302 authored by Maksim Shabunin's avatar Maksim Shabunin

Modified java wrapping mechanism

parent 5850a9b8
......@@ -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})
......
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)
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")
......
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
#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);
}
}
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)
misc/java/src/cpp/features2d_manual.hpp
#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);
}
#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
......
set(the_description "Image codecs")
ocv_add_module(imgcodecs opencv_imgproc)
ocv_add_module(imgcodecs opencv_imgproc WRAP java)
# ----------------------------------------------------------------------------
# CMake file for imgcodecs. See root CMakeLists.txt
......
set(the_description "Image Processing")
ocv_define_module(imgproc opencv_core)
ocv_define_module(imgproc opencv_core WRAP java)
......@@ -165,7 +165,7 @@ public class ImgprocTest extends OpenCVTestCase {
double arcLength = Imgproc.arcLength(curve, false);
assertEquals(5.656854152679443, arcLength);
assertEquals(5.656854249, arcLength, 0.000001);
}
public void testBilateralFilterMatMatIntDoubleDouble() {
......
......@@ -8,7 +8,7 @@ if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND O
endif()
set(the_description "The java bindings")
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_videoio opencv_calib3d opencv_photo opencv_bioinspired)
ocv_add_module(java BINDINGS opencv_core opencv_imgproc)
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp")
if(NOT ANDROID)
......@@ -20,89 +20,169 @@ set(JAVA_INSTALL_ROOT "sdk/java")
set(JNI_INSTALL_ROOT "sdk/native")
# get list of modules to wrap
string(REPLACE "opencv_" "" OPENCV_JAVA_MODULES "${OPENCV_MODULE_${the_module}_REQ_DEPS};${OPENCV_MODULE_${the_module}_OPT_DEPS}")
foreach(module ${OPENCV_JAVA_MODULES})
if(NOT HAVE_opencv_${module})
list(REMOVE_ITEM OPENCV_JAVA_MODULES ${module})
message(STATUS "Wrapped in java:")
set(OPENCV_JAVA_MODULES)
foreach(m ${OPENCV_MODULES_BUILD})
if (";${OPENCV_MODULE_${m}_WRAPPERS};" MATCHES ";java;" AND HAVE_${m})
string(REPLACE "opencv_" "" m ${m})
list(APPEND OPENCV_JAVA_MODULES ${m})
message(STATUS "\topencv_${m}")
endif()
endforeach()
######################################################################################################################################
# UTILITY: make C headers go first
macro(sort_headers_c_cpp __lst)
set(__cpp ${${__lst}})
ocv_list_filterout(__cpp "\\\\.h$")
if(__cpp)
list(REMOVE_ITEM ${__lst} ${__cpp})
list(APPEND ${__lst} ${__cpp})
endif()
unset(__cpp)
endmacro()
# UTILITY: force cmake to rerun when files from list have changed
macro(add_cmake_dependencies)
foreach (f ${ARGN})
get_filename_component(f_name "${f}" NAME)
configure_file(${f} ${OpenCV_BINARY_DIR}/junk/${f_name}.junk COPYONLY)
endforeach()
endmacro()
# UTILITY: glob specific sources and append them to list (type is in H, CPP, JAVA, AIDL)
macro(glob_more_specific_sources _type _root _output)
unset(_masks)
if(${_type} STREQUAL "H")
set(_masks "${_root}/src/cpp/*.h" "${root}/src/cpp/*.hpp")
elseif(${_type} STREQUAL "CPP")
set(_masks "${_root}/src/cpp/*.cpp")
elseif(${_type} STREQUAL "JAVA")
set(_masks "${_root}/src/java/*.java")
elseif(${_type} STREQUAL "AIDL")
set(_masks "${_root}/src/java/*.aidl")
endif()
if (_masks)
file(GLOB _result ${_masks})
list(APPEND ${_output} ${_result})
else()
message(WARNING "Bad argument passed to macro: skipped")
endif()
endmacro()
# UTILITY: copy common java test files and add them to _deps
# copy_common_tests(<source-folder> <destination-folder> <variable-to-store-deps>)
macro(copy_common_tests _src_location _dst_location _deps)
set(_src ${${_src_location}})
set(_dst ${${_dst_location}})
file(GLOB_RECURSE _files RELATIVE "${_src}" "${_src}/res/*" "${_src}/src/*")
foreach(f ${_files})
add_custom_command(
OUTPUT "${_dst}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${_src}/${f}" "${_dst}/${f}"
MAIN_DEPENDENCY "${_src}/${f}"
COMMENT "Copying ${f}")
list(APPEND ${_deps} "${_src}/${f}" "${_dst}/${f}")
endforeach()
unset(_files)
unset(_src)
unset(_dst)
endmacro()
# UTILITY: copy all java tests for specific module and add them to _deps
# copy_modules_tests(<modules-list> <destination-folder> <variable-to-store-deps>)
macro(copy_modules_tests _modules _dst_location _deps)
set(_dst ${${_dst_location}})
foreach(module ${${_modules}})
set(_src "${OPENCV_MODULE_opencv_${module}_LOCATION}/misc/java/test")
set(_tree "src/org/opencv/test/${module}")
file(GLOB _files RELATIVE "${_src}" "${_src}/*.java")
foreach (f ${_files})
add_custom_command(
OUTPUT "${_dst}/${_tree}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${_src}/${f}" "${_dst}/${_tree}/${f}"
MAIN_DEPENDENCY "${_src}/${f}"
COMMENT "Copying ${f}")
list(APPEND ${_deps} "${_src}/${f}" "${_dst}/${_tree}/${f}")
endforeach()
unset(_files)
unset(_src)
unset(_tree)
endforeach()
unset(_dst)
endmacro()
######################################################################################################################################
# scripts
set(scripts_gen_java "${CMAKE_CURRENT_SOURCE_DIR}/generator/gen_java.py")
set(scripts_hdr_parser "${CMAKE_CURRENT_SOURCE_DIR}/../python/src2/hdr_parser.py")
# directory to store temporary files generated on first gen_java.py run
set(probe_dir "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out")
# handwritten C/C++ and Java sources
file(GLOB handwrittren_h_sources "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp/*.hpp")
file(GLOB handwrittren_cpp_sources "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp/*.cpp")
file(GLOB handwrittren_java_sources "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/java/*.java")
file(GLOB handwrittren_aidl_sources "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/java/*.aidl")
if(NOT ANDROID)
ocv_list_filterout(handwrittren_java_sources "/(engine|android)\\\\+")
ocv_list_filterout(handwrittren_aidl_sources "/(engine|android)\\\\+")
else()
file(GLOB_RECURSE handwrittren_lib_project_files_rel RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/" "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/*")
list(REMOVE_ITEM handwrittren_lib_project_files_rel "${ANDROID_MANIFEST_FILE}")
endif()
glob_more_specific_sources(H "${CMAKE_CURRENT_SOURCE_DIR}/generator" handwritten_h_sources)
glob_more_specific_sources(CPP "${CMAKE_CURRENT_SOURCE_DIR}/generator" handwritten_cpp_sources)
glob_more_specific_sources(JAVA "${CMAKE_CURRENT_SOURCE_DIR}/generator" handwritten_java_sources)
glob_more_specific_sources(AIDL "${CMAKE_CURRENT_SOURCE_DIR}/generator" handwritten_aidl_sources)
# headers of OpenCV modules
set(opencv_public_headers "")
set(generated_cpp_sources "")
set(generated_java_sources "")
foreach(module ${OPENCV_JAVA_MODULES})
# get list of module headers
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/generator/config/${module}.filelist")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/generator/config/${module}.filelist" module_headers)
set(module_java_dir "${OPENCV_MODULE_opencv_${module}_LOCATION}/misc/java")
set(custom_header_list "${module_java_dir}/filelist")
if(EXISTS "${custom_header_list}")
file(STRINGS "${custom_header_list}" module_headers)
ocv_list_add_prefix(module_headers "${OPENCV_MODULE_opencv_${module}_LOCATION}/")
else()
set(module_headers "${OPENCV_MODULE_opencv_${module}_HEADERS}")
endif()
if(module_headers)
# C headers must go first
set(module_headers_cpp ${module_headers})
ocv_list_filterout(module_headers_cpp "\\\\.h$")
if(module_headers_cpp)
list(REMOVE_ITEM module_headers ${module_headers_cpp})
list(APPEND module_headers ${module_headers_cpp})
endif()
unset(module_headers_cpp)
set(opencv_public_headers_${module} ${module_headers})
list(APPEND opencv_public_headers ${module_headers})
else()
list(REMOVE_ITEM OPENCV_JAVA_MODULES ${module})
if(NOT module_headers)
message(WARNING "Module ${module} does not have headers to wrap for java")
endif()
endforeach()
# generated cpp files
set(generated_cpp_sources "")
foreach(module ${OPENCV_JAVA_MODULES})
sort_headers_c_cpp(module_headers)
set(opencv_public_headers_${module} ${module_headers})
list(APPEND opencv_public_headers ${module_headers})
list(APPEND generated_cpp_sources "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp")
endforeach()
# IMPORTANT: add dependencies to cmake (we should rerun cmake if any of these files is modified)
configure_file("${scripts_gen_java}" "${OpenCV_BINARY_DIR}/junk/gen_java.junk" COPYONLY)
configure_file("${scripts_hdr_parser}" "${OpenCV_BINARY_DIR}/junk/hdr_parser.junk" COPYONLY)
foreach(header ${opencv_public_headers})
get_filename_component(header_name "${header}" NAME)
configure_file("${header}" "${OpenCV_BINARY_DIR}/junk/${header_name}.junk" COPYONLY)
endforeach()
include_directories("${module_java_dir}/src/cpp")
glob_more_specific_sources(H "${module_java_dir}" handwritten_h_sources)
glob_more_specific_sources(CPP "${module_java_dir}" handwritten_cpp_sources)
glob_more_specific_sources(JAVA "${module_java_dir}" handwritten_java_sources)
glob_more_specific_sources(AIDL "${module_java_dir}" handwritten_aidl_sources)
# generated java files
set(generated_java_sources "")
foreach(module ${OPENCV_JAVA_MODULES})
# first run of gen_java.py (to get list of generated files)
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out")
file(REMOVE_RECURSE "${probe_dir}")
file(MAKE_DIRECTORY "${probe_dir}")
execute_process(COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${scripts_gen_java}" "${scripts_hdr_parser}" ${module} ${opencv_public_headers_${module}}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out"
WORKING_DIRECTORY "${probe_dir}"
OUTPUT_QUIET ERROR_QUIET)
unset(generated_java_sources_${module})
file(GLOB_RECURSE generated_java_sources_${module} RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/" "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/*.java")
file(GLOB_RECURSE generated_java_sources_${module} RELATIVE "${probe_dir}" "${probe_dir}/*.java")
ocv_list_add_prefix(generated_java_sources_${module} "${CMAKE_CURRENT_BINARY_DIR}/")
list(APPEND generated_java_sources ${generated_java_sources_${module}})
endforeach()
file(REMOVE_RECURSE "${probe_dir}")
if(NOT ANDROID)
ocv_list_filterout(handwritten_java_sources "/(engine|android)\\\\+")
ocv_list_filterout(handwritten_aidl_sources "/(engine|android)\\\\+")
else()
file(GLOB_RECURSE handwrittren_lib_project_files_rel RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/" "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/*")
list(REMOVE_ITEM handwrittren_lib_project_files_rel "${ANDROID_MANIFEST_FILE}")
endif()
# IMPORTANT: add dependencies to cmake (we should rerun cmake if any of these files is modified)
add_cmake_dependencies(${scripts_gen_java} ${scripts_hdr_parser} ${opencv_public_headers})
######################################################################################################################################
# step 1: generate .cpp/.java from OpenCV headers
......@@ -116,19 +196,20 @@ foreach(module ${OPENCV_JAVA_MODULES})
)
endforeach()
# step 2: TODO: generate documentation somewhere
# step 3: copy files to destination
set(step3_input_files ${generated_java_sources} ${handwrittren_java_sources} ${handwrittren_aidl_sources})
set(step3_input_files ${generated_java_sources} ${handwritten_java_sources} ${handwritten_aidl_sources})
set(copied_files "")
foreach(java_file ${step3_input_files})
get_filename_component(java_file_name "${java_file}" NAME)
string(REPLACE "-jdoc.java" ".java" java_file_name "${java_file_name}")
string(REPLACE "+" "/" java_file_name "${java_file_name}")
set(output_name "${OpenCV_BINARY_DIR}/src/org/opencv/${java_file_name}")
add_custom_command(OUTPUT "${output_name}"
COMMAND ${CMAKE_COMMAND} -E copy "${java_file}" "${output_name}"
MAIN_DEPENDENCY "${java_file}"
DEPENDS ${step1_depends} ${generated_java_sources} ${handwrittren_java_sources}
DEPENDS ${step1_depends} ${generated_java_sources} ${handwritten_java_sources}
COMMENT "Generating src/org/opencv/${java_file_name}"
)
list(APPEND copied_files "${output_name}")
......@@ -154,7 +235,7 @@ if(ANDROID)
endforeach()
# library project jni sources (nothing really depends on them so we will not add them to step3_input_files)
foreach(jni_file ${handwrittren_cpp_sources} ${handwrittren_h_sources} ${generated_cpp_sources})
foreach(jni_file ${handwritten_cpp_sources} ${handwritten_h_sources} ${generated_cpp_sources})
get_filename_component(jni_file_name "${jni_file}" NAME)
add_custom_command(OUTPUT "${OpenCV_BINARY_DIR}/jni/${jni_file_name}"
COMMAND ${CMAKE_COMMAND} -E copy "${jni_file}" "${OpenCV_BINARY_DIR}/jni/${jni_file_name}"
......@@ -250,7 +331,7 @@ endif(ANDROID)
# workarounding lack of `__attribute__ ((visibility("default")))` in jni_md.h/JNIEXPORT
string(REPLACE "-fvisibility=hidden" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ocv_add_library(${the_module} SHARED ${handwrittren_h_sources} ${handwrittren_cpp_sources} ${generated_cpp_sources}
ocv_add_library(${the_module} SHARED ${handwritten_h_sources} ${handwritten_cpp_sources} ${generated_cpp_sources}
${copied_files}
"${JAR_FILE}" "${JAR_FILE}.dephelper")
......@@ -332,6 +413,6 @@ if(BUILD_TESTS)
if(ANDROID)
add_subdirectory(android_test)
else()
add_subdirectory(test)
add_subdirectory(pure_test)
endif()
endif()
# list of modules covered with tests
set(tested_modules opencv_calib3d opencv_core opencv_features2d opencv_highgui opencv_imgproc opencv_objdetect opencv_photo opencv_video)
# opencv_ml is broken
#list(APPEND tested_modules opencv_ml)
ocv_check_dependencies(opencv_java ${tested_modules})
if(NOT OCV_DEPENDENCIES_FOUND OR NOT ANT_EXECUTABLE OR NOT ANDROID_EXECUTABLE OR NOT ANDROID_TOOLS_Pkg_Revision GREATER 13)
if(NOT ANT_EXECUTABLE OR NOT ANDROID_EXECUTABLE OR NOT ANDROID_TOOLS_Pkg_Revision GREATER 13)
return()
endif()
project(opencv_test_java)
set(opencv_test_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
set(test_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(test_common_dir "${CMAKE_CURRENT_SOURCE_DIR}/../common_test")
# get project sources
file(GLOB_RECURSE opencv_test_java_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/res/*" "${CMAKE_CURRENT_SOURCE_DIR}/src/*")
ocv_list_filterout(opencv_test_java_files ".svn")
# opencv_ml is broken
ocv_list_filterout(opencv_test_java_files "/ml/")
# copy sources out from the build tree
set(opencv_test_java_file_deps "")
foreach(f ${opencv_test_java_files} ${ANDROID_MANIFEST_FILE} ".classpath" ".project")
# 1. gather and copy common test files (resources, utils, etc.)
copy_common_tests(test_common_dir opencv_test_java_bin_dir opencv_test_java_file_deps)
# 2. gather and copy tests from each module
copy_modules_tests(OPENCV_JAVA_MODULES opencv_test_java_bin_dir opencv_test_java_file_deps)
# 3. gather and copy specific files for Android
file(GLOB_RECURSE test_files RELATIVE "${test_dir}" "${test_dir}/res/*" "${test_dir}/src/*")
foreach(f ${test_files} ${ANDROID_MANIFEST_FILE} ".classpath" ".project")
add_custom_command(
OUTPUT "${opencv_test_java_bin_dir}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${f}" "${opencv_test_java_bin_dir}/${f}"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${test_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
MAIN_DEPENDENCY "${test_dir}/${f}"
COMMENT "Copying ${f}")
list(APPEND opencv_test_java_file_deps "${CMAKE_CURRENT_SOURCE_DIR}/${f}" "${opencv_test_java_bin_dir}/${f}")
list(APPEND opencv_test_java_file_deps "${test_dir}/${f}" "${opencv_test_java_bin_dir}/${f}")
endforeach()
# fix Android project
......
package org.opencv.test.ml;
import org.opencv.ml.CvANN_MLP;
import org.opencv.test.OpenCVTestCase;
public class CvANN_MLPTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCreateMat() {
fail("Not yet implemented");
}
public void testCreateMatInt() {
fail("Not yet implemented");
}
public void testCreateMatIntDouble() {
fail("Not yet implemented");
}
public void testCreateMatIntDoubleDouble() {
fail("Not yet implemented");
}
public void testCvANN_MLP() {
new CvANN_MLP();
}
public void testCvANN_MLPMat() {
fail("Not yet implemented");
}
public void testCvANN_MLPMatInt() {
fail("Not yet implemented");
}
public void testCvANN_MLPMatIntDouble() {
fail("Not yet implemented");
}
public void testCvANN_MLPMatIntDoubleDouble() {
fail("Not yet implemented");
}
public void testPredict() {
fail("Not yet implemented");
}
public void testTrainMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMatCvANN_MLP_TrainParams() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMatCvANN_MLP_TrainParamsInt() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvANN_MLP_TrainParams;
import org.opencv.test.OpenCVTestCase;
public class CvANN_MLP_TrainParamsTest extends OpenCVTestCase {
public void testCvANN_MLP_TrainParams() {
new CvANN_MLP_TrainParams();
}
public void testGet_bp_dw_scale() {
fail("Not yet implemented");
}
public void testGet_bp_moment_scale() {
fail("Not yet implemented");
}
public void testGet_rp_dw_max() {
fail("Not yet implemented");
}
public void testGet_rp_dw_min() {
fail("Not yet implemented");
}
public void testGet_rp_dw_minus() {
fail("Not yet implemented");
}
public void testGet_rp_dw_plus() {
fail("Not yet implemented");
}
public void testGet_rp_dw0() {
fail("Not yet implemented");
}
public void testGet_train_method() {
fail("Not yet implemented");
}
public void testSet_bp_dw_scale() {
fail("Not yet implemented");
}
public void testSet_bp_moment_scale() {
fail("Not yet implemented");
}
public void testSet_rp_dw_max() {
fail("Not yet implemented");
}
public void testSet_rp_dw_min() {
fail("Not yet implemented");
}
public void testSet_rp_dw_minus() {
fail("Not yet implemented");
}
public void testSet_rp_dw_plus() {
fail("Not yet implemented");
}
public void testSet_rp_dw0() {
fail("Not yet implemented");
}
public void testSet_train_method() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvBoostParams;
import org.opencv.test.OpenCVTestCase;
public class CvBoostParamsTest extends OpenCVTestCase {
public void testCvBoostParams() {
new CvBoostParams();
}
public void testGet_boost_type() {
fail("Not yet implemented");
}
public void testGet_split_criteria() {
fail("Not yet implemented");
}
public void testGet_weak_count() {
fail("Not yet implemented");
}
public void testGet_weight_trim_rate() {
fail("Not yet implemented");
}
public void testSet_boost_type() {
fail("Not yet implemented");
}
public void testSet_split_criteria() {
fail("Not yet implemented");
}
public void testSet_weak_count() {
fail("Not yet implemented");
}
public void testSet_weight_trim_rate() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvBoost;
import org.opencv.test.OpenCVTestCase;
public class CvBoostTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCvBoost() {
new CvBoost();
}
public void testCvBoostMatIntMat() {
fail("Not yet implemented");
}
public void testCvBoostMatIntMatMat() {
fail("Not yet implemented");
}
public void testCvBoostMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testCvBoostMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testCvBoostMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testCvBoostMatIntMatMatMatMatMatCvBoostParams() {
fail("Not yet implemented");
}
public void testPredictMat() {
fail("Not yet implemented");
}
public void testPredictMatMat() {
fail("Not yet implemented");
}
public void testPredictMatMatRange() {
fail("Not yet implemented");
}
public void testPredictMatMatRangeBoolean() {
fail("Not yet implemented");
}
public void testPredictMatMatRangeBooleanBoolean() {
fail("Not yet implemented");
}
public void testPrune() {
fail("Not yet implemented");
}
public void testTrainMatIntMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvBoostParams() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvBoostParamsBoolean() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvDTreeParams;
import org.opencv.test.OpenCVTestCase;
public class CvDTreeParamsTest extends OpenCVTestCase {
public void testCvDTreeParams() {
new CvDTreeParams();
}
public void testGet_cv_folds() {
fail("Not yet implemented");
}
public void testGet_max_categories() {
fail("Not yet implemented");
}
public void testGet_max_depth() {
fail("Not yet implemented");
}
public void testGet_min_sample_count() {
fail("Not yet implemented");
}
public void testGet_regression_accuracy() {
fail("Not yet implemented");
}
public void testGet_truncate_pruned_tree() {
fail("Not yet implemented");
}
public void testGet_use_1se_rule() {
fail("Not yet implemented");
}
public void testGet_use_surrogates() {
fail("Not yet implemented");
}
public void testSet_cv_folds() {
fail("Not yet implemented");
}
public void testSet_max_categories() {
fail("Not yet implemented");
}
public void testSet_max_depth() {
fail("Not yet implemented");
}
public void testSet_min_sample_count() {
fail("Not yet implemented");
}
public void testSet_regression_accuracy() {
fail("Not yet implemented");
}
public void testSet_truncate_pruned_tree() {
fail("Not yet implemented");
}
public void testSet_use_1se_rule() {
fail("Not yet implemented");
}
public void testSet_use_surrogates() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvDTree;
import org.opencv.test.OpenCVTestCase;
public class CvDTreeTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCvDTree() {
new CvDTree();
}
public void testGetVarImportance() {
fail("Not yet implemented");
}
public void testTrainMatIntMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvDTreeParams() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvERTrees;
import org.opencv.test.OpenCVTestCase;
public class CvERTreesTest extends OpenCVTestCase {
public void testCvERTrees() {
new CvERTrees();
}
public void testTrainMatIntMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvRTParams() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvGBTreesParams;
import org.opencv.test.OpenCVTestCase;
public class CvGBTreesParamsTest extends OpenCVTestCase {
public void testCvGBTreesParams() {
new CvGBTreesParams();
}
public void testGet_loss_function_type() {
fail("Not yet implemented");
}
public void testGet_shrinkage() {
fail("Not yet implemented");
}
public void testGet_subsample_portion() {
fail("Not yet implemented");
}
public void testGet_weak_count() {
fail("Not yet implemented");
}
public void testSet_loss_function_type() {
fail("Not yet implemented");
}
public void testSet_shrinkage() {
fail("Not yet implemented");
}
public void testSet_subsample_portion() {
fail("Not yet implemented");
}
public void testSet_weak_count() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvGBTrees;
import org.opencv.test.OpenCVTestCase;
public class CvGBTreesTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCvGBTrees() {
new CvGBTrees();
}
public void testCvGBTreesMatIntMat() {
fail("Not yet implemented");
}
public void testCvGBTreesMatIntMatMat() {
fail("Not yet implemented");
}
public void testCvGBTreesMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testCvGBTreesMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testCvGBTreesMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testCvGBTreesMatIntMatMatMatMatMatCvGBTreesParams() {
fail("Not yet implemented");
}
public void testPredictMat() {
fail("Not yet implemented");
}
public void testPredictMatMat() {
fail("Not yet implemented");
}
public void testPredictMatMatRange() {
fail("Not yet implemented");
}
public void testPredictMatMatRangeInt() {
fail("Not yet implemented");
}
public void testTrainMatIntMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvGBTreesParams() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvGBTreesParamsBoolean() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvKNearest;
import org.opencv.test.OpenCVTestCase;
public class CvKNearestTest extends OpenCVTestCase {
public void testCvKNearest() {
new CvKNearest();
}
public void testCvKNearestMatMat() {
fail("Not yet implemented");
}
public void testCvKNearestMatMatMat() {
fail("Not yet implemented");
}
public void testCvKNearestMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testCvKNearestMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void testFind_nearest() {
fail("Not yet implemented");
}
public void testTrainMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testTrainMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void testTrainMatMatMatBooleanIntBoolean() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvNormalBayesClassifier;
import org.opencv.test.OpenCVTestCase;
public class CvNormalBayesClassifierTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCvNormalBayesClassifier() {
new CvNormalBayesClassifier();
}
public void testCvNormalBayesClassifierMatMat() {
fail("Not yet implemented");
}
public void testCvNormalBayesClassifierMatMatMat() {
fail("Not yet implemented");
}
public void testCvNormalBayesClassifierMatMatMatMat() {
fail("Not yet implemented");
}
public void testPredictMat() {
fail("Not yet implemented");
}
public void testPredictMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMatBoolean() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvParamGrid;
import org.opencv.test.OpenCVTestCase;
public class CvParamGridTest extends OpenCVTestCase {
public void testCvParamGrid() {
new CvParamGrid();
}
public void testGet_max_val() {
fail("Not yet implemented");
}
public void testGet_min_val() {
fail("Not yet implemented");
}
public void testGet_step() {
fail("Not yet implemented");
}
public void testSet_max_val() {
fail("Not yet implemented");
}
public void testSet_min_val() {
fail("Not yet implemented");
}
public void testSet_step() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvRTParams;
import org.opencv.test.OpenCVTestCase;
public class CvRTParamsTest extends OpenCVTestCase {
public void testCvRTParams() {
new CvRTParams();
}
public void testGet_calc_var_importance() {
fail("Not yet implemented");
}
public void testGet_nactive_vars() {
fail("Not yet implemented");
}
public void testSet_calc_var_importance() {
fail("Not yet implemented");
}
public void testSet_nactive_vars() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvRTrees;
import org.opencv.test.OpenCVTestCase;
public class CvRTreesTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCvRTrees() {
new CvRTrees();
}
public void testGetVarImportance() {
fail("Not yet implemented");
}
public void testPredict_probMat() {
fail("Not yet implemented");
}
public void testPredict_probMatMat() {
fail("Not yet implemented");
}
public void testPredictMat() {
fail("Not yet implemented");
}
public void testPredictMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatIntMatMatMatMatMatCvRTParams() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvSVMParams;
import org.opencv.test.OpenCVTestCase;
public class CvSVMParamsTest extends OpenCVTestCase {
public void testCvSVMParams() {
new CvSVMParams();
}
public void testGet_C() {
fail("Not yet implemented");
}
public void testGet_coef0() {
fail("Not yet implemented");
}
public void testGet_degree() {
fail("Not yet implemented");
}
public void testGet_gamma() {
fail("Not yet implemented");
}
public void testGet_kernel_type() {
fail("Not yet implemented");
}
public void testGet_nu() {
fail("Not yet implemented");
}
public void testGet_p() {
fail("Not yet implemented");
}
public void testGet_svm_type() {
fail("Not yet implemented");
}
public void testSet_C() {
fail("Not yet implemented");
}
public void testSet_coef0() {
fail("Not yet implemented");
}
public void testSet_degree() {
fail("Not yet implemented");
}
public void testSet_gamma() {
fail("Not yet implemented");
}
public void testSet_kernel_type() {
fail("Not yet implemented");
}
public void testSet_nu() {
fail("Not yet implemented");
}
public void testSet_p() {
fail("Not yet implemented");
}
public void testSet_svm_type() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvSVM;
import org.opencv.test.OpenCVTestCase;
public class CvSVMTest extends OpenCVTestCase {
public void testClear() {
fail("Not yet implemented");
}
public void testCvSVM() {
new CvSVM();
}
public void testCvSVMMatMat() {
fail("Not yet implemented");
}
public void testCvSVMMatMatMat() {
fail("Not yet implemented");
}
public void testCvSVMMatMatMatMat() {
fail("Not yet implemented");
}
public void testCvSVMMatMatMatMatCvSVMParams() {
fail("Not yet implemented");
}
public void testGet_support_vector_count() {
fail("Not yet implemented");
}
public void testGet_var_count() {
fail("Not yet implemented");
}
public void testPredictMat() {
fail("Not yet implemented");
}
public void testPredictMatBoolean() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParams() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsInt() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGrid() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGridCvParamGrid() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGridCvParamGridCvParamGrid() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGridCvParamGridCvParamGridCvParamGrid() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGridCvParamGridCvParamGridCvParamGridCvParamGrid() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGridCvParamGridCvParamGridCvParamGridCvParamGridCvParamGrid() {
fail("Not yet implemented");
}
public void testTrain_autoMatMatMatMatCvSVMParamsIntCvParamGridCvParamGridCvParamGridCvParamGridCvParamGridCvParamGridBoolean() {
fail("Not yet implemented");
}
public void testTrainMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMat() {
fail("Not yet implemented");
}
public void testTrainMatMatMatMatCvSVMParams() {
fail("Not yet implemented");
}
}
include/opencv2/bioinspired/retina.hpp
include/opencv2/bioinspired/retinafasttonemapping.hpp
include/opencv2/bioinspired/transientareassegmentationmodule.hpp
../java/generator/src/cpp/features2d_manual.hpp
......@@ -714,6 +714,8 @@ T_CPP_MODULE = """
#include "opencv2/$m.hpp"
$includes
using namespace cv;
/// throw java exception
......@@ -1081,11 +1083,14 @@ class JavaWrapperGenerator(object):
self.add_class( ['class ' + self.Module, '', [], []] ) # [ 'class/struct cname', ':bases', [modlist] [props] ]
# scan the headers and build more descriptive maps of classes, consts, functions
includes = [];
for hdr in srcfiles:
decls = parser.parse(hdr)
self.namespaces = parser.namespaces
logging.info("\n\n===== Header: %s =====", hdr)
logging.info("Namespaces: %s", parser.namespaces)
if decls:
includes.append('#include "' + hdr + '"')
for decl in decls:
logging.info("\n--- Incoming ---\n%s", pformat(decl, 4))
name = decl[0]
......@@ -1107,7 +1112,7 @@ class JavaWrapperGenerator(object):
self.save("%s/%s+%s.java" % (output_path, module, ci.jname), classJavaCode)
moduleCppCode.write(ci.generateCppCode())
ci.cleanupCodeStreams()
self.save(output_path+"/"+module+".cpp", Template(T_CPP_MODULE).substitute(m = module, M = module.upper(), code = moduleCppCode.getvalue()))
self.save(output_path+"/"+module+".cpp", Template(T_CPP_MODULE).substitute(m = module, M = module.upper(), code = moduleCppCode.getvalue(), includes = "\n".join(includes)))
self.save(output_path+"/"+module+".txt", self.makeReport())
def makeReport(self):
......
......@@ -24,10 +24,6 @@
#include "converters.h"
#include "core_manual.hpp"
#include "features2d_manual.hpp"
#ifdef _MSC_VER
# pragma warning(disable:4800 4244)
#endif
......
......@@ -173,35 +173,6 @@ void vector_Point3d_to_Mat(std::vector<Point3d>& v_point, Mat& mat)
mat = Mat(v_point, true);
}
#ifdef HAVE_OPENCV_FEATURES2D
//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);
}
}
#endif
//vector_Mat
void Mat_to_vector_Mat(cv::Mat& mat, std::vector<cv::Mat>& v_mat)
{
......@@ -233,34 +204,6 @@ void vector_Mat_to_Mat(std::vector<cv::Mat>& v_mat, cv::Mat& mat)
}
}
#ifdef HAVE_OPENCV_FEATURES2D
//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);
}
}
#endif
void Mat_to_vector_vector_Point(Mat& mat, std::vector< std::vector< Point > >& vv_pt)
{
std::vector<Mat> vm;
......@@ -300,60 +243,6 @@ void Mat_to_vector_vector_Point3f(Mat& mat, std::vector< std::vector< Point3f >
}
}
#ifdef HAVE_OPENCV_FEATURES2D
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);
}
#endif
void Mat_to_vector_vector_char(Mat& mat, std::vector< std::vector< char > >& vv_ch)
{
std::vector<Mat> vm;
......
#include "opencv2/opencv_modules.hpp"
#include "opencv2/core.hpp"
#include "features2d_manual.hpp"
void Mat_to_vector_int(cv::Mat& mat, std::vector<int>& v_int);
void vector_int_to_Mat(std::vector<int>& v_int, cv::Mat& mat);
......@@ -39,25 +38,9 @@ void vector_Vec4i_to_Mat(std::vector<cv::Vec4i>& v_vec, cv::Mat& mat);
void vector_Vec4f_to_Mat(std::vector<cv::Vec4f>& v_vec, cv::Mat& mat);
void vector_Vec6f_to_Mat(std::vector<cv::Vec6f>& v_vec, cv::Mat& mat);
#ifdef HAVE_OPENCV_FEATURES2D
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);
#endif
void Mat_to_vector_Mat(cv::Mat& mat, std::vector<cv::Mat>& v_mat);
void vector_Mat_to_Mat(std::vector<cv::Mat>& v_mat, cv::Mat& mat);
#ifdef HAVE_OPENCV_FEATURES2D
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
void Mat_to_vector_vector_char(cv::Mat& mat, std::vector< std::vector< char > >& vv_ch);
void vector_vector_char_to_Mat(std::vector< std::vector< char > >& vv_ch, cv::Mat& mat);
......
# list of modules covered with tests
set(tested_modules opencv_calib3d opencv_core opencv_features2d opencv_highgui opencv_imgproc opencv_objdetect opencv_photo opencv_video)
# opencv_ml is broken
#list(APPEND tested_modules opencv_ml)
ocv_check_dependencies(opencv_java ${tested_modules})
if(NOT OCV_DEPENDENCIES_FOUND)
if(NOT ANT_EXECUTABLE)
return()
endif()
project(opencv_test_java)
set(opencv_test_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
set(android_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/../android_test")
set(java_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
set(test_dir ${CMAKE_CURRENT_SOURCE_DIR})
set(test_common_dir "${CMAKE_CURRENT_SOURCE_DIR}/../common_test")
set(opencv_test_java_file_deps "")
# make sure the build directory exists
file(MAKE_DIRECTORY "${opencv_test_java_bin_dir}")
# get project sources
file(GLOB_RECURSE opencv_test_java_files RELATIVE "${android_source_dir}" "${android_source_dir}/res/*" "${android_source_dir}/src/*.java")
# These are the files that need to be updated for pure Java.
ocv_list_filterout(opencv_test_java_files "OpenCVTest(Case|Runner).java")
# These files aren't for desktop Java.
ocv_list_filterout(opencv_test_java_files "/android/")
# opencv_ml is broken
ocv_list_filterout(opencv_test_java_files "/ml/")
# These are files updated for pure Java.
file(GLOB_RECURSE modified_files RELATIVE "${java_source_dir}" "${java_source_dir}/src/*")
# 1. gather and copy common test files (resources, utils, etc.)
copy_common_tests(test_common_dir opencv_test_java_bin_dir opencv_test_java_file_deps)
# These are extra jars needed to run the tests.
file(GLOB_RECURSE lib_files RELATIVE "${java_source_dir}" "${java_source_dir}/lib/*.jar")
# copy sources out from the build tree
set(opencv_test_java_file_deps "")
foreach(f ${opencv_test_java_files})
add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${android_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
DEPENDS "${android_source_dir}/${f}"
COMMENT "Copying ${f}"
)
list(APPEND opencv_test_java_file_deps "${android_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}")
endforeach()
# 2. gather and copy tests from each module
copy_modules_tests(OPENCV_JAVA_MODULES opencv_test_java_bin_dir opencv_test_java_file_deps)
# Overwrite select Android sources with Java-specific sources.
# Also, copy over the libs we'll need for testing.
foreach(f ${modified_files} ${lib_files})
# 3. gather and copy specific files for pure java
file(GLOB_RECURSE test_files RELATIVE "${test_dir}" "${test_dir}/src/*")
file(GLOB_RECURSE test_lib_files RELATIVE "${test_dir}" "${test_dir}/lib/*.jar")
foreach(f ${test_files} ${test_lib_files})
add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${java_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
DEPENDS "${java_source_dir}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${test_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
DEPENDS "${test_dir}/${f}"
COMMENT "Copying ${f}"
)
list(APPEND opencv_test_java_file_deps "${java_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}")
list(APPEND opencv_test_java_file_deps "${test_dir}/${f}" "${opencv_test_java_bin_dir}/${f}")
endforeach()
# Copy the OpenCV jar after it has been generated.
......
set(the_description "Object Detection")
ocv_define_module(objdetect opencv_core opencv_imgproc opencv_ml OPTIONAL opencv_highgui)
ocv_define_module(objdetect opencv_core opencv_imgproc opencv_ml OPTIONAL opencv_highgui WRAP java)
......@@ -4,4 +4,4 @@ if(HAVE_CUDA)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
endif()
ocv_define_module(photo opencv_imgproc OPTIONAL opencv_cudaarithm opencv_cudaimgproc)
ocv_define_module(photo opencv_imgproc OPTIONAL opencv_cudaarithm opencv_cudaimgproc WRAP java)
set(the_description "Video Analysis")
ocv_define_module(video opencv_imgproc)
ocv_define_module(video opencv_imgproc WRAP java)
set(the_description "Media I/O")
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera)
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera WRAP java)
# ----------------------------------------------------------------------------
# CMake file for videoio. See root CMakeLists.txt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment