Merge branch '2.4'

pull/509/merge
Andrey Kamaev 12 years ago
commit 637397f621
  1. 1
      android/scripts/cmake_android_service.sh
  2. 11
      android/service/engine/CMakeLists.txt
  3. 69
      android/service/engine/jni/NativeService/CommonPackageManager.cpp
  4. 4
      android/service/engine/jni/NativeService/CommonPackageManager.h
  5. 15
      android/service/engine/jni/Tests/HardwareDetectionTest.cpp
  6. 26
      android/service/engine/jni/Tests/OpenCVEngineTest.cpp
  7. 40
      android/service/engine/jni/Tests/PackageInfoTest.cpp
  8. 45
      android/service/engine/jni/Tests/PackageManagmentTest.cpp
  9. 2
      doc/check_docs2.py
  10. 57
      doc/ocv.py
  11. 6
      doc/tutorials/introduction/android_binary_package/android_dev_intro.rst
  12. 4
      doc/tutorials/introduction/desktop_java/java_dev_intro.rst
  13. 17
      modules/core/doc/basic_structures.rst
  14. 4
      modules/core/doc/utility_and_system_functions_and_macros.rst
  15. 4
      modules/core/src/matrix.cpp
  16. 2
      modules/features2d/doc/common_interfaces_of_feature_detectors.rst
  17. 6
      modules/gpu/doc/data_structures.rst
  18. 29
      modules/gpu/doc/initalization_and_information.rst
  19. 63
      modules/gpu/doc/video.rst
  20. 2
      modules/legacy/src/epilines.cpp
  21. 2
      modules/legacy/src/lmeds.cpp
  22. 16
      modules/legacy/src/scanlines.cpp
  23. 8
      modules/ml/doc/boosting.rst
  24. 2
      modules/ml/doc/support_vector_machines.rst
  25. 34
      modules/ocl/include/opencv2/ocl/matrix_operations.hpp
  26. 30
      modules/ocl/include/opencv2/ocl/ocl.hpp
  27. 83
      modules/ocl/src/arithm.cpp
  28. 25
      modules/ocl/src/matrix_operations.cpp
  29. 14
      modules/stitching/doc/motion_estimation.rst
  30. 4
      modules/video/doc/motion_analysis_and_object_tracking.rst
  31. 4
      samples/python2/hist.py

@ -5,4 +5,3 @@ mkdir -p build_service
cd build_service
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.4.3" -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../..

@ -62,3 +62,14 @@ set_target_properties(${engine}_jni PROPERTIES
get_target_property(engine_lib_location ${engine}_jni LOCATION)
add_custom_command(TARGET ${engine}_jni POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${engine_lib_location}")
# native tests
add_definitions(-DGTEST_HAS_CLONE=0 -DANDROID -DGTEST_HAS_TR1_TUPLE=0)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/jni/Tests)
file(GLOB engine_test_files "jni/Tests/*.cpp")
add_executable(opencv_test_engine ${engine_test_files} jni/Tests/gtest/gtest-all.cpp)
target_link_libraries(opencv_test_engine z binder log utils android_runtime ${engine} ${engine}_jni)

@ -80,17 +80,21 @@ string CommonPackageManager::GetPackagePathByVersion(int version, int platform,
if (!packages.empty())
{
int OptRating = -1;
int OptVersion = 0;
std::vector<std::pair<int, int> >& group = CommonPackageManager::ArmRating;
int platform_group = 0;
if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64))
group = CommonPackageManager::IntelRating;
platform_group = 1;
int HardwareRating = GetHardwareRating(platform, cpu_id, group);
LOGD("Current hardware platform rating %d for (%d,%d)", HardwareRating, platform, cpu_id);
if (cpu_id & ARCH_MIPS)
platform_group = 2;
if (-1 == HardwareRating)
int opt_rating = -1;
int opt_version = 0;
const int hardware_rating = GetHardwareRating(platform, cpu_id, ArchRatings[platform_group]);
LOGD("Current hardware platform rating %d for (%d,%d)", hardware_rating, platform, cpu_id);
if (-1 == hardware_rating)
{
LOGE("Cannot calculate rating for current hardware platform!");
}
@ -99,26 +103,38 @@ string CommonPackageManager::GetPackagePathByVersion(int version, int platform,
vector<PackageInfo>::iterator found = packages.end();
for (vector<PackageInfo>::iterator it = packages.begin(); it != packages.end(); ++it)
{
int PackageRating = GetHardwareRating(it->GetPlatform(), it->GetCpuID(), group);
LOGD("Package \"%s\" rating %d for (%d,%d)", it->GetFullName().c_str(), PackageRating, it->GetPlatform(), it->GetCpuID());
if ((PackageRating >= 0) && (PackageRating <= HardwareRating))
int package_group = 0;
if ((it->GetCpuID() & ARCH_X86) || (it->GetCpuID() & ARCH_X64))
package_group = 1;
if (it->GetCpuID() & ARCH_MIPS)
package_group = 2;
if (package_group != platform_group)
continue;
const int package_rating = GetHardwareRating(it->GetPlatform(), it->GetCpuID(), ArchRatings[package_group]);
LOGD("Package \"%s\" rating %d for (%d,%d)", it->GetFullName().c_str(), package_rating, it->GetPlatform(), it->GetCpuID());
if ((package_rating >= 0) && (package_rating <= hardware_rating))
{
if (((it->GetVersion() >= OptVersion) && (PackageRating >= OptRating)) || (it->GetVersion() > OptVersion))
if (((it->GetVersion() >= opt_version) && (package_rating >= opt_rating)) || (it->GetVersion() > opt_version))
{
OptRating = PackageRating;
OptVersion = it->GetVersion();
opt_rating = package_rating;
opt_version = it->GetVersion();
found = it;
}
}
}
if ((-1 != OptRating) && (packages.end() != found))
if ((-1 != opt_rating) && (packages.end() != found))
{
result = found->GetInstalationPath();
}
else
{
LOGI("Found package is incompatible with current hardware platform");
LOGI("No compatible packages found!");
}
}
}
@ -146,10 +162,13 @@ int CommonPackageManager::GetHardwareRating(int platform, int cpu_id, const std:
else
{
// Calculate rating for Arm
LOGD("!!! Calculating rating for ARM\n");
for (size_t i = 0; i < group.size(); i++)
{
LOGD("Checking (%d, %d) against (%d,%d)\n", group[i].first, group[i].second, platform, cpu_id);
if (group[i] == std::pair<int, int>(platform, cpu_id))
{
LOGD("Rating found: %d\n", i);
result = i;
break;
}
@ -182,21 +201,27 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitArmRating()
return result;
}
// Stub for Intel platforms rating initialization. Common package for all Intel based devices is used now
std::vector<std::pair<int, int> > CommonPackageManager::InitIntelRating()
{
std::vector<std::pair<int, int> > result;
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_X64));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSSE3));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_X86));
return result;
}
// Stub for MIPS platforms rating initialization. Common package for all MIPS based devices is used now
std::vector<std::pair<int, int> > CommonPackageManager::InitMipsRating()
{
std::vector<std::pair<int, int> > result;
return result;
}
std::vector<std::pair<int, int> > CommonPackageManager::IntelRating = CommonPackageManager::InitIntelRating();
std::vector<std::pair<int, int> > CommonPackageManager::ArmRating = InitArmRating();
const std::vector<std::pair<int, int> > CommonPackageManager::ArchRatings[] = {
CommonPackageManager::InitArmRating(),
CommonPackageManager::InitIntelRating(),
CommonPackageManager::InitMipsRating()
};
CommonPackageManager::~CommonPackageManager()
{

@ -16,11 +16,11 @@ public:
virtual ~CommonPackageManager();
protected:
static std::vector<std::pair<int, int> > ArmRating;
static std::vector<std::pair<int, int> > IntelRating;
static const std::vector<std::pair<int, int> > ArchRatings[];
static std::vector<std::pair<int, int> > InitArmRating();
static std::vector<std::pair<int, int> > InitIntelRating();
static std::vector<std::pair<int, int> > InitMipsRating();
bool IsVersionCompatible(int target_version, int package_version);
int GetHardwareRating(int platform, int cpu_id, const std::vector<std::pair<int, int> >& group);

@ -111,7 +111,6 @@ TEST(Split, SplitMultiElementString)
TEST(CpuCount, CheckNonZero)
{
EXPECT_TRUE(GetProcessorCount() != 0);
EXPECT_TRUE(a.find("") == a.end());
}
TEST(GetCpuInfo, GetCpuInfo)
@ -127,7 +126,7 @@ TEST(CpuID, CheckNotEmpy)
EXPECT_NE(0, cpu_id);
}
#ifdef __i386__
#if defined(__i386__)
TEST(CpuID, CheckX86)
{
int cpu_id = GetCpuID();
@ -139,14 +138,14 @@ TEST(CpuID, CheckSSE2)
int cpu_id = GetCpuID();
EXPECT_TRUE(cpu_id & FEATURES_HAS_SSE2);
}
#elseif __mips
#ifdef __SUPPORT_MIPS
TEST(CpuID, CheckMips)
{
#elif defined(__mips)
#ifdef __SUPPORT_MIPS
TEST(CpuID, CheckMips)
{
int cpu_id = GetCpuID();
EXPECT_TRUE(cpu_id & ARCH_MIPS);
}
#endif
}
#endif
#else
TEST(TegraDetector, Detect)
{

@ -69,7 +69,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWExistVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("240", PLATFORM_UNKNOWN, ARCH_X86);
Starter.PackageManager->InstallVersion(2040000, PLATFORM_UNKNOWN, ARCH_X86);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
EXPECT_STREQ("/data/data/org.opencv.lib_v24_x86/lib", String8(result).string());
@ -79,7 +79,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWOldVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_X86);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_UNKNOWN, ARCH_X86);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4.1"));
EXPECT_STREQ("/data/data/org.opencv.lib_v24_x86/lib", String8(result).string());
@ -89,7 +89,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWNewVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("241", PLATFORM_UNKNOWN, ARCH_X86);
Starter.PackageManager->InstallVersion(2040100, PLATFORM_UNKNOWN, ARCH_X86);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4.2"));
EXPECT_EQ(0, result.size());
@ -100,7 +100,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWExistVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("240", PLATFORM_UNKNOWN, ARCH_MIPS);
Starter.PackageManager->InstallVersion(2040000, PLATFORM_UNKNOWN, ARCH_MIPS);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
EXPECT_STREQ("/data/data/org.opencv.lib_v24_mips/lib", String8(result).string());
@ -110,7 +110,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWOldVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_MIPS);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_UNKNOWN, ARCH_MIPS);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4.1"));
EXPECT_STREQ("/data/data/org.opencv.lib_v24_mips/lib", String8(result).string());
@ -120,7 +120,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWNewVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("241", PLATFORM_UNKNOWN, ARCH_MIPS);
Starter.PackageManager->InstallVersion(2040100, PLATFORM_UNKNOWN, ARCH_MIPS);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4.2"));
EXPECT_EQ(0, result.size());
@ -131,7 +131,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWExistVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("240", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
Starter.PackageManager->InstallVersion(2040000, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
#ifdef __SUPPORT_TEGRA3
@ -149,7 +149,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWOldVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4.1"));
#ifdef __SUPPORT_TEGRA3
@ -167,7 +167,7 @@ TEST(OpenCVEngineTest, GetPathForExecHWNewVersion)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("241", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
Starter.PackageManager->InstallVersion(2040100, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4.2"));
EXPECT_EQ(0, result.size());
@ -177,7 +177,7 @@ TEST(OpenCVEngineTest, GetPathForCompatiblePackage1)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_ARMv5);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_UNKNOWN, ARCH_ARMv5);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv5/lib", String8(result).string());
@ -187,7 +187,7 @@ TEST(OpenCVEngineTest, GetPathForCompatiblePackage2)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
#ifdef __SUPPORT_TEGRA3
@ -225,7 +225,7 @@ TEST(OpenCVEngineTest, GetPathForInCompatiblePackage1)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_X64);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_UNKNOWN, ARCH_X64);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
EXPECT_EQ(0, result.size());
@ -235,7 +235,7 @@ TEST(OpenCVEngineTest, GetPathForInCompatiblePackage1)
{
sp<IOpenCVEngine> Engine = InitConnect();
Starter.PackageManager->InstalledPackages.clear();
Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_ARMv7);
Starter.PackageManager->InstallVersion(2040200, PLATFORM_UNKNOWN, ARCH_ARMv7);
EXPECT_FALSE(NULL == Engine.get());
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
EXPECT_EQ(0, result.size());

@ -11,14 +11,14 @@ using namespace std;
TEST(PackageInfo, FullNameArmv7)
{
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv7);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7);
string name = info.GetFullName();
EXPECT_STREQ("org.opencv.lib_v23_armv7a", name.c_str());
}
TEST(PackageInfo, FullNameArmv7Neon)
{
PackageInfo info("241", PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON);
PackageInfo info(2040100, PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON);
string name = info.GetFullName();
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
EXPECT_STREQ("org.opencv.lib_v24_armv7a_neon", name.c_str());
@ -29,14 +29,14 @@ TEST(PackageInfo, FullNameArmv7Neon)
TEST(PackageInfo, FullNameArmv7VFPv3)
{
PackageInfo info("233", PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3);
PackageInfo info(2030300, PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3);
string name = info.GetFullName();
EXPECT_STREQ("org.opencv.lib_v23_armv7a", name.c_str());
}
TEST(PackageInfo, FullNameArmv7VFPv3Neon)
{
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
string name = info.GetFullName();
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
EXPECT_STREQ("org.opencv.lib_v23_armv7a_neon", name.c_str());
@ -47,21 +47,21 @@ TEST(PackageInfo, FullNameArmv7VFPv3Neon)
TEST(PackageInfo, FullNameArmv5)
{
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv5);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv5);
string name = info.GetFullName();
EXPECT_STREQ("org.opencv.lib_v23_armv5", name.c_str());
}
TEST(PackageInfo, FullNameArmv6)
{
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv6);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv6);
string name = info.GetFullName();
EXPECT_STREQ("org.opencv.lib_v23_armv5", name.c_str());
}
TEST(PackageInfo, FullNameArmv6VFPv3)
{
PackageInfo info("232", PLATFORM_UNKNOWN, ARCH_ARMv6 | FEATURES_HAS_VFPv3);
PackageInfo info(2030200, PLATFORM_UNKNOWN, ARCH_ARMv6 | FEATURES_HAS_VFPv3);
string name = info.GetFullName();
#ifdef __SUPPORT_ARMEABI_FEATURES
EXPECT_STREQ("org.opencv.lib_v23_armv5_vfpv3", name.c_str());
@ -72,7 +72,7 @@ TEST(PackageInfo, FullNameArmv6VFPv3)
TEST(PackageInfo, FullNameTegra3)
{
PackageInfo info("230", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
PackageInfo info(2030000, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
string name = info.GetFullName();
#ifdef __SUPPORT_TEGRA3
EXPECT_STREQ("org.opencv.lib_v23_tegra3", name.c_str());
@ -87,7 +87,7 @@ TEST(PackageInfo, FullNameTegra3)
TEST(PackageInfo, FullNameX86SSE2)
{
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2);
string name = info.GetFullName();
#ifdef __SUPPORT_INTEL_FEATURES
EXPECT_STREQ("org.opencv.lib_v23_x86_sse2", name.c_str());
@ -99,7 +99,7 @@ TEST(PackageInfo, FullNameX86SSE2)
#ifdef __SUPPORT_MIPS
TEST(PackageInfo, FullNameMips)
{
PackageInfo info("243", PLATFORM_UNKNOWN, ARCH_MIPS);
PackageInfo info(2040300, PLATFORM_UNKNOWN, ARCH_MIPS);
string name = info.GetFullName();
EXPECT_STREQ("org.opencv.lib_v24_mips", name.c_str());
}
@ -108,21 +108,21 @@ TEST(PackageInfo, FullNameMips)
TEST(PackageInfo, Armv7NeonFromFullName)
{
PackageInfo info("org.opencv.lib_v23_armv7a_neon", "/data/data/org.opencv.lib_v23_armv7_neon");
EXPECT_EQ("230", info.GetVersion());
EXPECT_EQ(2030000, info.GetVersion());
EXPECT_EQ(ARCH_ARMv7 | FEATURES_HAS_NEON, info.GetCpuID());
}
TEST(PackageInfo, Armv5FromFullName)
{
PackageInfo info("org.opencv.lib_v23_armv5", "/data/data/org.opencv.lib_v23_armv5");
EXPECT_EQ("230", info.GetVersion());
EXPECT_EQ(2030000, info.GetVersion());
EXPECT_EQ(ARCH_ARMv5, info.GetCpuID());
}
TEST(PackageInfo, Armv5VFPv3FromFullName)
{
PackageInfo info("org.opencv.lib_v23_armv5_vfpv3", "/data/data/org.opencv.lib_v23_armv5_vfpv3");
EXPECT_EQ("230", info.GetVersion());
EXPECT_EQ(2030000, info.GetVersion());
EXPECT_EQ(ARCH_ARMv5 | FEATURES_HAS_VFPv3, info.GetCpuID());
}
@ -131,20 +131,20 @@ TEST(PackageInfo, X86SSE2FromFullName)
PackageInfo info("org.opencv.lib_v24_x86_sse2", "/data/data/org.opencv.lib_v24_x86_sse2");
EXPECT_EQ(PLATFORM_UNKNOWN, info.GetPlatform());
EXPECT_EQ(ARCH_X86 | FEATURES_HAS_SSE2, info.GetCpuID());
EXPECT_EQ("240", info.GetVersion());
EXPECT_EQ(2040000, info.GetVersion());
}
TEST(PackageInfo, Tegra2FromFullName)
{
PackageInfo info("org.opencv.lib_v23_tegra2", "/data/data/org.opencv.lib_v23_tegra2");
EXPECT_EQ("230", info.GetVersion());
EXPECT_EQ(2030000, info.GetVersion());
EXPECT_EQ(PLATFORM_TEGRA2, info.GetPlatform());
}
TEST(PackageInfo, Tegra3FromFullName)
{
PackageInfo info("org.opencv.lib_v24_tegra3", "/data/data/org.opencv.lib_v24_tegra3");
EXPECT_EQ("240", info.GetVersion());
EXPECT_EQ(2040000, info.GetVersion());
EXPECT_EQ(PLATFORM_TEGRA3, info.GetPlatform());
}
@ -152,14 +152,14 @@ TEST(PackageInfo, Tegra3FromFullName)
TEST(PackageInfo, MipsFromFullName)
{
PackageInfo info("org.opencv.lib_v24_mips", "/data/data/org.opencv.lib_v24_mips");
EXPECT_EQ("240", info.GetVersion());
EXPECT_EQ(2040000, info.GetVersion());
EXPECT_EQ(ARCH_MIPS, info.GetCpuID());
}
#endif
TEST(PackageInfo, Comparator1)
{
PackageInfo info1("240", PLATFORM_UNKNOWN, ARCH_X86);
PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_X86);
PackageInfo info2("org.opencv.lib_v24_x86", "/data/data/org.opencv.lib_v24_x86");
EXPECT_STREQ(info1.GetFullName().c_str(), info2.GetFullName().c_str());
EXPECT_EQ(info1, info2);
@ -167,7 +167,7 @@ TEST(PackageInfo, Comparator1)
TEST(PackageInfo, Comparator2)
{
PackageInfo info1("240", PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON | FEATURES_HAS_VFPv3);
PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON | FEATURES_HAS_VFPv3);
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
PackageInfo info2("org.opencv.lib_v24_armv7a_neon", "/data/data/org.opencv.lib_v24_armv7a_neon");
#else
@ -180,7 +180,7 @@ TEST(PackageInfo, Comparator2)
#ifdef __SUPPORT_TEGRA3
TEST(PackageInfo, Comparator3)
{
PackageInfo info1("230", PLATFORM_TEGRA3, 0);
PackageInfo info1(2030000, PLATFORM_TEGRA3, 0);
PackageInfo info2("org.opencv.lib_v23_tegra3", "/data/data/org.opencv.lib_v23_tegra3");
EXPECT_STREQ(info1.GetFullName().c_str(), info2.GetFullName().c_str());
EXPECT_EQ(info1, info2);

@ -5,7 +5,6 @@
#include "IOpenCVEngine.h"
#include <utils/String16.h>
#include <gtest/gtest.h>
#include <set>
#include <string>
#include <vector>
@ -14,52 +13,52 @@ using namespace std;
TEST(PackageManager, InstalledVersions)
{
PackageManagerStub pm;
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv7);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7);
pm.InstalledPackages.push_back(info);
std::set<string> versions = pm.GetInstalledVersions();
std::vector<int> versions = pm.GetInstalledVersions();
EXPECT_EQ(1, versions.size());
EXPECT_EQ("230", *versions.begin());
EXPECT_EQ(2030000, *versions.begin());
}
TEST(PackageManager, CheckVersionInstalled)
{
PackageManagerStub pm;
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv7);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7);
pm.InstalledPackages.push_back(info);
EXPECT_TRUE(pm.CheckVersionInstalled("230", PLATFORM_UNKNOWN, ARCH_ARMv7));
EXPECT_TRUE(pm.CheckVersionInstalled(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7));
}
TEST(PackageManager, InstallVersion)
{
PackageManagerStub pm;
PackageInfo info("230", PLATFORM_UNKNOWN, ARCH_ARMv5);
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv5);
pm.InstalledPackages.push_back(info);
EXPECT_TRUE(pm.InstallVersion("240", PLATFORM_UNKNOWN, ARCH_ARMv5));
EXPECT_TRUE(pm.InstallVersion(2040000, PLATFORM_UNKNOWN, ARCH_ARMv5));
EXPECT_EQ(2, pm.InstalledPackages.size());
EXPECT_TRUE(pm.CheckVersionInstalled("240", PLATFORM_UNKNOWN, ARCH_ARMv5));
EXPECT_TRUE(pm.CheckVersionInstalled(2040000, PLATFORM_UNKNOWN, ARCH_ARMv5));
}
TEST(PackageManager, GetPackagePathForArmv5)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("243", PLATFORM_UNKNOWN, ARCH_ARMv5));
string path = pm.GetPackagePathByVersion("243", PLATFORM_UNKNOWN, ARCH_ARMv5);
EXPECT_TRUE(pm.InstallVersion(2040300, PLATFORM_UNKNOWN, ARCH_ARMv5));
string path = pm.GetPackagePathByVersion(2040300, PLATFORM_UNKNOWN, ARCH_ARMv5);
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv5/lib", path.c_str());
}
TEST(PackageManager, GetPackagePathForArmv7)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("230", PLATFORM_UNKNOWN, ARCH_ARMv7));
string path = pm.GetPackagePathByVersion("230", PLATFORM_UNKNOWN, ARCH_ARMv7);
EXPECT_TRUE(pm.InstallVersion(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7));
string path = pm.GetPackagePathByVersion(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7);
EXPECT_STREQ("/data/data/org.opencv.lib_v23_armv7a/lib", path.c_str());
}
TEST(PackageManager, GetPackagePathForArmv7Neon)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("230", PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON));
string path = pm.GetPackagePathByVersion("230", PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON);
EXPECT_TRUE(pm.InstallVersion(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON));
string path = pm.GetPackagePathByVersion(2030000, PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON);
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
EXPECT_STREQ("/data/data/org.opencv.lib_v23_armv7a_neon/lib", path.c_str());
#else
@ -70,16 +69,16 @@ TEST(PackageManager, GetPackagePathForArmv7Neon)
TEST(PackageManager, GetPackagePathForX86)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("230", PLATFORM_UNKNOWN, ARCH_X86));
string path = pm.GetPackagePathByVersion("230", PLATFORM_UNKNOWN, ARCH_X86);
EXPECT_TRUE(pm.InstallVersion(2030000, PLATFORM_UNKNOWN, ARCH_X86));
string path = pm.GetPackagePathByVersion(2030000, PLATFORM_UNKNOWN, ARCH_X86);
EXPECT_STREQ("/data/data/org.opencv.lib_v23_x86/lib", path.c_str());
}
TEST(PackageManager, GetPackagePathForX86SSE2)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("230", PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2));
string path = pm.GetPackagePathByVersion("230", PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2);
EXPECT_TRUE(pm.InstallVersion(2030000, PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2));
string path = pm.GetPackagePathByVersion(2030000, PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2);
#ifdef __SUPPORT_INTEL_FEATURES
EXPECT_STREQ("/data/data/org.opencv.lib_v23_x86_sse2/lib", path.c_str());
#else
@ -90,8 +89,8 @@ TEST(PackageManager, GetPackagePathForX86SSE2)
TEST(PackageManager, GetPackagePathForTegra3)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("230", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON));
string path = pm.GetPackagePathByVersion("230", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
EXPECT_TRUE(pm.InstallVersion(2030000, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
string path = pm.GetPackagePathByVersion(2030000, PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
#ifdef __SUPPORT_TEGRA3
EXPECT_STREQ("/data/data/org.opencv.lib_v23_tegra3/lib", path.c_str());
#else
@ -107,8 +106,8 @@ TEST(PackageManager, GetPackagePathForTegra3)
TEST(PackageManager, GetPackagePathForMips)
{
PackageManagerStub pm;
EXPECT_TRUE(pm.InstallVersion("243", PLATFORM_UNKNOWN, ARCH_MIPS));
string path = pm.GetPackagePathByVersion("243", PLATFORM_UNKNOWN, ARCH_MIPS);
EXPECT_TRUE(pm.InstallVersion(2040000, PLATFORM_UNKNOWN, ARCH_MIPS));
string path = pm.GetPackagePathByVersion(2040000, PLATFORM_UNKNOWN, ARCH_MIPS);
EXPECT_STREQ("/data/data/org.opencv.lib_v24_mips/lib", path.c_str());
}
#endif

@ -38,7 +38,7 @@ doc_signatures_whitelist = [
"CvArr", "CvFileStorage",
# other
"InputArray", "OutputArray",
]
] + ["CvSubdiv2D", "CvQuadEdge2D", "CvSubdiv2DPoint", "cvDrawContours"]
defines = ["cvGraphEdgeIdx", "cvFree", "CV_Assert", "cvSqrt", "cvGetGraphVtx", "cvGraphVtxIdx",
"cvCaptureFromFile", "cvCaptureFromCAM", "cvCalcBackProjectPatch", "cvCalcBackProject",

@ -992,6 +992,11 @@ class DefinitionParser(object):
return rv
def _parse_signature(self):
if r'CvStatModel::train' in self.definition:
# hack to skip parsing of problematic definition
self.pos = self.end
return [ArgumentDefExpr("const Mat&", "train_data", None), ArgumentDefExpr(None, self.definition[self.definition.find("["):-1], None)], False, True
self.skip_ws()
if not self.skip_string('('):
self.fail('expected parentheses for function')
@ -1075,6 +1080,17 @@ class DefinitionParser(object):
value = None
return MemberObjDefExpr(name, visibility, static, typename, value)
def parse_enum_member_object(self):
visibility, static = self._parse_visibility_static()
typename = None
name = self._parse_type()
self.skip_ws()
if self.skip_string('='):
value = self.read_rest().strip()
else:
value = None
return MemberObjDefExpr(name, visibility, static, typename, value)
def parse_function(self):
visibility, static = self._parse_visibility_static()
if self.skip_word('explicit'):
@ -1180,6 +1196,8 @@ class OCVObject(ObjectDescription):
def add_target_and_index(self, sigobj, sig, signode):
theid = sig#obj.get_id()
theid = re.sub(r" +", " ", theid)
if self.objtype == 'emember':
theid = re.sub(r" ?=.*", "", theid)
theid = re.sub(r"=[^,()]+\([^)]*?\)[^,)]*(,|\))", "\\1", theid)
theid = re.sub(r"=\w*[^,)(]+(,|\))", "\\1", theid)
theid = theid.replace("( ", "(").replace(" )", ")")
@ -1293,6 +1311,25 @@ class OCVTypeObject(OCVObject):
signode += nodes.Text(' ')
self.attach_name(signode, obj.name)
class OCVEnumObject(OCVObject):
def get_index_text(self, name):
if self.objtype == 'enum':
return _('%s (enum)') % name
return ''
def parse_definition(self, parser):
return parser.parse_type_object()
def describe_signature(self, signode, obj):
self.attach_modifiers(signode, obj)
signode += addnodes.desc_annotation('enum ', 'enum ')
if obj.typename is not None:
self.attach_type(signode, obj.typename)
signode += nodes.Text(' ')
self.attach_name(signode, obj.name)
class OCVMemberObject(OCVObject):
ismember = True
@ -1309,12 +1346,20 @@ class OCVMemberObject(OCVObject):
def describe_signature(self, signode, obj):
self.attach_modifiers(signode, obj)
if obj.typename:
self.attach_type(signode, obj.typename)
signode += nodes.Text(' ')
self.attach_name(signode, obj.name)
if obj.value is not None:
signode += nodes.Text(u' = ' + obj.value)
class OCVEnumMemberObject(OCVMemberObject):
def parse_definition(self, parser):
# parent_class = self.env.temp_data.get('ocv:parent')
# if parent_class is None:
# parser.fail("missing parent structure/class")
return parser.parse_enum_member_object()
class OCVFunctionObject(OCVObject):
def attach_function(self, node, func):
@ -1448,7 +1493,9 @@ class OCVDomain(Domain):
'pyfunction': ObjType(l_('pyfunction'), 'pyfunc'),
'pyoldfunction': ObjType(l_('pyoldfunction'), 'pyoldfunc'),
'member': ObjType(l_('member'), 'member'),
'type': ObjType(l_('type'), 'type')
'emember': ObjType(l_('emember'), 'emember'),
'type': ObjType(l_('type'), 'type'),
'enum': ObjType(l_('enum'), 'enum')
}
directives = {
@ -1460,7 +1507,9 @@ class OCVDomain(Domain):
'pyfunction': OCVPyModulelevel,
'pyoldfunction': OCVPyOldModulelevel,
'member': OCVMemberObject,
'emember': OCVEnumMemberObject,
'type': OCVTypeObject,
'enum': OCVEnumObject,
'namespace': OCVCurrentNamespace
}
roles = {
@ -1475,7 +1524,9 @@ class OCVDomain(Domain):
'pyfunc' : OCVPyXRefRole(),
'pyoldfunc' : OCVPyXRefRole(),
'member': OCVXRefRole(),
'type': OCVXRefRole()
'emember': OCVXRefRole(),
'type': OCVXRefRole(),
'enum': OCVXRefRole()
}
initial_data = {
'objects': {}, # fullname -> docname, objtype
@ -1563,7 +1614,9 @@ class OCVDomain(Domain):
'pyfunction': _('Python function'),
'pyoldfunction': _('Legacy Python function'),
'member': _('C++ member'),
'emember': _('enum member'),
'type': _('C/C++ type'),
'enum': _('C/C++ enum'),
'namespace': _('C++ namespace'),
}.get(type.lname, _('%s %s') % (self.label, type.lname))

@ -210,9 +210,9 @@ You need the following software to be installed in order to develop for Android
.. note:: Before start you can read official Android NDK documentation which is in the Android
NDK archive, in the folder :file:`docs/`.
The main article about using Android NDK build system is in the :file:`ANDROID-MK.html` file.
Some additional information you can find in the :file:`APPLICATION-MK.html`,
:file:`NDK-BUILD.html` files, and :file:`CPU-ARM-NEON.html`, :file:`CPLUSPLUS-SUPPORT.html`,
:file:`PREBUILTS.html`.
Some additional information you can find in
the :file:`APPLICATION-MK.html`, :file:`NDK-BUILD.html` files,
and :file:`CPU-ARM-NEON.html`, :file:`CPLUSPLUS-SUPPORT.html`, :file:`PREBUILTS.html`.
#. **CDT plugin for Eclipse**

@ -35,8 +35,8 @@ Starting from version 2.4.4 OpenCV includes desktop Java bindings.
The most simple way to get it is downloading the appropriate package of **version 2.4.4 or higher** from the
`OpenCV SourceForge repository <http://sourceforge.net/projects/opencvlibrary/files/>`_.
.. note:: Windows users can find the prebuilt files needed for Java development in the
:file:`opencv/build/java/` folder inside the package.
.. note:: Windows users can find the prebuilt files needed for Java development in
the :file:`opencv/build/java/` folder inside the package.
For other OSes it's required to build OpenCV from sources.
Another option to get OpenCV sources is to clone `OpenCV git repository

@ -2064,10 +2064,11 @@ SparseMat::SparseMat
Various SparseMat constructors.
.. ocv:function:: SparseMat::SparseMat()
.. ocv:function:: SparseMat::SparseMat(int dims, const int* _sizes, int _type)
.. ocv:function:: SparseMat::SparseMat(const SparseMat& m)
.. ocv:function:: SparseMat::SparseMat(const Mat& m, bool try1d=false)
.. ocv:function:: SparseMat::SparseMat(const CvSparseMat* m)
.. ocv:function:: SparseMat::SparseMat( int dims, const int* _sizes, int _type )
.. ocv:function:: SparseMat::SparseMat( const SparseMat& m )
.. ocv:function:: SparseMat::SparseMat( const Mat& m )
.. ocv:function:: SparseMat::SparseMat( const CvSparseMat* m )
:param m: Source matrix for copy constructor. If m is dense matrix (ocv:class:`Mat`) then it will be converted to sparse representation.
:param dims: Array dimensionality.
@ -2081,12 +2082,12 @@ SparseMat object destructor.
.. ocv:function:: SparseMat::~SparseMat()
SparseMat::operator =
---------------------
SparseMat::operator=
--------------------
Provides sparse matrix assignment operators.
.. ocv:function:: SparseMat& SparseMat::operator=(const SparseMat& m)
.. ocv:function:: SparseMat& SparseMat::operator=(const Mat& m)
.. ocv:function:: SparseMat& SparseMat::operator = (const SparseMat& m)
.. ocv:function:: SparseMat& SparseMat::operator = (const Mat& m)
The last variant is equivalent to the corresponding constructor with try1d=false.

@ -444,9 +444,9 @@ If ``threads == 0``, OpenCV will disable threading optimizations and run all it'
functions sequentially. Passing ``threads < 0`` will reset threads number to system default.
This function must be called outside of parallel region.
.. ocv:function:: void setNumThreads(int threads)
.. ocv:function:: void setNumThreads(int nthreads)
:param threads: Number of threads used by OpenCV.
:param nthreads: Number of threads used by OpenCV.
OpenCV will try to run it's functions with specified threads number, but
some behaviour differs from framework:

@ -3549,7 +3549,7 @@ enum { HASH_SIZE0 = 8 };
static inline void copyElem(const uchar* from, uchar* to, size_t elemSize)
{
size_t i;
for( i = 0; (int)i <= (int)(elemSize - sizeof(int)); i += sizeof(int) )
for( i = 0; i + sizeof(int) <= elemSize; i += sizeof(int) )
*(int*)(to + i) = *(const int*)(from + i);
for( ; i < elemSize; i++ )
to[i] = from[i];
@ -3558,7 +3558,7 @@ static inline void copyElem(const uchar* from, uchar* to, size_t elemSize)
static inline bool isZeroElem(const uchar* data, size_t elemSize)
{
size_t i;
for( i = 0; i <= elemSize - sizeof(int); i += sizeof(int) )
for( i = 0; i + sizeof(int) <= elemSize; i += sizeof(int) )
if( *(int*)(data + i) != 0 )
return false;
for( ; i < elemSize; i++ )

@ -531,7 +531,7 @@ StarAdjuster
SurfAdjuster
------------
.. ocv:class:: SurfAdjuster: public AdjusterAdapter
.. ocv:class:: SurfAdjuster : public AdjusterAdapter
:ocv:class:`AdjusterAdapter` for ``SurfFeatureDetector``. ::

@ -352,9 +352,9 @@ gpu::Stream::enqueueMemSet
--------------------------
Initializes or sets device memory to a value.
.. ocv:function:: void gpu::Stream::enqueueMemSet(const GpuMat& src, Scalar val)
.. ocv:function:: void gpu::Stream::enqueueMemSet( GpuMat& src, Scalar val )
.. ocv:function:: void gpu::Stream::enqueueMemSet(const GpuMat& src, Scalar val, const GpuMat& mask)
.. ocv:function:: void gpu::Stream::enqueueMemSet( GpuMat& src, Scalar val, const GpuMat& mask )
@ -362,7 +362,7 @@ gpu::Stream::enqueueConvert
---------------------------
Converts matrix type, ex from float to uchar depending on type.
.. ocv:function:: void gpu::Stream::enqueueConvert(const GpuMat& src, GpuMat& dst, int type, double a = 1, double b = 0)
.. ocv:function:: void gpu::Stream::enqueueConvert( const GpuMat& src, GpuMat& dst, int dtype, double a=1, double b=0 )

@ -47,20 +47,19 @@ Any subsequent API call to this device will reinitialize the device.
gpu::FeatureSet
---------------
Enumeration providing GPU computing features. ::
Enumeration providing GPU computing features.
enum FeatureSet
{
FEATURE_SET_COMPUTE_10,
FEATURE_SET_COMPUTE_11,
FEATURE_SET_COMPUTE_12,
FEATURE_SET_COMPUTE_13,
FEATURE_SET_COMPUTE_20,
FEATURE_SET_COMPUTE_21,
GLOBAL_ATOMICS,
SHARED_ATOMICS,
NATIVE_DOUBLE
};
.. ocv:enum:: gpu::FeatureSet
.. ocv:emember:: FEATURE_SET_COMPUTE_10
.. ocv:emember:: FEATURE_SET_COMPUTE_11
.. ocv:emember:: FEATURE_SET_COMPUTE_12
.. ocv:emember:: FEATURE_SET_COMPUTE_13
.. ocv:emember:: FEATURE_SET_COMPUTE_20
.. ocv:emember:: FEATURE_SET_COMPUTE_21
.. ocv:emember:: GLOBAL_ATOMICS
.. ocv:emember:: SHARED_ATOMICS
.. ocv:emember:: NATIVE_DOUBLE
gpu::TargetArchs
@ -73,7 +72,7 @@ The following method checks whether the module was built with the support of the
.. ocv:function:: static bool gpu::TargetArchs::builtWith( FeatureSet feature_set )
:param feature_set: Features to be checked. See :ocv:class:`gpu::FeatureSet`.
:param feature_set: Features to be checked. See :ocv:enum:`gpu::FeatureSet`.
There is a set of methods to check whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
@ -197,7 +196,7 @@ Provides information on GPU feature support.
.. ocv:function:: bool gpu::DeviceInfo::supports( FeatureSet feature_set ) const
:param feature_set: Features to be checked. See :ocv:class:`gpu::FeatureSet`.
:param feature_set: Features to be checked. See :ocv:enum:`gpu::FeatureSet`.
This function returns ``true`` if the device has the specified GPU feature. Otherwise, it returns ``false`` .

@ -985,41 +985,51 @@ Class for reading video from files.
gpu::VideoReader_GPU::Codec
---------------------------
Video codecs supported by :ocv:class:`gpu::VideoReader_GPU` . ::
Video codecs supported by :ocv:class:`gpu::VideoReader_GPU` .
enum Codec
{
MPEG1 = 0,
MPEG2,
MPEG4,
VC1,
H264,
JPEG,
H264_SVC,
H264_MVC,
Uncompressed_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), // Y,U,V (4:2:0)
Uncompressed_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), // Y,V,U (4:2:0)
Uncompressed_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), // Y,UV (4:2:0)
Uncompressed_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), // YUYV/YUY2 (4:2:2)
Uncompressed_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')), // UYVY (4:2:2)
};
.. ocv:enum:: gpu::VideoReader_GPU::Codec
.. ocv:emember:: MPEG1 = 0
.. ocv:emember:: MPEG2
.. ocv:emember:: MPEG4
.. ocv:emember:: VC1
.. ocv:emember:: H264
.. ocv:emember:: JPEG
.. ocv:emember:: H264_SVC
.. ocv:emember:: H264_MVC
.. ocv:emember:: Uncompressed_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V'))
Y,U,V (4:2:0)
.. ocv:emember:: Uncompressed_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2'))
Y,V,U (4:2:0)
.. ocv:emember:: Uncompressed_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2'))
Y,UV (4:2:0)
.. ocv:emember:: Uncompressed_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V'))
YUYV/YUY2 (4:2:2)
.. ocv:emember:: Uncompressed_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y'))
UYVY (4:2:2)
gpu::VideoReader_GPU::ChromaFormat
----------------------------------
Chroma formats supported by :ocv:class:`gpu::VideoReader_GPU` . ::
Chroma formats supported by :ocv:class:`gpu::VideoReader_GPU` .
enum ChromaFormat
{
Monochrome=0,
YUV420,
YUV422,
YUV444,
};
.. ocv:enum:: gpu::VideoReader_GPU::ChromaFormat
.. ocv:emember:: Monochrome = 0
.. ocv:emember:: YUV420
.. ocv:emember:: YUV422
.. ocv:emember:: YUV444
gpu::VideoReader_GPU::FormatInfo
@ -1037,7 +1047,6 @@ Struct providing information about video file format. ::
};
gpu::VideoReader_GPU::VideoReader_GPU
-------------------------------------
Constructors.

@ -1826,7 +1826,7 @@ void icvGetCutPiece( CvVect64d areaLineCoef1,CvVect64d areaLineCoef2,
/* Collect all candidate point */
CvPoint2D64d candPoints[8];
CvPoint2D64d midPoint;
CvPoint2D64d midPoint = {0, 0};
int numPoints = 0;
int res;
int i;

@ -1615,7 +1615,7 @@ CvStatus
icvPoint7( int *ml, int *mr, double *F, int *amount )
{
double A[63], B[7];
double *solutions;
double *solutions = 0;
double a2, a1, a0;
double squares[6];
int i, j;

@ -1125,7 +1125,7 @@ icvBuildScanlineLeft( CvMatrix3 * matrix,
CvMatrix3 *F;
float i;
int offset;
float epiline[3];
float epiline[3] = {0,};
double a, b;
assert( l_start_end != 0 );
@ -1211,7 +1211,7 @@ icvBuildScanlineRight( CvMatrix3 * matrix,
CvMatrix3 *F;
float i;
int offset;
float epiline[3];
float epiline[3] = {0,};
double a, b;
assert( r_start_end != 0 );
@ -1389,7 +1389,9 @@ icvGetCoefficientStereo( CvMatrix3 * matrix,
float l_angle[2], r_angle[2];
float l_radius, r_radius;
float r_point[3], l_point[3];
float l_epiline[3], r_epiline[3], x, y;
float l_epiline[3] = {0,};
float r_epiline[3] = {0,};
float x, y;
float swap;
float radius1, radius2, radius3, radius4;
@ -1731,8 +1733,8 @@ icvBuildScanlineLeftStereo( CvSize imgSize,
float delta;
float angle;
float l_point[3];
float l_epiline[3];
float r_epiline[3];
float l_epiline[3] = {0,};
float r_epiline[3] = {0,};
CvStatus error = CV_OK;
CvMatrix3 *F;
@ -1819,8 +1821,8 @@ icvBuildScanlineRightStereo( CvSize imgSize,
float delta;
float angle;
float r_point[3];
float l_epiline[3];
float r_epiline[3];
float l_epiline[3] = {0,};
float r_epiline[3] = {0,};
CvStatus error = CV_OK;
CvMatrix3 *F;

@ -169,11 +169,11 @@ CvBoost::predict
----------------
Predicts a response for an input sample.
.. ocv:function:: float CvBoost::predict( const Mat& sample, const Mat& missing=Mat(), const Range& slice=Range::all(), bool raw_mode=false, bool return_sum=false ) const
.. ocv:function:: float CvBoost::predict( const cv::Mat& sample, const cv::Mat& missing=Mat(), const cv::Range& slice=Range::all(), bool rawMode=false, bool returnSum=false ) const
.. ocv:function:: float CvBoost::predict( const CvMat* sample, const CvMat* missing=0, CvMat* weak_responses=0, CvSlice slice=CV_WHOLE_SEQ, bool raw_mode=false, bool return_sum=false ) const
.. ocv:pyfunction:: cv2.Boost.predict(sample[, missing[, slice[, raw_mode[, return_sum]]]]) -> retval
.. ocv:pyfunction:: cv2.Boost.predict(sample[, missing[, slice[, rawMode[, returnSum]]]]) -> retval
:param sample: Input sample.
@ -183,9 +183,9 @@ Predicts a response for an input sample.
:param slice: Continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used.
:param raw_mode: Normally, it should be set to ``false``.
:param rawMode: Normally, it should be set to ``false``.
:param return_sum: If ``true`` then return sum of votes instead of the class label.
:param returnSum: If ``true`` then return sum of votes instead of the class label.
The method runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting.

@ -232,6 +232,8 @@ Predicts the response for input sample(s).
.. ocv:pyfunction:: cv2.SVM.predict(sample[, returnDFVal]) -> retval
.. ocv:pyfunction:: cv2.SVM.predict_all(samples[, results]) -> results
:param sample: Input sample for prediction.
:param samples: Input samples for prediction.

@ -12,6 +12,7 @@
//
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -48,9 +49,32 @@ namespace cv
namespace ocl
{
////////////////////////////////////OpenCL kernel strings//////////////////////////
//extern const char *convertC3C4;
enum
{
MAT_ADD = 1,
MAT_SUB,
MAT_MUL,
MAT_DIV,
MAT_NOT,
MAT_AND,
MAT_OR,
MAT_XOR
};
class CV_EXPORTS oclMatExpr
{
public:
oclMatExpr() : a(oclMat()), b(oclMat()), op(0) {}
oclMatExpr(const oclMat& _a, const oclMat& _b, int _op)
: a(_a), b(_b), op(_op) {}
operator oclMat() const;
void assign(oclMat& m) const;
protected:
oclMat a, b;
int op;
};
////////////////////////////////////////////////////////////////////////
//////////////////////////////// oclMat ////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -237,6 +261,12 @@ namespace cv
return *this;
}
inline oclMat& oclMat::operator = (const oclMatExpr& expr)
{
expr.assign(*this);
return *this;
}
/* Fixme! To be supported in OpenCL later. */
#if 0
template <class T> inline oclMat::operator DevMem2D_<T>() const

@ -125,6 +125,7 @@ namespace cv
Impl *impl;
};
class CV_EXPORTS oclMatExpr;
//////////////////////////////// oclMat ////////////////////////////////
class CV_EXPORTS oclMat
{
@ -158,7 +159,7 @@ namespace cv
oclMat &operator = (const oclMat &m);
//! assignment operator. Perfom blocking upload to device.
oclMat &operator = (const Mat &m);
oclMat &operator = (const oclMatExpr& expr);
//! pefroms blocking upload data to oclMat.
void upload(const cv::Mat &m);
@ -225,6 +226,11 @@ namespace cv
oclMat operator()( Range rowRange, Range colRange ) const;
oclMat operator()( const Rect &roi ) const;
oclMat& operator+=( const oclMat& m );
oclMat& operator-=( const oclMat& m );
oclMat& operator*=( const oclMat& m );
oclMat& operator/=( const oclMat& m );
//! returns true if the oclMatrix data is continuous
// (i.e. when there are no gaps between successive rows).
// similar to CV_IS_oclMat_CONT(cvoclMat->type)
@ -297,6 +303,7 @@ namespace cv
int wholecols;
};
///////////////////// mat split and merge /////////////////////////////////
//! Compose a multi-channel array from several single-channel arrays
// Support all types
@ -460,18 +467,23 @@ namespace cv
// supports all types
CV_EXPORTS void bitwise_xor(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask = oclMat());
CV_EXPORTS void bitwise_xor(const oclMat &src1, const Scalar &s, oclMat &dst, const oclMat &mask = oclMat());
//! computes convolution of two images
//! support only CV_32FC1 type
//! Logical operators
CV_EXPORTS oclMatExpr operator ~ (const oclMat &src);
CV_EXPORTS oclMatExpr operator | (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMatExpr operator & (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMatExpr operator ^ (const oclMat &src1, const oclMat &src2);
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result);
//! Mathematics operators
CV_EXPORTS oclMatExpr operator + (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMatExpr operator - (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMatExpr operator * (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMatExpr operator / (const oclMat &src1, const oclMat &src2);
//! computes convolution of two images
//! support only CV_32FC1 type
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result);
//! Logical operators
CV_EXPORTS oclMat operator ~ (const oclMat &src);
CV_EXPORTS oclMat operator | (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMat operator & (const oclMat &src1, const oclMat &src2);
CV_EXPORTS oclMat operator ^ (const oclMat &src1, const oclMat &src2);
CV_EXPORTS void cvtColor(const oclMat &src, oclMat &dst, int code , int dcn = 0);
//////////////////////////////// Filter Engine ////////////////////////////////

@ -12,6 +12,7 @@
//
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// @Authors
@ -2124,32 +2125,82 @@ void cv::ocl::bitwise_xor(const oclMat &src1, const Scalar &src2, oclMat &dst, c
bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_xor_scalar);
}
cv::ocl::oclMat cv::ocl::operator ~ (const oclMat &src)
oclMatExpr cv::ocl::operator ~ (const oclMat &src)
{
oclMat dst;
bitwise_not(src, dst);
return dst;
return oclMatExpr(src, oclMat(), MAT_NOT);
}
cv::ocl::oclMat cv::ocl::operator | (const oclMat &src1, const oclMat &src2)
oclMatExpr cv::ocl::operator | (const oclMat &src1, const oclMat &src2)
{
oclMat dst;
bitwise_or(src1, src2, dst);
return dst;
return oclMatExpr(src1, src2, MAT_OR);
}
cv::ocl::oclMat cv::ocl::operator & (const oclMat &src1, const oclMat &src2)
oclMatExpr cv::ocl::operator & (const oclMat &src1, const oclMat &src2)
{
oclMat dst;
bitwise_and(src1, src2, dst);
return dst;
return oclMatExpr(src1, src2, MAT_AND);
}
cv::ocl::oclMat cv::ocl::operator ^ (const oclMat &src1, const oclMat &src2)
oclMatExpr cv::ocl::operator ^ (const oclMat &src1, const oclMat &src2)
{
oclMat dst;
bitwise_xor(src1, src2, dst);
return dst;
return oclMatExpr(src1, src2, MAT_XOR);
}
cv::ocl::oclMatExpr cv::ocl::operator + (const oclMat &src1, const oclMat &src2)
{
return oclMatExpr(src1, src2, cv::ocl::MAT_ADD);
}
cv::ocl::oclMatExpr cv::ocl::operator - (const oclMat &src1, const oclMat &src2)
{
return oclMatExpr(src1, src2, cv::ocl::MAT_SUB);
}
cv::ocl::oclMatExpr cv::ocl::operator * (const oclMat &src1, const oclMat &src2)
{
return oclMatExpr(src1, src2, cv::ocl::MAT_MUL);
}
cv::ocl::oclMatExpr cv::ocl::operator / (const oclMat &src1, const oclMat &src2)
{
return oclMatExpr(src1, src2, cv::ocl::MAT_DIV);
}
void oclMatExpr::assign(oclMat& m) const
{
switch (op)
{
case MAT_ADD:
add(a, b, m);
break;
case MAT_SUB:
subtract(a, b, m);
break;
case MAT_MUL:
multiply(a, b, m);
break;
case MAT_DIV:
divide(a, b, m);
break;
case MAT_NOT:
bitwise_not(a, m);
break;
case MAT_AND:
bitwise_and(a, b, m);
break;
case MAT_OR:
bitwise_or(a, b, m);
break;
case MAT_XOR:
bitwise_xor(a, b, m);
break;
}
}
oclMatExpr::operator oclMat() const
{
oclMat m;
assign(m);
return m;
}
//////////////////////////////////////////////////////////////////////////////

@ -12,10 +12,12 @@
//
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// @Authors
// Niko Li, newlife20080214@gmail.com
// Yao Wang, bitwangyaoyao@gmail.com
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@ -1020,4 +1022,27 @@ void cv::ocl::oclMat::release()
refcount = 0;
}
oclMat& cv::ocl::oclMat::operator+=( const oclMat& m )
{
add(*this, m, *this);
return *this;
}
oclMat& cv::ocl::oclMat::operator-=( const oclMat& m )
{
subtract(*this, m, *this);
return *this;
}
oclMat& cv::ocl::oclMat::operator*=( const oclMat& m )
{
multiply(*this, m, *this);
return *this;
}
oclMat& cv::ocl::oclMat::operator/=( const oclMat& m )
{
divide(*this, m, *this);
return *this;
}
#endif /* !defined (HAVE_OPENCL) */

@ -221,15 +221,13 @@ Implementation of the camera parameters refinement algorithm which minimizes sum
detail::WaveCorrectKind
-----------------------
.. ocv:class:: detail::WaveCorrectKind
Wave correction kind.
Wave correction kind. ::
.. ocv:enum:: detail::WaveCorrectKind
.. ocv:emember:: WAVE_CORRECT_HORIZ
.. ocv:emember:: WAVE_CORRECT_VERT
enum CV_EXPORTS WaveCorrectKind
{
WAVE_CORRECT_HORIZ,
WAVE_CORRECT_VERT
};
detail::waveCorrect
-------------------
@ -239,4 +237,4 @@ Tries to make panorama more horizontal (or vertical).
:param rmats: Camera rotation matrices.
:param kind: Correction kind, see :ocv:class:`detail::WaveCorrectKind`.
:param kind: Correction kind, see :ocv:enum:`detail::WaveCorrectKind`.

@ -648,9 +648,9 @@ createOptFlow_DualTVL1
.. ocv:function:: Ptr<DenseOpticalFlow> createOptFlow_DualTVL1()
The class implements the "Dual TV L1" optical flow algorithm described in [Zach2007]_ and [Javier2012]_ .
The class implements the "Dual TV L1" optical flow algorithm described in [Zach2007]_ and [Javier2012]_ .
Here are important members of the class that control the algorithm, which you can set after constructing the class instance:
Here are important members of the class that control the algorithm, which you can set after constructing the class instance:
.. ocv:member:: double tau

@ -27,7 +27,7 @@ def hist_curve(im):
elif im.shape[2] == 3:
color = [ (255,0,0),(0,255,0),(0,0,255) ]
for ch, col in enumerate(color):
hist_item = cv2.calcHist([im],[ch],None,[256],[0,255])
hist_item = cv2.calcHist([im],[ch],None,[256],[0,256])
cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX)
hist=np.int32(np.around(hist_item))
pts = np.int32(np.column_stack((bins,hist)))
@ -41,7 +41,7 @@ def hist_lines(im):
print "hist_lines applicable only for grayscale images"
#print "so converting image to grayscale for representation"
im = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
hist_item = cv2.calcHist([im],[0],None,[256],[0,255])
hist_item = cv2.calcHist([im],[0],None,[256],[0,256])
cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX)
hist=np.int32(np.around(hist_item))
for x,y in enumerate(hist):

Loading…
Cancel
Save